/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: Gustav Hartvigsson
  • Date: 2021-01-09 21:36:27 UTC
  • Revision ID: gustav.hartvigsson@gmail.com-20210109213627-h1xwcutzy9m7a99b
Added 'Case Preserving Working Tree Use Cases' from Canonical Wiki

* Addod a page from the Canonical Bazaar wiki
  with information on the scmeatics of case
  perserving filesystems an a case insensitive
  filesystem works.
  
  * Needs re-work, but this will do as it is the
    same inforamoton as what was on the linked
    page in the currint documentation.

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')])
325
347
        output = self.run_bzr('diff -Fboo', retcode=1)
326
348
        self.assertTrue("BOO!" in output[0])
327
349
 
 
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
    def test_moved_away(self):
 
362
        # pad.lv/1880354
 
363
        tree = self.make_branch_and_tree('.')
 
364
        self.build_tree_contents([('a', 'asdf\n')])
 
365
        tree.add(['a'])
 
366
        tree.commit('add a')
 
367
        tree.rename_one('a', 'b')
 
368
        self.build_tree_contents([('a', 'qwer\n')])
 
369
        tree.add('a')
 
370
        output, error = self.run_bzr('diff -p0', retcode=1)
 
371
        self.assertEqualDiff("""\
 
372
=== added file 'a'
 
373
--- a\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
374
+++ a\tYYYY-MM-DD HH:MM:SS +ZZZZ
 
375
@@ -0,0 +1,1 @@
 
376
+qwer
 
377
 
 
378
=== renamed file 'a' => 'b'
 
379
""", subst_dates(output))
 
380
 
328
381
 
329
382
class TestCheckoutDiff(TestDiff):
330
383