rebase: support --detach when null is common ancestor stable
authorHenrik Stuart <hg@hstuart.dk>
Sat, 20 Nov 2010 09:51:56 +0100
branchstable
changeset 13021 6c800e7ef2f6
parent 13020 ea3bada953d3
child 13024 da69a1597285
child 13025 99210fb3bc0a
rebase: support --detach when null is common ancestor
hgext/rebase.py
tests/test-rebase-detach.t
--- a/hgext/rebase.py	Thu Nov 18 19:52:58 2010 -0200
+++ b/hgext/rebase.py	Sat Nov 20 09:51:56 2010 +0100
@@ -485,7 +485,7 @@
             srcancestors = set(repo.changelog.ancestors(source))
             baseancestors = set(repo.changelog.ancestors(commonbase.rev()))
             detachset = srcancestors - baseancestors
-            detachset.remove(commonbase.rev())
+            detachset.discard(commonbase.rev())
     else:
         if base:
             cwd = repo[base].rev()
--- a/tests/test-rebase-detach.t	Thu Nov 18 19:52:58 2010 -0200
+++ b/tests/test-rebase-detach.t	Sat Nov 20 09:51:56 2010 +0100
@@ -191,3 +191,44 @@
 
   $ cd ..
 
+Rebasing across null as ancestor
+  $ hg clone -q -U a a5
+
+  $ cd a5
+
+  $ echo x > x
+
+  $ hg add x
+
+  $ hg ci -m "extra branch"
+  created new head
+
+  $ hg tglog
+  @  5: 'extra branch'
+  
+  o  4: 'E'
+  |
+  | o  3: 'D'
+  | |
+  | o  2: 'C'
+  | |
+  | o  1: 'B'
+  |/
+  o  0: 'A'
+  
+  $ hg rebase --detach -s 1 -d tip
+  saved backup bundle to $TESTTMP/a5/.hg/strip-backup/*-backup.hg (glob)
+
+  $ hg tglog
+  @  5: 'D'
+  |
+  o  4: 'C'
+  |
+  o  3: 'B'
+  |
+  o  2: 'extra branch'
+  
+  o  1: 'E'
+  |
+  o  0: 'A'
+