Mercurial > hg
changeset 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 |
files | hgext/rebase.py tests/test-largefiles.t tests/test-rebase-parameters.t tests/test-rebase-pull.t tests/test-rebase-scenario-global.t |
diffstat | 5 files changed, 44 insertions(+), 7 deletions(-) [+] |
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:
--- a/tests/test-largefiles.t Sun Nov 17 18:21:58 2013 -0500 +++ b/tests/test-largefiles.t Sun Nov 17 18:21:58 2013 -0500 @@ -977,7 +977,7 @@ M sub2/large6 saved backup bundle to $TESTTMP/d/.hg/strip-backup/f574fb32bb45-backup.hg (glob) 0 largefiles cached - nothing to rebase + nothing to rebase - working directory parent is also destination $ [ -f .hg/largefiles/e166e74c7303192238d60af5a9c4ce9bef0b7928 ] $ hg log --template '{rev}:{node|short} {desc|firstline}\n' 9:598410d3eb9a modify normal file largefile in repo d
--- a/tests/test-rebase-parameters.t Sun Nov 17 18:21:58 2013 -0500 +++ b/tests/test-rebase-parameters.t Sun Nov 17 18:21:58 2013 -0500 @@ -87,14 +87,26 @@ abort: empty "source" revision set - nothing to rebase [255] + $ hg rebase --base '1 & !1' + abort: empty "base" revision set - can't compute rebase set + [255] + $ hg rebase - nothing to rebase + nothing to rebase - working directory parent is also destination + [1] + + $ hg rebase -b. + nothing to rebase - e7ec4e813ba6 is both "base" and destination [1] $ hg up -q 7 $ hg rebase --traceback - nothing to rebase + nothing to rebase - working directory parent is already an ancestor of destination e7ec4e813ba6 + [1] + + $ hg rebase -b. + nothing to rebase - "base" 02de42196ebe is already an ancestor of destination e7ec4e813ba6 [1] $ hg rebase --dest '1 & !1' @@ -137,7 +149,6 @@ $ cd .. - Rebase with base == '.' => same as no arguments (from 3 onto 8): $ hg clone -q -u 3 a a2
--- a/tests/test-rebase-pull.t Sun Nov 17 18:21:58 2013 -0500 +++ b/tests/test-rebase-pull.t Sun Nov 17 18:21:58 2013 -0500 @@ -84,7 +84,7 @@ adding manifests adding file changes added 1 changesets with 1 changes to 1 files - nothing to rebase + nothing to rebase - working directory parent is already an ancestor of destination 77ae9631bcca 1 files updated, 0 files merged, 0 files removed, 0 files unresolved updating bookmark norebase
--- a/tests/test-rebase-scenario-global.t Sun Nov 17 18:21:58 2013 -0500 +++ b/tests/test-rebase-scenario-global.t Sun Nov 17 18:21:58 2013 -0500 @@ -235,7 +235,7 @@ G onto G - rebase onto same changeset: $ hg rebase -b 6 -d 6 - nothing to rebase + nothing to rebase - eea13746799a is both "base" and destination [1] G onto F - rebase onto an ancestor: @@ -247,7 +247,7 @@ F onto G - rebase onto a descendant: $ hg rebase -b 5 -d 6 - nothing to rebase + nothing to rebase - "base" 24b6387c8c8c is already an ancestor of destination eea13746799a [1] C onto A - rebase onto an ancestor: