599
os.symlink("NOWHERE1", "link1")
601
assert self.capture('unknowns') == ''
602
runbzr(['commit', '-m', '1: added symlink link1'])
606
assert self.capture('unknowns') == ''
607
os.symlink("NOWHERE2", "d1/link2")
608
assert self.capture('unknowns') == 'd1/link2\n'
609
# is d1/link2 found when adding d1
611
assert self.capture('unknowns') == ''
612
os.symlink("NOWHERE3", "d1/link3")
613
assert self.capture('unknowns') == 'd1/link3\n'
614
runbzr(['commit', '-m', '2: added dir, symlink'])
616
runbzr('rename d1 d2')
617
runbzr('move d2/link2 .')
618
runbzr('move link1 d2')
619
assert os.readlink("./link2") == "NOWHERE2"
620
assert os.readlink("d2/link1") == "NOWHERE1"
621
runbzr('add d2/link3')
623
runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
626
os.symlink("TARGET 2", "link2")
627
os.unlink("d2/link1")
628
os.symlink("TARGET 1", "d2/link1")
630
assert self.capture("relpath d2/link1") == "d2/link1\n"
631
runbzr(['commit', '-m', '4: retarget of two links'])
633
runbzr('remove d2/link1')
634
assert self.capture('unknowns') == 'd2/link1\n'
635
runbzr(['commit', '-m', '5: remove d2/link1'])
639
runbzr('rename d2/link3 d1/link3new')
640
assert self.capture('unknowns') == 'd2/link1\n'
641
runbzr(['commit', '-m', '6: remove d2/link1, move/rename link3'])
645
runbzr(['export', '-r', '1', 'exp1.tmp'])
647
assert listdir_sorted(".") == [ "link1" ]
648
assert os.readlink("link1") == "NOWHERE1"
651
runbzr(['export', '-r', '2', 'exp2.tmp'])
653
assert listdir_sorted(".") == [ "d1", "link1" ]
656
runbzr(['export', '-r', '3', 'exp3.tmp'])
658
assert listdir_sorted(".") == [ "d2", "link2" ]
659
assert listdir_sorted("d2") == [ "link1", "link3" ]
660
assert os.readlink("d2/link1") == "NOWHERE1"
661
assert os.readlink("link2") == "NOWHERE2"
664
runbzr(['export', '-r', '4', 'exp4.tmp'])
666
assert listdir_sorted(".") == [ "d2", "link2" ]
667
assert os.readlink("d2/link1") == "TARGET 1"
668
assert os.readlink("link2") == "TARGET 2"
669
assert listdir_sorted("d2") == [ "link1", "link3" ]
672
runbzr(['export', '-r', '5', 'exp5.tmp'])
674
assert listdir_sorted(".") == [ "d2", "link2" ]
675
assert os.path.islink("link2")
676
assert listdir_sorted("d2")== [ "link3" ]
679
runbzr(['export', '-r', '6', 'exp6.tmp'])
681
assert listdir_sorted(".") == [ "d1", "d2", "link2" ]
682
assert listdir_sorted("d1") == [ "link3new" ]
683
assert listdir_sorted("d2") == []
684
assert os.readlink("d1/link3new") == "NOWHERE3"
687
progress("skipping symlink tests")