diff hgext/rebase.py @ 29372:0b5e9a625042

rebase: do not abort if all changesets have equivalents in the destination
author Kostia Balytskyi <ikostia@fb.com>
date Fri, 17 Jun 2016 16:59:08 +0100
parents 8a080faba2eb
children adb0d58b8b0b
line wrap: on
line diff
--- a/hgext/rebase.py	Thu Jun 16 15:15:33 2016 -0700
+++ b/hgext/rebase.py	Fri Jun 17 16:59:08 2016 +0100
@@ -531,6 +531,9 @@
             for k, v in rbsrt.state.iteritems():
                 if v > nullmerge:
                     nstate[repo[k].node()] = repo[v].node()
+                elif v == revprecursor:
+                    succ = obsoletenotrebased[k]
+                    nstate[repo[k].node()] = repo[succ].node()
             # XXX this is the same as dest.node() for the non-continue path --
             # this should probably be cleaned up
             targetnode = repo[rbsrt.target].node()
@@ -538,7 +541,9 @@
         # restore original working directory
         # (we do this before stripping)
         newwd = rbsrt.state.get(rbsrt.originalwd, rbsrt.originalwd)
-        if newwd < 0:
+        if newwd == revprecursor:
+            newwd = obsoletenotrebased[rbsrt.originalwd]
+        elif newwd < 0:
             # original directory is a parent of rebase set root or ignored
             newwd = rbsrt.originalwd
         if newwd not in [c.rev() for c in repo[None].parents()]:
@@ -777,17 +782,6 @@
               "experimental.allowdivergence=True")
         raise error.Abort(msg % (",".join(divhashes),), hint=h)
 
-    # - plain prune (no successor) changesets are rebased
-    # - split changesets are not rebased if at least one of the
-    # changeset resulting from the split is an ancestor of dest
-    rebaseset = rebasesetrevs - rebaseobsskipped
-    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)
-
 def defineparents(repo, rev, target, state, targetancestors,
                   obsoletenotrebased):
     'Return the new parent relationship of the revision that will be rebased'