~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: Martin Pool
  • Date: 2006-05-04 06:03:00 UTC
  • mto: This revision was merged to the branch mainline in revision 1699.
  • Revision ID: mbp@sourcefrog.net-20060504060300-eed0e79351fd6182
Add -p0, -p1 options for diff.

Change --diff-prefix to just --prefix.

Show diffs side-by-side

added added

removed removed

Lines of Context:
51
51
        self.runbzr('diff')
52
52
 
53
53
    def test_diff_prefix(self):
54
 
        self.make_example_branch()
55
 
        file('hello', 'wt').write('hello world!\n')
56
 
        out, err = self.runbzr('diff --diff-prefix old/:new/', retcode=1)
57
 
        self.assertEquals(err, '')
58
 
        self.assertEqualDiff(out, '''\
59
 
=== modified file 'old/hello'
60
 
--- old/hello\t
61
 
+++ new/hello\t
 
54
        """diff --prefix appends to filenames in output"""
 
55
        self.make_example_branch()
 
56
        file('hello', 'wt').write('hello world!\n')
 
57
        out, err = self.runbzr('diff --prefix old/:new/', retcode=1)
 
58
        self.assertEquals(err, '')
 
59
        self.assertEqualDiff(out, '''\
 
60
=== modified file 'old/hello'
 
61
--- old/hello\t
 
62
+++ new/hello\t
 
63
@@ -1,1 +1,1 @@
 
64
-foo
 
65
+hello world!
 
66
 
 
67
''')
 
68
 
 
69
    def test_diff_p1(self):
 
70
        """diff -p1 produces lkml-style diffs"""
 
71
        self.make_example_branch()
 
72
        file('hello', 'wt').write('hello world!\n')
 
73
        out, err = self.runbzr('diff -p1', retcode=1)
 
74
        self.assertEquals(err, '')
 
75
        self.assertEqualDiff(out, '''\
 
76
=== modified file 'old/hello'
 
77
--- old/hello\t
 
78
+++ new/hello\t
 
79
@@ -1,1 +1,1 @@
 
80
-foo
 
81
+hello world!
 
82
 
 
83
''')
 
84
 
 
85
    def test_diff_p0(self):
 
86
        """diff -p0 produces diffs with no prefix"""
 
87
        self.make_example_branch()
 
88
        file('hello', 'wt').write('hello world!\n')
 
89
        out, err = self.runbzr('diff -p0', retcode=1)
 
90
        self.assertEquals(err, '')
 
91
        self.assertEqualDiff(out, '''\
 
92
=== modified file 'hello'
 
93
--- hello\t
 
94
+++ hello\t
62
95
@@ -1,1 +1,1 @@
63
96
-foo
64
97
+hello world!