658
658
bundle = self.get_valid_bundle('a@cset-0-6', 'a@cset-0-7')
660
def test_symlink_bundle(self):
660
def _test_symlink_bundle(self, link_name, link_target, new_link_target):
661
663
self.requireFeature(tests.SymlinkFeature)
662
664
self.tree1 = self.make_branch_and_tree('b1')
663
665
self.b1 = self.tree1.branch
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)
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))
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)
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))
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)
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')
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)
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')
706
def test_symlink_bundle(self):
707
self._test_symlink_bundle('link', 'bar/foo', 'mars')
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}')
691
715
def test_binary_bundle(self):
692
716
self.tree1 = self.make_branch_and_tree('b1')