|
1 ====================================================== |
|
2 Tests the resolution of content divergence: relocation |
|
3 ====================================================== |
|
4 |
|
5 This file intend to cover case where changesets need to be moved to different parents |
|
6 |
|
7 $ cat >> $HGRCPATH <<EOF |
|
8 > [alias] |
|
9 > glog = log -GT "{rev}:{node|short} {desc|firstline}\n ({bookmarks}) [{branch}] {phase}" |
|
10 > [phases] |
|
11 > publish = False |
|
12 > [extensions] |
|
13 > rebase = |
|
14 > EOF |
|
15 $ echo "evolve=$(echo $(dirname $TESTDIR))/hgext3rd/evolve/" >> $HGRCPATH |
|
16 |
|
17 |
|
18 Testing resolution of content-divergent changesets when they are on different |
|
19 parents and resolution and relocation wont result in conflicts |
|
20 ------------------------------------------------------------------------------ |
|
21 |
|
22 $ hg init multiparents |
|
23 $ cd multiparents |
|
24 $ echo ".*\.orig" > .hgignore |
|
25 $ hg add .hgignore |
|
26 $ hg ci -m "added hgignore" |
|
27 $ for ch in a b c d; do echo foo > $ch; hg add $ch; hg ci -qm "added "$ch; done; |
|
28 |
|
29 $ hg glog |
|
30 @ 4:c41c793e0ef1 added d |
|
31 | () [default] draft |
|
32 o 3:ca1b80f7960a added c |
|
33 | () [default] draft |
|
34 o 2:b1661037fa25 added b |
|
35 | () [default] draft |
|
36 o 1:c7586e2a9264 added a |
|
37 | () [default] draft |
|
38 o 0:8fa14d15e168 added hgignore |
|
39 () [default] draft |
|
40 |
|
41 $ hg up .^^ |
|
42 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
43 $ echo bar > b |
|
44 $ hg amend |
|
45 2 new orphan changesets |
|
46 |
|
47 $ hg rebase -r b1661037fa25 -d 8fa14d15e168 --hidden --config experimental.evolution.allowdivergence=True |
|
48 rebasing 2:b1661037fa25 "added b" |
|
49 2 new content-divergent changesets |
|
50 |
|
51 $ hg glog |
|
52 * 6:da4b96f4a8d6 added b |
|
53 | () [default] draft |
|
54 | @ 5:7ed0642d644b added b |
|
55 | | () [default] draft |
|
56 | | * 4:c41c793e0ef1 added d |
|
57 | | | () [default] draft |
|
58 | | * 3:ca1b80f7960a added c |
|
59 | | | () [default] draft |
|
60 | | x 2:b1661037fa25 added b |
|
61 | |/ () [default] draft |
|
62 | o 1:c7586e2a9264 added a |
|
63 |/ () [default] draft |
|
64 o 0:8fa14d15e168 added hgignore |
|
65 () [default] draft |
|
66 |
|
67 $ hg evolve --content-divergent |
|
68 merge:[5] added b |
|
69 with: [6] added b |
|
70 base: [2] added b |
|
71 rebasing "other" content-divergent changeset da4b96f4a8d6 on c7586e2a9264 |
|
72 updating to "local" side of the conflict: 7ed0642d644b |
|
73 merging "other" content-divergent changeset '11f849d7159f' |
|
74 0 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
75 working directory is now at 171614c9a791 |
|
76 |
|
77 $ hg glog |
|
78 @ 8:171614c9a791 added b |
|
79 | () [default] draft |
|
80 | * 4:c41c793e0ef1 added d |
|
81 | | () [default] draft |
|
82 | * 3:ca1b80f7960a added c |
|
83 | | () [default] draft |
|
84 | x 2:b1661037fa25 added b |
|
85 |/ () [default] draft |
|
86 o 1:c7586e2a9264 added a |
|
87 | () [default] draft |
|
88 o 0:8fa14d15e168 added hgignore |
|
89 () [default] draft |
|
90 |
|
91 $ hg exp |
|
92 # HG changeset patch |
|
93 # User test |
|
94 # Date 0 0 |
|
95 # Thu Jan 01 00:00:00 1970 +0000 |
|
96 # Node ID 171614c9a7914c53f531373b95632323fdbbac8d |
|
97 # Parent c7586e2a92645e473645847a7b69a6dc52be4276 |
|
98 added b |
|
99 |
|
100 diff -r c7586e2a9264 -r 171614c9a791 b |
|
101 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
102 +++ b/b Thu Jan 01 00:00:00 1970 +0000 |
|
103 @@ -0,0 +1,1 @@ |
|
104 +bar |
|
105 |
|
106 Resolving orphans to get back to a normal graph |
|
107 |
|
108 $ hg evolve --all |
|
109 move:[3] added c |
|
110 atop:[8] added b |
|
111 move:[4] added d |
|
112 working directory is now at 4ae4427ee9f8 |
|
113 $ hg glog |
|
114 @ 10:4ae4427ee9f8 added d |
|
115 | () [default] draft |
|
116 o 9:917281f93fcb added c |
|
117 | () [default] draft |
|
118 o 8:171614c9a791 added b |
|
119 | () [default] draft |
|
120 o 1:c7586e2a9264 added a |
|
121 | () [default] draft |
|
122 o 0:8fa14d15e168 added hgignore |
|
123 () [default] draft |
|
124 |
|
125 More testing! |
|
126 |
|
127 $ hg up .^^ |
|
128 0 files updated, 0 files merged, 2 files removed, 0 files unresolved |
|
129 $ echo x > x |
|
130 $ hg ci -Aqm "added x" |
|
131 $ hg glog -r . |
|
132 @ 11:71a392c714b5 added x |
|
133 | () [default] draft |
|
134 ~ |
|
135 |
|
136 $ echo foo > x |
|
137 $ hg branch bar |
|
138 marked working directory as branch bar |
|
139 (branches are permanent and global, did you want a bookmark?) |
|
140 $ hg amend -m "added foo to x" |
|
141 |
|
142 $ hg up 71a392c714b5 --hidden |
|
143 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
144 updated to hidden changeset 71a392c714b5 |
|
145 (hidden revision '71a392c714b5' was rewritten as: 1e1a50385a7d) |
|
146 working directory parent is obsolete! (71a392c714b5) |
|
147 (use 'hg evolve' to update to its successor: 1e1a50385a7d) |
|
148 $ hg rebase -r . -d 4ae4427ee9f8 --config experimental.evolution.allowdivergence=True |
|
149 rebasing 11:71a392c714b5 "added x" |
|
150 2 new content-divergent changesets |
|
151 |
|
152 $ hg glog |
|
153 @ 13:1e4f6b3bb39b added x |
|
154 | () [default] draft |
|
155 | * 12:1e1a50385a7d added foo to x |
|
156 | | () [bar] draft |
|
157 o | 10:4ae4427ee9f8 added d |
|
158 | | () [default] draft |
|
159 o | 9:917281f93fcb added c |
|
160 |/ () [default] draft |
|
161 o 8:171614c9a791 added b |
|
162 | () [default] draft |
|
163 o 1:c7586e2a9264 added a |
|
164 | () [default] draft |
|
165 o 0:8fa14d15e168 added hgignore |
|
166 () [default] draft |
|
167 |
|
168 $ hg evolve --content-divergent |
|
169 merge:[13] added x |
|
170 with: [12] added foo to x |
|
171 base: [11] added x |
|
172 rebasing "other" content-divergent changeset 1e1a50385a7d on 4ae4427ee9f8 |
|
173 updating to "local" side of the conflict: 1e4f6b3bb39b |
|
174 merging "other" content-divergent changeset '80cc9b1ec650' |
|
175 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
176 working directory is now at b006cf317e0e |
|
177 |
|
178 $ hg exp |
|
179 # HG changeset patch |
|
180 # User test |
|
181 # Date 0 0 |
|
182 # Thu Jan 01 00:00:00 1970 +0000 |
|
183 # Branch bar |
|
184 # Node ID b006cf317e0ed16dbe786c439577475580f645f1 |
|
185 # Parent 4ae4427ee9f8f0935211fd66360948b77ab5aee9 |
|
186 added foo to x |
|
187 |
|
188 diff -r 4ae4427ee9f8 -r b006cf317e0e x |
|
189 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
190 +++ b/x Thu Jan 01 00:00:00 1970 +0000 |
|
191 @@ -0,0 +1,1 @@ |
|
192 +foo |
|
193 |
|
194 The above `hg exp` and the following log call demonstrates that message, content |
|
195 and branch change is preserved in case of relocation |
|
196 $ hg glog |
|
197 @ 15:b006cf317e0e added foo to x |
|
198 | () [bar] draft |
|
199 o 10:4ae4427ee9f8 added d |
|
200 | () [default] draft |
|
201 o 9:917281f93fcb added c |
|
202 | () [default] draft |
|
203 o 8:171614c9a791 added b |
|
204 | () [default] draft |
|
205 o 1:c7586e2a9264 added a |
|
206 | () [default] draft |
|
207 o 0:8fa14d15e168 added hgignore |
|
208 () [default] draft |
|
209 |
|
210 Testing when both the content-divergence are on different parents and resolution |
|
211 will lead to conflicts |
|
212 --------------------------------------------------------------------------------- |
|
213 |
|
214 $ hg up .^^^ |
|
215 0 files updated, 0 files merged, 3 files removed, 0 files unresolved |
|
216 |
|
217 $ echo y > y |
|
218 $ hg ci -Aqm "added y" |
|
219 $ hg glog -r . |
|
220 @ 16:fc6ad2bac162 added y |
|
221 | () [default] draft |
|
222 ~ |
|
223 |
|
224 $ echo bar > y |
|
225 $ hg amend |
|
226 |
|
227 $ hg up fc6ad2bac162 --hidden |
|
228 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
|
229 updated to hidden changeset fc6ad2bac162 |
|
230 (hidden revision 'fc6ad2bac162' was rewritten as: 2a9f6ccbdeba) |
|
231 working directory parent is obsolete! (fc6ad2bac162) |
|
232 (use 'hg evolve' to update to its successor: 2a9f6ccbdeba) |
|
233 $ hg rebase -r . -d b006cf317e0e --config experimental.evolution.allowdivergence=True |
|
234 rebasing 16:fc6ad2bac162 "added y" |
|
235 2 new content-divergent changesets |
|
236 $ echo wat > y |
|
237 $ hg amend |
|
238 |
|
239 $ hg glog |
|
240 @ 19:b4575ed6fcfc added y |
|
241 | () [bar] draft |
|
242 | * 17:2a9f6ccbdeba added y |
|
243 | | () [default] draft |
|
244 o | 15:b006cf317e0e added foo to x |
|
245 | | () [bar] draft |
|
246 o | 10:4ae4427ee9f8 added d |
|
247 | | () [default] draft |
|
248 o | 9:917281f93fcb added c |
|
249 |/ () [default] draft |
|
250 o 8:171614c9a791 added b |
|
251 | () [default] draft |
|
252 o 1:c7586e2a9264 added a |
|
253 | () [default] draft |
|
254 o 0:8fa14d15e168 added hgignore |
|
255 () [default] draft |
|
256 |
|
257 $ hg evolve --content-divergent |
|
258 merge:[19] added y |
|
259 with: [17] added y |
|
260 base: [16] added y |
|
261 rebasing "other" content-divergent changeset 2a9f6ccbdeba on b006cf317e0e |
|
262 updating to "local" side of the conflict: b4575ed6fcfc |
|
263 merging "other" content-divergent changeset '48f745db3f53' |
|
264 merging y |
|
265 warning: conflicts while merging y! (edit, then use 'hg resolve --mark') |
|
266 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
267 fix conflicts and see `hg help evolve.interrupted` |
|
268 [1] |
|
269 |
|
270 $ echo watbar > y |
|
271 $ hg resolve -m |
|
272 (no more unresolved files) |
|
273 continue: hg evolve --continue |
|
274 $ hg evolve --continue |
|
275 working directory is now at 7bbcf24ddecf |
|
276 |
|
277 $ hg glog |
|
278 @ 21:7bbcf24ddecf added y |
|
279 | () [bar] draft |
|
280 o 15:b006cf317e0e added foo to x |
|
281 | () [bar] draft |
|
282 o 10:4ae4427ee9f8 added d |
|
283 | () [default] draft |
|
284 o 9:917281f93fcb added c |
|
285 | () [default] draft |
|
286 o 8:171614c9a791 added b |
|
287 | () [default] draft |
|
288 o 1:c7586e2a9264 added a |
|
289 | () [default] draft |
|
290 o 0:8fa14d15e168 added hgignore |
|
291 () [default] draft |
|
292 |
|
293 $ hg obslog -r . --all |
|
294 @ 7bbcf24ddecf (21) added y |
|
295 |\ |
|
296 x | 48f745db3f53 (20) added y |
|
297 | | rewritten(branch, content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000) |
|
298 | | |
|
299 | x b4575ed6fcfc (19) added y |
|
300 | | rewritten(content) as 7bbcf24ddecf using evolve by test (Thu Jan 01 00:00:00 1970 +0000) |
|
301 | | |
|
302 x | 2a9f6ccbdeba (17) added y |
|
303 | | rewritten(parent) as 48f745db3f53 using evolve by test (Thu Jan 01 00:00:00 1970 +0000) |
|
304 | | |
|
305 | x 96b677f01b81 (18) added y |
|
306 |/ rewritten(content) as b4575ed6fcfc using amend by test (Thu Jan 01 00:00:00 1970 +0000) |
|
307 | |
|
308 x fc6ad2bac162 (16) added y |
|
309 rewritten(content) as 2a9f6ccbdeba using amend by test (Thu Jan 01 00:00:00 1970 +0000) |
|
310 rewritten(branch, parent) as 96b677f01b81 using rebase by test (Thu Jan 01 00:00:00 1970 +0000) |
|
311 |
|
312 |
|
313 checking that relocated commit is there |
|
314 $ hg exp 48f745db3f53 --hidden |
|
315 # HG changeset patch |
|
316 # User test |
|
317 # Date 0 0 |
|
318 # Thu Jan 01 00:00:00 1970 +0000 |
|
319 # Node ID 48f745db3f5300363ca248b9aeab20ff2a55fbb3 |
|
320 # Parent b006cf317e0ed16dbe786c439577475580f645f1 |
|
321 added y |
|
322 |
|
323 diff -r b006cf317e0e -r 48f745db3f53 y |
|
324 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
325 +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
326 @@ -0,0 +1,1 @@ |
|
327 +bar |
|
328 |
|
329 Testing when the relocation will result in conflicts and merging also: |
|
330 ---------------------------------------------------------------------- |
|
331 |
|
332 $ hg glog |
|
333 @ 21:7bbcf24ddecf added y |
|
334 | () [bar] draft |
|
335 o 15:b006cf317e0e added foo to x |
|
336 | () [bar] draft |
|
337 o 10:4ae4427ee9f8 added d |
|
338 | () [default] draft |
|
339 o 9:917281f93fcb added c |
|
340 | () [default] draft |
|
341 o 8:171614c9a791 added b |
|
342 | () [default] draft |
|
343 o 1:c7586e2a9264 added a |
|
344 | () [default] draft |
|
345 o 0:8fa14d15e168 added hgignore |
|
346 () [default] draft |
|
347 |
|
348 $ hg up .^^^^ |
|
349 0 files updated, 0 files merged, 4 files removed, 0 files unresolved |
|
350 |
|
351 $ echo z > z |
|
352 $ hg ci -Aqm "added z" |
|
353 $ hg glog -r . |
|
354 @ 22:daf1de08f3b0 added z |
|
355 | () [default] draft |
|
356 ~ |
|
357 |
|
358 $ echo foo > y |
|
359 $ hg add y |
|
360 $ hg amend |
|
361 |
|
362 $ hg up daf1de08f3b0 --hidden |
|
363 0 files updated, 0 files merged, 1 files removed, 0 files unresolved |
|
364 updated to hidden changeset daf1de08f3b0 |
|
365 (hidden revision 'daf1de08f3b0' was rewritten as: 3f7a1f693080) |
|
366 working directory parent is obsolete! (daf1de08f3b0) |
|
367 (use 'hg evolve' to update to its successor: 3f7a1f693080) |
|
368 $ hg rebase -r . -d 7bbcf24ddecf --config experimental.evolution.allowdivergence=True |
|
369 rebasing 22:daf1de08f3b0 "added z" |
|
370 2 new content-divergent changesets |
|
371 $ echo bar > z |
|
372 $ hg amend |
|
373 |
|
374 $ hg glog |
|
375 @ 25:53242575ffa9 added z |
|
376 | () [bar] draft |
|
377 | * 23:3f7a1f693080 added z |
|
378 | | () [default] draft |
|
379 o | 21:7bbcf24ddecf added y |
|
380 | | () [bar] draft |
|
381 o | 15:b006cf317e0e added foo to x |
|
382 | | () [bar] draft |
|
383 o | 10:4ae4427ee9f8 added d |
|
384 | | () [default] draft |
|
385 o | 9:917281f93fcb added c |
|
386 |/ () [default] draft |
|
387 o 8:171614c9a791 added b |
|
388 | () [default] draft |
|
389 o 1:c7586e2a9264 added a |
|
390 | () [default] draft |
|
391 o 0:8fa14d15e168 added hgignore |
|
392 () [default] draft |
|
393 |
|
394 $ hg evolve --content-divergent --any |
|
395 merge:[25] added z |
|
396 with: [23] added z |
|
397 base: [22] added z |
|
398 rebasing "other" content-divergent changeset 3f7a1f693080 on 7bbcf24ddecf |
|
399 merging y |
|
400 warning: conflicts while merging y! (edit, then use 'hg resolve --mark') |
|
401 fix conflicts and see `hg help evolve.interrupted` |
|
402 [1] |
|
403 |
|
404 $ hg diff |
|
405 diff -r 7bbcf24ddecf y |
|
406 --- a/y Thu Jan 01 00:00:00 1970 +0000 |
|
407 +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
408 @@ -1,1 +1,5 @@ |
|
409 +<<<<<<< destination: 7bbcf24ddecf bar - test: added y |
|
410 watbar |
|
411 +======= |
|
412 +foo |
|
413 +>>>>>>> evolving: 3f7a1f693080 - test: added z |
|
414 diff -r 7bbcf24ddecf z |
|
415 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
416 +++ b/z Thu Jan 01 00:00:00 1970 +0000 |
|
417 @@ -0,0 +1,1 @@ |
|
418 +z |
|
419 |
|
420 $ echo foo > y |
|
421 $ hg resolve -m |
|
422 (no more unresolved files) |
|
423 continue: hg evolve --continue |
|
424 |
|
425 $ hg evolve --continue |
|
426 evolving 23:3f7a1f693080 "added z" |
|
427 updating to "local" side of the conflict: 53242575ffa9 |
|
428 merging "other" content-divergent changeset 'cdb0643c69fc' |
|
429 merging y |
|
430 warning: conflicts while merging y! (edit, then use 'hg resolve --mark') |
|
431 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
|
432 fix conflicts and see `hg help evolve.interrupted` |
|
433 [1] |
|
434 |
|
435 $ hg diff |
|
436 diff -r 53242575ffa9 y |
|
437 --- a/y Thu Jan 01 00:00:00 1970 +0000 |
|
438 +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
439 @@ -1,1 +1,5 @@ |
|
440 +<<<<<<< local: 53242575ffa9 bar - test: added z |
|
441 watbar |
|
442 +======= |
|
443 +foo |
|
444 +>>>>>>> other: cdb0643c69fc - test: added z |
|
445 |
|
446 $ echo foo > y |
|
447 $ hg resolve -m |
|
448 (no more unresolved files) |
|
449 continue: hg evolve --continue |
|
450 $ hg evolve --continue |
|
451 working directory is now at 6fc7d9682de6 |
|
452 |
|
453 $ hg glog |
|
454 @ 27:6fc7d9682de6 added z |
|
455 | () [bar] draft |
|
456 o 21:7bbcf24ddecf added y |
|
457 | () [bar] draft |
|
458 o 15:b006cf317e0e added foo to x |
|
459 | () [bar] draft |
|
460 o 10:4ae4427ee9f8 added d |
|
461 | () [default] draft |
|
462 o 9:917281f93fcb added c |
|
463 | () [default] draft |
|
464 o 8:171614c9a791 added b |
|
465 | () [default] draft |
|
466 o 1:c7586e2a9264 added a |
|
467 | () [default] draft |
|
468 o 0:8fa14d15e168 added hgignore |
|
469 () [default] draft |
|
470 |
|
471 $ hg exp |
|
472 # HG changeset patch |
|
473 # User test |
|
474 # Date 0 0 |
|
475 # Thu Jan 01 00:00:00 1970 +0000 |
|
476 # Branch bar |
|
477 # Node ID 6fc7d9682de6e3bee6c8b1266b756ed7d522b7e4 |
|
478 # Parent 7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b |
|
479 added z |
|
480 |
|
481 diff -r 7bbcf24ddecf -r 6fc7d9682de6 y |
|
482 --- a/y Thu Jan 01 00:00:00 1970 +0000 |
|
483 +++ b/y Thu Jan 01 00:00:00 1970 +0000 |
|
484 @@ -1,1 +1,1 @@ |
|
485 -watbar |
|
486 +foo |
|
487 diff -r 7bbcf24ddecf -r 6fc7d9682de6 z |
|
488 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 |
|
489 +++ b/z Thu Jan 01 00:00:00 1970 +0000 |
|
490 @@ -0,0 +1,1 @@ |
|
491 +bar |
|
492 |
|
493 $ cd .. |