# HG changeset patch # User Martin von Zweigbergk # Date 1601065901 25200 # Node ID e190a81a3ee843c0ed236cede15d0c087809fce8 # Parent dcadb8b1d098a516c2699d0a41630d71f1592c99 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. diff -r dcadb8b1d098 -r e190a81a3ee8 hgext3rd/evolve/evolvecmd.py --- a/hgext3rd/evolve/evolvecmd.py Fri Sep 25 13:12:57 2020 -0700 +++ b/hgext3rd/evolve/evolvecmd.py Fri Sep 25 13:31:41 2020 -0700 @@ -929,18 +929,11 @@ 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 @@ 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) -def _relocatecommit(repo, orig, commitmsg): + if stats.unresolvedcount: # some conflict + hint = _(b"see 'hg help evolve.interrupted'") + raise error.InterventionRequired(_(b"unresolved merge conflicts"), + hint=hint) + if commitmsg is None: commitmsg = orig.description() extra = dict(orig.extra())