tests/test-symlinks
author Matt Mackall <mpm@selenic.com>
Wed, 01 Aug 2007 12:33:12 -0500
changeset 5045 f191bc3916f7
parent 4882 25d753efd48e
child 5071 35d47b06d4e3
permissions -rwxr-xr-x
merge: do early copy to deal with issue636 Without copies/renames, merges source names are 1:1 with their targets. Copies and renames introduce the possibility that there will be two merges with the same input but different output. By doing the copy to the destination name before the merge, the actual merge becomes 1:1 again, and no source is the input to two different merges. - add a preliminary scan to applyupdates to do copies - for the merge action, pass the old name (for finding ancestors) and the new name (for input to the merge) to filemerge - eliminate the old post-merge copy - lookup file contents from new name in filemerge - pass new name to external merge helper - report merge failure at new name - add a test
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1408
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     1
#!/bin/sh
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     2
#Test bug regarding symlinks that showed up in hg 0.7
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     3
#Author: Matthew Elder <sseses@gmail.com>
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     4
4882
25d753efd48e test-symlink-basic: require symlinks availability
Patrick Mezard <pmezard@gmail.com>
parents: 4137
diff changeset
     5
"$TESTDIR/hghave" symlink || exit 80
25d753efd48e test-symlink-basic: require symlinks availability
Patrick Mezard <pmezard@gmail.com>
parents: 4137
diff changeset
     6
1408
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     7
#make and initialize repo
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     8
hg init test; cd test;
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
     9
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    10
#make a file and a symlink
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    11
touch foo; ln -s foo bar;
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    12
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    13
#import with addremove -- symlink walking should _not_ screwup.
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    14
hg addremove
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    15
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    16
#commit -- the symlink should _not_ appear added to dir state
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    17
hg commit -m 'initial'
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    18
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    19
#add a new file so hg will let me commit again
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    20
touch bomb
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    21
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    22
#again, symlink should _not_ show up on dir state
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    23
hg addremove
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    24
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    25
#Assert screamed here before, should go by without consequence
5010207c3527 symlink unit test
Matthew Elder <sseses@gmail.com>
parents:
diff changeset
    26
hg commit -m 'is there a bug?'
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    27
3988
9dcf9d45cab8 Don't use -f for rm in tests where not needed. Drop /bin/ from /bin/rm.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 3750
diff changeset
    28
cd .. ; rm -r test
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    29
hg init test; cd test;
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    30
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    31
mkdir dir
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    32
touch a.c dir/a.o dir/b.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    33
# test what happens if we want to trick hg
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    34
hg commit -A -m 0
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    35
echo "relglob:*.o" > .hgignore
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    36
rm a.c
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    37
rm dir/a.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    38
rm dir/b.o
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    39
mkdir dir/a.o
3750
0f550b87deb8 Compatibility fix for 'ln -sf'.
Thomas Arendsen Hein <thomas@intevation.de>
parents: 2115
diff changeset
    40
ln -s nonexist dir/b.o
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    41
mkfifo a.c
1620
6c61646fee5e Adjusted all but one test output for the new behaviour of localrepo.changes()
Thomas Arendsen Hein <thomas@intevation.de>
parents: 1527
diff changeset
    42
# it should show a.c, dir/a.o and dir/b.o deleted
1487
2bc6cd62a29c fix handling of files of unsupported type in the walk code
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1408
diff changeset
    43
hg status
1527
c13fce7167c2 don't print anything about file of unsupported type unless
Benoit Boissinot <benoit.boissinot@ens-lyon.org>
parents: 1487
diff changeset
    44
hg status a.c
2115
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    45
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    46
echo '# test absolute path through symlink outside repo'
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    47
cd ..
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    48
p=`pwd`
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    49
hg init x
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    50
ln -s x y
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    51
cd x
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    52
touch f
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    53
hg add f
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    54
hg status $p/y/f
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    55
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    56
echo '# try symlink outside repo to file inside'
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    57
ln -s x/f ../z
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    58
# this should fail
fd77b7ee4aac Fix issue 165: `hg status' with abs path containing a symlink-to-dir fails
Jim Meyering <list+hg@meyering.net>
parents: 1620
diff changeset
    59
hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || :
4137
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    60
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    61
cd .. ; rm -r test
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    62
hg init test; cd test;
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    63
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    64
echo '# try cloning symlink in a subdir'
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    65
echo '1. commit a symlink'
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    66
mkdir -p a/b/c
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    67
cd a/b/c
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    68
ln -s /path/to/symlink/source demo
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    69
cd ../../..
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    70
hg stat
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    71
hg commit -A -m 'add symlink in a/b/c subdir'
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    72
echo '2. clone it'
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    73
cd ..
26596a6b6518 Create the parent directory when checking out symlinks.
Giorgos Keramidas <keramida@ceid.upatras.gr>
parents: 3988
diff changeset
    74
hg clone test testclone