changeset 15469:ad336e093a59 stable

rebase: ensure target is not taken as external (issue3085) This could happen in specific situations in which 'target' was selected as external and used for p1 _and_ p2.
author Stefano Tortarolo <stefano.tortarolo@gmail.com>
date Tue, 08 Nov 2011 17:09:48 +0100
parents 3411a83e232a
children 93273948cdce
files hgext/rebase.py tests/test-rebase-detach.t
diffstat 2 files changed, 56 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/rebase.py	Sun Nov 06 23:35:33 2011 +0100
+++ b/hgext/rebase.py	Tue Nov 08 17:09:48 2011 +0100
@@ -215,6 +215,7 @@
                 originalwd, target, state = result
                 if collapsef:
                     targetancestors = set(repo.changelog.ancestors(target))
+                    targetancestors.add(target)
                     external = checkexternal(repo, state, targetancestors)
 
         if keepbranchesf:
--- a/tests/test-rebase-detach.t	Sun Nov 06 23:35:33 2011 +0100
+++ b/tests/test-rebase-detach.t	Tue Nov 08 17:09:48 2011 +0100
@@ -305,9 +305,61 @@
   
   $ cd ..
 
+Verify that target is not selected as external rev (issue3085)
+
+  $ hg clone -q -U a a6
+  $ cd a6
+  $ hg up -q 6
+
+  $ echo "I" >> E
+  $ hg ci -m "I"
+  $ hg merge 7
+  1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+  (branch merge, don't forget to commit)
+  $ hg ci -m "Merge"
+  $ echo "J" >> F
+  $ hg ci -m "J"
+
+  $ hg rebase -s 8 -d 7 --collapse --detach --config ui.merge=internal:other
+  remote changed E which local deleted
+  use (c)hanged version or leave (d)eleted? c
+  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/*-backup.hg (glob)
+
+  $ hg tglog
+  @  8: 'Collapsed revision
+  |  * I
+  |  * Merge
+  |  * J'
+  o  7: 'H'
+  |
+  | o  6: 'G'
+  |/|
+  o |  5: 'F'
+  | |
+  | o  4: 'E'
+  |/
+  | o  3: 'D'
+  | |
+  | o  2: 'C'
+  | |
+  | o  1: 'B'
+  |/
+  o  0: 'A'
+  
+
+  $ hg parents
+  changeset:   8:9472f4b1d736
+  tag:         tip
+  user:        test
+  date:        Thu Jan 01 00:00:00 1970 +0000
+  summary:     Collapsed revision
+  
+
+  $ cd ..
+
 Ensure --continue restores a correct state (issue3046):
-  $ hg clone -q a a6
-  $ cd a6
+  $ hg clone -q a a7
+  $ cd a7
   $ hg up -q 3
   $ echo 'H2' > H
   $ hg ci -A -m 'H2'
@@ -320,7 +372,7 @@
   [255]
   $ hg resolve --all -t internal:local
   $ hg rebase -c
-  saved backup bundle to $TESTTMP/a6/.hg/strip-backup/6215fafa5447-backup.hg
+  saved backup bundle to $TESTTMP/a7/.hg/strip-backup/6215fafa5447-backup.hg
   $ hg tglog
   @  8: 'H2'
   |