/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-07-07 15:22:42 UTC
  • mfrom: (1843 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1846.
  • Revision ID: john@arbash-meinel.com-20060707152242-a7b5e0afd64d9d5a
[merge] bzr.dev 1843

Show diffs side-by-side

added added

removed removed

Lines of Context:
23
23
 
24
24
import bzrlib
25
25
from bzrlib.branch import Branch
 
26
from bzrlib import workingtree
26
27
from bzrlib.tests.blackbox import ExternalBase
27
28
 
28
29
 
37
38
    def make_example_branch(test):
38
39
        # FIXME: copied from test_too_much -- share elsewhere?
39
40
        test.runbzr('init')
40
 
        file('hello', 'wt').write('foo\n')
 
41
        file('hello', 'wb').write('foo\n')
41
42
        test.runbzr('add hello')
42
43
        test.runbzr('commit -m setup hello')
43
 
        file('goodbye', 'wt').write('baz\n')
 
44
        file('goodbye', 'wb').write('baz\n')
44
45
        test.runbzr('add goodbye')
45
46
        test.runbzr('commit -m setup goodbye')
46
47
 
60
61
    def test_diff_prefix(self):
61
62
        """diff --prefix appends to filenames in output"""
62
63
        self.make_example_branch()
63
 
        file('hello', 'wt').write('hello world!\n')
 
64
        file('hello', 'wb').write('hello world!\n')
64
65
        out, err = self.runbzr('diff --prefix old/:new/', retcode=1)
65
66
        self.assertEquals(err, '')
66
67
        self.assertEqualDiff(subst_dates(out), '''\
76
77
    def test_diff_p1(self):
77
78
        """diff -p1 produces lkml-style diffs"""
78
79
        self.make_example_branch()
79
 
        file('hello', 'wt').write('hello world!\n')
 
80
        file('hello', 'wb').write('hello world!\n')
80
81
        out, err = self.runbzr('diff -p1', retcode=1)
81
82
        self.assertEquals(err, '')
82
83
        self.assertEqualDiff(subst_dates(out), '''\
92
93
    def test_diff_p0(self):
93
94
        """diff -p0 produces diffs with no prefix"""
94
95
        self.make_example_branch()
95
 
        file('hello', 'wt').write('hello world!\n')
 
96
        file('hello', 'wb').write('hello world!\n')
96
97
        out, err = self.runbzr('diff -p0', retcode=1)
97
98
        self.assertEquals(err, '')
98
99
        self.assertEqualDiff(subst_dates(out), '''\
173
174
        output = self.run_bzr_captured(['diff', '-r', '1..', 'branch1'], retcode=1)
174
175
        self.assertTrue('\n-original line\n+new line\n' in output[0])
175
176
 
 
177
    def test_diff_across_rename(self):
 
178
        """The working tree path should always be considered for diffing"""
 
179
        self.make_example_branch()
 
180
        self.run_bzr('diff', '-r', '0..1', 'hello', retcode=1)
 
181
        wt = workingtree.WorkingTree.open_containing('.')[0]
 
182
        wt.rename_one('hello', 'hello1')
 
183
        self.run_bzr('diff', 'hello1', retcode=1)
 
184
        self.run_bzr('diff', '-r', '0..1', 'hello1', retcode=1)
 
185
 
176
186
 
177
187
class TestCheckoutDiff(TestDiff):
178
188