hgext/rebase.py
branchstable
changeset 27988 61f4d59e9a0b
parent 27977 b698abf971e7
child 28015 a036e1ae1fbe
--- a/hgext/rebase.py	Tue Feb 02 23:49:49 2016 +0900
+++ b/hgext/rebase.py	Fri Feb 05 01:56:46 2016 +0000
@@ -975,15 +975,20 @@
             cleanup = False
 
         if cleanup:
+            shouldupdate = False
+            rebased = filter(lambda x: x >= 0 and x != target, state.values())
+            if rebased:
+                strippoints = [
+                        c.node() for c in repo.set('roots(%ld)', rebased)]
+                shouldupdate = len([
+                        c.node() for c in repo.set('. & (%ld)', rebased)]) > 0
+
             # Update away from the rebase if necessary
-            if needupdate(repo, state):
+            if shouldupdate or needupdate(repo, state):
                 merge.update(repo, originalwd, False, True)
 
             # Strip from the first rebased revision
-            rebased = filter(lambda x: x >= 0 and x != target, state.values())
             if rebased:
-                strippoints = [
-                        c.node()  for c in repo.set('roots(%ld)', rebased)]
                 # no backup of rebased cset versions needed
                 repair.strip(repo.ui, repo, strippoints)