rebase: better error message when rebased changes are all in destination
authorLaurent Charignon <lcharignon@fb.com>
Tue, 29 Dec 2015 15:32:12 -0800
changeset 27577 f9e755736b0e
parent 27576 6cd3044985c2
child 27578 d35ff0b0d0da
rebase: better error message when rebased changes are all in destination Before this patch, when rebasing a set of obsolete revisions that were plain pruned or already present in the destination, we were displaying: abort: no matching revisions This was not very helpful to understand what was going on, instead we replace the error message by: abort: all requested changesets have equivalents or were marked as obsolete (to force the rebase, set the config experimental.rebaseskipobsolete to False)
hgext/rebase.py
tests/test-rebase-obsolete.t
--- a/hgext/rebase.py	Wed Dec 30 13:10:53 2015 -0800
+++ b/hgext/rebase.py	Tue Dec 29 15:32:12 2015 -0800
@@ -348,6 +348,13 @@
                 # - split changesets are not rebased if at least one of the
                 # changeset resulting from the split is an ancestor of dest
                 rebaseset = rebasesetrevs - set(obsoletenotrebased)
+                if rebasesetrevs and not rebaseset:
+                    msg = _('all requested changesets have equivalents '
+                            'or were marked as obsolete')
+                    hint = _('to force the rebase, set the config '
+                             'experimental.rebaseskipobsolete to False')
+                    raise error.Abort(msg, hint=hint)
+
             result = buildstate(repo, dest, rebaseset, collapsef,
                                 obsoletenotrebased)
 
--- a/tests/test-rebase-obsolete.t	Wed Dec 30 13:10:53 2015 -0800
+++ b/tests/test-rebase-obsolete.t	Tue Dec 29 15:32:12 2015 -0800
@@ -685,3 +685,30 @@
   rebasing 4:ff2c4d47b71d "C"
   note: not rebasing 7:360bbaa7d3ce "O", it has no successor
   rebasing 8:8d47583e023f "P" (tip)
+
+If all the changeset to be rebased are obsolete and present in the destination, we
+should display a friendly error message
+
+  $ hg log -G
+  @  10:121d9e3bc4c6 P
+  |
+  o  9:4be60e099a77 C
+  |
+  o  6:9c48361117de D
+  |
+  o  2:261e70097290 B2
+  |
+  o  0:4a2df7238c3b A
+  
+
+  $ hg up 9
+  0 files updated, 0 files merged, 1 files removed, 0 files unresolved
+  $ echo "non-relevant change" > nonrelevant
+  $ hg add nonrelevant
+  $ hg commit -m nonrelevant
+  created new head
+  $ hg debugobsolete `hg log -r 11 -T '{node}\n'` --config experimental.evolution=all
+  $ hg rebase -r . -d 10
+  abort: all requested changesets have equivalents or were marked as obsolete
+  (to force the rebase, set the config experimental.rebaseskipobsolete to False)
+  [255]