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

  • Committer: Andrew Bennetts
  • Date: 2008-03-27 06:10:18 UTC
  • mfrom: (3309 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3320.
  • Revision ID: andrew.bennetts@canonical.com-20080327061018-dxztpxyv6yoeg3am
Merge from bzr.dev.

Show diffs side-by-side

added added

removed removed

Lines of Context:
34
34
    )
35
35
from bzrlib.errors import BinaryFile, NoDiff, ExecutableMissing
36
36
import bzrlib.osutils as osutils
 
37
import bzrlib.transform as transform
37
38
import bzrlib.patiencediff
38
39
import bzrlib._patiencediff_py
39
40
from bzrlib.tests import (Feature, TestCase, TestCaseWithTransport,
509
510
        self.assertContainsRe(diff, '-contents\n'
510
511
                                    '\\+new contents\n')
511
512
 
 
513
 
 
514
    def test_internal_diff_exec_property(self):
 
515
        tree = self.make_branch_and_tree('tree')
 
516
 
 
517
        tt = transform.TreeTransform(tree)
 
518
        tt.new_file('a', tt.root, 'contents\n', 'a-id', True)
 
519
        tt.new_file('b', tt.root, 'contents\n', 'b-id', False)
 
520
        tt.new_file('c', tt.root, 'contents\n', 'c-id', True)
 
521
        tt.new_file('d', tt.root, 'contents\n', 'd-id', False)
 
522
        tt.new_file('e', tt.root, 'contents\n', 'control-e-id', True)
 
523
        tt.new_file('f', tt.root, 'contents\n', 'control-f-id', False)
 
524
        tt.apply()
 
525
        tree.commit('one', rev_id='rev-1')
 
526
 
 
527
        tt = transform.TreeTransform(tree)
 
528
        tt.set_executability(False, tt.trans_id_file_id('a-id'))
 
529
        tt.set_executability(True, tt.trans_id_file_id('b-id'))
 
530
        tt.set_executability(False, tt.trans_id_file_id('c-id'))
 
531
        tt.set_executability(True, tt.trans_id_file_id('d-id'))
 
532
        tt.apply()
 
533
        tree.rename_one('c', 'new-c')
 
534
        tree.rename_one('d', 'new-d')
 
535
 
 
536
        diff = self.get_diff(tree.basis_tree(), tree)
 
537
 
 
538
        self.assertContainsRe(diff, r"file 'a'.*\(properties changed:.*\+x to -x.*\)")
 
539
        self.assertContainsRe(diff, r"file 'b'.*\(properties changed:.*-x to \+x.*\)")
 
540
        self.assertContainsRe(diff, r"file 'c'.*\(properties changed:.*\+x to -x.*\)")
 
541
        self.assertContainsRe(diff, r"file 'd'.*\(properties changed:.*-x to \+x.*\)")
 
542
        self.assertNotContainsRe(diff, r"file 'e'")
 
543
        self.assertNotContainsRe(diff, r"file 'f'")
 
544
 
 
545
 
512
546
    def test_binary_unicode_filenames(self):
513
547
        """Test that contents of files are *not* encoded in UTF-8 when there
514
548
        is a binary file in the diff.
1246
1280
        self.addCleanup(diff_obj.finish)
1247
1281
        self.assertEqual(['diff', '%(old_path)s', '%(new_path)s'],
1248
1282
            diff_obj.command_template)
 
1283
 
 
1284
    def test_from_string_u5(self):
1249
1285
        diff_obj = DiffFromTool.from_string('diff -u\\ 5', None, None, None)
 
1286
        self.addCleanup(diff_obj.finish)
1250
1287
        self.assertEqual(['diff', '-u 5', '%(old_path)s', '%(new_path)s'],
1251
1288
                         diff_obj.command_template)
1252
1289
        self.assertEqual(['diff', '-u 5', 'old-path', 'new-path'],