Mercurial > public > mercurial-scm > hg-stable
diff mercurial/merge.py @ 45550:2b339c6c6e99
merge: add a back_out() function to encapsulate update()
I've sent several earlier patches adding `merge.clean_update()`,
`merge.merge()` etc, one function for each use case. This patch
continues that work. I plan to hide the complex `update()` eventually.
Differential Revision: https://phab.mercurial-scm.org/D9064
author | Martin von Zweigbergk <martinvonz@google.com> |
---|---|
date | Mon, 21 Sep 2020 09:56:48 -0700 |
parents | 590a840fa367 |
children | 2c86b9587740 |
line wrap: on
line diff
--- a/mercurial/merge.py Fri Sep 18 17:19:49 2020 +0530 +++ b/mercurial/merge.py Mon Sep 21 09:56:48 2020 -0700 @@ -2159,6 +2159,23 @@ return stats +def back_out(ctx, parent=None, wc=None): + if parent is None: + if ctx.p2() is not None: + raise error.ProgrammingError( + b"must specify parent of merge commit to back out" + ) + parent = ctx.p1() + return update( + ctx.repo(), + parent, + branchmerge=True, + force=True, + ancestor=ctx.node(), + mergeancestor=False, + ) + + def purge( repo, matcher,