Show More
@@ -0,0 +1,435 b'' | |||||
|
1 | ||||
|
2 | $ cat >> $HGRCPATH << EOF | |||
|
3 | > [alias] | |||
|
4 | > l = log -G -T '{rev} {desc}\n{files}\n' | |||
|
5 | > EOF | |||
|
6 | ||||
|
7 | $ REPONUM=0 | |||
|
8 | $ newrepo() { | |||
|
9 | > cd $TESTTMP | |||
|
10 | > REPONUM=`expr $REPONUM + 1` | |||
|
11 | > hg init repo-$REPONUM | |||
|
12 | > cd repo-$REPONUM | |||
|
13 | > } | |||
|
14 | ||||
|
15 | Simple rename case | |||
|
16 | $ newrepo | |||
|
17 | $ echo x > x | |||
|
18 | $ hg ci -Aqm 'add x' | |||
|
19 | $ hg mv x y | |||
|
20 | $ hg ci -m 'rename x to y' | |||
|
21 | $ hg l | |||
|
22 | @ 1 rename x to y | |||
|
23 | | x y | |||
|
24 | o 0 add x | |||
|
25 | x | |||
|
26 | $ hg debugpathcopies 0 1 | |||
|
27 | x -> y | |||
|
28 | $ hg debugpathcopies 1 0 | |||
|
29 | y -> x | |||
|
30 | Test filtering copies by path. We do filtering by destination. | |||
|
31 | $ hg debugpathcopies 0 1 x | |||
|
32 | $ hg debugpathcopies 1 0 x | |||
|
33 | y -> x | |||
|
34 | $ hg debugpathcopies 0 1 y | |||
|
35 | x -> y | |||
|
36 | BROKEN: the following command should not include the copy | |||
|
37 | $ hg debugpathcopies 1 0 y | |||
|
38 | y -> x | |||
|
39 | ||||
|
40 | Copy a file onto another file | |||
|
41 | $ newrepo | |||
|
42 | $ echo x > x | |||
|
43 | $ echo y > y | |||
|
44 | $ hg ci -Aqm 'add x and y' | |||
|
45 | $ hg cp -f x y | |||
|
46 | $ hg ci -m 'copy x onto y' | |||
|
47 | $ hg l | |||
|
48 | @ 1 copy x onto y | |||
|
49 | | y | |||
|
50 | o 0 add x and y | |||
|
51 | x y | |||
|
52 | Incorrectly doesn't show the rename | |||
|
53 | $ hg debugpathcopies 0 1 | |||
|
54 | ||||
|
55 | Copy a file onto another file with same content. If metadata is stored in changeset, this does not | |||
|
56 | produce a new filelog entry. The changeset's "files" entry should still list the file. | |||
|
57 | $ newrepo | |||
|
58 | $ echo x > x | |||
|
59 | $ echo x > x2 | |||
|
60 | $ hg ci -Aqm 'add x and x2 with same content' | |||
|
61 | $ hg cp -f x x2 | |||
|
62 | $ hg ci -m 'copy x onto x2' | |||
|
63 | $ hg l | |||
|
64 | @ 1 copy x onto x2 | |||
|
65 | | x2 | |||
|
66 | o 0 add x and x2 with same content | |||
|
67 | x x2 | |||
|
68 | Incorrectly doesn't show the rename | |||
|
69 | $ hg debugpathcopies 0 1 | |||
|
70 | ||||
|
71 | Copy a file, then delete destination, then copy again. This does not create a new filelog entry. | |||
|
72 | $ newrepo | |||
|
73 | $ echo x > x | |||
|
74 | $ hg ci -Aqm 'add x' | |||
|
75 | $ hg cp x y | |||
|
76 | $ hg ci -m 'copy x to y' | |||
|
77 | $ hg rm y | |||
|
78 | $ hg ci -m 'remove y' | |||
|
79 | $ hg cp -f x y | |||
|
80 | $ hg ci -m 'copy x onto y (again)' | |||
|
81 | $ hg l | |||
|
82 | @ 3 copy x onto y (again) | |||
|
83 | | y | |||
|
84 | o 2 remove y | |||
|
85 | | y | |||
|
86 | o 1 copy x to y | |||
|
87 | | y | |||
|
88 | o 0 add x | |||
|
89 | x | |||
|
90 | $ hg debugpathcopies 0 3 | |||
|
91 | x -> y | |||
|
92 | ||||
|
93 | Rename file in a loop: x->y->z->x | |||
|
94 | $ newrepo | |||
|
95 | $ echo x > x | |||
|
96 | $ hg ci -Aqm 'add x' | |||
|
97 | $ hg mv x y | |||
|
98 | $ hg ci -m 'rename x to y' | |||
|
99 | $ hg mv y z | |||
|
100 | $ hg ci -m 'rename y to z' | |||
|
101 | $ hg mv z x | |||
|
102 | $ hg ci -m 'rename z to x' | |||
|
103 | $ hg l | |||
|
104 | @ 3 rename z to x | |||
|
105 | | x z | |||
|
106 | o 2 rename y to z | |||
|
107 | | y z | |||
|
108 | o 1 rename x to y | |||
|
109 | | x y | |||
|
110 | o 0 add x | |||
|
111 | x | |||
|
112 | $ hg debugpathcopies 0 3 | |||
|
113 | ||||
|
114 | Copy x to y, then remove y, then add back y. With copy metadata in the changeset, this could easily | |||
|
115 | end up reporting y as copied from x (if we don't unmark it as a copy when it's removed). | |||
|
116 | $ newrepo | |||
|
117 | $ echo x > x | |||
|
118 | $ hg ci -Aqm 'add x' | |||
|
119 | $ hg mv x y | |||
|
120 | $ hg ci -m 'rename x to y' | |||
|
121 | $ hg rm y | |||
|
122 | $ hg ci -qm 'remove y' | |||
|
123 | $ echo x > y | |||
|
124 | $ hg ci -Aqm 'add back y' | |||
|
125 | $ hg l | |||
|
126 | @ 3 add back y | |||
|
127 | | y | |||
|
128 | o 2 remove y | |||
|
129 | | y | |||
|
130 | o 1 rename x to y | |||
|
131 | | x y | |||
|
132 | o 0 add x | |||
|
133 | x | |||
|
134 | $ hg debugpathcopies 0 3 | |||
|
135 | ||||
|
136 | Copy x to z, then remove z, then copy x2 (same content as x) to z. With copy metadata in the | |||
|
137 | changeset, the two copies here will have the same filelog entry, so ctx['z'].introrev() might point | |||
|
138 | to the first commit that added the file. We should still report the copy as being from x2. | |||
|
139 | $ newrepo | |||
|
140 | $ echo x > x | |||
|
141 | $ echo x > x2 | |||
|
142 | $ hg ci -Aqm 'add x and x2 with same content' | |||
|
143 | $ hg cp x z | |||
|
144 | $ hg ci -qm 'copy x to z' | |||
|
145 | $ hg rm z | |||
|
146 | $ hg ci -m 'remove z' | |||
|
147 | $ hg cp x2 z | |||
|
148 | $ hg ci -m 'copy x2 to z' | |||
|
149 | $ hg l | |||
|
150 | @ 3 copy x2 to z | |||
|
151 | | z | |||
|
152 | o 2 remove z | |||
|
153 | | z | |||
|
154 | o 1 copy x to z | |||
|
155 | | z | |||
|
156 | o 0 add x and x2 with same content | |||
|
157 | x x2 | |||
|
158 | $ hg debugpathcopies 0 3 | |||
|
159 | x2 -> z | |||
|
160 | ||||
|
161 | Create x and y, then rename them both to the same name, but on different sides of a fork | |||
|
162 | $ newrepo | |||
|
163 | $ echo x > x | |||
|
164 | $ echo y > y | |||
|
165 | $ hg ci -Aqm 'add x and y' | |||
|
166 | $ hg mv x z | |||
|
167 | $ hg ci -qm 'rename x to z' | |||
|
168 | $ hg co -q 0 | |||
|
169 | $ hg mv y z | |||
|
170 | $ hg ci -qm 'rename y to z' | |||
|
171 | $ hg l | |||
|
172 | @ 2 rename y to z | |||
|
173 | | y z | |||
|
174 | | o 1 rename x to z | |||
|
175 | |/ x z | |||
|
176 | o 0 add x and y | |||
|
177 | x y | |||
|
178 | $ hg debugpathcopies 1 2 | |||
|
179 | z -> x | |||
|
180 | y -> z | |||
|
181 | ||||
|
182 | Fork renames x to y on one side and removes x on the other | |||
|
183 | $ newrepo | |||
|
184 | $ echo x > x | |||
|
185 | $ hg ci -Aqm 'add x' | |||
|
186 | $ hg mv x y | |||
|
187 | $ hg ci -m 'rename x to y' | |||
|
188 | $ hg co -q 0 | |||
|
189 | $ hg rm x | |||
|
190 | $ hg ci -m 'remove x' | |||
|
191 | created new head | |||
|
192 | $ hg l | |||
|
193 | @ 2 remove x | |||
|
194 | | x | |||
|
195 | | o 1 rename x to y | |||
|
196 | |/ x y | |||
|
197 | o 0 add x | |||
|
198 | x | |||
|
199 | BROKEN: x doesn't exist here | |||
|
200 | $ hg debugpathcopies 1 2 | |||
|
201 | y -> x | |||
|
202 | ||||
|
203 | Copies via null revision (there shouldn't be any) | |||
|
204 | $ newrepo | |||
|
205 | $ echo x > x | |||
|
206 | $ hg ci -Aqm 'add x' | |||
|
207 | $ hg cp x y | |||
|
208 | $ hg ci -m 'copy x to y' | |||
|
209 | $ hg co -q null | |||
|
210 | $ echo x > x | |||
|
211 | $ hg ci -Aqm 'add x (again)' | |||
|
212 | $ hg l | |||
|
213 | @ 2 add x (again) | |||
|
214 | x | |||
|
215 | o 1 copy x to y | |||
|
216 | | y | |||
|
217 | o 0 add x | |||
|
218 | x | |||
|
219 | $ hg debugpathcopies 1 2 | |||
|
220 | $ hg debugpathcopies 2 1 | |||
|
221 | ||||
|
222 | Merge rename from other branch | |||
|
223 | $ newrepo | |||
|
224 | $ echo x > x | |||
|
225 | $ hg ci -Aqm 'add x' | |||
|
226 | $ hg mv x y | |||
|
227 | $ hg ci -m 'rename x to y' | |||
|
228 | $ hg co -q 0 | |||
|
229 | $ echo z > z | |||
|
230 | $ hg ci -Aqm 'add z' | |||
|
231 | $ hg merge -q 1 | |||
|
232 | $ hg ci -m 'merge rename from p2' | |||
|
233 | $ hg l | |||
|
234 | @ 3 merge rename from p2 | |||
|
235 | |\ x | |||
|
236 | | o 2 add z | |||
|
237 | | | z | |||
|
238 | o | 1 rename x to y | |||
|
239 | |/ x y | |||
|
240 | o 0 add x | |||
|
241 | x | |||
|
242 | Perhaps we should indicate the rename here, but `hg status` is documented to be weird during | |||
|
243 | merges, so... | |||
|
244 | $ hg debugpathcopies 0 3 | |||
|
245 | x -> y | |||
|
246 | $ hg debugpathcopies 1 2 | |||
|
247 | y -> x | |||
|
248 | $ hg debugpathcopies 1 3 | |||
|
249 | $ hg debugpathcopies 2 3 | |||
|
250 | x -> y | |||
|
251 | ||||
|
252 | Copy file from either side in a merge | |||
|
253 | $ newrepo | |||
|
254 | $ echo x > x | |||
|
255 | $ hg ci -Aqm 'add x' | |||
|
256 | $ hg co -q null | |||
|
257 | $ echo y > y | |||
|
258 | $ hg ci -Aqm 'add y' | |||
|
259 | $ hg merge -q 0 | |||
|
260 | $ hg cp y z | |||
|
261 | $ hg ci -m 'copy file from p1 in merge' | |||
|
262 | $ hg co -q 1 | |||
|
263 | $ hg merge -q 0 | |||
|
264 | $ hg cp x z | |||
|
265 | $ hg ci -qm 'copy file from p2 in merge' | |||
|
266 | $ hg l | |||
|
267 | @ 3 copy file from p2 in merge | |||
|
268 | |\ z | |||
|
269 | +---o 2 copy file from p1 in merge | |||
|
270 | | |/ z | |||
|
271 | | o 1 add y | |||
|
272 | | y | |||
|
273 | o 0 add x | |||
|
274 | x | |||
|
275 | $ hg debugpathcopies 1 2 | |||
|
276 | y -> z | |||
|
277 | $ hg debugpathcopies 0 2 | |||
|
278 | $ hg debugpathcopies 1 3 | |||
|
279 | $ hg debugpathcopies 0 3 | |||
|
280 | x -> z | |||
|
281 | ||||
|
282 | Copy file that exists on both sides of the merge, same content on both sides | |||
|
283 | $ newrepo | |||
|
284 | $ echo x > x | |||
|
285 | $ hg ci -Aqm 'add x on branch 1' | |||
|
286 | $ hg co -q null | |||
|
287 | $ echo x > x | |||
|
288 | $ hg ci -Aqm 'add x on branch 2' | |||
|
289 | $ hg merge -q 0 | |||
|
290 | $ hg cp x z | |||
|
291 | $ hg ci -qm 'merge' | |||
|
292 | $ hg l | |||
|
293 | @ 2 merge | |||
|
294 | |\ z | |||
|
295 | | o 1 add x on branch 2 | |||
|
296 | | x | |||
|
297 | o 0 add x on branch 1 | |||
|
298 | x | |||
|
299 | It's a little weird that it shows up on both sides | |||
|
300 | $ hg debugpathcopies 1 2 | |||
|
301 | x -> z | |||
|
302 | $ hg debugpathcopies 0 2 | |||
|
303 | x -> z | |||
|
304 | ||||
|
305 | Copy file that exists on both sides of the merge, different content | |||
|
306 | $ newrepo | |||
|
307 | $ echo branch1 > x | |||
|
308 | $ hg ci -Aqm 'add x on branch 1' | |||
|
309 | $ hg co -q null | |||
|
310 | $ echo branch2 > x | |||
|
311 | $ hg ci -Aqm 'add x on branch 2' | |||
|
312 | $ hg merge -q 0 | |||
|
313 | warning: conflicts while merging x! (edit, then use 'hg resolve --mark') | |||
|
314 | [1] | |||
|
315 | $ echo resolved > x | |||
|
316 | $ hg resolve -m x | |||
|
317 | (no more unresolved files) | |||
|
318 | $ hg cp x z | |||
|
319 | $ hg ci -qm 'merge' | |||
|
320 | $ hg l | |||
|
321 | @ 2 merge | |||
|
322 | |\ x z | |||
|
323 | | o 1 add x on branch 2 | |||
|
324 | | x | |||
|
325 | o 0 add x on branch 1 | |||
|
326 | x | |||
|
327 | $ hg debugpathcopies 1 2 | |||
|
328 | $ hg debugpathcopies 0 2 | |||
|
329 | x -> z | |||
|
330 | ||||
|
331 | Copy x->y on one side of merge and copy x->z on the other side. Pathcopies from one parent | |||
|
332 | of the merge to the merge should include the copy from the other side. | |||
|
333 | $ newrepo | |||
|
334 | $ echo x > x | |||
|
335 | $ hg ci -Aqm 'add x' | |||
|
336 | $ hg cp x y | |||
|
337 | $ hg ci -qm 'copy x to y' | |||
|
338 | $ hg co -q 0 | |||
|
339 | $ hg cp x z | |||
|
340 | $ hg ci -qm 'copy x to z' | |||
|
341 | $ hg merge -q 1 | |||
|
342 | $ hg ci -m 'merge copy x->y and copy x->z' | |||
|
343 | $ hg l | |||
|
344 | @ 3 merge copy x->y and copy x->z | |||
|
345 | |\ | |||
|
346 | | o 2 copy x to z | |||
|
347 | | | z | |||
|
348 | o | 1 copy x to y | |||
|
349 | |/ y | |||
|
350 | o 0 add x | |||
|
351 | x | |||
|
352 | $ hg debugpathcopies 2 3 | |||
|
353 | x -> y | |||
|
354 | $ hg debugpathcopies 1 3 | |||
|
355 | x -> z | |||
|
356 | ||||
|
357 | Copy x to y on one side of merge, create y and rename to z on the other side. Pathcopies from the | |||
|
358 | first side should not include the y->z rename since y didn't exist in the merge base. | |||
|
359 | $ newrepo | |||
|
360 | $ echo x > x | |||
|
361 | $ hg ci -Aqm 'add x' | |||
|
362 | $ hg cp x y | |||
|
363 | $ hg ci -qm 'copy x to y' | |||
|
364 | $ hg co -q 0 | |||
|
365 | $ echo y > y | |||
|
366 | $ hg ci -Aqm 'add y' | |||
|
367 | $ hg mv y z | |||
|
368 | $ hg ci -m 'rename y to z' | |||
|
369 | $ hg merge -q 1 | |||
|
370 | $ hg ci -m 'merge' | |||
|
371 | $ hg l | |||
|
372 | @ 4 merge | |||
|
373 | |\ | |||
|
374 | | o 3 rename y to z | |||
|
375 | | | y z | |||
|
376 | | o 2 add y | |||
|
377 | | | y | |||
|
378 | o | 1 copy x to y | |||
|
379 | |/ y | |||
|
380 | o 0 add x | |||
|
381 | x | |||
|
382 | $ hg debugpathcopies 2 3 | |||
|
383 | y -> z | |||
|
384 | $ hg debugpathcopies 1 3 | |||
|
385 | ||||
|
386 | Create x and y, then rename x to z on one side of merge, and rename y to z and modify z on the | |||
|
387 | other side. | |||
|
388 | $ newrepo | |||
|
389 | $ echo x > x | |||
|
390 | $ echo y > y | |||
|
391 | $ hg ci -Aqm 'add x and y' | |||
|
392 | $ hg mv x z | |||
|
393 | $ hg ci -qm 'rename x to z' | |||
|
394 | $ hg co -q 0 | |||
|
395 | $ hg mv y z | |||
|
396 | $ hg ci -qm 'rename y to z' | |||
|
397 | $ echo z >> z | |||
|
398 | $ hg ci -m 'modify z' | |||
|
399 | $ hg merge -q 1 | |||
|
400 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') | |||
|
401 | [1] | |||
|
402 | $ echo z > z | |||
|
403 | $ hg resolve -qm z | |||
|
404 | $ hg ci -m 'merge 1 into 3' | |||
|
405 | Try merging the other direction too | |||
|
406 | $ hg co -q 1 | |||
|
407 | $ hg merge -q 3 | |||
|
408 | warning: conflicts while merging z! (edit, then use 'hg resolve --mark') | |||
|
409 | [1] | |||
|
410 | $ echo z > z | |||
|
411 | $ hg resolve -qm z | |||
|
412 | $ hg ci -m 'merge 3 into 1' | |||
|
413 | created new head | |||
|
414 | $ hg l | |||
|
415 | @ 5 merge 3 into 1 | |||
|
416 | |\ y z | |||
|
417 | +---o 4 merge 1 into 3 | |||
|
418 | | |/ x z | |||
|
419 | | o 3 modify z | |||
|
420 | | | z | |||
|
421 | | o 2 rename y to z | |||
|
422 | | | y z | |||
|
423 | o | 1 rename x to z | |||
|
424 | |/ x z | |||
|
425 | o 0 add x and y | |||
|
426 | x y | |||
|
427 | $ hg debugpathcopies 1 4 | |||
|
428 | $ hg debugpathcopies 2 4 | |||
|
429 | $ hg debugpathcopies 0 4 | |||
|
430 | x -> z | |||
|
431 | $ hg debugpathcopies 1 5 | |||
|
432 | $ hg debugpathcopies 2 5 | |||
|
433 | $ hg debugpathcopies 0 5 | |||
|
434 | x -> z | |||
|
435 |
General Comments 0
You need to be logged in to leave comments.
Login now