hgext/rebase.py
changeset 26677 e9b3d523f2e6
parent 26675 b73eb98c0243
child 26717 1755e1d9d1c3
--- a/hgext/rebase.py	Wed Oct 14 18:03:17 2015 -0500
+++ b/hgext/rebase.py	Tue Oct 13 14:06:51 2015 -0700
@@ -920,7 +920,11 @@
 
     activebookmark: the name of the bookmark that should be active after the
         restore'''
-    dstates = [s for s in state.values() if s >= 0]
+
+    # If the first commits in the rebased set get skipped during the rebase,
+    # their values within the state mapping will be the target rev id. The
+    # dstates list must must not contain the target rev (issue4896)
+    dstates = [s for s in state.values() if s >= 0 and s != target]
     immutable = [d for d in dstates if not repo[d].mutable()]
     cleanup = True
     if immutable: