# HG changeset patch # User Sushil khanchi # Date 1596620088 -19800 # Node ID 95d00d58885f8241573c3851e328cd2fab18e32a # Parent 56e5dc7d63194b7d0fe69fce5b552361911dcb2c evolve: rely on resolutionparent when relocating divergent csets As discussed with Pierre-Yves the current behavior of resolving content-divergence when parent changes: 1) First we decide the resolution parent (the parent where resolution cset will be based on) 2) Relocate both the divergent csets to the resolution parent (if a cset is already on resolution parent, nothing to do for it) 3) Perform 3-way merge to create the resolution cset of content-div This patch makes sure that we rely on that decided resolution parent, when relocating divergent csets to the parent where the resolution cset will be based on. diff -r 56e5dc7d6319 -r 95d00d58885f hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Tue Jul 21 11:23:41 2020 +0800 +++ b/hgext3rd/evolve/evolvecmd.py Wed Aug 05 15:04:48 2020 +0530 @@ -518,17 +518,12 @@ ui.write((b'hg commit -m "`hg log -r %s --template={desc}`";\n' % divergent)) return (False, b".") - try: - succsdivp1 = utility._singlesuccessor(repo, divergent.p1()) - except utility.MultipleSuccessorsError: - msg = _(b"ambiguous orphan resolution parent for %s") - raise error.Abort(msg % divergent.hex()[:12]) # relocate divergent cset to its obsolete parent's successsor - if succsdivp1 != divergent.p1().rev(): + if divergent.p1().node() != resolutionparent: evolvestate[b'relocating-div'] = True ui.status(_(b'rebasing "divergent" content-divergent changeset %s on' - b' %s\n' % (divergent, repo[succsdivp1]))) - newdivergent = _relocatedivergent(repo, divergent, repo[succsdivp1], + b' %s\n' % (divergent, repo[resolutionparent]))) + newdivergent = _relocatedivergent(repo, divergent, repo[resolutionparent], evolvestate) evolvestate[b'old-divergent'] = divergent.node() evolvestate[b'relocating-div'] = False @@ -544,8 +539,8 @@ # content divergent changesets evolvestate[b'relocating-other'] = True ui.status(_(b'rebasing "other" content-divergent changeset %s on' - b' %s\n' % (other, divergent.p1()))) - newother = _relocatedivergent(repo, other, divergent.p1(), evolvestate) + b' %s\n' % (other, repo[resolutionparent]))) + newother = _relocatedivergent(repo, other, repo[resolutionparent], evolvestate) evolvestate[b'old-other'] = other.node() evolvestate[b'relocating-other'] = False evolvestate[b'relocated-other'] = newother @@ -1964,6 +1959,7 @@ divergent = repo[evolvestate[b'divergent']] other = repo[evolvestate[b'other-divergent']] base = repo[evolvestate[b'base']] + resolutionparent = repo[evolvestate.get(b'resolutionparent')] if evolvestate[b'relocating-div']: newdiv = _completerelocation(ui, repo, evolvestate) current = repo[evolvestate[b'current']] @@ -1980,8 +1976,8 @@ if relocatereq: evolvestate[b'relocating-other'] = True ui.status(_(b'rebasing "other" content-divergent changeset %s on' - b' %s\n' % (other, divergent.p1()))) - newother = _relocatedivergent(repo, other, divergent.p1(), + b' %s\n' % (other, resolutionparent))) + newother = _relocatedivergent(repo, other, resolutionparent, evolvestate) evolvestate[b'old-other'] = other.node() evolvestate[b'relocating-other'] = False