Comments
Patch
@@ -214,11 +214,11 @@ def _destmergebook(repo, action='merge',
msg, hint = msgdestmerge['nootherbookmarks'][action]
raise error.Abort(msg, hint=hint)
assert node is not None
return node
-def _destmergebranch(repo, action='merge', sourceset=None):
+def _destmergebranch(repo, action='merge', sourceset=None, onheadcheck=True):
"""find merge destination based on branch heads"""
node = None
if sourceset is None:
sourceset = [repo[repo.dirstate.p1()].rev()]
@@ -233,11 +233,11 @@ def _destmergebranch(repo, action='merge
msg, hint = msgdestmerge['multiplebranchessourceset'][action]
raise error.Abort(msg, hint=hint)
branch = ctx.branch()
bheads = repo.branchheads(branch)
- if not repo.revs('%ld and %ln', sourceset, bheads):
+ if onheadcheck and not repo.revs('%ld and %ln', sourceset, bheads):
# Case A: working copy if not on a head. (merge only)
#
# This is probably a user mistake We bailout pointing at 'hg update'
if len(repo.heads()) <= 1:
msg, hint = msgdestmerge['nootherheadsbehind'][action]
@@ -273,21 +273,22 @@ def _destmergebranch(repo, action='merge
else:
node = nbhs[0]
assert node is not None
return node
-def destmerge(repo, action='merge', sourceset=None):
+def destmerge(repo, action='merge', sourceset=None, onheadcheck=True):
"""return the default destination for a merge
(or raise exception about why it can't pick one)
:action: the action being performed, controls emitted error message
"""
if repo._activebookmark:
node = _destmergebook(repo, action=action, sourceset=sourceset)
else:
- node = _destmergebranch(repo, action=action, sourceset=sourceset)
+ node = _destmergebranch(repo, action=action, sourceset=sourceset,
+ onheadcheck=onheadcheck)
return repo[node].rev()
histeditdefaultrevset = 'reverse(only(.) and not public() and not ::merge())'
def desthistedit(ui, repo):