Mercurial > evolve
comparison tests/test-stabilize-result.t @ 3846:f9dad99a90d5
evolve: create a new commit instead of amending one of the divergents
This patch changes the behavior of evolve command while resolving
content-divergence to create a new commit instead of amending one of the
divergent ones.
In past, I have made this change, backed out this change and now today again I
am doing this change, so let's dive in some history.
Using cmdrewrite.amend() was never a good option as that requires hack to delete
the evolvestate and also gives us less control over things. We can't make the
commit on top of different parents as that of content-divergent ones. Due to all
these, I first made this change to create a new commit instead of amending one.
But, after few days, there was flakiness observed in the tests and turned out
that we need to do some dirstate dance as repo.dirstate.setparents() does not
always fix the dirstate. That flakiness was a blocker for progress at that time
and we decided to switch to amend back so that we can have things working with
some hacks and we can later fix the implementation part.
Now, yesterday while tackling resolving content-divergence of a stack which is
as follows:
C1 C2
| |
B1 B2
| |
A1 A2
\/
base
where, A1-A2, B1-B2, C1-C2 are content-divergent with each other. Now we can
resolve A1-A2 very well because they have the same parent and let's say that
resolution leads to A3.
Now, we want to resolve B1-B2 and make the new resolution commit on top of A3 so
that we can end up something like:
C3
|
B3
|
A3
|
base
however, amending one of the divergent changesets, it's not possible to create a
commit on a different parent like A3 here without some relocation. We should
prevent relocation as that may leads to some conflicts and should change the
parent before committing.
So, looking ahead, we can't move with using amend as still using that we will
need some relocation hacks making code ugly and prone to bad behaviors, bugs.
Let's change back to creating a new commit so that we can move forward in a good
way.
About repo.dirstate.setparents() not setting the dirstate, I have researched
yesterday night about how we can do that and found out that we can use
cmdrewrite._uncommitdirstate() here. Expect upcoming patches to improve the
documentation of that function.
There are lot of test changes because of change in hash but there is no behavior
change. The only behavior change is in test-evolve-abort-contentdiv.t which is
nice because creating a new commit helps us in stripping that while aborting.
We have a lot of testing of content-divergence and no behavior change gives
enough confidence for making this change.
I reviewed the patch carefully to make sure there is no behavior change and I
suggest reviewer to do the same.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Wed, 13 Jun 2018 17:15:10 +0530 |
parents | f0096db2a7b1 |
children | 629558d09898 |
comparison
equal
deleted
inserted
replaced
3845:5c964ebe4d4b | 3846:f9dad99a90d5 |
---|---|
290 base: [12] More addition | 290 base: [12] More addition |
291 merging "other" content-divergent changeset 'd2f173e25686' | 291 merging "other" content-divergent changeset 'd2f173e25686' |
292 resolving manifests | 292 resolving manifests |
293 merging a | 293 merging a |
294 0 files updated, 1 files merged, 0 files removed, 0 files unresolved | 294 0 files updated, 1 files merged, 0 files removed, 0 files unresolved |
295 amending changeset eacc9c8240fe | |
296 committing files: | 295 committing files: |
297 a | 296 a |
298 committing manifest | 297 committing manifest |
299 committing changelog | 298 committing changelog |
300 committed changeset 15:f344982e63c4 | 299 working directory is now at 4d6ed26797bc |
301 working directory is now at f344982e63c4 | |
302 $ hg st | 300 $ hg st |
303 $ glog | 301 $ glog |
304 @ 15:f344982e63c4@default(draft) bk:[] More addition | 302 @ 15:4d6ed26797bc@default(draft) bk:[] More addition |
305 | | 303 | |
306 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: | 304 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: |
307 | | | 305 | | |
308 o | 7:7bc2f5967f5e@default(draft) bk:[] add c | 306 o | 7:7bc2f5967f5e@default(draft) bk:[] add c |
309 | | | 307 | | |
312 o 5:66719795a494@default(public) bk:[changea] changea | 310 o 5:66719795a494@default(public) bk:[changea] changea |
313 | | 311 | |
314 o 0:07f494440405@default(public) bk:[] adda | 312 o 0:07f494440405@default(public) bk:[] adda |
315 | 313 |
316 $ hg summary | 314 $ hg summary |
317 parent: 15:f344982e63c4 tip | 315 parent: 15:4d6ed26797bc tip |
318 More addition | 316 More addition |
319 branch: default | 317 branch: default |
320 commit: (clean) | 318 commit: (clean) |
321 update: 2 new changesets, 2 branch heads (merge) | 319 update: 2 new changesets, 2 branch heads (merge) |
322 phases: 3 draft | 320 phases: 3 draft |
323 $ hg export . | 321 $ hg export . |
324 # HG changeset patch | 322 # HG changeset patch |
325 # User test | 323 # User test |
326 # Date 0 0 | 324 # Date 0 0 |
327 # Thu Jan 01 00:00:00 1970 +0000 | 325 # Thu Jan 01 00:00:00 1970 +0000 |
328 # Node ID f344982e63c462b1e44c0371c804685389e673a9 | 326 # Node ID 4d6ed26797bc392c0099e48402a5134e669f1a60 |
329 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced | 327 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced |
330 More addition | 328 More addition |
331 | 329 |
332 diff -r 7bc2f5967f5e -r f344982e63c4 a | 330 diff -r 7bc2f5967f5e -r 4d6ed26797bc a |
333 --- a/a Thu Jan 01 00:00:00 1970 +0000 | 331 --- a/a Thu Jan 01 00:00:00 1970 +0000 |
334 +++ b/a Thu Jan 01 00:00:00 1970 +0000 | 332 +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
335 @@ -1,1 +1,9 @@ | 333 @@ -1,1 +1,9 @@ |
336 +jungle | 334 +jungle |
337 a | 335 a |
347 ------------------------------------------------- | 345 ------------------------------------------------- |
348 | 346 |
349 $ hg up --hidden 3932c176bbaa | 347 $ hg up --hidden 3932c176bbaa |
350 1 files updated, 0 files merged, 0 files removed, 0 files unresolved | 348 1 files updated, 0 files merged, 0 files removed, 0 files unresolved |
351 updated to hidden changeset 3932c176bbaa | 349 updated to hidden changeset 3932c176bbaa |
352 (hidden revision '3932c176bbaa' was rewritten as: f344982e63c4) | 350 (hidden revision '3932c176bbaa' was rewritten as: 4d6ed26797bc) |
353 working directory parent is obsolete! (3932c176bbaa) | 351 working directory parent is obsolete! (3932c176bbaa) |
354 (use 'hg evolve' to update to its successor: f344982e63c4) | 352 (use 'hg evolve' to update to its successor: 4d6ed26797bc) |
355 $ echo 'gotta break' >> a | 353 $ echo 'gotta break' >> a |
356 $ hg amend | 354 $ hg amend |
357 2 new content-divergent changesets | 355 2 new content-divergent changesets |
358 # reamend so that the case is not the first precursor. | 356 # reamend so that the case is not the first precursor. |
359 $ hg amend -m "More addition (2)" | 357 $ hg amend -m "More addition (2)" |
362 17: draft | 360 17: draft |
363 | 361 |
364 $ glog | 362 $ glog |
365 @ 17:0b336205a5d0@default(draft) bk:[] More addition (2) | 363 @ 17:0b336205a5d0@default(draft) bk:[] More addition (2) |
366 | | 364 | |
367 | * 15:f344982e63c4@default(draft) bk:[] More addition | 365 | * 15:4d6ed26797bc@default(draft) bk:[] More addition |
368 |/ | 366 |/ |
369 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: | 367 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: |
370 | | | 368 | | |
371 o | 7:7bc2f5967f5e@default(draft) bk:[] add c | 369 o | 7:7bc2f5967f5e@default(draft) bk:[] add c |
372 | | | 370 | | |
377 o 0:07f494440405@default(public) bk:[] adda | 375 o 0:07f494440405@default(public) bk:[] adda |
378 | 376 |
379 | 377 |
380 $ hg evolve -qn --content-divergent | 378 $ hg evolve -qn --content-divergent |
381 hg update -c 0b336205a5d0 && | 379 hg update -c 0b336205a5d0 && |
382 hg merge f344982e63c4 && | 380 hg merge 4d6ed26797bc && |
383 hg commit -m "auto merge resolving conflict between 0b336205a5d0 and f344982e63c4"&& | 381 hg commit -m "auto merge resolving conflict between 0b336205a5d0 and 4d6ed26797bc"&& |
384 hg up -C 3932c176bbaa && | 382 hg up -C 3932c176bbaa && |
385 hg revert --all --rev tip && | 383 hg revert --all --rev tip && |
386 hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`"; | 384 hg commit -m "`hg log -r 0b336205a5d0 --template={desc}`"; |
387 $ hg evolve --content-divergent | 385 $ hg evolve --content-divergent |
388 merge:[17] More addition (2) | 386 merge:[17] More addition (2) |
389 with: [15] More addition | 387 with: [15] More addition |
390 base: [12] More addition | 388 base: [12] More addition |
391 merging "other" content-divergent changeset 'f344982e63c4' | 389 merging "other" content-divergent changeset '4d6ed26797bc' |
392 merging a | 390 merging a |
393 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') | 391 warning: conflicts while merging a! (edit, then use 'hg resolve --mark') |
394 0 files updated, 0 files merged, 0 files removed, 1 files unresolved | 392 0 files updated, 0 files merged, 0 files removed, 1 files unresolved |
395 abort: fix conflicts and see `hg help evolve.interrupted` | 393 abort: fix conflicts and see `hg help evolve.interrupted` |
396 [255] | 394 [255] |
409 | 407 |
410 $ hg resolve -m | 408 $ hg resolve -m |
411 (no more unresolved files) | 409 (no more unresolved files) |
412 continue: hg evolve --continue | 410 continue: hg evolve --continue |
413 $ hg evolve --continue | 411 $ hg evolve --continue |
414 working directory is now at e015aa78acee | 412 working directory is now at e8746835a2a1 |
415 $ glog | 413 $ glog |
416 @ 18:e015aa78acee@default(draft) bk:[] More addition (2) | 414 @ 18:e8746835a2a1@default(draft) bk:[] More addition (2) |
417 | | 415 | |
418 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: | 416 | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: |
419 | | | 417 | | |
420 o | 7:7bc2f5967f5e@default(draft) bk:[] add c | 418 o | 7:7bc2f5967f5e@default(draft) bk:[] add c |
421 | | | 419 | | |
428 $ hg exp | 426 $ hg exp |
429 # HG changeset patch | 427 # HG changeset patch |
430 # User test | 428 # User test |
431 # Date 0 0 | 429 # Date 0 0 |
432 # Thu Jan 01 00:00:00 1970 +0000 | 430 # Thu Jan 01 00:00:00 1970 +0000 |
433 # Node ID e015aa78acee692d26215fafdb7f70974682739c | 431 # Node ID e8746835a2a13122bc8c0ed84fe4ee35649af25d |
434 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced | 432 # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced |
435 More addition (2) | 433 More addition (2) |
436 | 434 |
437 diff -r 7bc2f5967f5e -r e015aa78acee a | 435 diff -r 7bc2f5967f5e -r e8746835a2a1 a |
438 --- a/a Thu Jan 01 00:00:00 1970 +0000 | 436 --- a/a Thu Jan 01 00:00:00 1970 +0000 |
439 +++ b/a Thu Jan 01 00:00:00 1970 +0000 | 437 +++ b/a Thu Jan 01 00:00:00 1970 +0000 |
440 @@ -1,1 +1,9 @@ | 438 @@ -1,1 +1,9 @@ |
441 +jungle | 439 +jungle |
442 a | 440 a |