Mercurial > evolve
changeset 3737:5b0bd82ea914
evolve: add logic to continue interrupted content-divergence resolution
We continue the interrupted content-divergence using the logic to complete
content-divergence which we refactored in it's own function few patches ago.
We had to delete evolvestate file before using cmdutil.amend() because otherwise
we can't use the function. This leads to a hack which deletes the evolvestate
file, we may want to not to use the high level API function here. Also we had to
pass evolvestate also to _completecontentdivergent function because of this.
This patch also, adds a test which demonstrates that the logic works fine.
author | Pulkit Goyal <7895pulkit@gmail.com> |
---|---|
date | Sun, 29 Apr 2018 18:51:56 +0530 |
parents | 4b8c63d14f18 |
children | ed3f69fb67bf |
files | hgext3rd/evolve/evolvecmd.py tests/test-stabilize-result.t |
diffstat | 2 files changed, 95 insertions(+), 2 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Sun Apr 29 18:48:36 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Sun Apr 29 18:51:56 2018 +0530 @@ -428,9 +428,11 @@ /!\ * hg prune -n Y W Z """) - return _completecontentdivergence(ui, repo, progresscb, divergent, other) + return _completecontentdivergent(ui, repo, progresscb, divergent, other, + evolvestate) -def _completecontentdivergence(ui, repo, progresscb, divergent, other): +def _completecontentdivergent(ui, repo, progresscb, divergent, other, + evolvestate): """completes the content-divergence resolution""" if progresscb: progresscb() @@ -442,6 +444,9 @@ with repo.dirstate.parentchange(): repo.dirstate.setparents(divergent.node(), node.nullid) oldlen = len(repo) + # temporary hack because we can't use cmdrewrite.amend() during an + # interrupted evolve + evolvestate.delete() cmdrewrite.amend(ui, repo, message='', logfile='') if oldlen == len(repo): new = divergent @@ -1357,6 +1362,18 @@ _completeorphan(ui, repo, evolvestate) elif evolvestate['category'] == 'phasedivergent': _completephasedivergent(ui, repo, evolvestate) + elif evolvestate['category'] == 'contentdivergent': + tr = None + try: + tr = repo.transaction('evolve') + repo = repo.unfiltered() + _completecontentdivergent(ui, repo, progresscb, + repo[evolvestate['divergent']], + repo[evolvestate['other-divergent']], + evolvestate) + tr.close() + finally: + tr.release() else: repo.ui.status(_("continuing interrupted '%s' resolution is not yet" " supported\n") % evolvestate['category'])
--- a/tests/test-stabilize-result.t Sun Apr 29 18:48:36 2018 +0530 +++ b/tests/test-stabilize-result.t Sun Apr 29 18:51:56 2018 +0530 @@ -362,6 +362,23 @@ $ hg phase 'contentdivergent()' 15: draft 17: draft + + $ glog + @ 17:0b336205a5d0@default(draft) bk:[] More addition (2) + | + | * 15:f344982e63c4@default(draft) bk:[] More addition + |/ + | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: + | | + o | 7:7bc2f5967f5e@default(draft) bk:[] add c + | | + | o 6:1cf0aacfd363@default(public) bk:[] newer a + |/ + o 5:66719795a494@default(public) bk:[changea] changea + | + o 0:07f494440405@default(public) bk:[] adda + + $ hg evolve -qn --content-divergent hg update -c 0b336205a5d0 && hg merge f344982e63c4 && @@ -386,3 +403,62 @@ /!\ * hg prune -n Y W Z ) [255] + + $ cat > a <<EOF + > jungle + > a + > flore + > arthur + > zephir + > some + > less + > conflict + > babar + > EOF + + $ hg resolve -m + (no more unresolved files) + continue: hg evolve --continue + $ hg evolve --continue + merge:[17] More addition (2) + with: [18] More addition (2) + base: [16] More addition + updating to "local" conflict + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + 1 files updated, 0 files merged, 0 files removed, 0 files unresolved + working directory is now at e015aa78acee + $ glog + @ 18:e015aa78acee@default(draft) bk:[] More addition (2) + | + | o 11:8fc63fe1f297@default(draft) bk:[] phase-divergent update to 1cf0aacfd363: + | | + o | 7:7bc2f5967f5e@default(draft) bk:[] add c + | | + | o 6:1cf0aacfd363@default(public) bk:[] newer a + |/ + o 5:66719795a494@default(public) bk:[changea] changea + | + o 0:07f494440405@default(public) bk:[] adda + + $ hg exp + # HG changeset patch + # User test + # Date 0 0 + # Thu Jan 01 00:00:00 1970 +0000 + # Node ID e015aa78acee692d26215fafdb7f70974682739c + # Parent 7bc2f5967f5e4ed277f60a89b7b04cc5d6407ced + More addition (2) + + diff -r 7bc2f5967f5e -r e015aa78acee a + --- a/a Thu Jan 01 00:00:00 1970 +0000 + +++ b/a Thu Jan 01 00:00:00 1970 +0000 + @@ -1,1 +1,9 @@ + +jungle + a + +flore + +arthur + +zephir + +some + +less + +conflict + +babar