mq: pull --rebase bug after changeset crew:1b82a26635d7

Giorgos Keramidas keramida at ceid.upatras.gr
Mon Jul 12 01:22:18 CDT 2010


I recently installed crew:f4eddec324b7 and noticed that pull --rebase
seems to be *removing* patches from the .hg/patches/.hg repo:

    keramida at kobe:~$ cd /tmp
    keramida at kobe:/tmp$ mkdir hgtest
    keramida at kobe:/tmp$ cd hgtest
    keramida at kobe:/tmp/hgtest$ hg init foo
    keramida at kobe:/tmp/hgtest$ cd foo
    keramida at kobe:/tmp/hgtest/foo$ echo foo > foo
    keramida at kobe:/tmp/hgtest/foo$ hg add
    adding foo
    keramida at kobe:/tmp/hgtest/foo$ hg commit -m foo
    keramida at kobe:/tmp/hgtest/foo$ cd ..
    keramida at kobe:/tmp/hgtest$ export LANG=C
    keramida at kobe:/tmp/hgtest$ export LC_ALL=C
    keramida at kobe:/tmp/hgtest$ hg clone foo bar
    updating to branch default
    1 files updated, 0 files merged, 0 files removed, 0 files unresolved
    keramida at kobe:/tmp/hgtest$ cd bar
    keramida at kobe:/tmp/hgtest/bar$ hg qinit -c
    keramida at kobe:/tmp/hgtest/bar$ echo bar > bar
    keramida at kobe:/tmp/hgtest/bar$ hg add
    adding bar
    keramida at kobe:/tmp/hgtest/bar$ hg qnew --git -f -m 'add a new "bar" file' bar-patch
    keramida at kobe:/tmp/hgtest/bar$ hg qcommit -m 'new patch queue'
    keramida at kobe:/tmp/hgtest/bar$ cd ../foo
    keramida at kobe:/tmp/hgtest/foo$ echo foobar > foo
    keramida at kobe:/tmp/hgtest/foo$ hg commit -m foobar
    keramida at kobe:/tmp/hgtest/foo$ cd -
    /tmp/hgtest/bar
    keramida at kobe:/tmp/hgtest/bar$ mq manifest
    .hgignore
    bar-patch
    series
    keramida at kobe:/tmp/hgtest/bar$ mq stat
    keramida at kobe:/tmp/hgtest/bar$ hg pull --rebase
    pulling from /tmp/hgtest/foo
    searching for changes
    adding changesets
    adding manifests
    adding file changes
    added 1 changesets with 1 changes to 1 files (+1 heads)
    saved backup bundle to /tmp/hgtest/bar/.hg/strip-backup/bead1dfa5063-backup.hg
    keramida at kobe:/tmp/hgtest/bar$ mq manifest
    .hgignore
    bar-patch
    series
    keramida at kobe:/tmp/hgtest/bar$ mq stat
=>  R bar-patch
    keramida at kobe:/tmp/hgtest/bar$

The bar-patch file in .hg/patches should not be left in 'removed' state
when pull --rebase is done!

Running the following test script in an empty /tmp/hgtest directory
should show the bar-patch as "modified" when rebase is done.  If the
patch shows up as removed (R) then it's wrong.

Bisecting between crew 8b452fe4bf50:f4eddec324b7 I found that the first
revision where pull --rebase messes up the MQ patch state is:

    keramida at kobe:/hg/mercurial/crew$ hg bisect -b
    The first bad revision is:
    changeset:   11462:1b82a26635d7
    branch:      stable
    user:        Vishakh H <vsh426 at gmail.com>
    date:        Tue Jun 29 03:09:42 2010 +0530
    summary:     mq: qimport cleanup on fail (issue2214)

The attached patch changes /tests/test-rebase-mq to show the bug in action...

------------------------------------------------------------------------
# HG changeset patch
# User Giorgos Keramidas <keramida at ceid.upatras.gr>
# Date 1278915568 -10800
# Node ID a10aa9dc627e5ab45afd9c0d51208203a7a98ac1
# Parent  f753dfae000afffad4741cf6a7a4a7a88537a0d3
tests: add a rebase test for committed MQ patches

diff -r f753dfae000a -r a10aa9dc627e tests/test-rebase-mq
--- a/tests/test-rebase-mq	Sun Jul 11 16:37:06 2010 +0300
+++ b/tests/test-rebase-mq	Mon Jul 12 09:19:28 2010 +0300
@@ -101,6 +101,11 @@
 hg qnew f.patch
 echo 'mq2' > p
 hg qref -m 'P1'
+hg qcommit -m 'save patch state'
+echo '% patch series step 1/2'
+hg qseries -s
+echo '% patch queue manifest step 1/2'
+hg -R .hg/patches manifest
 
 echo '% Git patch'
 cat .hg/patches/f_git.patch  | filterpatch
@@ -112,6 +117,11 @@
 echo
 echo '% Rebase the applied mq patches'
 hg rebase -s 2 -d 1 --quiet
+hg qcommit -m 'save patch state'
+echo '% patch series step 2/2'
+hg qseries -s
+echo '% patch queue manifest step 2/2'
+hg -R .hg/patches manifest
 
 echo '% And the patches are correct'
 echo '% Git patch'
diff -r f753dfae000a -r a10aa9dc627e tests/test-rebase-mq.out
--- a/tests/test-rebase-mq.out	Sun Jul 11 16:37:06 2010 +0300
+++ b/tests/test-rebase-mq.out	Mon Jul 12 09:19:28 2010 +0300
@@ -80,6 +80,14 @@
 popping f.patch
 patch queue now empty
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+% patch series step 1/2
+f_git.patch: P0 (git)
+f.patch: P1
+% patch queue manifest step 1/2
+.hgignore
+f.patch
+f_git.patch
+series
 % Git patch
 P0 (git)
 
@@ -101,6 +109,14 @@
 +mq2
 
 % Rebase the applied mq patches
+% patch series step 2/2
+f_git.patch: P0 (git)
+f.patch: P1
+% patch queue manifest step 2/2
+.hgignore
+f.patch
+f_git.patch
+series
 % And the patches are correct
 % Git patch
 # HG changeset patch
------------------------------------------------------------------------


More information about the Mercurial-devel mailing list