269
269
"+contents of branch1/file\n"
270
270
"\n", subst_dates(out))
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')
281
out, err = self.run_bzr('diff --color=always -r revno:2:branch2..revno:1:branch1',
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(),
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])
350
def test_binary_diff_remove(self):
351
tree = self.make_branch_and_tree('.')
352
self.build_tree_contents([('a', b'\x00' * 20)])
354
tree.commit('add binary file')
356
output = self.run_bzr('diff', retcode=1)
358
"=== removed file 'a'\nBinary files old/a and new/a differ\n",
362
329
class TestCheckoutDiff(TestDiff):