diff hgext/rebase.py @ 19925:9c78ed396075

rebase: preserve working directory parent (BC) Prior to this changeset, rebase always left the working directory as a parent of the last rebased changeset. The is dubious when, before the rebase, the working directory was not a parent of the tip most rebased changeset. With this changeset, we move the working directory back to its original parent. If the original parent was rebased, we use it's successors. This is a step toward solving issue3813 (rebase loses active bookmark if it's not on a head)
author Pierre-Yves David <pierre-yves.david@ens-lyon.org>
date Mon, 14 Oct 2013 16:12:29 +0200
parents a69a77a80900
children 0f99747202f9
line wrap: on
line diff
--- a/hgext/rebase.py	Mon Oct 14 16:49:54 2013 +0200
+++ b/hgext/rebase.py	Mon Oct 14 16:12:29 2013 +0200
@@ -359,6 +359,13 @@
             # this should probably be cleaned up
             targetnode = repo[target].node()
 
+        # restore original working directory
+        # (we do this before stripping)
+        newwd = state.get(originalwd, originalwd)
+        if newwd not in [c.rev() for c in repo[None].parents()]:
+            ui.note(_("update back to initial working directory parent\n"))
+            hg.updaterepo(repo, newwd, False)
+
         if not keepf:
             collapsedas = None
             if collapsef: