~amanica/bzr/320119-log_exclusive_lower_bound

« back to all changes in this revision

Viewing changes to bzrlib/tests/test_bundle.py

  • Committer: Johan Walles
  • Date: 2009-05-06 05:36:28 UTC
  • mfrom: (4332 +trunk)
  • mto: This revision was merged to the branch mainline in revision 4343.
  • Revision ID: johan.walles@gmail.com-20090506053628-tbf1wz4a0m9t684g
MergeĀ fromĀ upstream.

Show diffs side-by-side

added added

removed removed

Lines of Context:
657
657
                          verbose=False)
658
658
        bundle = self.get_valid_bundle('a@cset-0-6', 'a@cset-0-7')
659
659
 
660
 
    def test_symlink_bundle(self):
 
660
    def _test_symlink_bundle(self, link_name, link_target, new_link_target):
 
661
        link_id = 'link-1'
 
662
 
661
663
        self.requireFeature(tests.SymlinkFeature)
662
664
        self.tree1 = self.make_branch_and_tree('b1')
663
665
        self.b1 = self.tree1.branch
 
666
 
664
667
        tt = TreeTransform(self.tree1)
665
 
        tt.new_symlink('link', tt.root, 'bar/foo', 'link-1')
 
668
        tt.new_symlink(link_name, tt.root, link_target, link_id)
666
669
        tt.apply()
667
670
        self.tree1.commit('add symlink', rev_id='l@cset-0-1')
668
 
        self.get_valid_bundle('null:', 'l@cset-0-1')
 
671
        bundle = self.get_valid_bundle('null:', 'l@cset-0-1')
 
672
        if getattr(bundle ,'revision_tree', None) is not None:
 
673
            # Not all bundle formats supports revision_tree
 
674
            bund_tree = bundle.revision_tree(self.b1.repository, 'l@cset-0-1')
 
675
            self.assertEqual(link_target, bund_tree.get_symlink_target(link_id))
 
676
 
669
677
        tt = TreeTransform(self.tree1)
670
 
        trans_id = tt.trans_id_tree_file_id('link-1')
 
678
        trans_id = tt.trans_id_tree_file_id(link_id)
671
679
        tt.adjust_path('link2', tt.root, trans_id)
672
680
        tt.delete_contents(trans_id)
673
 
        tt.create_symlink('mars', trans_id)
 
681
        tt.create_symlink(new_link_target, trans_id)
674
682
        tt.apply()
675
683
        self.tree1.commit('rename and change symlink', rev_id='l@cset-0-2')
676
 
        self.get_valid_bundle('l@cset-0-1', 'l@cset-0-2')
 
684
        bundle = self.get_valid_bundle('l@cset-0-1', 'l@cset-0-2')
 
685
        if getattr(bundle ,'revision_tree', None) is not None:
 
686
            # Not all bundle formats supports revision_tree
 
687
            bund_tree = bundle.revision_tree(self.b1.repository, 'l@cset-0-2')
 
688
            self.assertEqual(new_link_target,
 
689
                             bund_tree.get_symlink_target(link_id))
 
690
 
677
691
        tt = TreeTransform(self.tree1)
678
 
        trans_id = tt.trans_id_tree_file_id('link-1')
 
692
        trans_id = tt.trans_id_tree_file_id(link_id)
679
693
        tt.delete_contents(trans_id)
680
694
        tt.create_symlink('jupiter', trans_id)
681
695
        tt.apply()
682
696
        self.tree1.commit('just change symlink target', rev_id='l@cset-0-3')
683
 
        self.get_valid_bundle('l@cset-0-2', 'l@cset-0-3')
 
697
        bundle = self.get_valid_bundle('l@cset-0-2', 'l@cset-0-3')
 
698
 
684
699
        tt = TreeTransform(self.tree1)
685
 
        trans_id = tt.trans_id_tree_file_id('link-1')
 
700
        trans_id = tt.trans_id_tree_file_id(link_id)
686
701
        tt.delete_contents(trans_id)
687
702
        tt.apply()
688
703
        self.tree1.commit('Delete symlink', rev_id='l@cset-0-4')
689
 
        self.get_valid_bundle('l@cset-0-3', 'l@cset-0-4')
 
704
        bundle = self.get_valid_bundle('l@cset-0-3', 'l@cset-0-4')
 
705
 
 
706
    def test_symlink_bundle(self):
 
707
        self._test_symlink_bundle('link', 'bar/foo', 'mars')
 
708
 
 
709
    def test_unicode_symlink_bundle(self):
 
710
        self.requireFeature(tests.UnicodeFilenameFeature)
 
711
        self._test_symlink_bundle(u'\N{Euro Sign}link',
 
712
                                  u'bar/\N{Euro Sign}foo',
 
713
                                  u'mars\N{Euro Sign}')
690
714
 
691
715
    def test_binary_bundle(self):
692
716
        self.tree1 = self.make_branch_and_tree('b1')