##// END OF EJS Templates
tests: move verification closer to setup in test-copies-chain-merge.t...
Martin von Zweigbergk -
r45169:806f1f1b default
parent child Browse files
Show More
This diff has been collapsed as it changes many lines, (504 lines changed) Show them Hide them
@@ -1,868 +1,816 b''
1 1 =====================================================
2 2 Test Copy tracing for chain of copies involving merge
3 3 =====================================================
4 4
5 5 This test files covers copies/rename case for a chains of commit where merges
6 6 are involved. It cheks we do not have unwanted update of behavior and that the
7 7 different options to retrieve copies behave correctly.
8 8
9 9 Setup
10 10 =====
11 11
12 12 use git diff to see rename
13 13
14 14 $ cat << EOF >> $HGRCPATH
15 15 > [diff]
16 16 > git=yes
17 17 > [ui]
18 18 > logtemplate={rev} {desc}\n
19 19 > EOF
20 20
21 21 $ hg init repo-chain
22 22 $ cd repo-chain
23 23
24 24 Add some linear rename initialy
25 25
26 26 $ touch a b h
27 27 $ hg ci -Am 'i-0 initial commit: a b h'
28 28 adding a
29 29 adding b
30 30 adding h
31 31 $ hg mv a c
32 32 $ hg ci -Am 'i-1: a -move-> c'
33 33 $ hg mv c d
34 34 $ hg ci -Am 'i-2: c -move-> d'
35 35 $ hg log -G
36 36 @ 2 i-2: c -move-> d
37 37 |
38 38 o 1 i-1: a -move-> c
39 39 |
40 40 o 0 i-0 initial commit: a b h
41 41
42 42
43 43 And having another branch with renames on the other side
44 44
45 45 $ hg mv d e
46 46 $ hg ci -Am 'a-1: d -move-> e'
47 47 $ hg mv e f
48 48 $ hg ci -Am 'a-2: e -move-> f'
49 49 $ hg log -G --rev '::.'
50 50 @ 4 a-2: e -move-> f
51 51 |
52 52 o 3 a-1: d -move-> e
53 53 |
54 54 o 2 i-2: c -move-> d
55 55 |
56 56 o 1 i-1: a -move-> c
57 57 |
58 58 o 0 i-0 initial commit: a b h
59 59
60 60
61 61 Have a branching with nothing on one side
62 62
63 63 $ hg up 'desc("i-2")'
64 64 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
65 65 $ echo foo > b
66 66 $ hg ci -m 'b-1: b update'
67 67 created new head
68 68 $ hg log -G --rev '::.'
69 69 @ 5 b-1: b update
70 70 |
71 71 o 2 i-2: c -move-> d
72 72 |
73 73 o 1 i-1: a -move-> c
74 74 |
75 75 o 0 i-0 initial commit: a b h
76 76
77 77
78 78 Create a branch that delete a file previous renamed
79 79
80 80 $ hg up 'desc("i-2")'
81 81 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
82 82 $ hg rm d
83 83 $ hg ci -m 'c-1 delete d'
84 84 created new head
85 85 $ hg log -G --rev '::.'
86 86 @ 6 c-1 delete d
87 87 |
88 88 o 2 i-2: c -move-> d
89 89 |
90 90 o 1 i-1: a -move-> c
91 91 |
92 92 o 0 i-0 initial commit: a b h
93 93
94 94
95 95 Create a branch that delete a file previous renamed and recreate it
96 96
97 97 $ hg up 'desc("i-2")'
98 98 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
99 99 $ hg rm d
100 100 $ hg ci -m 'd-1 delete d'
101 101 created new head
102 102 $ echo bar > d
103 103 $ hg add d
104 104 $ hg ci -m 'd-2 re-add d'
105 105 $ hg log -G --rev '::.'
106 106 @ 8 d-2 re-add d
107 107 |
108 108 o 7 d-1 delete d
109 109 |
110 110 o 2 i-2: c -move-> d
111 111 |
112 112 o 1 i-1: a -move-> c
113 113 |
114 114 o 0 i-0 initial commit: a b h
115 115
116 116
117 117 Having another branch renaming a different file to the same filename as another
118 118
119 119 $ hg up 'desc("i-2")'
120 120 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
121 121 $ hg mv b g
122 122 $ hg ci -m 'e-1 b -move-> g'
123 123 created new head
124 124 $ hg mv g f
125 125 $ hg ci -m 'e-2 g -move-> f'
126 126 $ hg log -G --rev '::.'
127 127 @ 10 e-2 g -move-> f
128 128 |
129 129 o 9 e-1 b -move-> g
130 130 |
131 131 o 2 i-2: c -move-> d
132 132 |
133 133 o 1 i-1: a -move-> c
134 134 |
135 135 o 0 i-0 initial commit: a b h
136 136
137 137
138 Merge the two branches we just defined (in both directions)
139 - one with change to an unrelated file
140 - one with renames in them
138 merging with unrelated change does not interfere with the renames
139 ---------------------------------------------------------------
140
141 - rename on one side
142 - unrelated change on the other side
141 143
142 144 $ hg up 'desc("b-1")'
143 145 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
144 146 $ hg merge 'desc("a-2")'
145 147 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
146 148 (branch merge, don't forget to commit)
147 149 $ hg ci -m 'mBAm-0 simple merge - one way'
148 150 $ hg up 'desc("a-2")'
149 151 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
150 152 $ hg merge 'desc("b-1")'
151 153 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
152 154 (branch merge, don't forget to commit)
153 155 $ hg ci -m 'mABm-0 simple merge - the other way'
154 156 created new head
155 157 $ hg log -G --rev '::(desc("mABm")+desc("mBAm"))'
156 158 @ 12 mABm-0 simple merge - the other way
157 159 |\
158 160 +---o 11 mBAm-0 simple merge - one way
159 161 | |/
160 162 | o 5 b-1: b update
161 163 | |
162 164 o | 4 a-2: e -move-> f
163 165 | |
164 166 o | 3 a-1: d -move-> e
165 167 |/
166 168 o 2 i-2: c -move-> d
167 169 |
168 170 o 1 i-1: a -move-> c
169 171 |
170 172 o 0 i-0 initial commit: a b h
171 173
172 174
173 Merge:
175 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
176 A f
177 d
178 R d
179 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
180 A f
181 d
182 R d
183 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
184 M b
185 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
186 M b
187 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
188 M b
189 A f
190 d
191 R d
192 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
193 M b
194 A f
195 d
196 R d
197 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
198 M b
199 A f
200 a
201 R a
202 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
203 M b
204 A f
205 a
206 R a
207
208 merging with the side having a delete
209 -------------------------------------
210
211 case summary:
174 212 - one with change to an unrelated file
175 213 - one deleting the change
176 214 and recreate an unrelated file after the merge
177 215
178 216 $ hg up 'desc("b-1")'
179 217 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
180 218 $ hg merge 'desc("c-1")'
181 219 0 files updated, 0 files merged, 1 files removed, 0 files unresolved
182 220 (branch merge, don't forget to commit)
183 221 $ hg ci -m 'mBCm-0 simple merge - one way'
184 222 $ echo bar > d
185 223 $ hg add d
186 224 $ hg ci -m 'mBCm-1 re-add d'
187 225 $ hg up 'desc("c-1")'
188 226 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
189 227 $ hg merge 'desc("b-1")'
190 228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
191 229 (branch merge, don't forget to commit)
192 230 $ hg ci -m 'mCBm-0 simple merge - the other way'
193 231 created new head
194 232 $ echo bar > d
195 233 $ hg add d
196 234 $ hg ci -m 'mCBm-1 re-add d'
197 235 $ hg log -G --rev '::(desc("mCBm")+desc("mBCm"))'
198 236 @ 16 mCBm-1 re-add d
199 237 |
200 238 o 15 mCBm-0 simple merge - the other way
201 239 |\
202 240 | | o 14 mBCm-1 re-add d
203 241 | | |
204 242 +---o 13 mBCm-0 simple merge - one way
205 243 | |/
206 244 | o 6 c-1 delete d
207 245 | |
208 246 o | 5 b-1: b update
209 247 |/
210 248 o 2 i-2: c -move-> d
211 249 |
212 250 o 1 i-1: a -move-> c
213 251 |
214 252 o 0 i-0 initial commit: a b h
215 253
216
217 Merge:
218 - one with change to an unrelated file
219 - one deleting and recreating the file
220
221 Note:
222 | In this case, the merge get conflicting information since on one side we have
223 | a "brand new" d. and one the other one we have "d renamed from c (itself
224 | renamed from c)".
225 |
226 | The current code arbitrarily pick one side
227
228 $ hg up 'desc("b-1")'
229 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
230 $ hg merge 'desc("d-2")'
231 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
232 (branch merge, don't forget to commit)
233 $ hg ci -m 'mBDm-0 simple merge - one way'
234 $ hg up 'desc("d-2")'
235 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
236 $ hg merge 'desc("b-1")'
237 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
238 (branch merge, don't forget to commit)
239 $ hg ci -m 'mDBm-0 simple merge - the other way'
240 created new head
241 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
242 @ 18 mDBm-0 simple merge - the other way
243 |\
244 +---o 17 mBDm-0 simple merge - one way
245 | |/
246 | o 8 d-2 re-add d
247 | |
248 | o 7 d-1 delete d
249 | |
250 o | 5 b-1: b update
251 |/
252 o 2 i-2: c -move-> d
253 |
254 o 1 i-1: a -move-> c
255 |
256 o 0 i-0 initial commit: a b h
257
258
259 Merge:
260 - the "e-" branch renaming b to f (through 'g')
261 - the "a-" branch renaming d to f (through e)
262
263 $ hg up 'desc("a-2")'
264 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
265 $ hg merge 'desc("e-2")'
266 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
267 (branch merge, don't forget to commit)
268 $ hg ci -m 'mAEm-0 simple merge - one way'
269 $ hg up 'desc("e-2")'
270 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
271 $ hg merge 'desc("a-2")'
272 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
273 (branch merge, don't forget to commit)
274 $ hg ci -m 'mEAm-0 simple merge - the other way'
275 created new head
276 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
277 @ 20 mEAm-0 simple merge - the other way
278 |\
279 +---o 19 mAEm-0 simple merge - one way
280 | |/
281 | o 10 e-2 g -move-> f
282 | |
283 | o 9 e-1 b -move-> g
284 | |
285 o | 4 a-2: e -move-> f
286 | |
287 o | 3 a-1: d -move-> e
288 |/
289 o 2 i-2: c -move-> d
290 |
291 o 1 i-1: a -move-> c
292 |
293 o 0 i-0 initial commit: a b h
294
295
296 Note:
297 | In this case, one of the merge wrongly record a merge while there is none.
298 | This lead to bad copy tracing information to be dug up.
299
300
301 Merge:
302 - one with change to an unrelated file (b)
303 - one overwriting a file (d) with a rename (from h to i to d)
304
305 $ hg up 'desc("i-2")'
306 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
307 $ hg mv h i
308 $ hg commit -m "f-1: rename h -> i"
309 created new head
310 $ hg mv --force i d
311 $ hg commit -m "f-2: rename i -> d"
312 $ hg debugindex d
313 rev linkrev nodeid p1 p2
314 0 2 01c2f5eabdc4 000000000000 000000000000
315 1 8 b004912a8510 000000000000 000000000000
316 2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
317 3 22 c72365ee036f 000000000000 000000000000
318 $ hg up 'desc("b-1")'
319 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
320 $ hg merge 'desc("f-2")'
321 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
322 (branch merge, don't forget to commit)
323 $ hg ci -m 'mBFm-0 simple merge - one way'
324 $ hg up 'desc("f-2")'
325 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
326 $ hg merge 'desc("b-1")'
327 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
328 (branch merge, don't forget to commit)
329 $ hg ci -m 'mFBm-0 simple merge - the other way'
330 created new head
331 $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
332 @ 24 mFBm-0 simple merge - the other way
333 |\
334 +---o 23 mBFm-0 simple merge - one way
335 | |/
336 | o 22 f-2: rename i -> d
337 | |
338 | o 21 f-1: rename h -> i
339 | |
340 o | 5 b-1: b update
341 |/
342 o 2 i-2: c -move-> d
343 |
344 o 1 i-1: a -move-> c
345 |
346 o 0 i-0 initial commit: a b h
347
348
349 Merge:
350 - one with change to a file
351 - one deleting and recreating the file
352
353 $ hg up 'desc("i-2")'
354 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
355 $ echo "some update" >> d
356 $ hg commit -m "g-1: update d"
357 created new head
358 $ hg up 'desc("d-2")'
359 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
360 $ hg merge 'desc("g-1")' --tool :union
361 merging d
362 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
363 (branch merge, don't forget to commit)
364 $ hg ci -m 'mDGm-0 simple merge - one way'
365 $ hg up 'desc("g-1")'
366 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
367 $ hg merge 'desc("d-2")' --tool :union
368 merging d
369 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
370 (branch merge, don't forget to commit)
371 $ hg ci -m 'mGDm-0 simple merge - the other way'
372 created new head
373 $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
374 @ 27 mGDm-0 simple merge - the other way
375 |\
376 +---o 26 mDGm-0 simple merge - one way
377 | |/
378 | o 25 g-1: update d
379 | |
380 o | 8 d-2 re-add d
381 | |
382 o | 7 d-1 delete d
383 |/
384 o 2 i-2: c -move-> d
385 |
386 o 1 i-1: a -move-> c
387 |
388 o 0 i-0 initial commit: a b h
389
390
391
392 Merge:
393 - one with change to a file (d)
394 - one overwriting that file with a rename (from h to i, to d)
395
396 $ hg up 'desc("f-2")'
397 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
398 $ hg merge 'desc("g-1")' --tool :union
399 merging d
400 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
401 (branch merge, don't forget to commit)
402 $ hg ci -m 'mFGm-0 simple merge - one way'
403 created new head
404 $ hg up 'desc("g-1")'
405 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
406 $ hg merge 'desc("f-2")' --tool :union
407 merging d
408 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
409 (branch merge, don't forget to commit)
410 $ hg ci -m 'mGFm-0 simple merge - the other way'
411 created new head
412 $ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
413 @ 29 mGFm-0 simple merge - the other way
414 |\
415 +---o 28 mFGm-0 simple merge - one way
416 | |/
417 | o 25 g-1: update d
418 | |
419 o | 22 f-2: rename i -> d
420 | |
421 o | 21 f-1: rename h -> i
422 |/
423 o 2 i-2: c -move-> d
424 |
425 o 1 i-1: a -move-> c
426 |
427 o 0 i-0 initial commit: a b h
428
429
430
431 Check results
432 =============
433
434 merging with unrelated change does not interfer wit the renames
435 ---------------------------------------------------------------
436
437 - rename on one side
438 - unrelated change on the other side
439
440 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mABm")'
441 A f
442 d
443 R d
444 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBAm")'
445 A f
446 d
447 R d
448 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mABm")'
449 M b
450 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mBAm")'
451 M b
452 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mABm")'
453 M b
454 A f
455 d
456 R d
457 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBAm")'
458 M b
459 A f
460 d
461 R d
462 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mABm")'
463 M b
464 A f
465 a
466 R a
467 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBAm")'
468 M b
469 A f
470 a
471 R a
472
473 merging with the side having a delete
474 -------------------------------------
475
476 case summary:
477 - one with change to an unrelated file
478 - one deleting the change
479 and recreate an unrelated file after the merge
480
481 checks:
482 254 - comparing from the merge
483 255
484 256 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-0")'
485 257 R d
486 258 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-0")'
487 259 R d
488 260 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-0")'
489 261 M b
490 262 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-0")'
491 263 M b
492 264 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-0")'
493 265 M b
494 266 R d
495 267 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-0")'
496 268 M b
497 269 R d
498 270 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-0")'
499 271 M b
500 272 R a
501 273 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-0")'
502 274 M b
503 275 R a
504 276
505 277 - comparing with the merge children re-adding the file
506 278
507 279 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBCm-1")'
508 280 M d
509 281 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mCBm-1")'
510 282 M d
511 283 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mBCm-1")'
512 284 M b
513 285 A d
514 286 $ hg status --copies --rev 'desc("c-1")' --rev 'desc("mCBm-1")'
515 287 M b
516 288 A d
517 289 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBCm-1")'
518 290 M b
519 291 M d
520 292 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mCBm-1")'
521 293 M b
522 294 M d
523 295 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBCm-1")'
524 296 M b
525 297 A d
526 298 R a
527 299 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mCBm-1")'
528 300 M b
529 301 A d
530 302 R a
531 303
532 304 Comparing with a merge re-adding the file afterward
533 305 ---------------------------------------------------
534 306
535 307 Merge:
536 308 - one with change to an unrelated file
537 309 - one deleting and recreating the change
538 310
539 311 Note:
540 312 | In this case, one of the merge wrongly record a merge while there is none.
541 313 | This lead to bad copy tracing information to be dug up.
542 314
315 $ hg up 'desc("b-1")'
316 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
317 $ hg merge 'desc("d-2")'
318 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
319 (branch merge, don't forget to commit)
320 $ hg ci -m 'mBDm-0 simple merge - one way'
321 $ hg up 'desc("d-2")'
322 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
323 $ hg merge 'desc("b-1")'
324 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
325 (branch merge, don't forget to commit)
326 $ hg ci -m 'mDBm-0 simple merge - the other way'
327 created new head
328 $ hg log -G --rev '::(desc("mDBm")+desc("mBDm"))'
329 @ 18 mDBm-0 simple merge - the other way
330 |\
331 +---o 17 mBDm-0 simple merge - one way
332 | |/
333 | o 8 d-2 re-add d
334 | |
335 | o 7 d-1 delete d
336 | |
337 o | 5 b-1: b update
338 |/
339 o 2 i-2: c -move-> d
340 |
341 o 1 i-1: a -move-> c
342 |
343 o 0 i-0 initial commit: a b h
344
543 345 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBDm-0")'
544 346 M d
545 347 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mDBm-0")'
546 348 M d
547 349 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mBDm-0")'
548 350 M b
549 351 M d
550 352 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDBm-0")'
551 353 M b
552 354 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mBDm-0")'
553 355 M b
554 356 M d
555 357 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mDBm-0")'
556 358 M b
557 359 M d
558 360
559 361 The bugs makes recorded copy is different depending of where we started the merge from since
560 362
561 363 $ hg manifest --debug --rev 'desc("mBDm-0")' | grep '644 d'
562 364 0bb5445dc4d02f4e0d86cf16f9f3a411d0f17744 644 d
563 365 $ hg manifest --debug --rev 'desc("mDBm-0")' | grep '644 d'
564 366 b004912a8510032a0350a74daa2803dadfb00e12 644 d
565 367
566 368 The 0bb5445dc4d02f4e0d86cf16f9f3a411d0f17744 entry is wrong, since the file was
567 369 deleted on one side (then recreate) and untouched on the other side, no "merge"
568 370 has happened. The resulting `d` file is the untouched version from branch `D`,
569 371 not a merge.
570 372
571 373 $ hg manifest --debug --rev 'desc("d-2")' | grep '644 d'
572 374 b004912a8510032a0350a74daa2803dadfb00e12 644 d
573 375 $ hg manifest --debug --rev 'desc("b-1")' | grep '644 d'
574 376 01c2f5eabdc4ce2bdee42b5f86311955e6c8f573 644 d
575 377 $ hg debugindex d
576 378 rev linkrev nodeid p1 p2
577 379 0 2 01c2f5eabdc4 000000000000 000000000000
578 380 1 8 b004912a8510 000000000000 000000000000
579 381 2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
580 3 22 c72365ee036f 000000000000 000000000000
581 4 23 863d9bc49190 01c2f5eabdc4 c72365ee036f
582 5 25 7bded9d9da1f 01c2f5eabdc4 000000000000
583 6 26 f04cac32d703 b004912a8510 7bded9d9da1f
584 7 27 d7a5eafb9322 7bded9d9da1f b004912a8510
585 8 28 2ed7a51aed47 c72365ee036f 7bded9d9da1f
586 382
587 383 (This `hg log` output if wrong, since no merge actually happened).
588 384
589 385 $ hg log -Gfr 'desc("mBDm-0")' d
590 386 o 17 mBDm-0 simple merge - one way
591 387 |\
592 388 o : 8 d-2 re-add d
593 389 :/
594 390 o 2 i-2: c -move-> d
595 391 |
596 392 o 1 i-1: a -move-> c
597 393 |
598 394 o 0 i-0 initial commit: a b h
599 395
600 396
601 397 This `hg log` output is correct
602 398
603 399 $ hg log -Gfr 'desc("mDBm-0")' d
604 400 o 8 d-2 re-add d
605 401 |
606 402 ~
607 403
608 404 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBDm-0")'
609 405 M b
610 406 A d
611 407 a
612 408 R a
613 409 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDBm-0")'
614 410 M b
615 411 A d
616 412 R a
617 413
414
618 415 Comparing with a merge with colliding rename
619 416 --------------------------------------------
620 417
621 418 - the "e-" branch renaming b to f (through 'g')
622 419 - the "a-" branch renaming d to f (through e)
623 420
421 $ hg up 'desc("a-2")'
422 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
423 $ hg merge 'desc("e-2")'
424 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
425 (branch merge, don't forget to commit)
426 $ hg ci -m 'mAEm-0 simple merge - one way'
427 $ hg up 'desc("e-2")'
428 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
429 $ hg merge 'desc("a-2")'
430 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
431 (branch merge, don't forget to commit)
432 $ hg ci -m 'mEAm-0 simple merge - the other way'
433 created new head
434 $ hg log -G --rev '::(desc("mAEm")+desc("mEAm"))'
435 @ 20 mEAm-0 simple merge - the other way
436 |\
437 +---o 19 mAEm-0 simple merge - one way
438 | |/
439 | o 10 e-2 g -move-> f
440 | |
441 | o 9 e-1 b -move-> g
442 | |
443 o | 4 a-2: e -move-> f
444 | |
445 o | 3 a-1: d -move-> e
446 |/
447 o 2 i-2: c -move-> d
448 |
449 o 1 i-1: a -move-> c
450 |
451 o 0 i-0 initial commit: a b h
452
624 453 $ hg manifest --debug --rev 'desc("mAEm-0")' | grep '644 f'
625 454 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
626 455 $ hg manifest --debug --rev 'desc("mEAm-0")' | grep '644 f'
627 456 eb806e34ef6be4c264effd5933d31004ad15a793 644 f
628 457 $ hg manifest --debug --rev 'desc("a-2")' | grep '644 f'
629 458 0dd616bc7ab1a111921d95d76f69cda5c2ac539c 644 f
630 459 $ hg manifest --debug --rev 'desc("e-2")' | grep '644 f'
631 460 6da5a2eecb9c833f830b67a4972366d49a9a142c 644 f
632 461 $ hg debugindex f
633 462 rev linkrev nodeid p1 p2
634 463 0 4 0dd616bc7ab1 000000000000 000000000000
635 464 1 10 6da5a2eecb9c 000000000000 000000000000
636 465 2 19 eb806e34ef6b 0dd616bc7ab1 6da5a2eecb9c
637 466 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mAEm-0")'
638 467 M f
639 468 R b
640 469 $ hg status --copies --rev 'desc("a-2")' --rev 'desc("mEAm-0")'
641 470 M f
642 471 R b
643 472 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mAEm-0")'
644 473 M f
645 474 R d
646 475 $ hg status --copies --rev 'desc("e-2")' --rev 'desc("mEAm-0")'
647 476 M f
648 477 R d
649 478 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("a-2")'
650 479 A f
651 480 d
652 481 R d
653 482 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("e-2")'
654 483 A f
655 484 b
656 485 R b
657 486 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mAEm-0")'
658 487 A f
659 488 d
660 489 R b
661 490 R d
662 491 $ hg status --copies --rev 'desc("i-2")' --rev 'desc("mEAm-0")'
663 492 A f
664 493 d
665 494 R b
666 495 R d
667 496 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mAEm-0")'
668 497 A f
669 498 a
670 499 R a
671 500 R b
672 501 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mEAm-0")'
673 502 A f
674 503 a
675 504 R a
676 505 R b
677 506
507
508 Note:
509 | In this case, one of the merge wrongly record a merge while there is none.
510 | This lead to bad copy tracing information to be dug up.
511
512
678 513 Merge:
679 514 - one with change to an unrelated file (b)
680 515 - one overwriting a file (d) with a rename (from h to i to d)
681 516
517 $ hg up 'desc("i-2")'
518 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
519 $ hg mv h i
520 $ hg commit -m "f-1: rename h -> i"
521 created new head
522 $ hg mv --force i d
523 $ hg commit -m "f-2: rename i -> d"
524 $ hg debugindex d
525 rev linkrev nodeid p1 p2
526 0 2 01c2f5eabdc4 000000000000 000000000000
527 1 8 b004912a8510 000000000000 000000000000
528 2 17 0bb5445dc4d0 01c2f5eabdc4 b004912a8510
529 3 22 c72365ee036f 000000000000 000000000000
530 $ hg up 'desc("b-1")'
531 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
532 $ hg merge 'desc("f-2")'
533 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
534 (branch merge, don't forget to commit)
535 $ hg ci -m 'mBFm-0 simple merge - one way'
536 $ hg up 'desc("f-2")'
537 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
538 $ hg merge 'desc("b-1")'
539 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
540 (branch merge, don't forget to commit)
541 $ hg ci -m 'mFBm-0 simple merge - the other way'
542 created new head
543 $ hg log -G --rev '::(desc("mBFm")+desc("mFBm"))'
544 @ 24 mFBm-0 simple merge - the other way
545 |\
546 +---o 23 mBFm-0 simple merge - one way
547 | |/
548 | o 22 f-2: rename i -> d
549 | |
550 | o 21 f-1: rename h -> i
551 | |
552 o | 5 b-1: b update
553 |/
554 o 2 i-2: c -move-> d
555 |
556 o 1 i-1: a -move-> c
557 |
558 o 0 i-0 initial commit: a b h
559
682 560 The overwriting should take over. However, the behavior is currently buggy
683 561
684 562 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mBFm-0")'
685 563 M b
686 564 A d
687 565 a (true !)
688 566 h (false !)
689 567 R a
690 568 R h
691 569 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFBm-0")'
692 570 M b
693 571 A d
694 572 h
695 573 R a
696 574 R h
697 575 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mBFm-0")'
698 576 M d
699 577 R h
700 578 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mBFm-0")'
701 579 M b
702 580 M d
703 581 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mBFm-0")'
704 582 M b
705 583 M d
706 584 R i
707 585 $ hg status --copies --rev 'desc("b-1")' --rev 'desc("mFBm-0")'
708 586 M d
709 587 R h
710 588 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFBm-0")'
711 589 M b
712 590 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFBm-0")'
713 591 M b
714 592 M d
715 593 R i
716 594
717 595 The following graphlog is wrong, the "a -> c -> d" chain was overwritten and should not appear.
718 596
719 597 $ hg log -Gfr 'desc("mBFm-0")' d
720 598 o 23 mBFm-0 simple merge - one way
721 599 |\
722 600 o : 22 f-2: rename i -> d
723 601 | :
724 602 o : 21 f-1: rename h -> i
725 603 :/
726 604 o 2 i-2: c -move-> d
727 605 |
728 606 o 1 i-1: a -move-> c
729 607 |
730 608 o 0 i-0 initial commit: a b h
731 609
732 610
733 611 The following output is correct.
734 612
735 613 $ hg log -Gfr 'desc("mFBm-0")' d
736 614 o 22 f-2: rename i -> d
737 615 |
738 616 o 21 f-1: rename h -> i
739 617 :
740 618 o 0 i-0 initial commit: a b h
741 619
742 620
621
743 622 Merge:
744 623 - one with change to a file
745 624 - one deleting and recreating the file
746 625
747 Unlike in the 'BD/DB' cases, an actuall merge happened here. So we should
626 Unlike in the 'BD/DB' cases, an actual merge happened here. So we should
748 627 consider history and rename on both branch of the merge.
749 628
629 $ hg up 'desc("i-2")'
630 3 files updated, 0 files merged, 0 files removed, 0 files unresolved
631 $ echo "some update" >> d
632 $ hg commit -m "g-1: update d"
633 created new head
634 $ hg up 'desc("d-2")'
635 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
636 $ hg merge 'desc("g-1")' --tool :union
637 merging d
638 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
639 (branch merge, don't forget to commit)
640 $ hg ci -m 'mDGm-0 simple merge - one way'
641 $ hg up 'desc("g-1")'
642 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
643 $ hg merge 'desc("d-2")' --tool :union
644 merging d
645 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
646 (branch merge, don't forget to commit)
647 $ hg ci -m 'mGDm-0 simple merge - the other way'
648 created new head
649 $ hg log -G --rev '::(desc("mDGm")+desc("mGDm"))'
650 @ 27 mGDm-0 simple merge - the other way
651 |\
652 +---o 26 mDGm-0 simple merge - one way
653 | |/
654 | o 25 g-1: update d
655 | |
656 o | 8 d-2 re-add d
657 | |
658 o | 7 d-1 delete d
659 |/
660 o 2 i-2: c -move-> d
661 |
662 o 1 i-1: a -move-> c
663 |
664 o 0 i-0 initial commit: a b h
665
750 666 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mDGm-0")'
751 667 A d
752 668 a
753 669 R a
754 670 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGDm-0")'
755 671 A d
756 672 a
757 673 R a
758 674 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mDGm-0")'
759 675 M d
760 676 $ hg status --copies --rev 'desc("d-2")' --rev 'desc("mGDm-0")'
761 677 M d
762 678 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mDGm-0")'
763 679 M d
764 680 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGDm-0")'
765 681 M d
766 682
767 683 $ hg log -Gfr 'desc("mDGm-0")' d
768 684 o 26 mDGm-0 simple merge - one way
769 685 |\
770 686 | o 25 g-1: update d
771 687 | |
772 688 o | 8 d-2 re-add d
773 689 |/
774 690 o 2 i-2: c -move-> d
775 691 |
776 692 o 1 i-1: a -move-> c
777 693 |
778 694 o 0 i-0 initial commit: a b h
779 695
780 696
781 697
782 698 $ hg log -Gfr 'desc("mDGm-0")' d
783 699 o 26 mDGm-0 simple merge - one way
784 700 |\
785 701 | o 25 g-1: update d
786 702 | |
787 703 o | 8 d-2 re-add d
788 704 |/
789 705 o 2 i-2: c -move-> d
790 706 |
791 707 o 1 i-1: a -move-> c
792 708 |
793 709 o 0 i-0 initial commit: a b h
794 710
795 711
796 712
797 713 Merge:
798 714 - one with change to a file (d)
799 715 - one overwriting that file with a rename (from h to i, to d)
800 716
801 717 This case is similar to BF/FB, but an actual merge happens, so both side of the
802 718 history are relevant.
803 719
804 720 Note:
805 721 | In this case, the merge get conflicting information since on one side we have
806 722 | "a -> c -> d". and one the other one we have "h -> i -> d".
807 723 |
808 724 | The current code arbitrarily pick one side
809 725
726 $ hg up 'desc("f-2")'
727 1 files updated, 0 files merged, 1 files removed, 0 files unresolved
728 $ hg merge 'desc("g-1")' --tool :union
729 merging d
730 0 files updated, 1 files merged, 0 files removed, 0 files unresolved
731 (branch merge, don't forget to commit)
732 $ hg ci -m 'mFGm-0 simple merge - one way'
733 created new head
734 $ hg up 'desc("g-1")'
735 2 files updated, 0 files merged, 0 files removed, 0 files unresolved
736 $ hg merge 'desc("f-2")' --tool :union
737 merging d
738 0 files updated, 1 files merged, 1 files removed, 0 files unresolved
739 (branch merge, don't forget to commit)
740 $ hg ci -m 'mGFm-0 simple merge - the other way'
741 created new head
742 $ hg log -G --rev '::(desc("mGFm")+desc("mFGm"))'
743 @ 29 mGFm-0 simple merge - the other way
744 |\
745 +---o 28 mFGm-0 simple merge - one way
746 | |/
747 | o 25 g-1: update d
748 | |
749 o | 22 f-2: rename i -> d
750 | |
751 o | 21 f-1: rename h -> i
752 |/
753 o 2 i-2: c -move-> d
754 |
755 o 1 i-1: a -move-> c
756 |
757 o 0 i-0 initial commit: a b h
758
810 759 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mFGm-0")'
811 760 A d
812 761 a
813 762 R a
814 763 R h
815 764 $ hg status --copies --rev 'desc("i-0")' --rev 'desc("mGFm-0")'
816 765 A d
817 766 a
818 767 R a
819 768 R h
820 769 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mFGm-0")'
821 770 M d
822 771 $ hg status --copies --rev 'desc("f-2")' --rev 'desc("mGFm-0")'
823 772 M d
824 773 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mFGm-0")'
825 774 M d
826 775 R i
827 776 $ hg status --copies --rev 'desc("f-1")' --rev 'desc("mGFm-0")'
828 777 M d
829 778 R i
830 779 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mFGm-0")'
831 780 M d
832 781 R h
833 782 $ hg status --copies --rev 'desc("g-1")' --rev 'desc("mGFm-0")'
834 783 M d
835 784 R h
836 785
837 786 $ hg log -Gfr 'desc("mFGm-0")' d
838 787 o 28 mFGm-0 simple merge - one way
839 788 |\
840 789 | o 25 g-1: update d
841 790 | |
842 791 o | 22 f-2: rename i -> d
843 792 | |
844 793 o | 21 f-1: rename h -> i
845 794 |/
846 795 o 2 i-2: c -move-> d
847 796 |
848 797 o 1 i-1: a -move-> c
849 798 |
850 799 o 0 i-0 initial commit: a b h
851 800
852 801
853
854 802 $ hg log -Gfr 'desc("mGFm-0")' d
855 803 @ 29 mGFm-0 simple merge - the other way
856 804 |\
857 805 | o 25 g-1: update d
858 806 | |
859 807 o | 22 f-2: rename i -> d
860 808 | |
861 809 o | 21 f-1: rename h -> i
862 810 |/
863 811 o 2 i-2: c -move-> d
864 812 |
865 813 o 1 i-1: a -move-> c
866 814 |
867 815 o 0 i-0 initial commit: a b h
868 816
General Comments 0
You need to be logged in to leave comments. Login now