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')
514
def test_internal_diff_exec_property(self):
515
tree = self.make_branch_and_tree('tree')
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)
525
tree.commit('one', rev_id='rev-1')
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'))
533
tree.rename_one('c', 'new-c')
534
tree.rename_one('d', 'new-d')
536
diff = self.get_diff(tree.basis_tree(), tree)
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'")
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.