Mercurial > hg-stable
diff hgext/rebase.py @ 20249:dc5157841361
rebase: improve error message for --base being empty or causing emptiness
Before it just said 'nothing to rebase'.
Now 'if "base" is an empty set:
abort: empty "base" revision set - can't compute rebase set
If the set of changesets to rebase can't be found from "base", it will fail as
before but with more explanation of what the problem was.
The name of the "base" option is not obvious - it is more like "samples
identifying the branch to rebase". The error messages for problems with the
specified "base" value will use that term and might thus also not be obvious,
but at least they are consistent with the option name. The name "base" will not
be used if the base only was specified implicitly as the working directory
parent.
author | Mads Kiilerich <madski@unity3d.com> |
---|---|
date | Sun, 17 Nov 2013 18:21:58 -0500 |
parents | 3bff26f67169 |
children | f380b191e085 |
line wrap: on
line diff
--- a/hgext/rebase.py Sun Nov 17 18:21:58 2013 -0500 +++ b/hgext/rebase.py Sun Nov 17 18:21:58 2013 -0500 @@ -233,9 +233,35 @@ assert rebaseset else: base = scmutil.revrange(repo, [basef or '.']) + if not base: + raise util.Abort(_('empty "base" revision set - ' + "can't compute rebase set")) rebaseset = repo.revs( '(children(ancestor(%ld, %d)) and ::(%ld))::', base, dest, base) + if not rebaseset: + if base == [dest.rev()]: + if basef: + ui.status(_('nothing to rebase - %s is both "base"' + ' and destination\n') % dest) + else: + ui.status(_('nothing to rebase - working directory ' + 'parent is also destination\n')) + elif not repo.revs('%ld - ::%d', base, dest): + if basef: + ui.status(_('nothing to rebase - "base" %s is ' + 'already an ancestor of destination ' + '%s\n') % + ('+'.join(str(repo[r]) for r in base), + dest)) + else: + ui.status(_('nothing to rebase - working ' + 'directory parent is already an ' + 'ancestor of destination %s\n') % dest) + else: # can it happen? + ui.status(_('nothing to rebase from %s to %s\n') % + ('+'.join(str(repo[r]) for r in base), dest)) + return 1 if rebaseset: root = min(rebaseset) else: