hgext/rebase.py
branchstable
changeset 16280 0806823370d8
parent 16228 5b41d5ad52bf
child 16531 b9f51f49bf2a
--- a/hgext/rebase.py	Thu Mar 22 17:07:39 2012 -0500
+++ b/hgext/rebase.py	Thu Mar 22 17:47:00 2012 -0500
@@ -557,15 +557,18 @@
 
 def abort(repo, originalwd, target, state):
     'Restore the repository to its original state'
-    descendants = repo.changelog.descendants
-    ispublic = lambda r: repo._phaserev[r] == phases.public
-    if filter(ispublic, descendants(target)):
+    dstates = [s for s in state.values() if s != nullrev]
+    if [d for d in dstates if not repo[d].mutable()]:
         repo.ui.warn(_("warning: immutable rebased changeset detected, "
                        "can't abort\n"))
         return -1
-    elif set(descendants(target)) - set(state.values()):
+
+    descendants = set()
+    if dstates:
+        descendants = set(repo.changelog.descendants(*dstates))
+    if descendants - set(dstates):
         repo.ui.warn(_("warning: new changesets detected on target branch, "
-                                                    "can't abort\n"))
+                       "can't abort\n"))
         return -1
     else:
         # Strip from the first rebased revision