633
os.symlink("NOWHERE1", "link1")
635
assert self.capture('unknowns') == ''
636
runbzr(['commit', '-m', '1: added symlink link1'])
640
assert self.capture('unknowns') == ''
641
os.symlink("NOWHERE2", "d1/link2")
642
assert self.capture('unknowns') == 'd1/link2\n'
643
# is d1/link2 found when adding d1
645
assert self.capture('unknowns') == ''
646
os.symlink("NOWHERE3", "d1/link3")
647
assert self.capture('unknowns') == 'd1/link3\n'
648
runbzr(['commit', '-m', '2: added dir, symlink'])
650
runbzr('rename d1 d2')
651
runbzr('move d2/link2 .')
652
runbzr('move link1 d2')
653
assert os.readlink("./link2") == "NOWHERE2"
654
assert os.readlink("d2/link1") == "NOWHERE1"
655
runbzr('add d2/link3')
657
runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
660
os.symlink("TARGET 2", "link2")
661
os.unlink("d2/link1")
662
os.symlink("TARGET 1", "d2/link1")
664
assert self.capture("relpath d2/link1") == "d2/link1\n"
665
runbzr(['commit', '-m', '4: retarget of two links'])
667
runbzr('remove d2/link1')
668
assert self.capture('unknowns') == 'd2/link1\n'
669
runbzr(['commit', '-m', '5: remove d2/link1'])
673
runbzr('rename d2/link3 d1/link3new')
674
assert self.capture('unknowns') == 'd2/link1\n'
675
runbzr(['commit', '-m', '6: remove d2/link1, move/rename link3'])
679
runbzr(['export', '-r', '1', 'exp1.tmp'])
681
assert listdir_sorted(".") == [ "link1" ]
682
assert os.readlink("link1") == "NOWHERE1"
685
runbzr(['export', '-r', '2', 'exp2.tmp'])
687
assert listdir_sorted(".") == [ "d1", "link1" ]
690
runbzr(['export', '-r', '3', 'exp3.tmp'])
692
assert listdir_sorted(".") == [ "d2", "link2" ]
693
assert listdir_sorted("d2") == [ "link1", "link3" ]
694
assert os.readlink("d2/link1") == "NOWHERE1"
695
assert os.readlink("link2") == "NOWHERE2"
698
runbzr(['export', '-r', '4', 'exp4.tmp'])
700
assert listdir_sorted(".") == [ "d2", "link2" ]
701
assert os.readlink("d2/link1") == "TARGET 1"
702
assert os.readlink("link2") == "TARGET 2"
703
assert listdir_sorted("d2") == [ "link1", "link3" ]
706
runbzr(['export', '-r', '5', 'exp5.tmp'])
708
assert listdir_sorted(".") == [ "d2", "link2" ]
709
assert os.path.islink("link2")
710
assert listdir_sorted("d2")== [ "link3" ]
713
runbzr(['export', '-r', '6', 'exp6.tmp'])
715
assert listdir_sorted(".") == [ "d1", "d2", "link2" ]
716
assert listdir_sorted("d1") == [ "link3new" ]
717
assert listdir_sorted("d2") == []
718
assert os.readlink("d1/link3new") == "NOWHERE3"
721
progress("skipping symlink tests")