Show More
The requested changes are too big and content was truncated. Show full diff
|
1 | NO CONTENT: modified file | |
The requested commit or file is too big and content was truncated. Show full diff |
@@ -1,319 +1,315 b'' | |||
|
1 | 1 | #require symlink |
|
2 | 2 | |
|
3 | 3 | #testcases dirstate-v1 dirstate-v2 |
|
4 | 4 | |
|
5 | 5 | #if dirstate-v2 |
|
6 | 6 | $ cat >> $HGRCPATH << EOF |
|
7 | 7 | > [format] |
|
8 | 8 | > use-dirstate-v2=1 |
|
9 | 9 | > [storage] |
|
10 | 10 | > dirstate-v2.slow-path=allow |
|
11 | 11 | > EOF |
|
12 | 12 | #endif |
|
13 | 13 | |
|
14 | 14 | == tests added in 0.7 == |
|
15 | 15 | |
|
16 | 16 | $ hg init test-symlinks-0.7; cd test-symlinks-0.7; |
|
17 | 17 | $ touch foo; ln -s foo bar; ln -s nonexistent baz |
|
18 | 18 | |
|
19 | 19 | import with add and addremove -- symlink walking should _not_ screwup. |
|
20 | 20 | |
|
21 | 21 | $ hg add |
|
22 | 22 | adding bar |
|
23 | 23 | adding baz |
|
24 | 24 | adding foo |
|
25 | 25 | $ hg forget bar baz foo |
|
26 | 26 | $ hg addremove |
|
27 | 27 | adding bar |
|
28 | 28 | adding baz |
|
29 | 29 | adding foo |
|
30 | 30 | |
|
31 | 31 | commit -- the symlink should _not_ appear added to dir state |
|
32 | 32 | |
|
33 | 33 | $ hg commit -m 'initial' |
|
34 | 34 | |
|
35 | 35 | $ touch bomb |
|
36 | 36 | |
|
37 | 37 | again, symlink should _not_ show up on dir state |
|
38 | 38 | |
|
39 | 39 | $ hg addremove |
|
40 | 40 | adding bomb |
|
41 | 41 | |
|
42 | 42 | Assert screamed here before, should go by without consequence |
|
43 | 43 | |
|
44 | 44 | $ hg commit -m 'is there a bug?' |
|
45 | 45 | $ cd .. |
|
46 | 46 | |
|
47 | 47 | |
|
48 | 48 | == fifo & ignore == |
|
49 | 49 | |
|
50 | 50 | $ hg init test; cd test; |
|
51 | 51 | |
|
52 | 52 | $ mkdir dir |
|
53 | 53 | $ touch a.c dir/a.o dir/b.o |
|
54 | 54 | |
|
55 | 55 | test what happens if we want to trick hg |
|
56 | 56 | |
|
57 | 57 | $ hg commit -A -m 0 |
|
58 | 58 | adding a.c |
|
59 | 59 | adding dir/a.o |
|
60 | 60 | adding dir/b.o |
|
61 | 61 | $ echo "relglob:*.o" > .hgignore |
|
62 | 62 | $ rm a.c |
|
63 | 63 | $ rm dir/a.o |
|
64 | 64 | $ rm dir/b.o |
|
65 | 65 | $ mkdir dir/a.o |
|
66 | 66 | $ ln -s nonexistent dir/b.o |
|
67 | 67 | $ mkfifo a.c |
|
68 | 68 | |
|
69 | 69 | it should show a.c, dir/a.o and dir/b.o deleted |
|
70 | 70 | |
|
71 | 71 | $ hg status |
|
72 | 72 | M dir/b.o |
|
73 | 73 | ! a.c |
|
74 | 74 | ! dir/a.o |
|
75 | 75 | ? .hgignore |
|
76 | 76 | $ hg status a.c |
|
77 | 77 | a.c: unsupported file type (type is fifo) |
|
78 | 78 | ! a.c |
|
79 | 79 | $ cd .. |
|
80 | 80 | |
|
81 | 81 | |
|
82 | 82 | == symlinks from outside the tree == |
|
83 | 83 | |
|
84 | 84 | test absolute path through symlink outside repo |
|
85 | 85 | |
|
86 | 86 | $ p=`pwd` |
|
87 | 87 | $ hg init x |
|
88 | 88 | $ ln -s x y |
|
89 | 89 | $ cd x |
|
90 | 90 | $ touch f |
|
91 | 91 | $ hg add f |
|
92 | 92 | $ hg status "$p"/y/f |
|
93 | 93 | A f |
|
94 | 94 | |
|
95 | 95 | try symlink outside repo to file inside |
|
96 | 96 | |
|
97 | 97 | $ ln -s x/f ../z |
|
98 | 98 | |
|
99 | 99 | this should fail |
|
100 | 100 | |
|
101 | 101 | $ hg status ../z && { echo hg mistakenly exited with status 0; exit 1; } || : |
|
102 | 102 | abort: ../z not under root '$TESTTMP/x' |
|
103 | 103 | $ cd .. |
|
104 | 104 | |
|
105 | 105 | |
|
106 | 106 | == cloning symlinks == |
|
107 | 107 | $ hg init clone; cd clone; |
|
108 | 108 | |
|
109 | 109 | try cloning symlink in a subdir |
|
110 | 110 | 1. commit a symlink |
|
111 | 111 | |
|
112 | 112 | $ mkdir -p a/b/c |
|
113 | 113 | $ cd a/b/c |
|
114 | 114 | $ ln -s /path/to/symlink/source demo |
|
115 | 115 | $ cd ../../.. |
|
116 | 116 | $ hg stat |
|
117 | 117 | ? a/b/c/demo |
|
118 | 118 | $ hg commit -A -m 'add symlink in a/b/c subdir' |
|
119 | 119 | adding a/b/c/demo |
|
120 | 120 | |
|
121 | 121 | 2. clone it |
|
122 | 122 | |
|
123 | 123 | $ cd .. |
|
124 | 124 | $ hg clone clone clonedest |
|
125 | 125 | updating to branch default |
|
126 | 126 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
127 | 127 | |
|
128 | 128 | |
|
129 | 129 | == symlink and git diffs == |
|
130 | 130 | |
|
131 | 131 | git symlink diff |
|
132 | 132 | |
|
133 | 133 | $ cd clonedest |
|
134 | 134 | $ hg diff --git -r null:tip |
|
135 | 135 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
136 | 136 | new file mode 120000 |
|
137 | 137 | --- /dev/null |
|
138 | 138 | +++ b/a/b/c/demo |
|
139 | 139 | @@ -0,0 +1,1 @@ |
|
140 | 140 | +/path/to/symlink/source |
|
141 | 141 | \ No newline at end of file |
|
142 | 142 | $ hg export --git tip > ../sl.diff |
|
143 | 143 | |
|
144 | 144 | import git symlink diff |
|
145 | 145 | |
|
146 | 146 | $ hg rm a/b/c/demo |
|
147 | 147 | $ hg commit -m'remove link' |
|
148 | 148 | $ hg import ../sl.diff |
|
149 | 149 | applying ../sl.diff |
|
150 | 150 | $ hg diff --git -r 1:tip |
|
151 | 151 | diff --git a/a/b/c/demo b/a/b/c/demo |
|
152 | 152 | new file mode 120000 |
|
153 | 153 | --- /dev/null |
|
154 | 154 | +++ b/a/b/c/demo |
|
155 | 155 | @@ -0,0 +1,1 @@ |
|
156 | 156 | +/path/to/symlink/source |
|
157 | 157 | \ No newline at end of file |
|
158 | 158 | |
|
159 | 159 | == symlinks and addremove == |
|
160 | 160 | |
|
161 | 161 | directory moved and symlinked |
|
162 | 162 | |
|
163 | 163 | $ mkdir foo |
|
164 | 164 | $ touch foo/a |
|
165 | 165 | $ hg ci -Ama |
|
166 | 166 | adding foo/a |
|
167 | 167 | $ mv foo bar |
|
168 | 168 | $ ln -s bar foo |
|
169 | 169 | $ hg status |
|
170 | 170 | ! foo/a |
|
171 | 171 | ? bar/a |
|
172 | 172 | ? foo |
|
173 | 173 | |
|
174 | 174 | now addremove should remove old files |
|
175 | 175 | |
|
176 | 176 | $ hg addremove |
|
177 | 177 | adding bar/a |
|
178 | 178 | adding foo |
|
179 | 179 | removing foo/a |
|
180 | 180 | |
|
181 | 181 | commit and update back |
|
182 | 182 | |
|
183 | 183 | $ hg ci -mb |
|
184 | 184 | $ hg up '.^' |
|
185 | 185 | 1 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
186 | 186 | $ hg up tip |
|
187 | 187 | 2 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
188 | 188 | |
|
189 | 189 | $ cd .. |
|
190 | 190 | |
|
191 | 191 | == symlinks and add with --include == |
|
192 | 192 | |
|
193 | 193 | directory moved and symlinked |
|
194 | 194 | |
|
195 | 195 | $ hg init add-include |
|
196 | 196 | $ cd add-include |
|
197 | 197 | $ mkdir foo |
|
198 | 198 | $ touch foo/a |
|
199 | 199 | $ hg ci -Ama |
|
200 | 200 | adding foo/a |
|
201 | 201 | $ hg mv foo bar |
|
202 | 202 | moving foo/a to bar/a |
|
203 | 203 | $ ln -s bar foo |
|
204 | 204 | $ hg status |
|
205 | 205 | A bar/a |
|
206 | 206 | R foo/a |
|
207 | 207 | ? foo |
|
208 | 208 | |
|
209 | 209 | can add with --include |
|
210 | 210 | |
|
211 | 211 | $ hg add -I foo |
|
212 | 212 | adding foo |
|
213 | adding foo/a (known-bad-output !) | |
|
214 | abort: file 'foo' in dirstate clashes with 'foo/a' (known-bad-output !) | |
|
215 | [255] | |
|
216 | 213 | $ hg status |
|
217 | 214 | A bar/a |
|
218 | A foo (missing-correct-output !) | |
|
215 | A foo | |
|
219 | 216 | R foo/a |
|
220 | ? foo (known-bad-output !) | |
|
221 | 217 | |
|
222 | 218 | $ cd .. |
|
223 | 219 | |
|
224 | 220 | == root of repository is symlinked == |
|
225 | 221 | |
|
226 | 222 | $ hg init root |
|
227 | 223 | $ ln -s root link |
|
228 | 224 | $ cd root |
|
229 | 225 | $ echo foo > foo |
|
230 | 226 | $ hg status |
|
231 | 227 | ? foo |
|
232 | 228 | $ hg status ../link |
|
233 | 229 | ? foo |
|
234 | 230 | $ hg add foo |
|
235 | 231 | $ hg cp foo "$TESTTMP/link/bar" |
|
236 | 232 | foo has not been committed yet, so no copy data will be stored for bar. |
|
237 | 233 | $ cd .. |
|
238 | 234 | |
|
239 | 235 | |
|
240 | 236 | $ hg init b |
|
241 | 237 | $ cd b |
|
242 | 238 | $ ln -s nothing dangling |
|
243 | 239 | $ hg commit -m 'commit symlink without adding' dangling |
|
244 | 240 | abort: dangling: file not tracked! |
|
245 | 241 | [10] |
|
246 | 242 | $ hg add dangling |
|
247 | 243 | $ hg commit -m 'add symlink' |
|
248 | 244 | |
|
249 | 245 | $ hg tip -v |
|
250 | 246 | changeset: 0:cabd88b706fc |
|
251 | 247 | tag: tip |
|
252 | 248 | user: test |
|
253 | 249 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
254 | 250 | files: dangling |
|
255 | 251 | description: |
|
256 | 252 | add symlink |
|
257 | 253 | |
|
258 | 254 | |
|
259 | 255 | $ hg manifest --debug |
|
260 | 256 | 2564acbe54bbbedfbf608479340b359f04597f80 644 @ dangling |
|
261 | 257 | $ readlink.py dangling |
|
262 | 258 | dangling -> nothing |
|
263 | 259 | |
|
264 | 260 | $ rm dangling |
|
265 | 261 | $ ln -s void dangling |
|
266 | 262 | $ hg commit -m 'change symlink' |
|
267 | 263 | $ readlink.py dangling |
|
268 | 264 | dangling -> void |
|
269 | 265 | |
|
270 | 266 | |
|
271 | 267 | modifying link |
|
272 | 268 | |
|
273 | 269 | $ rm dangling |
|
274 | 270 | $ ln -s empty dangling |
|
275 | 271 | $ readlink.py dangling |
|
276 | 272 | dangling -> empty |
|
277 | 273 | |
|
278 | 274 | |
|
279 | 275 | reverting to rev 0: |
|
280 | 276 | |
|
281 | 277 | $ hg revert -r 0 -a |
|
282 | 278 | reverting dangling |
|
283 | 279 | $ readlink.py dangling |
|
284 | 280 | dangling -> nothing |
|
285 | 281 | |
|
286 | 282 | |
|
287 | 283 | backups: |
|
288 | 284 | |
|
289 | 285 | $ readlink.py *.orig |
|
290 | 286 | dangling.orig -> empty |
|
291 | 287 | $ rm *.orig |
|
292 | 288 | $ hg up -C |
|
293 | 289 | 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
294 | 290 | |
|
295 | 291 | copies |
|
296 | 292 | |
|
297 | 293 | $ hg cp -v dangling dangling2 |
|
298 | 294 | copying dangling to dangling2 |
|
299 | 295 | $ hg st -Cmard |
|
300 | 296 | A dangling2 |
|
301 | 297 | dangling |
|
302 | 298 | $ readlink.py dangling dangling2 |
|
303 | 299 | dangling -> void |
|
304 | 300 | dangling2 -> void |
|
305 | 301 | |
|
306 | 302 | |
|
307 | 303 | Issue995: hg copy -A incorrectly handles symbolic links |
|
308 | 304 | |
|
309 | 305 | $ hg up -C |
|
310 | 306 | 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
311 | 307 | $ mkdir dir |
|
312 | 308 | $ ln -s dir dirlink |
|
313 | 309 | $ hg ci -qAm 'add dirlink' |
|
314 | 310 | $ mkdir newdir |
|
315 | 311 | $ mv dir newdir/dir |
|
316 | 312 | $ mv dirlink newdir/dirlink |
|
317 | 313 | $ hg mv -A dirlink newdir/dirlink |
|
318 | 314 | |
|
319 | 315 | $ cd .. |
General Comments 0
You need to be logged in to leave comments.
Login now