Show More
@@ -1,137 +1,253 b'' | |||
|
1 | Test bug regarding symlinks that showed up in hg 0.7 | |
|
2 | Author: Matthew Elder <sseses@gmail.com> | |
|
3 | ||
|
4 | 1 |
|
|
5 | 2 | |
|
6 | make and initialize repo | |
|
3 | == tests added in 0.7 == | |
|
7 | 4 | |
|
8 | $ hg init test; cd test; | |
|
9 | ||
|
10 | make a file and a symlink | |
|
11 | ||
|
5 | $ hg init test-symlinks-0.7; cd test-symlinks-0.7; | |
|
12 | 6 | $ touch foo; ln -s foo bar; |
|
13 | 7 | |
|
14 | 8 | import with addremove -- symlink walking should _not_ screwup. |
|
15 | 9 | |
|
16 | 10 | $ hg addremove |
|
17 | 11 | adding bar |
|
18 | 12 | adding foo |
|
19 | 13 | |
|
20 | 14 | commit -- the symlink should _not_ appear added to dir state |
|
21 | 15 | |
|
22 | 16 | $ hg commit -m 'initial' |
|
23 | 17 | |
|
24 | add a new file so hg will let me commit again | |
|
25 | ||
|
26 | 18 | $ touch bomb |
|
27 | 19 | |
|
28 | 20 | again, symlink should _not_ show up on dir state |
|
29 | 21 | |
|
30 | 22 | $ hg addremove |
|
31 | 23 | adding bomb |
|
32 | 24 | |
|
33 | 25 | Assert screamed here before, should go by without consequence |
|
34 | 26 | |
|
35 | 27 | $ hg commit -m 'is there a bug?' |
|
28 | $ cd .. | |
|
36 | 29 | |
|
37 | $ cd .. ; rm -r test | |
|
30 | ||
|
31 | == fifo & ignore == | |
|
32 | ||
|
38 | 33 | $ hg init test; cd test; |
|
39 | 34 | |
|
40 | 35 | $ mkdir dir |
|
41 | 36 | $ touch a.c dir/a.o dir/b.o |
|
42 | 37 | |
|
43 | 38 | test what happens if we want to trick hg |
|
44 | 39 | |
|
45 | 40 | $ hg commit -A -m 0 |
|
46 | 41 | adding a.c |
|
47 | 42 | adding dir/a.o |
|
48 | 43 | adding dir/b.o |
|
49 | 44 | $ echo "relglob:*.o" > .hgignore |
|
50 | 45 | $ rm a.c |
|
51 | 46 | $ rm dir/a.o |
|
52 | 47 | $ rm dir/b.o |
|
53 | 48 | $ mkdir dir/a.o |
|
54 | 49 | $ ln -s nonexist dir/b.o |
|
55 | 50 | $ mkfifo a.c |
|
56 | 51 | |
|
57 | 52 | it should show a.c, dir/a.o and dir/b.o deleted |
|
58 | 53 | |
|
59 | 54 | $ hg status |
|
60 | 55 | M dir/b.o |
|
61 | 56 | ! a.c |
|
62 | 57 | ! dir/a.o |
|
63 | 58 | ? .hgignore |
|
64 | 59 | $ hg status a.c |
|
65 | 60 | a.c: unsupported file type (type is fifo) |
|
66 | 61 | ! a.c |
|
62 | $ cd .. | |
|
63 | ||
|
64 | ||
|
65 | == symlinks from outside the tree == | |
|
67 | 66 | |
|
68 | 67 | test absolute path through symlink outside repo |
|
69 | 68 | |
|
70 | $ cd .. | |
|
71 | 69 | $ p=`pwd` |
|
72 | 70 | $ hg init x |
|
73 | 71 | $ ln -s x y |
|
74 | 72 | $ cd x |
|
75 | 73 | $ touch f |
|
76 | 74 | $ hg add f |
|
77 | 75 | $ hg status "$p"/y/f |
|
78 | 76 | A f |
|
79 | 77 | |
|
80 | 78 | try symlink outside repo to file inside |
|
81 | 79 | |
|
82 | 80 | $ ln -s x/f ../z |
|
83 | 81 | |
|
84 | 82 | this should fail |
|
85 | 83 | |
|
86 | 84 | $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
|
87 | 85 | abort: ../z not under root |
|
86 | $ cd .. | |
|
88 | 87 | |
|
89 | $ cd .. ; rm -r test | |
|
90 | $ hg init test; cd test; | |
|
88 | ||
|
89 | == cloning symlinks == | |
|
90 | $ hg init clone; cd clone; | |
|
91 | 91 | |
|
92 | 92 | try cloning symlink in a subdir |
|
93 | 93 | 1. commit a symlink |
|
94 | 94 | |
|
95 | 95 | $ mkdir -p a/b/c |
|
96 | 96 | $ cd a/b/c |
|
97 | 97 | $ ln -s /path/to/symlink/source demo |
|
98 | 98 | $ cd ../../.. |
|
99 | 99 | $ hg stat |
|
100 | 100 | ? a/b/c/demo |
|
101 | 101 | $ hg commit -A -m 'add symlink in a/b/c subdir' |
|
102 | 102 | adding a/b/c/demo |
|
103 | 103 | |
|
104 | 104 | 2. clone it |
|
105 | 105 | |
|
106 | 106 | $ cd .. |
|
107 |
$ hg clone |
|
|
107 | $ hg clone clone clonedest | |
|
108 | 108 | updating to branch default |
|
109 | 109 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
110 | 110 | |
|
111 | ||
|
112 | == symlink and git diffs == | |
|
113 | ||
|
111 | 114 |
|
|
112 | 115 | |
|
113 |
$ cd |
|
|
116 | $ cd clonedest | |
|
114 | 117 | $ hg diff --git -r null:tip |
|
115 | 118 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
116 | 119 | new file mode 120000 |
|
117 | 120 | --- /dev/null |
|
118 | 121 | +++ b/a/b/c/demo |
|
119 | 122 | @@ -0,0 +1,1 @@ |
|
120 | 123 | +/path/to/symlink/source |
|
121 | 124 | \ No newline at end of file |
|
122 | 125 | $ hg export --git tip > ../sl.diff |
|
123 | 126 | |
|
124 | 127 | import git symlink diff |
|
125 | 128 | |
|
126 | 129 | $ hg rm a/b/c/demo |
|
127 | 130 | $ hg commit -m'remove link' |
|
128 | 131 | $ hg import ../sl.diff |
|
129 | 132 | applying ../sl.diff |
|
130 | 133 | $ hg diff --git -r 1:tip |
|
131 | 134 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
132 | 135 | new file mode 120000 |
|
133 | 136 | --- /dev/null |
|
134 | 137 | +++ b/a/b/c/demo |
|
135 | 138 | @@ -0,0 +1,1 @@ |
|
136 | 139 | +/path/to/symlink/source |
|
137 | 140 | \ No newline at end of file |
|
141 | ||
|
142 | == symlinks and addremove == | |
|
143 | ||
|
144 | directory moved and symlinked | |
|
145 | ||
|
146 | $ mkdir foo | |
|
147 | $ touch foo/a | |
|
148 | $ hg ci -Ama | |
|
149 | adding foo/a | |
|
150 | $ mv foo bar | |
|
151 | $ ln -s bar foo | |
|
152 | ||
|
153 | now addremove should remove old files | |
|
154 | ||
|
155 | $ hg addremove | |
|
156 | adding bar/a | |
|
157 | adding foo | |
|
158 | removing foo/a | |
|
159 | $ cd .. | |
|
160 | ||
|
161 | == root of repository is symlinked == | |
|
162 | ||
|
163 | $ hg init root | |
|
164 | $ ln -s root link | |
|
165 | $ cd root | |
|
166 | $ echo foo > foo | |
|
167 | $ hg status | |
|
168 | ? foo | |
|
169 | $ hg status ../link | |
|
170 | ? foo | |
|
171 | $ cd .. | |
|
172 | ||
|
173 | ||
|
174 | ||
|
175 | ||
|
176 | $ hg init b | |
|
177 | $ cd b | |
|
178 | $ ln -s nothing dangling | |
|
179 | $ hg commit -m 'commit symlink without adding' dangling | |
|
180 | abort: dangling: file not tracked! | |
|
181 | $ hg add dangling | |
|
182 | $ hg commit -m 'add symlink' | |
|
183 | ||
|
184 | $ hg tip -v | |
|
185 | changeset: 0:cabd88b706fc | |
|
186 | tag: tip | |
|
187 | user: test | |
|
188 | date: Thu Jan 01 00:00:00 1970 +0000 | |
|
189 | files: dangling | |
|
190 | description: | |
|
191 | add symlink | |
|
192 | ||
|
193 | ||
|
194 | $ hg manifest --debug | |
|
195 | 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling | |
|
196 | $ $TESTDIR/readlink.py dangling | |
|
197 | dangling -> nothing | |
|
198 | ||
|
199 | $ rm dangling | |
|
200 | $ ln -s void dangling | |
|
201 | $ hg commit -m 'change symlink' | |
|
202 | $ $TESTDIR/readlink.py dangling | |
|
203 | dangling -> void | |
|
204 | ||
|
205 | ||
|
206 | modifying link | |
|
207 | ||
|
208 | $ rm dangling | |
|
209 | $ ln -s empty dangling | |
|
210 | $ $TESTDIR/readlink.py dangling | |
|
211 | dangling -> empty | |
|
212 | ||
|
213 | ||
|
214 | reverting to rev 0: | |
|
215 | ||
|
216 | $ hg revert -r 0 -a | |
|
217 | reverting dangling | |
|
218 | $ $TESTDIR/readlink.py dangling | |
|
219 | dangling -> nothing | |
|
220 | ||
|
221 | ||
|
222 | backups: | |
|
223 | ||
|
224 | $ $TESTDIR/readlink.py *.orig | |
|
225 | dangling.orig -> empty | |
|
226 | $ rm *.orig | |
|
227 | $ hg up -C | |
|
228 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
229 | ||
|
230 | copies | |
|
231 | ||
|
232 | $ hg cp -v dangling dangling2 | |
|
233 | copying dangling to dangling2 | |
|
234 | $ hg st -Cmard | |
|
235 | A dangling2 | |
|
236 | dangling | |
|
237 | $ $TESTDIR/readlink.py dangling dangling2 | |
|
238 | dangling -> void | |
|
239 | dangling2 -> void | |
|
240 | ||
|
241 | ||
|
242 | issue995 | |
|
243 | ||
|
244 | $ hg up -C | |
|
245 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved | |
|
246 | $ mkdir dir | |
|
247 | $ ln -s dir dirlink | |
|
248 | $ hg ci -qAm 'add dirlink' | |
|
249 | $ mkdir newdir | |
|
250 | $ mv dir newdir/dir | |
|
251 | $ mv dirlink newdir/dirlink | |
|
252 | $ hg mv -A dirlink newdir/dirlink | |
|
253 |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
|
1 | NO CONTENT: file was removed |
General Comments 0
You need to be logged in to leave comments.
Login now