/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 breezy/tests/blackbox/test_diff.py

  • Committer: Jelmer Vernooij
  • Date: 2019-06-03 23:48:08 UTC
  • mfrom: (7316 work)
  • mto: This revision was merged to the branch mainline in revision 7328.
  • Revision ID: jelmer@jelmer.uk-20190603234808-15yk5c7054tj8e2b
Merge trunk.

Show diffs side-by-side

added added

removed removed

Lines of Context:
269
269
                             "+contents of branch1/file\n"
270
270
                             "\n", subst_dates(out))
271
271
 
272
 
    def test_diff_color_always(self):
273
 
        from ...terminal import colorstring
274
 
        from ... import colordiff
275
 
        self.overrideAttr(colordiff, 'GLOBAL_COLORDIFFRC', None)
276
 
        self.example_branches()
277
 
        branch2_tree = workingtree.WorkingTree.open_containing('branch2')[0]
278
 
        self.build_tree_contents([('branch2/file', b'even newer content')])
279
 
        branch2_tree.commit(message='update file once more')
280
 
 
281
 
        out, err = self.run_bzr('diff --color=always -r revno:2:branch2..revno:1:branch1',
282
 
                                retcode=1)
283
 
        self.assertEqual('', err)
284
 
        self.assertEqualDiff((
285
 
            colorstring(b"=== modified file 'file'\n", 'darkyellow') +
286
 
            colorstring(b"--- old/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n", 'darkred') +
287
 
            colorstring(b"+++ new/file\tYYYY-MM-DD HH:MM:SS +ZZZZ\n", 'darkblue') +
288
 
            colorstring(b"@@ -1 +1 @@\n", 'darkgreen') +
289
 
            colorstring(b"-new content\n", 'darkred') +
290
 
            colorstring(b"+contents of branch1/file\n", 'darkblue') +
291
 
            colorstring(b"\n", 'darkwhite')).decode(),
292
 
            subst_dates(out))
293
 
 
294
272
    def example_branch2(self):
295
273
        branch1_tree = self.make_branch_and_tree('branch1')
296
274
        self.build_tree_contents([('branch1/file1', b'original line\n')])
347
325
        output = self.run_bzr('diff -Fboo', retcode=1)
348
326
        self.assertTrue("BOO!" in output[0])
349
327
 
350
 
    def test_binary_diff_remove(self):
351
 
        tree = self.make_branch_and_tree('.')
352
 
        self.build_tree_contents([('a', b'\x00' * 20)])
353
 
        tree.add(['a'])
354
 
        tree.commit('add binary file')
355
 
        os.unlink('a')
356
 
        output = self.run_bzr('diff', retcode=1)
357
 
        self.assertEqual(
358
 
            "=== removed file 'a'\nBinary files old/a and new/a differ\n",
359
 
            output[0])
360
 
 
361
328
 
362
329
class TestCheckoutDiff(TestDiff):
363
330