Mercurial > evolve
changeset 5595:e190a81a3ee8
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.
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Fri, 25 Sep 2020 13:31:41 -0700 |
parents | dcadb8b1d098 |
children | 8e0bf4869cad |
files | hgext3rd/evolve/evolvecmd.py |
diffstat | 1 files changed, 8 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- 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())