~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Patch Queue Manager
  • Date: 2011-10-14 16:54:26 UTC
  • mfrom: (6216.1.1 remove-this-file)
  • Revision ID: pqm@pqm.ubuntu.com-20111014165426-tjix4e6idryf1r2z
(jelmer) Remove an accidentally committed .THIS file. (Jelmer Vernooij)

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
# Copyright (C) 2006-2010 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
29
29
    DiffTree,
30
30
    format_registry as diff_format_registry,
31
31
    )
 
32
from bzrlib.tests import (
 
33
    features,
 
34
    )
32
35
 
33
36
 
34
37
def subst_dates(string):
155
158
        self.assertContainsRe(err,
156
159
            "Requested revision: '1.1' does not exist in branch:")
157
160
 
158
 
    def test_diff_diff_options_and_using(self):
159
 
        out, err = self.run_bzr('diff --diff-options -wu --using /usr/bin/diff', retcode=3,
160
 
          error_regexes=('are mutually exclusive.',))
161
 
 
162
161
    def test_diff_unversioned(self):
163
162
        # Get an error when diffing a non-versioned file.
164
163
        # (Malone #3619)
324
323
        self.build_tree_contents([('hello', 'hello world!\n')])
325
324
        output = self.run_bzr('diff --format=boo', retcode=1)
326
325
        self.assertTrue("BOO!" in output[0])
 
326
        output = self.run_bzr('diff -Fboo', retcode=1)
 
327
        self.assertTrue("BOO!" in output[0])
 
328
 
327
329
 
328
330
class TestCheckoutDiff(TestDiff):
329
331
 
387
389
        # subprocess.py that we had to workaround).
388
390
        # However, if 'diff' may not be available
389
391
        self.make_example_branch()
390
 
        # this will be automatically restored by the base bzr test class
391
 
        os.environ['BZR_PROGRESS_BAR'] = 'none'
 
392
        self.overrideEnv('BZR_PROGRESS_BAR', 'none')
392
393
        out, err = self.run_bzr_subprocess('diff -r 1 --diff-options -ub',
393
394
                                           universal_newlines=True,
394
395
                                           retcode=None)
403
404
        self.assertEndsWith(out, "\n@@ -0,0 +1 @@\n"
404
405
                                 "+baz\n\n")
405
406
 
 
407
    def test_external_diff_options_and_using(self):
 
408
        """Test that the options are passed correctly to an external diff process"""
 
409
        self.requireFeature(features.diff_feature)
 
410
        self.make_example_branch()
 
411
        self.build_tree_contents([('hello', 'Foo\n')])
 
412
        out, err = self.run_bzr('diff --diff-options -i --using diff',
 
413
                                    retcode=1)
 
414
        self.assertEquals("=== modified file 'hello'\n", out)
 
415
        self.assertEquals('', err)
 
416
 
406
417
 
407
418
class TestDiffOutput(DiffBase):
408
419