hgext/rebase.py
changeset 15132 81f76098211e
parent 14917 2957b8b1e809
child 15214 231aac5280ba
--- 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