# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1528658248 -19800 # Node ID 82c72eb37f85b543a3494f0132b6d01648c9f43e # Parent 8e8bd5bb2f904609c862c8e2d136db43e3302914 evolve: strip the relocation commit on `hg evolve --stop` While resolving content-divergence on multiple parents, we relocate one of the commit on the parent of another one and then merge the divergent changesets. Merging can leads to conflicts, and if user does `hg evolve --stop`, we need to strip that relocated changeset too! This patch does that. Test changes demonstrates the fix. diff -r 8e8bd5bb2f90 -r 82c72eb37f85 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Mon Jun 11 00:43:39 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Mon Jun 11 00:47:28 2018 +0530 @@ -1476,6 +1476,18 @@ """logic for handling of `hg evolve --stop`""" updated = False pctx = None + if (evolvestate['command'] == 'evolve' and + evolvestate['category'] == 'contentdivergent' and + evolvestate['relocated']): + oldother = evolvestate['old-other'] + if oldother: + with repo.wlock(), repo.lock(): + repo = repo.unfiltered() + hg.updaterepo(repo, oldother, True) + strips = [evolvestate['relocated']] + repair.strip(ui, repo, strips, False) + updated = True + pctx = repo[oldother] if not updated: pctx = repo['.'] hg.updaterepo(repo, pctx.node(), True) diff -r 8e8bd5bb2f90 -r 82c72eb37f85 tests/test-evolve-stop-contentdiv.t --- a/tests/test-evolve-stop-contentdiv.t Mon Jun 11 00:43:39 2018 +0530 +++ b/tests/test-evolve-stop-contentdiv.t Mon Jun 11 00:47:28 2018 +0530 @@ -134,18 +134,17 @@ $ hg evolve --stop stopped the interrupted evolve - working directory is now at e49523854bc8 + working directory is now at 517d4375cb72 -XXX: we need to strip the relocated commit $ hg glog - * 8:606ad96040fc added d + @ 7:517d4375cb72 added d | () draft - | @ 5:e49523854bc8 added d + | * 5:e49523854bc8 added d + | | () draft + | o 3:ca1b80f7960a added c + | | () draft + | o 2:b1661037fa25 added b |/ () draft - o 3:ca1b80f7960a added c - | () draft - o 2:b1661037fa25 added b - | () draft o 1:c7586e2a9264 added a | () draft o 0:8fa14d15e168 added hgignore