comparison 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
comparison
equal deleted inserted replaced
45549:68906595016c 45550:2b339c6c6e99
2157 # fix up dirstate for copies and renames 2157 # fix up dirstate for copies and renames
2158 copies.graftcopies(wctx, ctx, base) 2158 copies.graftcopies(wctx, ctx, base)
2159 return stats 2159 return stats
2160 2160
2161 2161
2162 def back_out(ctx, parent=None, wc=None):
2163 if parent is None:
2164 if ctx.p2() is not None:
2165 raise error.ProgrammingError(
2166 b"must specify parent of merge commit to back out"
2167 )
2168 parent = ctx.p1()
2169 return update(
2170 ctx.repo(),
2171 parent,
2172 branchmerge=True,
2173 force=True,
2174 ancestor=ctx.node(),
2175 mergeancestor=False,
2176 )
2177
2178
2162 def purge( 2179 def purge(
2163 repo, 2180 repo,
2164 matcher, 2181 matcher,
2165 unknown=True, 2182 unknown=True,
2166 ignored=False, 2183 ignored=False,