# HG changeset patch # User Luke Granger-Brown # Date 1647280800 0 # Node ID cc80747ef3c88c3540653bd3fc6c466e075c950e # Parent f1d4c9eddcc138fc7cdf577e055356bafa4c6371 evolve: support hg continue diff -r f1d4c9eddcc1 -r cc80747ef3c8 hgext3rd/evolve/__init__.py --- a/hgext3rd/evolve/__init__.py Mon Mar 14 17:05:41 2022 +0000 +++ b/hgext3rd/evolve/__init__.py Mon Mar 14 18:00:00 2022 +0000 @@ -1167,7 +1167,8 @@ statemod.addunfinished(b'evolve', fname=b'evolvestate', continueflag=True, stopflag=True, statushint=_msg, - abortfunc=evolvecmd.hgabortevolve) + abortfunc=evolvecmd.hgabortevolve, + continuefunc=evolvecmd.hgcontinueevolve) statemod.addunfinished(b'pick', fname=b'pickstate', continueflag=True, abortfunc=cmdrewrite.hgabortpick) _fixup_msg = _(b'To continue: hg fixup --continue\n' diff -r f1d4c9eddcc1 -r cc80747ef3c8 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Mon Mar 14 17:05:41 2022 +0000 +++ b/hgext3rd/evolve/evolvecmd.py Mon Mar 14 18:00:00 2022 +0000 @@ -2047,6 +2047,23 @@ progress.complete() return headnode +def hgcontinueevolve(ui, repo): + """logic for continuing evolve using 'hg continue'""" + with repo.wlock(), repo.lock(): + evolvestate = state.cmdstate(repo) + evolvestate.load() + headnode = continueevolve(ui, repo, evolvestate) + if evolvestate[b'command'] != b'evolve': + evolvestate.delete() + return + startnode = evolvestate[b'startnode'] + shouldupdate = False + if b'update' in evolvestate: + shouldupdate = evolvestate[b'update'] + evolvestate.delete() + + _cleanup(ui, repo, startnode, shouldupdate, headnode) + def _continuecontentdivergent(ui, repo, evolvestate, progresscb): """function to continue the interrupted content-divergence resolution.""" tr = repo.transaction(b'evolve') diff -r f1d4c9eddcc1 -r cc80747ef3c8 tests/test-evolve-continue.t --- a/tests/test-evolve-continue.t Mon Mar 14 17:05:41 2022 +0000 +++ b/tests/test-evolve-continue.t Mon Mar 14 18:00:00 2022 +0000 @@ -95,28 +95,86 @@ $ hg up 1 files updated, 0 files merged, 0 files removed, 0 files unresolved +Testing hg continue for evolve + + $ hg up 'desc("added b")' + 0 files updated, 0 files merged, 2 files removed, 0 files unresolved + $ echo bar > c + $ hg add c + $ hg amend + 2 new orphan changesets + $ hg glog + @ 7:8591ebad2ee8 added b + | () draft + | * 6:2a4e03d422e2 added d + | | () draft orphan + | * 5:cb6a2ab625bb added c + | | () draft orphan + | x 2:b1661037fa25 added b + |/ () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg evolve --all + move:[5] added c + atop:[7] added b + merging c (inmemory !) + hit merge conflicts; retrying merge in working copy (inmemory !) + merging c + warning: conflicts while merging c! (edit, then use 'hg resolve --mark') + unresolved merge conflicts + (see 'hg help evolve.interrupted') + [240] + + $ echo foo > c + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + + $ hg continue + evolving 5:cb6a2ab625bb "added c" + move:[6] added d + atop:[8] added c + + $ hg glog + o 9:ee53d012d45b added d + | () draft + o 8:ba3724c42438 added c + | () draft + @ 7:8591ebad2ee8 added b + | () draft + o 1:c7586e2a9264 added a + | () draft + o 0:8fa14d15e168 added hgignore + () draft + + $ hg up + 2 files updated, 0 files merged, 0 files removed, 0 files unresolved + Case when conflicts resolution lead to empty wdir in evolve --continue $ echo foo > e $ hg ci -Aqm "added e" $ hg prev 0 files updated, 0 files merged, 1 files removed, 0 files unresolved - [6] added d + [9] added d $ echo bar > e $ hg add e $ hg amend 1 new orphan changesets $ hg glog - @ 8:00a5c774cc37 added d + @ 11:184dba7cf613 added d | () draft - | * 7:ad0a59d83efe added e + | * 10:87d7311179ee added e | | () draft orphan - | x 6:2a4e03d422e2 added d + | x 9:ee53d012d45b added d |/ () draft - o 5:cb6a2ab625bb added c + o 8:ba3724c42438 added c | () draft - o 2:b1661037fa25 added b + o 7:8591ebad2ee8 added b | () draft o 1:c7586e2a9264 added a | () draft @@ -124,8 +182,8 @@ () draft $ hg evolve --update - move:[7] added e - atop:[8] added d + move:[10] added e + atop:[11] added d merging e (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) merging e @@ -141,15 +199,15 @@ $ hg diff $ hg evolve --continue - evolving 7:ad0a59d83efe "added e" - evolution of 7:ad0a59d83efe created no changes to commit + evolving 10:87d7311179ee "added e" + evolution of 10:87d7311179ee created no changes to commit $ hg glog - @ 8:00a5c774cc37 added d + @ 11:184dba7cf613 added d | () draft - o 5:cb6a2ab625bb added c + o 8:ba3724c42438 added c | () draft - o 2:b1661037fa25 added b + o 7:8591ebad2ee8 added b | () draft o 1:c7586e2a9264 added a | () draft @@ -166,8 +224,8 @@ 3 new orphan changesets $ hg evolve --all --update - move:[2] added b - atop:[9] added a + move:[7] added b + atop:[12] added a merging b (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) merging b @@ -181,20 +239,20 @@ (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue - evolving 2:b1661037fa25 "added b" - move:[5] added c - atop:[10] added b - move:[8] added d - working directory is now at 6642d2c9176e + evolving 7:8591ebad2ee8 "added b" + move:[8] added c + atop:[13] added b + move:[11] added d + working directory is now at 44cb92e89781 $ hg glog - @ 12:6642d2c9176e added d + @ 15:44cb92e89781 added d | () draft - o 11:95665a2de664 added c + o 14:152ba81b0477 added c | () draft - o 10:87f748868183 added b + o 13:58b400d15a91 added b | () draft - o 9:53b632d203d8 added a + o 12:53b632d203d8 added a | () draft o 0:8fa14d15e168 added hgignore () draft @@ -205,19 +263,19 @@ $ for ch in f g h; do echo foo > $ch; hg add $ch; hg ci -m "added "$ch; done; $ hg glog - @ 15:09becba8f97d added h + @ 18:bc3b992c22bd added h | () draft - o 14:5aa7b2bbd944 added g + o 17:28352edcd58d added g | () draft - o 13:be88f889b6dc added f + o 16:f9f6a4a00822 added f | () draft - o 12:6642d2c9176e added d + o 15:44cb92e89781 added d | () draft - o 11:95665a2de664 added c + o 14:152ba81b0477 added c | () draft - o 10:87f748868183 added b + o 13:58b400d15a91 added b | () draft - o 9:53b632d203d8 added a + o 12:53b632d203d8 added a | () draft o 0:8fa14d15e168 added hgignore () draft @@ -232,29 +290,29 @@ 4 new orphan changesets $ hg glog - @ 16:645135c5caa4 added c + @ 19:f4023955bf12 added c | () draft - | * 15:09becba8f97d added h + | * 18:bc3b992c22bd added h | | () draft orphan - | * 14:5aa7b2bbd944 added g + | * 17:28352edcd58d added g | | () draft orphan - | * 13:be88f889b6dc added f + | * 16:f9f6a4a00822 added f | | () draft orphan - | * 12:6642d2c9176e added d + | * 15:44cb92e89781 added d | | () draft orphan - | x 11:95665a2de664 added c + | x 14:152ba81b0477 added c |/ () draft - o 10:87f748868183 added b + o 13:58b400d15a91 added b | () draft - o 9:53b632d203d8 added a + o 12:53b632d203d8 added a | () draft o 0:8fa14d15e168 added hgignore () draft $ hg evolve --all --update - move:[12] added d - atop:[16] added c - move:[13] added f + move:[15] added d + atop:[19] added c + move:[16] added f merging f (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) merging f @@ -268,10 +326,10 @@ (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue - evolving 13:be88f889b6dc "added f" - move:[14] added g - atop:[18] added f - move:[15] added h + evolving 16:f9f6a4a00822 "added f" + move:[17] added g + atop:[21] added f + move:[18] added h merging h (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) merging h @@ -285,25 +343,25 @@ (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue - evolving 15:09becba8f97d "added h" - working directory is now at 3ba9d3d1b089 + evolving 18:bc3b992c22bd "added h" + working directory is now at b4b76f2b86eb Make sure, confirmopt is respected while continue $ hg glog - @ 20:3ba9d3d1b089 added h + @ 23:b4b76f2b86eb added h | () draft - o 19:981e615b14ca added g + o 22:c75da1c807b4 added g | () draft - o 18:5794f1a3cbb2 added f + o 21:1b1bb06b1b76 added f | () draft - o 17:e47537da02b3 added d + o 20:63d80a6d5203 added d | () draft - o 16:645135c5caa4 added c + o 19:f4023955bf12 added c | () draft - o 10:87f748868183 added b + o 13:58b400d15a91 added b | () draft - o 9:53b632d203d8 added a + o 12:53b632d203d8 added a | () draft o 0:8fa14d15e168 added hgignore () draft @@ -318,8 +376,8 @@ $ hg evolve --all --update --confirm << EOF > y > EOF - move:[19] added g - atop:[21] added f + move:[22] added g + atop:[24] added f perform evolve? [Ny] y merging g (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) @@ -337,26 +395,26 @@ $ hg evolve --continue << EOF > y > EOF - evolving 19:981e615b14ca "added g" - move:[20] added h - atop:[22] added g + evolving 22:c75da1c807b4 "added g" + move:[23] added h + atop:[25] added g perform evolve? [Ny] y - working directory is now at af6bd002a48d + working directory is now at 53fa2be5b910 $ hg glog - @ 23:af6bd002a48d added h + @ 26:53fa2be5b910 added h | () draft - o 22:d2c94a8f44bd added g + o 25:3efe414bea19 added g | () draft - o 21:9849fa96c885 added f + o 24:a8dd354780ea added f | () draft - o 17:e47537da02b3 added d + o 20:63d80a6d5203 added d | () draft - o 16:645135c5caa4 added c + o 19:f4023955bf12 added c | () draft - o 10:87f748868183 added b + o 13:58b400d15a91 added b | () draft - o 9:53b632d203d8 added a + o 12:53b632d203d8 added a | () draft o 0:8fa14d15e168 added hgignore () draft @@ -370,8 +428,8 @@ 2 new orphan changesets $ hg next --evolve - move:[22] added g - atop:[24] added f + move:[25] added g + atop:[27] added f merging g (inmemory !) hit merge conflicts; retrying merge in working copy (inmemory !) merging g @@ -384,7 +442,7 @@ (no more unresolved files) continue: hg evolve --continue $ hg evolve --continue - evolving 22:d2c94a8f44bd "added g" + evolving 25:3efe414bea19 "added g" Testing that interrupted evolve don't get confused about copies (issue5930): ----------------------------------------------------------------------------