411
os.symlink("NOWHERE1", "link1")
413
assert backtick('bzr unknowns') == ''
414
runbzr(['commit', '-m', '1: added symlink link1'])
418
assert backtick('bzr unknowns') == ''
419
os.symlink("NOWHERE2", "d1/link2")
420
assert backtick('bzr unknowns') == 'd1/link2\n'
421
# is d1/link2 found when adding d1
423
assert backtick('bzr unknowns') == ''
424
os.symlink("NOWHERE3", "d1/link3")
425
assert backtick('bzr unknowns') == 'd1/link3\n'
426
runbzr(['commit', '-m', '2: added dir, symlink'])
428
runbzr('rename d1 d2')
429
runbzr('move d2/link2 .')
430
runbzr('move link1 d2')
431
assert os.readlink("./link2") == "NOWHERE2"
432
assert os.readlink("d2/link1") == "NOWHERE1"
433
runbzr('add d2/link3')
435
runbzr(['commit', '-m', '3: rename of dir, move symlinks, add link3'])
438
os.symlink("TARGET 2", "link2")
439
os.unlink("d2/link1")
440
os.symlink("TARGET 1", "d2/link1")
442
assert backtick("bzr relpath d2/link1") == "d2/link1\n"
443
runbzr(['commit', '-m', '4: retarget of two links'])
445
runbzr('remove d2/link1')
446
assert backtick('bzr unknowns') == 'd2/link1\n'
447
runbzr(['commit', '--unchanged', '-m', '5: remove d2/link1'])
448
print ("commit --uchanged is needed to delete a file with no other"
449
" changes. this is a bug.")
453
runbzr('rename d2/link3 d1/link3new')
454
assert backtick('bzr unknowns') == 'd2/link1\n'
455
runbzr(['commit', '-m', '6: remove d2/link1, move/rename link3'])
459
runbzr(['export', '-r', '1', 'exp1.tmp'])
461
assert listdir_sorted(".") == [ "link1" ]
462
assert os.readlink("link1") == "NOWHERE1"
465
runbzr(['export', '-r', '2', 'exp2.tmp'])
467
assert listdir_sorted(".") == [ "d1", "link1" ]
470
runbzr(['export', '-r', '3', 'exp3.tmp'])
472
assert listdir_sorted(".") == [ "d2", "link2" ]
473
assert listdir_sorted("d2") == [ "link1", "link3" ]
474
assert os.readlink("d2/link1") == "NOWHERE1"
475
assert os.readlink("link2") == "NOWHERE2"
478
runbzr(['export', '-r', '4', 'exp4.tmp'])
480
assert listdir_sorted(".") == [ "d2", "link2" ]
481
assert os.readlink("d2/link1") == "TARGET 1"
482
assert os.readlink("link2") == "TARGET 2"
483
assert listdir_sorted("d2") == [ "link1", "link3" ]
486
runbzr(['export', '-r', '5', 'exp5.tmp'])
488
assert listdir_sorted(".") == [ "d2", "link2" ]
489
assert os.path.islink("link2")
490
assert listdir_sorted("d2")== [ "link3" ]
493
runbzr(['export', '-r', '6', 'exp6.tmp'])
495
assert listdir_sorted(".") == [ "d1", "d2", "link2" ]
496
assert listdir_sorted("d1") == [ "link3new" ]
497
assert listdir_sorted("d2") == []
498
assert os.readlink("d1/link3new") == "NOWHERE3"
501
progress("skipping symlink tests")