Comments
Patch
@@ -945,11 +945,11 @@ def recordupdates(repo, actions, branchm
repo.dirstate.copy(f0, f)
else:
repo.dirstate.normal(f)
def update(repo, node, branchmerge, force, partial, ancestor=None,
- mergeancestor=False, labels=None):
+ mergeancestor=False, labels=None, rctx=None):
"""
Perform a merge between the working directory and the given node
node = the node to update to, or None if unspecified
branchmerge = whether to merge between branches
@@ -992,17 +992,22 @@ def update(repo, node, branchmerge, forc
"""
onode = node
wlock = repo.wlock()
try:
- wc = repo[None]
+ wc = rctx
+ if wc is None:
+ wc = repo[None]
pl = wc.parents()
p1 = pl[0]
pas = [None]
if ancestor:
pas = [repo[ancestor]]
+ if rctx is not None:
+ node = pl[1]
+
if node is None:
# Here is where we should consider bookmarks, divergent bookmarks,
# foreground changesets (successors), and tip of current branch;
# but currently we are only checking the branch tips.
try:
@@ -1051,11 +1056,11 @@ def update(repo, node, branchmerge, forc
pas = [p1.ancestor(p2, warn=True)]
fp1, fp2, xp1, xp2 = p1.node(), p2.node(), str(p1), str(p2)
### check phase
- if not overwrite and len(pl) > 1:
+ if not overwrite and len(pl) > 1 and rctx is None:
raise util.Abort(_("outstanding uncommitted merges"))
if branchmerge:
if pas == [p2]:
raise util.Abort(_("merging with a working directory ancestor"
" has no effect"))