changeset 16280:0806823370d8 stable

rebase: properly calculate descendant set when aborting (issue3332) Checking for descendants of target being public was also wrong.
author Matt Mackall <mpm@selenic.com>
date Thu, 22 Mar 2012 17:47:00 -0500
parents 900eee0778d1
children d8cc67114dc3
files hgext/rebase.py
diffstat 1 files changed, 8 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- 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