Show More
@@ -0,0 +1,12 b'' | |||||
|
1 | #!/usr/bin/env python | |||
|
2 | ||||
|
3 | import errno, os, sys | |||
|
4 | ||||
|
5 | for f in sys.argv[1:]: | |||
|
6 | try: | |||
|
7 | print f, '->', os.readlink(f) | |||
|
8 | except OSError, err: | |||
|
9 | if err.errno != errno.EINVAL: raise | |||
|
10 | print f, 'not a symlink' | |||
|
11 | ||||
|
12 | sys.exit(0) |
@@ -1,40 +1,32 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" symlink || exit 80 |
|
3 | "$TESTDIR/hghave" symlink || exit 80 | |
4 |
|
4 | |||
5 | origdir=`pwd` |
|
5 | origdir=`pwd` | |
6 |
|
6 | |||
7 | cat >> readlink.py <<EOF |
|
|||
8 | import os |
|
|||
9 | import sys |
|
|||
10 |
|
||||
11 | for f in sys.argv[1:]: |
|
|||
12 | print f, '->', os.readlink(f) |
|
|||
13 | EOF |
|
|||
14 |
|
||||
15 | hg init repo |
|
7 | hg init repo | |
16 | cd repo |
|
8 | cd repo | |
17 | ln -s nothing dangling |
|
9 | ln -s nothing dangling | |
18 | # avoid tar warnings about old timestamp |
|
10 | # avoid tar warnings about old timestamp | |
19 | hg ci -d '2000-01-01 00:00:00 +0000' -qAm 'add symlink' |
|
11 | hg ci -d '2000-01-01 00:00:00 +0000' -qAm 'add symlink' | |
20 |
|
12 | |||
21 | hg archive -t files ../archive |
|
13 | hg archive -t files ../archive | |
22 | hg archive -t tar -p tar ../archive.tar |
|
14 | hg archive -t tar -p tar ../archive.tar | |
23 | hg archive -t zip -p zip ../archive.zip |
|
15 | hg archive -t zip -p zip ../archive.zip | |
24 |
|
16 | |||
25 | echo '% files' |
|
17 | echo '% files' | |
26 | cd "$origdir" |
|
18 | cd "$origdir" | |
27 | cd archive |
|
19 | cd archive | |
28 |
|
|
20 | $TESTDIR/readlink.py dangling | |
29 |
|
21 | |||
30 | echo '% tar' |
|
22 | echo '% tar' | |
31 | cd "$origdir" |
|
23 | cd "$origdir" | |
32 | tar xf archive.tar |
|
24 | tar xf archive.tar | |
33 | cd tar |
|
25 | cd tar | |
34 |
|
|
26 | $TESTDIR/readlink.py dangling | |
35 |
|
27 | |||
36 | echo '% zip' |
|
28 | echo '% zip' | |
37 | cd "$origdir" |
|
29 | cd "$origdir" | |
38 | unzip archive.zip > /dev/null |
|
30 | unzip archive.zip > /dev/null | |
39 | cd zip |
|
31 | cd zip | |
40 |
|
|
32 | $TESTDIR/readlink.py dangling |
@@ -1,36 +1,36 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | hg init |
|
3 | hg init | |
4 | echo a > a |
|
4 | echo a > a | |
5 | hg ci -Amadd |
|
5 | hg ci -Amadd | |
6 |
|
6 | |||
7 | chmod +x a |
|
7 | chmod +x a | |
8 | hg ci -mexecutable |
|
8 | hg ci -mexecutable | |
9 |
|
9 | |||
10 | hg up 0 |
|
10 | hg up 0 | |
11 | rm a |
|
11 | rm a | |
12 | ln -s symlink a |
|
12 | ln -s symlink a | |
13 | hg ci -msymlink |
|
13 | hg ci -msymlink | |
14 |
|
14 | |||
15 | hg merge |
|
15 | hg merge | |
16 |
|
16 | |||
17 | echo % symlink is left parent, executable is right |
|
17 | echo % symlink is left parent, executable is right | |
18 |
|
18 | |||
19 | if [ -h a ]; then |
|
19 | if [ -h a ]; then | |
20 | echo a is a symlink |
|
20 | echo a is a symlink | |
21 | readlink a |
|
21 | $TESTDIR/readlink.py a | |
22 | elif [ -x a ]; then |
|
22 | elif [ -x a ]; then | |
23 | echo a is executable |
|
23 | echo a is executable | |
24 | fi |
|
24 | fi | |
25 |
|
25 | |||
26 | hg update -C 1 |
|
26 | hg update -C 1 | |
27 | hg merge |
|
27 | hg merge | |
28 |
|
28 | |||
29 | echo % symlink is right parent, executable is left |
|
29 | echo % symlink is right parent, executable is left | |
30 |
|
30 | |||
31 | if [ -h a ]; then |
|
31 | if [ -h a ]; then | |
32 | echo a is a symlink |
|
32 | echo a is a symlink | |
33 | readlink a |
|
33 | $TESTDIR/readlink.py a | |
34 | elif [ -x a ]; then |
|
34 | elif [ -x a ]; then | |
35 | echo a is executable |
|
35 | echo a is executable | |
36 | fi |
|
36 | fi |
@@ -1,34 +1,23 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | echo "[extensions]" >> $HGRCPATH |
|
3 | echo "[extensions]" >> $HGRCPATH | |
4 | echo "mq=" >> $HGRCPATH |
|
4 | echo "mq=" >> $HGRCPATH | |
5 |
|
5 | |||
6 | cat >> readlink.py <<EOF |
|
|||
7 | import errno, os, sys |
|
|||
8 |
|
||||
9 | for f in sys.argv[1:]: |
|
|||
10 | try: |
|
|||
11 | print f, '->', os.readlink(f) |
|
|||
12 | except OSError, err: |
|
|||
13 | if err.errno != errno.EINVAL: raise |
|
|||
14 | print f, 'not a symlink' |
|
|||
15 | EOF |
|
|||
16 |
|
||||
17 | hg init |
|
6 | hg init | |
18 | hg qinit |
|
7 | hg qinit | |
19 | hg qnew base.patch |
|
8 | hg qnew base.patch | |
20 | echo a > a |
|
9 | echo a > a | |
21 | echo b > b |
|
10 | echo b > b | |
22 | hg add a b |
|
11 | hg add a b | |
23 | hg qrefresh |
|
12 | hg qrefresh | |
24 |
|
|
13 | $TESTDIR/readlink.py a | |
25 |
|
14 | |||
26 | hg qnew symlink.patch |
|
15 | hg qnew symlink.patch | |
27 | rm a |
|
16 | rm a | |
28 | ln -s b a |
|
17 | ln -s b a | |
29 | hg qrefresh --git |
|
18 | hg qrefresh --git | |
30 |
|
|
19 | $TESTDIR/readlink.py a | |
31 |
|
20 | |||
32 | hg qpop |
|
21 | hg qpop | |
33 | hg qpush |
|
22 | hg qpush | |
34 |
|
|
23 | $TESTDIR/readlink.py a |
@@ -1,53 +1,45 b'' | |||||
1 | #!/bin/sh |
|
1 | #!/bin/sh | |
2 |
|
2 | |||
3 | "$TESTDIR/hghave" symlink || exit 80 |
|
3 | "$TESTDIR/hghave" symlink || exit 80 | |
4 |
|
4 | |||
5 | cleanpath() |
|
5 | cleanpath() | |
6 | { |
|
6 | { | |
7 | sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" |
|
7 | sed -e "s:/.*\(/test-symlink-basic/.*\):...\1:" | |
8 | } |
|
8 | } | |
9 |
|
9 | |||
10 | cat >> readlink.py <<EOF |
|
|||
11 | import os |
|
|||
12 | import sys |
|
|||
13 |
|
||||
14 | for f in sys.argv[1:]: |
|
|||
15 | print f, '->', os.readlink(f) |
|
|||
16 | EOF |
|
|||
17 |
|
||||
18 | hg init a |
|
10 | hg init a | |
19 | cd a |
|
11 | cd a | |
20 | ln -s nothing dangling |
|
12 | ln -s nothing dangling | |
21 | hg commit -m 'commit symlink without adding' -d '0 0' dangling 2>&1 | cleanpath |
|
13 | hg commit -m 'commit symlink without adding' -d '0 0' dangling 2>&1 | cleanpath | |
22 | hg add dangling |
|
14 | hg add dangling | |
23 | hg commit -m 'add symlink' -d '0 0' |
|
15 | hg commit -m 'add symlink' -d '0 0' | |
24 |
|
16 | |||
25 | hg tip -v |
|
17 | hg tip -v | |
26 | hg manifest --debug |
|
18 | hg manifest --debug | |
27 | echo '% rev 0:' |
|
19 | echo '% rev 0:' | |
28 |
|
|
20 | $TESTDIR/readlink.py dangling | |
29 |
|
21 | |||
30 | rm dangling |
|
22 | rm dangling | |
31 | ln -s void dangling |
|
23 | ln -s void dangling | |
32 | hg commit -m 'change symlink' |
|
24 | hg commit -m 'change symlink' | |
33 | echo '% rev 1:' |
|
25 | echo '% rev 1:' | |
34 |
|
|
26 | $TESTDIR/readlink.py dangling | |
35 |
|
27 | |||
36 | echo '% modifying link' |
|
28 | echo '% modifying link' | |
37 | rm dangling |
|
29 | rm dangling | |
38 | ln -s empty dangling |
|
30 | ln -s empty dangling | |
39 |
|
|
31 | $TESTDIR/readlink.py dangling | |
40 |
|
32 | |||
41 | echo '% reverting to rev 0:' |
|
33 | echo '% reverting to rev 0:' | |
42 | hg revert -r 0 -a |
|
34 | hg revert -r 0 -a | |
43 |
|
|
35 | $TESTDIR/readlink.py dangling | |
44 |
|
36 | |||
45 | echo '% backups:' |
|
37 | echo '% backups:' | |
46 |
|
|
38 | $TESTDIR/readlink.py *.orig | |
47 |
|
39 | |||
48 | rm *.orig |
|
40 | rm *.orig | |
49 | hg up -C |
|
41 | hg up -C | |
50 | echo '% copies' |
|
42 | echo '% copies' | |
51 | hg cp -v dangling dangling2 |
|
43 | hg cp -v dangling dangling2 | |
52 | hg st -Cmard |
|
44 | hg st -Cmard | |
53 |
|
|
45 | $TESTDIR/readlink.py dangling dangling2 |
General Comments 0
You need to be logged in to leave comments.
Login now