Mercurial > hg
changeset 28161:3324345a498e
destutil: ensure we offer 'hg update' hint when not at head in all cases
In the merge case, we abort if the working copy is not at head, offering to
run 'hg update' in the hint instead. In the rebase case, we do not abort in that
case. Yet if no rebase destination are found, it still make sense to hint the
user about running 'hg update'. So we re-introduce a conditional using this
branch in the 'onheadcheck == False' case.
This will get used on rebase use this function.
author | Pierre-Yves David <pierre-yves.david@fb.com> |
---|---|
date | Tue, 09 Feb 2016 23:35:21 +0000 |
parents | 098cb7bd46a7 |
children | 3784d9eb7245 |
files | mercurial/destutil.py |
diffstat | 1 files changed, 6 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/destutil.py Mon Feb 15 14:35:26 2016 +0000 +++ b/mercurial/destutil.py Tue Feb 09 23:35:21 2016 +0000 @@ -235,7 +235,8 @@ branch = ctx.branch() bheads = repo.branchheads(branch) - if onheadcheck and not repo.revs('%ld and %ln', sourceset, bheads): + onhead = repo.revs('%ld and %ln', sourceset, bheads) + if onheadcheck and not onhead: # Case A: working copy if not on a head. (merge only) # # This is probably a user mistake We bailout pointing at 'hg update' @@ -267,6 +268,10 @@ elif len(repo.heads()) > 1: msg, hint = msgdestmerge['nootherbranchheads'][action] msg %= branch + elif not onhead: + # if 'onheadcheck == False' (rebase case), + # this was not caught in Case A. + msg, hint = msgdestmerge['nootherheadsbehind'][action] else: msg, hint = msgdestmerge['nootherheads'][action] raise error.NoMergeDestAbort(msg, hint=hint)