/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: Breezy landing bot
  • Author(s): Jelmer Vernooij
  • Date: 2020-01-31 10:46:23 UTC
  • mfrom: (7406.4.7 colordiff)
  • Revision ID: breezy.the.bot@gmail.com-20200131104623-bjvpfpvmiztp2ilg
Add support for a --color={auto,never,always} argument to 'brz diff'.

Merged from https://code.launchpad.net/~jelmer/brz/colordiff/+merge/374749

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
 
272
294
    def example_branch2(self):
273
295
        branch1_tree = self.make_branch_and_tree('branch1')
274
296
        self.build_tree_contents([('branch1/file1', b'original line\n')])