~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

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

  • Committer: John Arbash Meinel
  • Date: 2006-07-13 18:38:58 UTC
  • mfrom: (1863 +trunk)
  • mto: This revision was merged to the branch mainline in revision 1869.
  • Revision ID: john@arbash-meinel.com-20060713183858-ebf4aa1f9ef8bb6e
[merge] bzr.dev 1863

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
 
156
157
                              "+contents of branch1/file\n"
157
158
                              "\n", subst_dates(out))
158
159
 
 
160
    def test_diff_revno_branches(self):
 
161
        self.example_branches()
 
162
        print >> open('branch2/file', 'wb'), 'even newer content'
 
163
        self.run_bzr_captured(['commit', '-m', 'update file once more', 'branch2'])
 
164
 
 
165
        out, err = self.run_bzr_captured(['diff', '-r', 'revno:1:branch2..revno:1:branch1'],
 
166
                                         retcode=0)
 
167
        self.assertEquals('', err)
 
168
        self.assertEquals('', out)
 
169
        out, ett = self.run_bzr_captured(['diff', '-r', 'revno:2:branch2..revno:1:branch1'],
 
170
                                         retcode=1)
 
171
        self.assertEquals('', err)
 
172
        self.assertEqualDiff("=== modified file 'file'\n"
 
173
                              "--- file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
 
174
                              "+++ file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n"
 
175
                              "@@ -1,1 +1,1 @@\n"
 
176
                              "-new content\n"
 
177
                              "+contents of branch1/file\n"
 
178
                              "\n", subst_dates(out))
 
179
 
159
180
    def example_branch2(self):
160
181
        self.build_tree(['branch1/', 'branch1/file1'], line_endings='binary')
161
182
        self.capture('init branch1')
173
194
        output = self.run_bzr_captured(['diff', '-r', '1..', 'branch1'], retcode=1)
174
195
        self.assertTrue('\n-original line\n+new line\n' in output[0])
175
196
 
 
197
    def test_diff_across_rename(self):
 
198
        """The working tree path should always be considered for diffing"""
 
199
        self.make_example_branch()
 
200
        self.run_bzr('diff', '-r', '0..1', 'hello', retcode=1)
 
201
        wt = workingtree.WorkingTree.open_containing('.')[0]
 
202
        wt.rename_one('hello', 'hello1')
 
203
        self.run_bzr('diff', 'hello1', retcode=1)
 
204
        self.run_bzr('diff', '-r', '0..1', 'hello1', retcode=1)
 
205
 
176
206
 
177
207
class TestCheckoutDiff(TestDiff):
178
208