diff hgext/rebase.py @ 15132:81f76098211e

rebase: allow rebase to ancestor (issue3010) We only deny rebasing onto direct parent. Thanks to the ancestor argument of merge. the "implementation" of this feature only consist in loosing the check and imply detach when rebasing on ancestor.
author Pierre-Yves David <pierre-yves.david@logilab.fr>
date Mon, 19 Sep 2011 16:57:13 +0200
parents 2957b8b1e809
children 231aac5280ba
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Sep 18 19:59:33 2011 -0400
+++ b/hgext/rebase.py	Mon Sep 19 16:57:13 2011 +0200
@@ -536,11 +536,14 @@
 
     if src:
         commonbase = repo[src].ancestor(repo[dest])
-        samebranch = repo[src].branch() == repo[dest].branch()
         if commonbase == repo[src]:
             raise util.Abort(_('source is ancestor of destination'))
-        if samebranch and commonbase == repo[dest]:
-            raise util.Abort(_('source is descendant of destination'))
+        if commonbase == repo[dest]:
+            samebranch = repo[src].branch() == repo[dest].branch()
+            if samebranch and repo[src] in repo[dest].children():
+                raise util.Abort(_('source is a child of destination'))
+            # rebase on ancestor, force detach
+            detach = True
         source = repo[src].rev()
         if detach:
             # We need to keep track of source's ancestors up to the common base