# HG changeset patch # User Sushil khanchi # Date 1597319539 -19800 # Node ID d6b3f32f8261f0ad099fae42ed7f06f51bf59485 # Parent b31cd9ee890a4797601538870f8fd78ab74fc043 evolve: add logic to decide local and other side before merge Before we perform merge between the two content-divergent csets, this logic decides which cset would reside at which side i.e. local or other. for e.g. in case of public content divergence where one side of divergence is public, we always keep public one to local side. (this logic of always keeping public one to local side may change in future, but for now that's what it is.) diff -r b31cd9ee890a -r d6b3f32f8261 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Wed Aug 05 14:25:29 2020 +0530 +++ b/hgext3rd/evolve/evolvecmd.py Thu Aug 13 17:22:19 2020 +0530 @@ -551,7 +551,10 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] - _mergecontentdivergents(repo, progresscb, divergent, other, base, + localside, otherside = divergent, other + if not otherside.mutable(): + localside, otherside = other, divergent + _mergecontentdivergents(repo, progresscb, localside, otherside, base, evolvestate) res, newnode = _completecontentdivergent(ui, repo, progresscb, divergent, other, base, evolvestate) @@ -572,7 +575,7 @@ if newnode == publicdiv.node(): # case 2) pubstr = bytes(publicdiv) - othstr = bytes(other) + othstr = bytes(otherside) msg = _(b'content divergence resolution between %s ' b'(public) and %s has same content as %s, ' b'discarding %s\n') @@ -668,6 +671,9 @@ else: date = max(divergent.date(), other.date()) + localside, otherside = divergent, other + if not otherside.mutable(): + localside, otherside = other, divergent # We really want a new commit in order to avoid obsmarker cycles (otherwise # divergence resolutions done in separate repos may create markers in the # opposite directions). For that reason, we set ui.allowemptycommit and @@ -677,8 +683,8 @@ {(b'ui', b'allowemptycommit'): b'true'}, b'evolve' ): extra = { - b'divergence_source_local': divergent.hex(), - b'divergence_source_other': other.hex() + b'divergence_source_local': localside.hex(), + b'divergence_source_other': otherside.hex() } newnode = repo.commit(text=desc, user=user, date=date, extra=extra) new = repo[newnode] @@ -1989,7 +1995,10 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] # continue the resolution by merging the content-divergent csets - _mergecontentdivergents(repo, progresscb, divergent, other, + localside, otherside = divergent, other + if not otherside.mutable(): + localside, otherside = other, divergent + _mergecontentdivergents(repo, progresscb, localside, otherside, base, evolvestate) if evolvestate[b'relocating-other']: @@ -2004,8 +2013,11 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] # continue the resolution by merging the content-divergent csets - _mergecontentdivergents(repo, progresscb, divergent, - other, base, evolvestate) + localside, otherside = divergent, other + if not otherside.mutable(): + localside, otherside = other, divergent + _mergecontentdivergents(repo, progresscb, localside, otherside, + base, evolvestate) res, newnode = _completecontentdivergent(ui, repo, progresscb, divergent, other,