changeset 4065:8ee983e3d461

fix strip'ping the second parent of a merge
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Tue, 06 Feb 2007 15:54:58 -0200
parents 5d9ede002453
children cff3e4b4a8de
files hgext/mq.py tests/test-mq tests/test-mq.out
diffstat 3 files changed, 72 insertions(+), 3 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Tue Feb 06 15:43:01 2007 -0200
+++ b/hgext/mq.py	Tue Feb 06 15:54:58 2007 -0200
@@ -678,9 +678,10 @@
             while True:
                 seen[n] = 1
                 pp = chlog.parents(n)
-                if pp[1] != revlog.nullid and chlog.rev(pp[1]) > revnum:
-                    if pp[1] not in seen:
-                        heads.append(pp[1])
+                if pp[1] != revlog.nullid:
+                    for p in pp:
+                        if chlog.rev(p) > revnum and p not in seen:
+                            heads.append(p)
                 if pp[0] == revlog.nullid:
                     break
                 if chlog.rev(pp[0]) < revnum:
--- a/tests/test-mq	Tue Feb 06 15:43:01 2007 -0200
+++ b/tests/test-mq	Tue Feb 06 15:54:58 2007 -0200
@@ -246,3 +246,22 @@
 hg qrefresh --git
 cat .hg/patches/bar
 hg log -vC --template '{rev} {file_copies%filecopy}\n' -r .
+
+echo '% strip again'
+cd ..
+hg init strip
+cd strip
+touch foo
+hg add foo
+hg ci -m 'add foo' -d '0 0'
+echo >> foo
+hg ci -m 'change foo 1' -d '0 0'
+hg up -C 0
+echo 1 >> foo
+hg ci -m 'change foo 2' -d '0 0'
+HGMERGE=true hg merge
+hg ci -m merge -d '0 0'
+hg log
+hg strip 1 2>&1 | sed 's/\(saving bundle to \).*/\1/'
+hg log
+
--- a/tests/test-mq.out	Tue Feb 06 15:43:01 2007 -0200
+++ b/tests/test-mq.out	Tue Feb 06 15:54:58 2007 -0200
@@ -264,3 +264,52 @@
 @@ -0,0 +1,1 @@
 +bar
 3 barney (foo)
+% strip again
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+merging foo
+0 files updated, 1 files merged, 0 files removed, 0 files unresolved
+(branch merge, don't forget to commit)
+changeset:   3:99615015637b
+tag:         tip
+parent:      2:20cbbe65cff7
+parent:      1:d2871fc282d4
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     merge
+
+changeset:   2:20cbbe65cff7
+parent:      0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 2
+
+changeset:   1:d2871fc282d4
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 1
+
+changeset:   0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+
+1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+saving bundle to 
+saving bundle to 
+adding branch
+adding changesets
+adding manifests
+adding file changes
+added 1 changesets with 1 changes to 1 files
+(run 'hg update' to get a working copy)
+changeset:   1:20cbbe65cff7
+tag:         tip
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     change foo 2
+
+changeset:   0:53245c60e682
+user:        test
+date:        Thu Jan 01 00:00:00 1970 +0000
+summary:     add foo
+