Mercurial > evolve
changeset 5857:b0b1ab64f6d8
public-content-divergence: early set the public one to local side
This change helps us to:
1. remove some check-ups which we had to perform later at the time of
merging the two (to make sure that public one is at local side).
2. make the status msgs consistent:
```
Merge:[public_rev] desc_1
with: [other_rev] desc_2
```
author | Sushil khanchi <sushilkhanchi97@gmail.com> |
---|---|
date | Mon, 08 Mar 2021 17:45:57 +0530 |
parents | ad7c9c0b7a63 |
children | 22f4ebf3f7d8 |
files | hgext3rd/evolve/evolvecmd.py tests/test-evolve-public-content-divergent-corner-cases.t tests/test-evolve-public-content-divergent-discard.t tests/test-evolve-public-content-divergent-main.t |
diffstat | 4 files changed, 37 insertions(+), 47 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext3rd/evolve/evolvecmd.py Fri Mar 19 16:23:24 2021 +0800 +++ b/hgext3rd/evolve/evolvecmd.py Mon Mar 08 17:45:57 2021 +0530 @@ -448,10 +448,12 @@ ui.write_err(msg) return (False, b".") other = others[0] + evolvestate[b'orig-divergent'] = divergent.node() + if not other.mutable(): + divergent, other = other, divergent evolvestate[b'divergent'] = divergent.node() evolvestate[b'other-divergent'] = other.node() evolvestate[b'base'] = base.node() - evolvestate[b'orig-divergent'] = divergent.node() # sometimes we will relocate a node in case of different parents and we can # encounter conflicts after relocation is done while solving @@ -532,10 +534,7 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] - localside, otherside = divergent, other - if not otherside.mutable(): - localside, otherside = other, divergent - _mergecontentdivergents(repo, progresscb, localside, otherside, base, + _mergecontentdivergents(repo, progresscb, divergent, other, base, evolvestate) res, newnode = _completecontentdivergent(ui, repo, progresscb, divergent, other, base, evolvestate) @@ -556,7 +555,7 @@ if newnode == publicdiv.node(): # case 2) pubstr = bytes(publicdiv) - othstr = bytes(otherside) + othstr = bytes(other) msg = _(b'content divergence resolution between %s ' b'(public) and %s has same content as %s, ' b'discarding %s\n') @@ -653,9 +652,6 @@ 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 @@ -665,8 +661,8 @@ {(b'ui', b'allowemptycommit'): b'true'}, b'evolve' ): extra = { - b'divergence_source_local': localside.hex(), - b'divergence_source_other': otherside.hex() + b'divergence_source_local': divergent.hex(), + b'divergence_source_other': other.hex() } newnode = repo.commit(text=desc, user=user, date=date, extra=extra) new = repo[newnode] @@ -2076,10 +2072,7 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] # continue the resolution by merging the content-divergent csets - localside, otherside = divergent, other - if not otherside.mutable(): - localside, otherside = other, divergent - _mergecontentdivergents(repo, progresscb, localside, otherside, + _mergecontentdivergents(repo, progresscb, divergent, other, base, evolvestate) if evolvestate[b'relocating-other']: @@ -2094,10 +2087,7 @@ evolvestate[b'other-divergent'] = newother other = repo[newother] # continue the resolution by merging the content-divergent csets - localside, otherside = divergent, other - if not otherside.mutable(): - localside, otherside = other, divergent - _mergecontentdivergents(repo, progresscb, localside, otherside, + _mergecontentdivergents(repo, progresscb, divergent, other, base, evolvestate) res, newnode = _completecontentdivergent(ui, repo, progresscb,
--- a/tests/test-evolve-public-content-divergent-corner-cases.t Fri Mar 19 16:23:24 2021 +0800 +++ b/tests/test-evolve-public-content-divergent-corner-cases.t Mon Mar 08 17:45:57 2021 +0530 @@ -388,10 +388,10 @@ $ hg evolve --content-divergent --any --update - merge:[4] added c e - with: [5] added d + merge:[5] added d + with: [4] added c e base: [3] added d - rebasing "divergent" content-divergent changeset e568fd1029bb on 155349b645be + rebasing "other" content-divergent changeset e568fd1029bb on 155349b645be merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts
--- a/tests/test-evolve-public-content-divergent-discard.t Fri Mar 19 16:23:24 2021 +0800 +++ b/tests/test-evolve-public-content-divergent-discard.t Mon Mar 08 17:45:57 2021 +0530 @@ -89,8 +89,8 @@ public $ hg evolve --content-divergent --any - merge:[3] added ch - with: [4] added c + merge:[4] added c + with: [3] added ch base: [2] added c 0 files updated, 0 files merged, 0 files removed, 0 files unresolved other divergent changeset 90522bccf499 has same content as local f7c1071f1e7c and differs by "description" only, discarding 90522bccf499 @@ -180,10 +180,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added dh - with: [5] added d + merge:[5] added d + with: [4] added dh base: [3] added d - rebasing "divergent" content-divergent changeset 5acd58ef5066 on 155349b645be + rebasing "other" content-divergent changeset 5acd58ef5066 on 155349b645be 0 files updated, 0 files merged, 0 files removed, 0 files unresolved other divergent changeset ae3429430ef1 has same content as local e800202333a4 and differs by "description" only, discarding ae3429430ef1 content divergence resolution between e800202333a4 (public) and ae3429430ef1 has same content as e800202333a4, discarding ae3429430ef1 @@ -265,8 +265,8 @@ public $ hg evolve --content-divergent --any - merge:[3] added ch - with: [4] added c + merge:[4] added c + with: [3] added ch base: [2] added c merging ch warning: conflicts while merging ch! (edit, then use 'hg resolve --mark') @@ -379,10 +379,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added dh - with: [5] added d + merge:[5] added d + with: [4] added dh base: [3] added d - rebasing "divergent" content-divergent changeset f89a8e2f86ac on 155349b645be + rebasing "other" content-divergent changeset f89a8e2f86ac on 155349b645be merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts @@ -483,10 +483,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added dh - with: [5] added d + merge:[5] added d + with: [4] added dh base: [3] added d - rebasing "divergent" content-divergent changeset db0b7bba0aae on 155349b645be + rebasing "other" content-divergent changeset db0b7bba0aae on 155349b645be merging dh warning: conflicts while merging dh! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved @@ -587,10 +587,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added dh - with: [5] added d + merge:[5] added d + with: [4] added dh base: [3] added d - rebasing "divergent" content-divergent changeset 67b19bbd770f on 155349b645be + rebasing "other" content-divergent changeset 67b19bbd770f on 155349b645be merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts
--- a/tests/test-evolve-public-content-divergent-main.t Fri Mar 19 16:23:24 2021 +0800 +++ b/tests/test-evolve-public-content-divergent-main.t Mon Mar 08 17:45:57 2021 +0530 @@ -353,10 +353,10 @@ public $ hg evolve --content-divergent --any --update - merge:[4] added d c e - with: [5] added d + merge:[5] added d + with: [4] added d c e base: [3] added d - rebasing "divergent" content-divergent changeset f31bcc378766 on 155349b645be + rebasing "other" content-divergent changeset f31bcc378766 on 155349b645be merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts @@ -483,10 +483,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added d - with: [5] added d + merge:[5] added d + with: [4] added d base: [3] added d - rebasing "divergent" content-divergent changeset 9411ad1fe615 on 155349b645be + rebasing "other" content-divergent changeset 9411ad1fe615 on 155349b645be merging d warning: conflicts while merging d! (edit, then use 'hg resolve --mark') 0 files updated, 0 files merged, 0 files removed, 1 files unresolved @@ -576,10 +576,10 @@ public $ hg evolve --content-divergent --any - merge:[4] added c e - with: [5] added d + merge:[5] added d + with: [4] added c e base: [3] added d - rebasing "divergent" content-divergent changeset 3c17c7afaf6e on 155349b645be + rebasing "other" content-divergent changeset 3c17c7afaf6e on 155349b645be merging c warning: conflicts while merging c! (edit, then use 'hg resolve --mark') unresolved merge conflicts