~bzr-pqm/bzr/bzr.dev

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_diff.py

  • Committer: Andrew Bennetts
  • Date: 2008-04-07 08:20:13 UTC
  • mfrom: (3340 +trunk)
  • mto: This revision was merged to the branch mainline in revision 3344.
  • Revision ID: andrew.bennetts@canonical.com-20080407082013-ca1n1tqqon7ugxiy
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.