|
1 |
|
2 Graft from behind a move or rename |
|
3 ================================== |
|
4 |
|
5 NOTE: This is affected by issue5343, and will need updating when it's fixed |
|
6 |
|
7 Consider this topology for a regular graft: |
|
8 |
|
9 o c1 |
|
10 | |
|
11 | o c2 |
|
12 | | |
|
13 | o ca # stands for "common ancestor" |
|
14 |/ |
|
15 o cta # stands for "common topological ancestor" |
|
16 |
|
17 Note that in issue5343, ca==cta. |
|
18 |
|
19 The following table shows the possible cases. Here, "x->y" and, equivalently, |
|
20 "y<-x", where x is an ancestor of y, means that some copy happened from x to y. |
|
21 |
|
22 name | c1<-cta | cta<->ca | ca->c2 |
|
23 A.0 | | | |
|
24 A.1 | X | | |
|
25 A.2 | | X | |
|
26 A.3 | | | X |
|
27 A.4 | X | X | |
|
28 A.5 | X | | X |
|
29 A.6 | | X | X |
|
30 A.7 | X | X | X |
|
31 |
|
32 A.0 is trivial, and doesn't need copy tracking. |
|
33 For A.1, a forward rename is recorded in the c1 pass, to be followed later. |
|
34 In A.2, the rename is recorded in the c2 pass and followed backwards. |
|
35 A.3 is recorded in the c2 pass as a forward rename to be duplicated on target. |
|
36 In A.4, both passes of checkcopies record incomplete renames, which are |
|
37 then joined in mergecopies to record a rename to be followed. |
|
38 In A.5 and A.7, the c1 pass records an incomplete rename, while the c2 pass |
|
39 records an incomplete divergence. The incomplete rename is then joined to the |
|
40 appropriate side of the incomplete divergence, and the result is recorded as a |
|
41 divergence. The code doesn't distinguish at all between these two cases, since |
|
42 the end result of them is the same: an incomplete divergence joined with an |
|
43 incomplete rename into a divergence. |
|
44 Finally, A.6 records a divergence entirely in the c2 pass. |
|
45 |
|
46 A.4 has a degenerate case a<-b<-a->a, where checkcopies isn't needed at all. |
|
47 A.5 has a special case a<-b<-b->a, which is treated like a<-b->a in a merge. |
|
48 A.5 has issue5343 as a special case. |
|
49 A.6 has a special case a<-a<-b->a. Here, checkcopies will find a spurious |
|
50 incomplete divergence, which is in fact complete. This is handled later in |
|
51 mergecopies. |
|
52 A.7 has 4 special cases: a<-b<-a->b (the "ping-pong" case), a<-b<-c->b, |
|
53 a<-b<-a->c and a<-b<-c->a. Of these, only the "ping-pong" case is interesting, |
|
54 the others are fairly trivial (a<-b<-c->b and a<-b<-a->c proceed like the base |
|
55 case, a<-b<-c->a is treated the same as a<-b<-b->a). |
|
56 |
|
57 f5a therefore tests the "ping-pong" rename case, where a file is renamed to the |
|
58 same name on both branches, then the rename is backed out on one branch, and |
|
59 the backout is grafted to the other branch. This creates a challenging rename |
|
60 sequence of a<-b<-a->b in the graft target, topological CA, graft CA and graft |
|
61 source, respectively. Since rename detection will run on the c1 side for such a |
|
62 sequence (as for technical reasons, we split the c1 and c2 sides not at the |
|
63 graft CA, but rather at the topological CA), it will pick up a false rename, |
|
64 and cause a spurious merge conflict. This false rename is always exactly the |
|
65 reverse of the true rename that would be detected on the c2 side, so we can |
|
66 correct for it by detecting this condition and reversing as necessary. |
|
67 |
|
68 First, set up the repository with commits to be grafted |
|
69 |
|
70 $ hg init graftmove |
|
71 $ cd graftmove |
|
72 $ echo c1a > f1a |
|
73 $ echo c2a > f2a |
|
74 $ echo c3a > f3a |
|
75 $ echo c4a > f4a |
|
76 $ echo c5a > f5a |
|
77 $ hg ci -qAm A0 |
|
78 $ hg mv f1a f1b |
|
79 $ hg mv f3a f3b |
|
80 $ hg mv f5a f5b |
|
81 $ hg ci -qAm B0 |
|
82 $ echo c1c > f1b |
|
83 $ hg mv f2a f2c |
|
84 $ hg mv f5b f5a |
|
85 $ echo c5c > f5a |
|
86 $ hg ci -qAm C0 |
|
87 $ hg mv f3b f3d |
|
88 $ echo c4d > f4a |
|
89 $ hg ci -qAm D0 |
|
90 $ hg log -G |
|
91 @ changeset: 3:b69f5839d2d9 |
|
92 | tag: tip |
|
93 | user: test |
|
94 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
95 | summary: D0 |
|
96 | |
|
97 o changeset: 2:f58c7e2b28fa |
|
98 | user: test |
|
99 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
100 | summary: C0 |
|
101 | |
|
102 o changeset: 1:3d7bba921b5d |
|
103 | user: test |
|
104 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
105 | summary: B0 |
|
106 | |
|
107 o changeset: 0:11f7a1b56675 |
|
108 user: test |
|
109 date: Thu Jan 01 00:00:00 1970 +0000 |
|
110 summary: A0 |
|
111 |
|
112 |
|
113 Test the cases A.2 (f1x), A.3 (f2x) and a special case of A.6 (f5x) where the |
|
114 two renames actually converge to the same name (thus no actual divergence). |
|
115 |
|
116 $ hg up -q 'desc("A0")' |
|
117 $ HGEDITOR="echo C1 >" hg graft -r 'desc("C0")' --edit |
|
118 grafting 2:f58c7e2b28fa "C0" |
|
119 merging f1a and f1b to f1a |
|
120 merging f5a |
|
121 warning: can't find ancestor for 'f5a' copied from 'f5b'! |
|
122 $ hg status --change . |
|
123 M f1a |
|
124 M f5a |
|
125 A f2c |
|
126 R f2a |
|
127 $ hg cat f1a |
|
128 c1c |
|
129 $ hg cat f1b |
|
130 f1b: no such file in rev c9763722f9bd |
|
131 [1] |
|
132 |
|
133 Test the cases A.0 (f4x) and A.6 (f3x) |
|
134 |
|
135 $ HGEDITOR="echo D1 >" hg graft -r 'desc("D0")' --edit |
|
136 grafting 3:b69f5839d2d9 "D0" |
|
137 note: possible conflict - f3b was renamed multiple times to: |
|
138 f3a |
|
139 f3d |
|
140 warning: can't find ancestor for 'f3d' copied from 'f3b'! |
|
141 |
|
142 Set up the repository for some further tests |
|
143 |
|
144 $ hg up -q "min(desc("A0"))" |
|
145 $ hg mv f1a f1e |
|
146 $ echo c2e > f2a |
|
147 $ hg mv f3a f3e |
|
148 $ hg mv f4a f4e |
|
149 $ hg mv f5a f5b |
|
150 $ hg ci -qAm "E0" |
|
151 $ hg up -q "min(desc("A0"))" |
|
152 $ hg cp f1a f1f |
|
153 $ hg ci -qAm "F0" |
|
154 $ hg up -q "min(desc("A0"))" |
|
155 $ hg cp f1a f1g |
|
156 $ echo c1g > f1g |
|
157 $ hg ci -qAm "G0" |
|
158 $ hg log -G |
|
159 @ changeset: 8:ba67f08fb15a |
|
160 | tag: tip |
|
161 | parent: 0:11f7a1b56675 |
|
162 | user: test |
|
163 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
164 | summary: G0 |
|
165 | |
|
166 | o changeset: 7:d376ab0d7fda |
|
167 |/ parent: 0:11f7a1b56675 |
|
168 | user: test |
|
169 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
170 | summary: F0 |
|
171 | |
|
172 | o changeset: 6:6bd1736cab86 |
|
173 |/ parent: 0:11f7a1b56675 |
|
174 | user: test |
|
175 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
176 | summary: E0 |
|
177 | |
|
178 | o changeset: 5:560daee679da |
|
179 | | user: test |
|
180 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
181 | | summary: D1 |
|
182 | | |
|
183 | o changeset: 4:c9763722f9bd |
|
184 |/ parent: 0:11f7a1b56675 |
|
185 | user: test |
|
186 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
187 | summary: C1 |
|
188 | |
|
189 | o changeset: 3:b69f5839d2d9 |
|
190 | | user: test |
|
191 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
192 | | summary: D0 |
|
193 | | |
|
194 | o changeset: 2:f58c7e2b28fa |
|
195 | | user: test |
|
196 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
197 | | summary: C0 |
|
198 | | |
|
199 | o changeset: 1:3d7bba921b5d |
|
200 |/ user: test |
|
201 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
202 | summary: B0 |
|
203 | |
|
204 o changeset: 0:11f7a1b56675 |
|
205 user: test |
|
206 date: Thu Jan 01 00:00:00 1970 +0000 |
|
207 summary: A0 |
|
208 |
|
209 |
|
210 Test the cases A.4 (f1x), the "ping-pong" special case of A.7 (f5x), |
|
211 and A.3 with a local content change to be preserved (f2x). |
|
212 |
|
213 $ hg up -q "desc("E0")" |
|
214 $ HGEDITOR="echo C2 >" hg graft -r 'desc("C0")' --edit |
|
215 grafting 2:f58c7e2b28fa "C0" |
|
216 merging f1e and f1b to f1e |
|
217 merging f2a and f2c to f2c |
|
218 |
|
219 Test the cases A.1 (f4x) and A.7 (f3x). |
|
220 |
|
221 $ HGEDITOR="echo D2 >" hg graft -r 'desc("D0")' --edit |
|
222 grafting 3:b69f5839d2d9 "D0" |
|
223 note: possible conflict - f3b was renamed multiple times to: |
|
224 f3d |
|
225 f3e |
|
226 merging f4e and f4a to f4e |
|
227 warning: can't find ancestor for 'f3d' copied from 'f3b'! |
|
228 |
|
229 $ hg cat f2c |
|
230 c2e |
|
231 |
|
232 Test the case A.5 (move case, f1x). |
|
233 |
|
234 $ hg up -q "desc("C0")" |
|
235 BROKEN: Shouldn't get the warning about missing ancestor |
|
236 $ HGEDITOR="echo E1 >" hg graft -r 'desc("E0")' --edit |
|
237 grafting 6:6bd1736cab86 "E0" |
|
238 note: possible conflict - f1a was renamed multiple times to: |
|
239 f1b |
|
240 f1e |
|
241 note: possible conflict - f3a was renamed multiple times to: |
|
242 f3b |
|
243 f3e |
|
244 merging f2c and f2a to f2c |
|
245 merging f5a and f5b to f5b |
|
246 warning: can't find ancestor for 'f1e' copied from 'f1a'! |
|
247 warning: can't find ancestor for 'f3e' copied from 'f3a'! |
|
248 $ cat f1e |
|
249 c1a |
|
250 |
|
251 Test the case A.5 (copy case, f1x). |
|
252 |
|
253 $ hg up -q "desc("C0")" |
|
254 BROKEN: Shouldn't get the warning about missing ancestor |
|
255 $ HGEDITOR="echo F1 >" hg graft -r 'desc("F0")' --edit |
|
256 grafting 7:d376ab0d7fda "F0" |
|
257 warning: can't find ancestor for 'f1f' copied from 'f1a'! |
|
258 BROKEN: f1f should be marked a copy from f1b |
|
259 $ hg st --copies --change . |
|
260 A f1f |
|
261 BROKEN: f1f should have the new content from f1b (i.e. "c1c") |
|
262 $ cat f1f |
|
263 c1a |
|
264 |
|
265 Test the case A.5 (copy+modify case, f1x). |
|
266 |
|
267 $ hg up -q "desc("C0")" |
|
268 BROKEN: We should get a merge conflict from the 3-way merge between f1b in C0 |
|
269 (content "c1c") and f1g in G0 (content "c1g") with f1a in A0 as base (content |
|
270 "c1a") |
|
271 $ HGEDITOR="echo G1 >" hg graft -r 'desc("G0")' --edit |
|
272 grafting 8:ba67f08fb15a "G0" |
|
273 warning: can't find ancestor for 'f1g' copied from 'f1a'! |
|
274 |
|
275 Check the results of the grafts tested |
|
276 |
|
277 $ hg log -CGv --patch --git |
|
278 @ changeset: 13:ef3adf6c20a4 |
|
279 | tag: tip |
|
280 | parent: 2:f58c7e2b28fa |
|
281 | user: test |
|
282 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
283 | files: f1g |
|
284 | description: |
|
285 | G1 |
|
286 | |
|
287 | |
|
288 | diff --git a/f1g b/f1g |
|
289 | new file mode 100644 |
|
290 | --- /dev/null |
|
291 | +++ b/f1g |
|
292 | @@ -0,0 +1,1 @@ |
|
293 | +c1g |
|
294 | |
|
295 | o changeset: 12:b5542d755b54 |
|
296 |/ parent: 2:f58c7e2b28fa |
|
297 | user: test |
|
298 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
299 | files: f1f |
|
300 | description: |
|
301 | F1 |
|
302 | |
|
303 | |
|
304 | diff --git a/f1f b/f1f |
|
305 | new file mode 100644 |
|
306 | --- /dev/null |
|
307 | +++ b/f1f |
|
308 | @@ -0,0 +1,1 @@ |
|
309 | +c1a |
|
310 | |
|
311 | o changeset: 11:f8a162271246 |
|
312 |/ parent: 2:f58c7e2b28fa |
|
313 | user: test |
|
314 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
315 | files: f1e f2c f3e f4a f4e f5a f5b |
|
316 | copies: f4e (f4a) f5b (f5a) |
|
317 | description: |
|
318 | E1 |
|
319 | |
|
320 | |
|
321 | diff --git a/f1e b/f1e |
|
322 | new file mode 100644 |
|
323 | --- /dev/null |
|
324 | +++ b/f1e |
|
325 | @@ -0,0 +1,1 @@ |
|
326 | +c1a |
|
327 | diff --git a/f2c b/f2c |
|
328 | --- a/f2c |
|
329 | +++ b/f2c |
|
330 | @@ -1,1 +1,1 @@ |
|
331 | -c2a |
|
332 | +c2e |
|
333 | diff --git a/f3e b/f3e |
|
334 | new file mode 100644 |
|
335 | --- /dev/null |
|
336 | +++ b/f3e |
|
337 | @@ -0,0 +1,1 @@ |
|
338 | +c3a |
|
339 | diff --git a/f4a b/f4e |
|
340 | rename from f4a |
|
341 | rename to f4e |
|
342 | diff --git a/f5a b/f5b |
|
343 | rename from f5a |
|
344 | rename to f5b |
|
345 | |
|
346 | o changeset: 10:93ee502e8b0a |
|
347 | | user: test |
|
348 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
349 | | files: f3d f4e |
|
350 | | description: |
|
351 | | D2 |
|
352 | | |
|
353 | | |
|
354 | | diff --git a/f3d b/f3d |
|
355 | | new file mode 100644 |
|
356 | | --- /dev/null |
|
357 | | +++ b/f3d |
|
358 | | @@ -0,0 +1,1 @@ |
|
359 | | +c3a |
|
360 | | diff --git a/f4e b/f4e |
|
361 | | --- a/f4e |
|
362 | | +++ b/f4e |
|
363 | | @@ -1,1 +1,1 @@ |
|
364 | | -c4a |
|
365 | | +c4d |
|
366 | | |
|
367 | o changeset: 9:539cf145f496 |
|
368 | | parent: 6:6bd1736cab86 |
|
369 | | user: test |
|
370 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
371 | | files: f1e f2a f2c f5a f5b |
|
372 | | copies: f2c (f2a) f5a (f5b) |
|
373 | | description: |
|
374 | | C2 |
|
375 | | |
|
376 | | |
|
377 | | diff --git a/f1e b/f1e |
|
378 | | --- a/f1e |
|
379 | | +++ b/f1e |
|
380 | | @@ -1,1 +1,1 @@ |
|
381 | | -c1a |
|
382 | | +c1c |
|
383 | | diff --git a/f2a b/f2c |
|
384 | | rename from f2a |
|
385 | | rename to f2c |
|
386 | | diff --git a/f5b b/f5a |
|
387 | | rename from f5b |
|
388 | | rename to f5a |
|
389 | | --- a/f5b |
|
390 | | +++ b/f5a |
|
391 | | @@ -1,1 +1,1 @@ |
|
392 | | -c5a |
|
393 | | +c5c |
|
394 | | |
|
395 | | o changeset: 8:ba67f08fb15a |
|
396 | | | parent: 0:11f7a1b56675 |
|
397 | | | user: test |
|
398 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
399 | | | files: f1g |
|
400 | | | copies: f1g (f1a) |
|
401 | | | description: |
|
402 | | | G0 |
|
403 | | | |
|
404 | | | |
|
405 | | | diff --git a/f1a b/f1g |
|
406 | | | copy from f1a |
|
407 | | | copy to f1g |
|
408 | | | --- a/f1a |
|
409 | | | +++ b/f1g |
|
410 | | | @@ -1,1 +1,1 @@ |
|
411 | | | -c1a |
|
412 | | | +c1g |
|
413 | | | |
|
414 | | | o changeset: 7:d376ab0d7fda |
|
415 | | |/ parent: 0:11f7a1b56675 |
|
416 | | | user: test |
|
417 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
418 | | | files: f1f |
|
419 | | | copies: f1f (f1a) |
|
420 | | | description: |
|
421 | | | F0 |
|
422 | | | |
|
423 | | | |
|
424 | | | diff --git a/f1a b/f1f |
|
425 | | | copy from f1a |
|
426 | | | copy to f1f |
|
427 | | | |
|
428 | o | changeset: 6:6bd1736cab86 |
|
429 | |/ parent: 0:11f7a1b56675 |
|
430 | | user: test |
|
431 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
432 | | files: f1a f1e f2a f3a f3e f4a f4e f5a f5b |
|
433 | | copies: f1e (f1a) f3e (f3a) f4e (f4a) f5b (f5a) |
|
434 | | description: |
|
435 | | E0 |
|
436 | | |
|
437 | | |
|
438 | | diff --git a/f1a b/f1e |
|
439 | | rename from f1a |
|
440 | | rename to f1e |
|
441 | | diff --git a/f2a b/f2a |
|
442 | | --- a/f2a |
|
443 | | +++ b/f2a |
|
444 | | @@ -1,1 +1,1 @@ |
|
445 | | -c2a |
|
446 | | +c2e |
|
447 | | diff --git a/f3a b/f3e |
|
448 | | rename from f3a |
|
449 | | rename to f3e |
|
450 | | diff --git a/f4a b/f4e |
|
451 | | rename from f4a |
|
452 | | rename to f4e |
|
453 | | diff --git a/f5a b/f5b |
|
454 | | rename from f5a |
|
455 | | rename to f5b |
|
456 | | |
|
457 | | o changeset: 5:560daee679da |
|
458 | | | user: test |
|
459 | | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
460 | | | files: f3d f4a |
|
461 | | | description: |
|
462 | | | D1 |
|
463 | | | |
|
464 | | | |
|
465 | | | diff --git a/f3d b/f3d |
|
466 | | | new file mode 100644 |
|
467 | | | --- /dev/null |
|
468 | | | +++ b/f3d |
|
469 | | | @@ -0,0 +1,1 @@ |
|
470 | | | +c3a |
|
471 | | | diff --git a/f4a b/f4a |
|
472 | | | --- a/f4a |
|
473 | | | +++ b/f4a |
|
474 | | | @@ -1,1 +1,1 @@ |
|
475 | | | -c4a |
|
476 | | | +c4d |
|
477 | | | |
|
478 | | o changeset: 4:c9763722f9bd |
|
479 | |/ parent: 0:11f7a1b56675 |
|
480 | | user: test |
|
481 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
482 | | files: f1a f2a f2c f5a |
|
483 | | copies: f2c (f2a) |
|
484 | | description: |
|
485 | | C1 |
|
486 | | |
|
487 | | |
|
488 | | diff --git a/f1a b/f1a |
|
489 | | --- a/f1a |
|
490 | | +++ b/f1a |
|
491 | | @@ -1,1 +1,1 @@ |
|
492 | | -c1a |
|
493 | | +c1c |
|
494 | | diff --git a/f2a b/f2c |
|
495 | | rename from f2a |
|
496 | | rename to f2c |
|
497 | | diff --git a/f5a b/f5a |
|
498 | | --- a/f5a |
|
499 | | +++ b/f5a |
|
500 | | @@ -1,1 +1,1 @@ |
|
501 | | -c5a |
|
502 | | +c5c |
|
503 | | |
|
504 +---o changeset: 3:b69f5839d2d9 |
|
505 | | user: test |
|
506 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
507 | | files: f3b f3d f4a |
|
508 | | copies: f3d (f3b) |
|
509 | | description: |
|
510 | | D0 |
|
511 | | |
|
512 | | |
|
513 | | diff --git a/f3b b/f3d |
|
514 | | rename from f3b |
|
515 | | rename to f3d |
|
516 | | diff --git a/f4a b/f4a |
|
517 | | --- a/f4a |
|
518 | | +++ b/f4a |
|
519 | | @@ -1,1 +1,1 @@ |
|
520 | | -c4a |
|
521 | | +c4d |
|
522 | | |
|
523 o | changeset: 2:f58c7e2b28fa |
|
524 | | user: test |
|
525 | | date: Thu Jan 01 00:00:00 1970 +0000 |
|
526 | | files: f1b f2a f2c f5a f5b |
|
527 | | copies: f2c (f2a) f5a (f5b) |
|
528 | | description: |
|
529 | | C0 |
|
530 | | |
|
531 | | |
|
532 | | diff --git a/f1b b/f1b |
|
533 | | --- a/f1b |
|
534 | | +++ b/f1b |
|
535 | | @@ -1,1 +1,1 @@ |
|
536 | | -c1a |
|
537 | | +c1c |
|
538 | | diff --git a/f2a b/f2c |
|
539 | | rename from f2a |
|
540 | | rename to f2c |
|
541 | | diff --git a/f5b b/f5a |
|
542 | | rename from f5b |
|
543 | | rename to f5a |
|
544 | | --- a/f5b |
|
545 | | +++ b/f5a |
|
546 | | @@ -1,1 +1,1 @@ |
|
547 | | -c5a |
|
548 | | +c5c |
|
549 | | |
|
550 o | changeset: 1:3d7bba921b5d |
|
551 |/ user: test |
|
552 | date: Thu Jan 01 00:00:00 1970 +0000 |
|
553 | files: f1a f1b f3a f3b f5a f5b |
|
554 | copies: f1b (f1a) f3b (f3a) f5b (f5a) |
|
555 | description: |
|
556 | B0 |
|
557 | |
|
558 | |
|
559 | diff --git a/f1a b/f1b |
|
560 | rename from f1a |
|
561 | rename to f1b |
|
562 | diff --git a/f3a b/f3b |
|
563 | rename from f3a |
|
564 | rename to f3b |
|
565 | diff --git a/f5a b/f5b |
|
566 | rename from f5a |
|
567 | rename to f5b |
|
568 | |
|
569 o changeset: 0:11f7a1b56675 |
|
570 user: test |
|
571 date: Thu Jan 01 00:00:00 1970 +0000 |
|
572 files: f1a f2a f3a f4a f5a |
|
573 description: |
|
574 A0 |
|
575 |
|
576 |
|
577 diff --git a/f1a b/f1a |
|
578 new file mode 100644 |
|
579 --- /dev/null |
|
580 +++ b/f1a |
|
581 @@ -0,0 +1,1 @@ |
|
582 +c1a |
|
583 diff --git a/f2a b/f2a |
|
584 new file mode 100644 |
|
585 --- /dev/null |
|
586 +++ b/f2a |
|
587 @@ -0,0 +1,1 @@ |
|
588 +c2a |
|
589 diff --git a/f3a b/f3a |
|
590 new file mode 100644 |
|
591 --- /dev/null |
|
592 +++ b/f3a |
|
593 @@ -0,0 +1,1 @@ |
|
594 +c3a |
|
595 diff --git a/f4a b/f4a |
|
596 new file mode 100644 |
|
597 --- /dev/null |
|
598 +++ b/f4a |
|
599 @@ -0,0 +1,1 @@ |
|
600 +c4a |
|
601 diff --git a/f5a b/f5a |
|
602 new file mode 100644 |
|
603 --- /dev/null |
|
604 +++ b/f5a |
|
605 @@ -0,0 +1,1 @@ |
|
606 +c5a |
|
607 |
|
608 Check superfluous filemerge of files renamed in the past but untouched by graft |
|
609 |
|
610 $ echo a > a |
|
611 $ hg ci -qAma |
|
612 $ hg mv a b |
|
613 $ echo b > b |
|
614 $ hg ci -qAmb |
|
615 $ echo c > c |
|
616 $ hg ci -qAmc |
|
617 $ hg up -q .~2 |
|
618 $ hg graft tip -qt:fail |
|
619 |
|
620 $ cd .. |
|
621 |
|
622 Graft a change into a new file previously grafted into a renamed directory |
|
623 |
|
624 $ hg init dirmovenewfile |
|
625 $ cd dirmovenewfile |
|
626 $ mkdir a |
|
627 $ echo a > a/a |
|
628 $ hg ci -qAma |
|
629 $ echo x > a/x |
|
630 $ hg ci -qAmx |
|
631 $ hg up -q 0 |
|
632 $ hg mv -q a b |
|
633 $ hg ci -qAmb |
|
634 $ hg graft -q 1 # a/x grafted as b/x, but no copy information recorded |
|
635 $ hg up -q 1 |
|
636 $ echo y > a/x |
|
637 $ hg ci -qAmy |
|
638 $ hg up -q 3 |
|
639 $ hg graft -q 4 |
|
640 $ hg status --change . |
|
641 M b/x |
|
642 |
|
643 Prepare for test of skipped changesets and how merges can influence it: |
|
644 |
|
645 $ hg merge -q -r 1 --tool :local |
|
646 $ hg ci -m m |
|
647 $ echo xx >> b/x |
|
648 $ hg ci -m xx |
|
649 |
|
650 $ hg log -G -T '{rev} {desc|firstline}' |
|
651 @ 7 xx |
|
652 | |
|
653 o 6 m |
|
654 |\ |
|
655 | o 5 y |
|
656 | | |
|
657 +---o 4 y |
|
658 | | |
|
659 | o 3 x |
|
660 | | |
|
661 | o 2 b |
|
662 | | |
|
663 o | 1 x |
|
664 |/ |
|
665 o 0 a |
|
666 |
|
667 Grafting of plain changes correctly detects that 3 and 5 should be skipped: |
|
668 |
|
669 $ hg up -qCr 4 |
|
670 $ hg graft --tool :local -r 2::5 |
|
671 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
|
672 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
|
673 grafting 2:42127f193bcd "b" |
|
674 |
|
675 Extending the graft range to include a (skipped) merge of 3 will not prevent us from |
|
676 also detecting that both 3 and 5 should be skipped: |
|
677 |
|
678 $ hg up -qCr 4 |
|
679 $ hg graft --tool :local -r 2::7 |
|
680 skipping ungraftable merge revision 6 |
|
681 skipping already grafted revision 3:ca093ca2f1d9 (was grafted from 1:13ec5badbf2a) |
|
682 skipping already grafted revision 5:43e9eb70dab0 (was grafted from 4:6c9a1289e5f1) |
|
683 grafting 2:42127f193bcd "b" |
|
684 grafting 7:d3c3f2b38ecc "xx" |
|
685 note: graft of 7:d3c3f2b38ecc created no changes to commit |
|
686 |
|
687 $ cd .. |
|
688 |
|
689 Grafted revision should be warned and skipped only once. (issue6024) |
|
690 |
|
691 $ mkdir issue6024 |
|
692 $ cd issue6024 |
|
693 |
|
694 $ hg init base |
|
695 $ cd base |
|
696 $ touch x |
|
697 $ hg commit -qAminit |
|
698 $ echo a > x |
|
699 $ hg commit -mchange |
|
700 $ hg update -q 0 |
|
701 $ hg graft -r 1 |
|
702 grafting 1:a0b923c546aa "change" (tip) |
|
703 $ cd .. |
|
704 |
|
705 $ hg clone -qr 2 base clone |
|
706 $ cd clone |
|
707 $ hg pull -q |
|
708 $ hg merge -q 2 |
|
709 $ hg commit -mmerge |
|
710 $ hg update -q 0 |
|
711 $ hg graft -r 1 |
|
712 grafting 1:04fc6d444368 "change" |
|
713 $ hg update -q 3 |
|
714 $ hg log -G -T '{rev}:{node|shortest} <- {extras.source|shortest}\n' |
|
715 o 4:4e16 <- a0b9 |
|
716 | |
|
717 | @ 3:f0ac <- |
|
718 | |\ |
|
719 +---o 2:a0b9 <- |
|
720 | | |
|
721 | o 1:04fc <- a0b9 |
|
722 |/ |
|
723 o 0:7848 <- |
|
724 |
|
725 |
|
726 the source of rev 4 is an ancestor of the working parent, and was also |
|
727 grafted as rev 1. it should be stripped from the target revisions only once. |
|
728 |
|
729 $ hg graft -r 4 |
|
730 skipping already grafted revision 4:4e16bab40c9c (1:04fc6d444368 also has origin 2:a0b923c546aa) |
|
731 [255] |
|
732 |
|
733 $ cd ../.. |