Mercurial > hg
comparison tests/test-symlinks.t @ 11798:1ab3d8977bdf
tests: unify test-symlinks
author | Nicolas Dumazet <nicdumz.commits@gmail.com> |
---|---|
date | Thu, 12 Aug 2010 20:08:02 +0900 |
parents | tests/test-symlinks@c52057614c72 |
children | 6f12f53ae795 |
comparison
equal
deleted
inserted
replaced
11797:66e4e8e8b1e5 | 11798:1ab3d8977bdf |
---|---|
1 Test bug regarding symlinks that showed up in hg 0.7 | |
2 Author: Matthew Elder <sseses@gmail.com> | |
3 | |
4 $ "$TESTDIR/hghave" symlink || exit 80 | |
5 | |
6 make and initialize repo | |
7 | |
8 $ hg init test; cd test; | |
9 | |
10 make a file and a symlink | |
11 | |
12 $ touch foo; ln -s foo bar; | |
13 | |
14 import with addremove -- symlink walking should _not_ screwup. | |
15 | |
16 $ hg addremove | |
17 adding bar | |
18 adding foo | |
19 | |
20 commit -- the symlink should _not_ appear added to dir state | |
21 | |
22 $ hg commit -m 'initial' | |
23 | |
24 add a new file so hg will let me commit again | |
25 | |
26 $ touch bomb | |
27 | |
28 again, symlink should _not_ show up on dir state | |
29 | |
30 $ hg addremove | |
31 adding bomb | |
32 | |
33 Assert screamed here before, should go by without consequence | |
34 | |
35 $ hg commit -m 'is there a bug?' | |
36 | |
37 $ cd .. ; rm -r test | |
38 $ hg init test; cd test; | |
39 | |
40 $ mkdir dir | |
41 $ touch a.c dir/a.o dir/b.o | |
42 | |
43 test what happens if we want to trick hg | |
44 | |
45 $ hg commit -A -m 0 | |
46 adding a.c | |
47 adding dir/a.o | |
48 adding dir/b.o | |
49 $ echo "relglob:*.o" > .hgignore | |
50 $ rm a.c | |
51 $ rm dir/a.o | |
52 $ rm dir/b.o | |
53 $ mkdir dir/a.o | |
54 $ ln -s nonexist dir/b.o | |
55 $ mkfifo a.c | |
56 | |
57 it should show a.c, dir/a.o and dir/b.o deleted | |
58 | |
59 $ hg status | |
60 M dir/b.o | |
61 ! a.c | |
62 ! dir/a.o | |
63 ? .hgignore | |
64 $ hg status a.c | |
65 a.c: unsupported file type (type is fifo) | |
66 ! a.c | |
67 | |
68 test absolute path through symlink outside repo | |
69 | |
70 $ cd .. | |
71 $ p=`pwd` | |
72 $ hg init x | |
73 $ ln -s x y | |
74 $ cd x | |
75 $ touch f | |
76 $ hg add f | |
77 $ hg status "$p"/y/f | |
78 A f | |
79 | |
80 try symlink outside repo to file inside | |
81 | |
82 $ ln -s x/f ../z | |
83 | |
84 this should fail | |
85 | |
86 $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : | |
87 abort: ../z not under root | |
88 | |
89 $ cd .. ; rm -r test | |
90 $ hg init test; cd test; | |
91 | |
92 try cloning symlink in a subdir | |
93 1. commit a symlink | |
94 | |
95 $ mkdir -p a/b/c | |
96 $ cd a/b/c | |
97 $ ln -s /path/to/symlink/source demo | |
98 $ cd ../../.. | |
99 $ hg stat | |
100 ? a/b/c/demo | |
101 $ hg commit -A -m 'add symlink in a/b/c subdir' | |
102 adding a/b/c/demo | |
103 | |
104 2. clone it | |
105 | |
106 $ cd .. | |
107 $ hg clone test testclone | |
108 updating to branch default | |
109 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
110 | |
111 git symlink diff | |
112 | |
113 $ cd testclone | |
114 $ hg diff --git -r null:tip | |
115 diff --git a/a/b/c/demo b/a/b/c/demo | |
116 new file mode 120000 | |
117 --- /dev/null | |
118 +++ b/a/b/c/demo | |
119 @@ -0,0 +1,1 @@ | |
120 +/path/to/symlink/source | |
121 \ No newline at end of file | |
122 $ hg export --git tip > ../sl.diff | |
123 | |
124 import git symlink diff | |
125 | |
126 $ hg rm a/b/c/demo | |
127 $ hg commit -m'remove link' | |
128 $ hg import ../sl.diff | |
129 applying ../sl.diff | |
130 $ hg diff --git -r 1:tip | |
131 diff --git a/a/b/c/demo b/a/b/c/demo | |
132 new file mode 120000 | |
133 --- /dev/null | |
134 +++ b/a/b/c/demo | |
135 @@ -0,0 +1,1 @@ | |
136 +/path/to/symlink/source | |
137 \ No newline at end of file |