Commit 5f50b0cf authored by Martin von Zweigbergk's avatar Martin von Zweigbergk
Browse files

evolvecmd: inline _evolvemerge() into _relocatecommit()

I'm about to add a version of `_relocatecommit()` that uses in-memory
merge. It will be simpler to have `_evolvemerge()` inlined then than
to need a separate version of that function too. Also, the name
`_evolvemerge()` has often made me think that it's about evolving
merge commits, so it's nice to get rid of it for that reason too.
parent dcadb8b1d098
......@@ -929,18 +929,11 @@ def _relocate(repo, orig, dest, evolvestate, pctx=None, keepbranch=False,
tr = repo.currenttransaction()
assert tr is not None
stats = _evolvemerge(repo, orig, dest, pctx, keepbranch)
if stats.unresolvedcount: # some conflict
hint = _(b"see 'hg help evolve.interrupted'")
raise error.InterventionRequired(_(b"unresolved merge conflicts"),
hint=hint)
nodenew = _relocatecommit(repo, orig, commitmsg)
nodenew = _relocatecommit(repo, orig, dest, pctx, keepbranch, commitmsg)
_finalizerelocate(repo, orig, dest, nodenew, tr, category, evolvestate)
return nodenew
def _evolvemerge(repo, orig, dest, pctx, keepbranch):
"""Used by the evolve function to merge dest on top of pctx.
return the same tuple as merge.graft"""
def _relocatecommit(repo, orig, dest, pctx, keepbranch, commitmsg):
if repo[b'.'].rev() != dest.rev():
compat._update(repo, dest, branchmerge=False, force=True)
if repo._activebookmark:
......@@ -957,9 +950,13 @@ def _evolvemerge(repo, orig, dest, pctx, keepbranch):
with repo.vfs.open(b'topic', b'w') as f:
f.write(orig.topic())
return merge.graft(repo, orig, pctx, [b'destination', b'evolving'], True)
stats = merge.graft(repo, orig, pctx, [b'destination', b'evolving'], True)
if stats.unresolvedcount: # some conflict
hint = _(b"see 'hg help evolve.interrupted'")
raise error.InterventionRequired(_(b"unresolved merge conflicts"),
hint=hint)
def _relocatecommit(repo, orig, commitmsg):
if commitmsg is None:
commitmsg = orig.description()
extra = dict(orig.extra())
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment