# HG changeset patch # User Pulkit Goyal <7895pulkit@gmail.com> # Date 1528375710 -19800 # Node ID 9cf45b94f97788bb47bdc76272767a4b8228e70a # Parent 1fa3bf6e9e93cc244dea752196955a6d0c6b25b1 evolve: continue conflicted relocation content-divergence This patch adds logic to continue an conflicted content-divergence resolution which was interrupted while relocating one of the divergent commits. The tests shows the there is some mishandling of copies internally which will be fixed in next patch. diff -r 1fa3bf6e9e93 -r 9cf45b94f977 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Sun Jul 08 22:16:17 2018 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Thu Jun 07 18:18:30 2018 +0530 @@ -1733,9 +1733,25 @@ try: tr = repo.transaction('evolve') divergent = evolvestate['divergent'] - other = evolvestate['other-divergent'] base = evolvestate['base'] repo = repo.unfiltered() + if evolvestate['relocating']: + newother = _completerelocation(ui, repo, evolvestate) + current = repo[evolvestate['current']] + obsolete.createmarkers(repo, [(current, (repo[newother],))], + operation='evolve') + evolvestate['relocating'] = False + evolvestate['relocated'] = newother + evolvestate['temprevs'].append(newother) + evolvestate['other-divergent'] = newother + # continue the resolution by merging the content-divergence + _mergecontentdivergents(repo, progresscb, + repo[divergent], + repo[newother], + repo[base], + evolvestate) + + other = evolvestate['other-divergent'] ret = _completecontentdivergent(ui, repo, progresscb, repo[divergent], repo[other], diff -r 1fa3bf6e9e93 -r 9cf45b94f977 tests/test-evolve-content-divergence.t --- a/tests/test-evolve-content-divergence.t Sun Jul 08 22:16:17 2018 +0530 +++ b/tests/test-evolve-content-divergence.t Thu Jun 07 18:18:30 2018 +0530 @@ -693,19 +693,147 @@ continue: hg evolve --continue $ hg evolve --continue - working directory is now at 10c9f94f1e99 + evolving 23:3f7a1f693080 "added z" + updating to "local" side of the conflict: 53242575ffa9 + merging "other" content-divergent changeset 'cdb0643c69fc' + transaction abort! + rollback completed + ** Unknown exception encountered with possibly-broken third-party extension evolve + ** which supports versions 4.6 of Mercurial. + ** Please disable evolve and try your action again. + ** If that fixes the bug please report it to https://bz.mercurial-scm.org/ + ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] + ** Mercurial Distributed SCM (version 4.7rc0+2-10d40c83205b) + ** Extensions loaded: rebase, evolve + Traceback (most recent call last): + File "/tmp/hgtests.rpfl6k/install/bin/hg", line 41, in + dispatch.run() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 90, in run + status = dispatch(req) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 213, in dispatch + ret = _runcatch(req) or 0 + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch + return _callcatch(ui, _runcatchfunc) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch + return scmutil.callcatch(ui, func) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/scmutil.py", line 161, in callcatch + return func() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc + return _dispatch(req) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 984, in _dispatch + cmdpats, cmdoptions) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 730, in runcommand + ret = _runcommand(ui, options, cmd, d) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 992, in _runcommand + return cmdfunc() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 981, in + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/util.py", line 1528, in check + return func(*args, **kwargs) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1519, in evolve + continueevolve(ui, repo, evolvestate, progresscb) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1706, in continueevolve + _continuecontentdivergent(ui, repo, evolvestate, progresscb) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1752, in _continuecontentdivergent + evolvestate) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 512, in _mergecontentdivergents + mergeancestor=True) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 2052, in update + followcopies, matcher=matcher, mergeforce=mergeforce) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 1337, in calculateupdates + acceptremote, followcopies) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 1138, in manifestmerge + ret = copies.mergecopies(repo, wctx, p2, pa) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/copies.py", line 383, in mergecopies + return _fullcopytracing(repo, c1, c2, base) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/copies.py", line 537, in _fullcopytracing + assert not both2['incomplete'] + AssertionError + [1] + + $ hg diff + diff -r 7bbcf24ddecf z + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 + +++ b/z Thu Jan 01 00:00:00 1970 +0000 + @@ -0,0 +1,1 @@ + +bar + + $ echo foo > y + $ hg resolve -m + abort: resolve command not applicable when not merging + [255] + $ hg evolve --continue + evolving 23:3f7a1f693080 "added z" + updating to "local" side of the conflict: 53242575ffa9 + merging "other" content-divergent changeset '4954f28e111b' + transaction abort! + rollback completed + ** Unknown exception encountered with possibly-broken third-party extension evolve + ** which supports versions 4.6 of Mercurial. + ** Please disable evolve and try your action again. + ** If that fixes the bug please report it to https://bz.mercurial-scm.org/ + ** Python 2.7.12 (default, Dec 4 2017, 14:50:18) [GCC 5.4.0 20160609] + ** Mercurial Distributed SCM (version 4.7rc0+2-10d40c83205b) + ** Extensions loaded: rebase, evolve + Traceback (most recent call last): + File "/tmp/hgtests.rpfl6k/install/bin/hg", line 41, in + dispatch.run() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 90, in run + status = dispatch(req) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 213, in dispatch + ret = _runcatch(req) or 0 + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 354, in _runcatch + return _callcatch(ui, _runcatchfunc) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 362, in _callcatch + return scmutil.callcatch(ui, func) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/scmutil.py", line 161, in callcatch + return func() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 344, in _runcatchfunc + return _dispatch(req) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 984, in _dispatch + cmdpats, cmdoptions) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 730, in runcommand + ret = _runcommand(ui, options, cmd, d) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 992, in _runcommand + return cmdfunc() + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/dispatch.py", line 981, in + d = lambda: util.checksignature(func)(ui, *args, **strcmdopt) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/util.py", line 1528, in check + return func(*args, **kwargs) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1519, in evolve + continueevolve(ui, repo, evolvestate, progresscb) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1706, in continueevolve + _continuecontentdivergent(ui, repo, evolvestate, progresscb) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 1752, in _continuecontentdivergent + evolvestate) + File "/home/foobar/repo/mutable-history/hgext3rd/evolve/evolvecmd.py", line 512, in _mergecontentdivergents + mergeancestor=True) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 2052, in update + followcopies, matcher=matcher, mergeforce=mergeforce) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 1337, in calculateupdates + acceptremote, followcopies) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/merge.py", line 1138, in manifestmerge + ret = copies.mergecopies(repo, wctx, p2, pa) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/copies.py", line 383, in mergecopies + return _fullcopytracing(repo, c1, c2, base) + File "/tmp/hgtests.rpfl6k/install/lib/python/mercurial/copies.py", line 537, in _fullcopytracing + assert not both2['incomplete'] + AssertionError + [1] $ hg glog - @ 26:10c9f94f1e99 added z - | () [default] draft - o 21:7bbcf24ddecf added y + * 25:53242575ffa9 added z | () [bar] draft - o 15:b006cf317e0e added foo to x - | () [bar] draft - o 10:4ae4427ee9f8 added d - | () [default] draft - o 9:917281f93fcb added c - | () [default] draft + | * 23:3f7a1f693080 added z + | | () [default] draft + @ | 21:7bbcf24ddecf added y + | | () [bar] draft + o | 15:b006cf317e0e added foo to x + | | () [bar] draft + o | 10:4ae4427ee9f8 added d + | | () [default] draft + o | 9:917281f93fcb added c + |/ () [default] draft o 8:171614c9a791 added b | () [default] draft o 1:c7586e2a9264 added a @@ -713,27 +841,21 @@ o 0:8fa14d15e168 added hgignore () [default] draft -XXX: z should have bar inside, the merge definitely did not happen $ hg exp # HG changeset patch # User test # Date 0 0 # Thu Jan 01 00:00:00 1970 +0000 - # Node ID 10c9f94f1e9902d905b22019d711d31f3642f589 - # Parent 7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b - added z + # Branch bar + # Node ID 7bbcf24ddecfe97d7c2ac6fa8c07c155c8fda47b + # Parent b006cf317e0ed16dbe786c439577475580f645f1 + added y - diff -r 7bbcf24ddecf -r 10c9f94f1e99 y - --- a/y Thu Jan 01 00:00:00 1970 +0000 + diff -r b006cf317e0e -r 7bbcf24ddecf y + --- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/y Thu Jan 01 00:00:00 1970 +0000 - @@ -1,1 +1,1 @@ - -watbar - +foo - diff -r 7bbcf24ddecf -r 10c9f94f1e99 z - --- /dev/null Thu Jan 01 00:00:00 1970 +0000 - +++ b/z Thu Jan 01 00:00:00 1970 +0000 @@ -0,0 +1,1 @@ - +z + +watbar $ cd ..