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