~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/blackbox/test_diff.py

  • Committer: Jonathan Riddell
  • Date: 2011-09-19 15:59:40 UTC
  • mto: This revision was merged to the branch mainline in revision 6150.
  • Revision ID: jriddell@canonical.com-20110919155940-4q4itcff3jhmhg6u
use .format() instead of % for string formatting where there are multiple formats in one string to allow for translations

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2012 Canonical Ltd
 
1
# Copyright (C) 2006-2011 Canonical Ltd
2
2
#
3
3
# This program is free software; you can redistribute it and/or modify
4
4
# it under the terms of the GNU General Public License as published by
15
15
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
16
16
 
17
17
 
18
 
"""Black-box tests for bzr diff."""
 
18
"""Black-box tests for bzr diff.
 
19
"""
19
20
 
20
21
import os
21
22
import re
287
288
        self.example_branch2()
288
289
        self.build_tree_contents([('branch1/file1', 'new line')])
289
290
        os.mkdir('branch1/dir1')
290
 
        output = self.run_bzr('diff -r 1..', retcode=1,
291
 
                              working_dir='branch1/dir1')
 
291
        os.chdir('branch1/dir1')
 
292
        output = self.run_bzr('diff -r 1..', retcode=1)
292
293
        self.assertContainsRe(output[0], '\n\\-original line\n\\+new line\n')
293
294
 
294
295
    def test_diff_across_rename(self):
315
316
                return super(BooDiffTree, self).show_diff(specific_files,
316
317
                    extra_trees)
317
318
 
318
 
        diff_format_registry.register("boo", BooDiffTree, "Scary diff format")
 
319
        diff_format_registry.register("boo", BooDiffTree, 
 
320
            "Scary diff format")
319
321
        self.addCleanup(diff_format_registry.remove, "boo")
320
322
        self.make_example_branch()
321
323
        self.build_tree_contents([('hello', 'hello world!\n')])
341
343
        return tree
342
344
 
343
345
    def example_branches(self):
344
 
        branch1_tree, branch2_tree = super(TestCheckoutDiff,
345
 
                                           self).example_branches()
 
346
        branch1_tree, branch2_tree = super(TestCheckoutDiff, self).example_branches()
346
347
        os.mkdir('checkouts')
347
348
        branch1_tree = branch1_tree.branch.create_checkout('checkouts/branch1')
348
349
        branch2_tree = branch2_tree.branch.create_checkout('checkouts/branch2')
388
389
        # subprocess.py that we had to workaround).
389
390
        # However, if 'diff' may not be available
390
391
        self.make_example_branch()
391
 
        out, err = self.run_bzr_subprocess(
392
 
            'diff -Oprogress_bar=none -r 1 --diff-options -ub',
393
 
            universal_newlines=True,
394
 
            retcode=None)
 
392
        self.overrideEnv('BZR_PROGRESS_BAR', 'none')
 
393
        out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
 
394
                                           universal_newlines=True,
 
395
                                           retcode=None)
395
396
        if 'Diff is not installed on this machine' in err:
396
397
            raise tests.TestSkipped("No external 'diff' is available")
397
398
        self.assertEqual('', err)