##// END OF EJS Templates
merge: add a back_out() function to encapsulate update()...
Martin von Zweigbergk -
r46117:2b339c6c default
parent child Browse files
Show More
@@ -790,7 +790,8 b' def _dobackout(ui, repo, node=None, rev='
790
790
791 cmdutil.checkunfinished(repo)
791 cmdutil.checkunfinished(repo)
792 cmdutil.bailifchanged(repo)
792 cmdutil.bailifchanged(repo)
793 node = scmutil.revsingle(repo, rev).node()
793 ctx = scmutil.revsingle(repo, rev)
794 node = ctx.node()
794
795
795 op1, op2 = repo.dirstate.parents()
796 op1, op2 = repo.dirstate.parents()
796 if not repo.changelog.isancestor(node, op1):
797 if not repo.changelog.isancestor(node, op1):
@@ -821,14 +822,7 b' def _dobackout(ui, repo, node=None, rev='
821 with dirstateguard.dirstateguard(repo, b'backout'):
822 with dirstateguard.dirstateguard(repo, b'backout'):
822 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
823 overrides = {(b'ui', b'forcemerge'): opts.get(b'tool', b'')}
823 with ui.configoverride(overrides, b'backout'):
824 with ui.configoverride(overrides, b'backout'):
824 stats = mergemod.update(
825 stats = mergemod.back_out(ctx, parent=repo[parent])
825 repo,
826 parent,
827 branchmerge=True,
828 force=True,
829 ancestor=node,
830 mergeancestor=False,
831 )
832 repo.setparents(op1, op2)
826 repo.setparents(op1, op2)
833 hg._showstats(repo, stats)
827 hg._showstats(repo, stats)
834 if stats.unresolvedcount:
828 if stats.unresolvedcount:
@@ -2159,6 +2159,23 b' def graft('
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,
General Comments 0
You need to be logged in to leave comments. Login now