[PATCH] mq: qpop now tells which patches are popped

Mads Kiilerich mads at kiilerich.com
Thu Jul 9 17:00:19 CDT 2009


# HG changeset patch
# User Mads Kiilerich <mads at kiilerich.com>
# Date 1247176743 -7200
# Node ID a15c20d8d6b0de43e5f3ce3579e02494277f8fb8
# Parent  6cf043b1aa144db317beef7a5ecbbc86e7bed820
mq: qpop now tells which patches are popped

When navigating through a patch series by qpushing and qpopping it was easy to
get lost because qpop was silent. I found myself often running qnext after qpop
to see which patch I just dropped - especially if I was about to qrm it. This
patch makes qpop more symmetric to qpush by showing which patches are
applied/"unapplied".

I think it is a good change even though it changes output by adding a new line
of output.

diff --git a/hgext/mq.py b/hgext/mq.py
--- a/hgext/mq.py
+++ b/hgext/mq.py
@@ -1080,6 +1080,8 @@
                     except: pass
                     repo.dirstate.forget(f)
                 repo.dirstate.setparents(qp, nullid)
+            for patch in reversed(self.applied[start:end]):
+                self.ui.warn(_("popping %s\n") % patch.name)
             del self.applied[start:end]
             self.strip(repo, rev, update=False, backup='strip')
             if len(self.applied):
diff --git a/tests/test-mq-caches.out b/tests/test-mq-caches.out
--- a/tests/test-mq-caches.out
+++ b/tests/test-mq-caches.out
@@ -5,6 +5,7 @@
 No branch cache
 
 # some regular revisions
+popping p1
 patch queue now empty
 tip: 1
 3f910abad313ff802d3a23a7529433872df9b3ae 1
@@ -43,6 +44,9 @@
 qbase: 1
 
 # detect an invalid cache
+popping p2
+popping p1
+popping p0
 patch queue now empty
 applying p0
 applying p1
diff --git a/tests/test-mq-eol.out b/tests/test-mq-eol.out
--- a/tests/test-mq-eol.out
+++ b/tests/test-mq-eol.out
@@ -9,12 +9,14 @@
 patch failed, unable to continue (try -v)
 patch failed, rejects left in working dir
 errors during apply, please fix and refresh eol.diff
+popping eol.diff
 patch queue now empty
 % invalid eol
 applying eol.diff
 patch failed, unable to continue (try -v)
 patch failed, rejects left in working dir
 errors during apply, please fix and refresh eol.diff
+popping eol.diff
 patch queue now empty
 % force LF
 applying eol.diff
@@ -42,6 +44,7 @@
 c<CR><LF>
 d<CR><LF>
 z
+popping eol.diff
 patch queue now empty
 % push again forcing LF and compare revisions
 applying eol.diff
@@ -51,6 +54,7 @@
 c<CR><LF>
 d<CR><LF>
 z
+popping eol.diff
 patch queue now empty
 % push again without LF and compare revisions
 applying eol.diff
@@ -60,4 +64,5 @@
 c<CR><LF>
 d<CR><LF>
 z
+popping eol.diff
 patch queue now empty
diff --git a/tests/test-mq-guards.out b/tests/test-mq-guards.out
--- a/tests/test-mq-guards.out
+++ b/tests/test-mq-guards.out
@@ -1,4 +1,7 @@
 adding x
+popping c.patch
+popping b.patch
+popping a.patch
 patch queue now empty
 % should fail
 abort: no patch named does-not-exist.patch
@@ -9,6 +12,7 @@
 % should guard a.patch
 % should print +a
 a.patch: +a
+popping a.patch
 patch queue now empty
 % should fail
 cannot push 'a.patch' - guarded by ['+a']
@@ -16,6 +20,7 @@
 % should push b.patch
 applying b.patch
 now at: b.patch
+popping b.patch
 patch queue now empty
 % test selection of an empty guard
 abort: guard cannot be an empty string
@@ -34,6 +39,9 @@
 % should push c.patch
 applying c.patch
 now at: c.patch
+popping c.patch
+popping b.patch
+popping a.patch
 patch queue now empty
 guards deactivated
 number of unguarded, unapplied patches has changed from 3 to 2
@@ -41,6 +49,8 @@
 applying b.patch
 applying c.patch
 now at: c.patch
+popping c.patch
+popping b.patch
 patch queue now empty
 number of unguarded, unapplied patches has changed from 1 to 2
 % should push a.patch, not b.patch
@@ -48,6 +58,8 @@
 now at: a.patch
 applying c.patch
 now at: c.patch
+popping c.patch
+popping a.patch
 patch queue now empty
 % should push b.patch
 applying b.patch
@@ -55,6 +67,8 @@
 applying c.patch
 now at: c.patch
 c.patch
+popping c.patch
+popping b.patch
 patch queue now empty
 number of unguarded, unapplied patches has changed from 2 to 3
 % should push a.patch, b.patch
@@ -62,6 +76,8 @@
 now at: a.patch
 applying b.patch
 now at: b.patch
+popping b.patch
+popping a.patch
 patch queue now empty
 number of unguarded, unapplied patches has changed from 3 to 2
 % list patches and guards
@@ -83,6 +99,8 @@
 now at: c.patch
 guards deactivated
 popping guarded patches
+popping c.patch
+popping b.patch
 patch queue now empty
 reapplying unguarded patches
 applying c.patch
@@ -100,6 +118,7 @@
 new.patch: +1 +2 -3
 b.patch: +2
 c.patch: unguarded
+popping d.patch
 now at: c.patch
 % should show new.patch and b.patch as Guarded, c.patch as Applied
 % and d.patch as Unapplied
@@ -112,6 +131,7 @@
 1 G b.patch
 2 A c.patch
 3 G d.patch
+popping c.patch
 patch queue now empty
 new.patch: +1 +2 -3
 b.patch: +2
diff --git a/tests/test-mq-header-date.out b/tests/test-mq-header-date.out
--- a/tests/test-mq-header-date.out
+++ b/tests/test-mq-header-date.out
@@ -42,6 +42,7 @@
 +2
 1: [mq]: 2.patch - test
 0: [mq]: 1.patch - test
+popping 2.patch
 now at: 1.patch
 ==== qnew -d -m
 # HG changeset patch
@@ -127,8 +128,10 @@
 2: Four - test
 1: Three (again) - test
 0: [mq]: 1.patch - test
+popping 4.patch
 now at: 3.patch
 ==== qnew with HG header
+popping 5.patch
 now at: 3.patch
 # HG changeset patch
 # Date 10 0
@@ -185,6 +188,7 @@
 2: [mq]: 5.patch - test
 1: Three (again) - test
 0: [mq]: 1.patch - test
+popping 6.patch
 now at: 5.patch
 ==== qnew -d
 adding 7
@@ -240,6 +244,7 @@
 2: [mq]: 5.patch - test
 1: Three (again) - test
 0: [mq]: 1.patch - test
+popping 8.patch
 now at: 7.patch
 ==== qnew -m
 adding 9
@@ -270,8 +275,13 @@
 2: [mq]: 5.patch - test
 1: Three (again) - test
 0: [mq]: 1.patch - test
+popping 9.patch
 now at: 7.patch
 ==== qpop -a / qpush -a
+popping 7.patch
+popping 5.patch
+popping 3.patch
+popping 1.patch
 patch queue now empty
 applying 1.patch
 applying 3.patch
diff --git a/tests/test-mq-header-from.out b/tests/test-mq-header-from.out
--- a/tests/test-mq-header-from.out
+++ b/tests/test-mq-header-from.out
@@ -131,6 +131,7 @@
 1: [mq]: 2.patch - jane
 0: [mq]: 1.patch - mary
 ==== qnew with HG header
+popping 5.patch
 now at: 4.patch
 now at: 5.patch
 # HG changeset patch
@@ -184,6 +185,11 @@
 1: [mq]: 2.patch - jane
 0: [mq]: 1.patch - mary
 ==== qpop -a / qpush -a
+popping 5.patch
+popping 4.patch
+popping 3.patch
+popping 2.patch
+popping 1.patch
 patch queue now empty
 applying 1.patch
 applying 2.patch
diff --git a/tests/test-mq-merge.out b/tests/test-mq-merge.out
--- a/tests/test-mq-merge.out
+++ b/tests/test-mq-merge.out
@@ -10,6 +10,8 @@
 applying rm_a
 now at: rm_a
 b
+popping rm_a
+popping .hg.patches.merge.marker
 patch queue now empty
 
 % init t2
diff --git a/tests/test-mq-missingfiles.out b/tests/test-mq-missingfiles.out
--- a/tests/test-mq-missingfiles.out
+++ b/tests/test-mq-missingfiles.out
@@ -1,4 +1,5 @@
 adding b
+popping changeb
 patch queue now empty
 % push patch with missing target
 applying changeb
@@ -26,6 +27,7 @@
 +c
 +c
 adding b
+popping changeb
 patch queue now empty
 % push git patch with missing target
 applying changeb
@@ -48,6 +50,7 @@
 
 % test push creating directory during git copy or rename
 adding a
+popping patch
 patch queue now empty
 applying patch
 now at: patch
diff --git a/tests/test-mq-pull-from-bundle.out b/tests/test-mq-pull-from-bundle.out
--- a/tests/test-mq-pull-from-bundle.out
+++ b/tests/test-mq-pull-from-bundle.out
@@ -13,6 +13,7 @@
 1: main: one updated.
 ====== Setup queue
 adding two
+popping two.patch
 patch queue now empty
 ====== Bundle queue
 1 changesets found
diff --git a/tests/test-mq-qdelete.out b/tests/test-mq-qdelete.out
--- a/tests/test-mq-qdelete.out
+++ b/tests/test-mq-qdelete.out
@@ -1,6 +1,7 @@
 adding base
 abort: qdelete requires at least one revision or patch name
 abort: cannot delete applied patch c
+popping c
 now at: b
 a
 b
@@ -8,6 +9,7 @@
 b
 series
 status
+popping b
 now at: a
 a
 b
@@ -30,6 +32,7 @@
 no patches applied
 abort: revision 0 is not managed
 abort: cannot delete revision 2 above applied patches
+popping c
 now at: b
 abort: unknown revision 'c'!
 applying c
diff --git a/tests/test-mq-qdiff.out b/tests/test-mq-qdiff.out
--- a/tests/test-mq-qdiff.out
+++ b/tests/test-mq-qdiff.out
@@ -26,6 +26,7 @@
 +patched
 % revert
 % qpop
+popping mqbase
 patch queue now empty
 % qdelete mqbase
 % commit 2
diff --git a/tests/test-mq-qfold.out b/tests/test-mq-qfold.out
--- a/tests/test-mq-qfold.out
+++ b/tests/test-mq-qfold.out
@@ -1,6 +1,8 @@
 % init
 adding a
 % fold in the middle of the queue
+popping p3
+popping p2
 now at: p1
 --- a/a
 +++ b/a
diff --git a/tests/test-mq-qgoto.out b/tests/test-mq-qgoto.out
--- a/tests/test-mq-qgoto.out
+++ b/tests/test-mq-qgoto.out
@@ -1,17 +1,24 @@
 adding a
+popping c.patch
+popping b.patch
 now at: a.patch
 applying b.patch
 applying c.patch
 now at: c.patch
+popping c.patch
 now at: b.patch
 
 % Using index
+popping b.patch
 now at: a.patch
 applying b.patch
 applying c.patch
 now at: c.patch
 
 % No warnings when using index
+popping bug141421
+popping bug314159
+popping c.patch
 now at: b.patch
 applying c.patch
 applying bug314159
diff --git a/tests/test-mq-qimport.out b/tests/test-mq-qimport.out
--- a/tests/test-mq-qimport.out
+++ b/tests/test-mq-qimport.out
@@ -8,12 +8,14 @@
 applying url.diff
 now at: url.diff
 foo
+popping url.diff
 patch queue now empty
 % qimport -f
 adding url.diff to series file
 applying url.diff
 now at: url.diff
 foo2
+popping url.diff
 patch queue now empty
 % build diff with CRLF
 adding b
diff --git a/tests/test-mq-qnew.out b/tests/test-mq-qnew.out
--- a/tests/test-mq-qnew.out
+++ b/tests/test-mq-qnew.out
@@ -20,6 +20,9 @@
 abort: patch "first.patch" already exists
 abort: patch "first.patch" already exists
 % qnew -f from a subdirectory
+popping first.patch
+popping mtest.patch
+popping test.patch
 patch queue now empty
 adding d/b
 M d/b
diff --git a/tests/test-mq-qpush-fail.out b/tests/test-mq-qpush-fail.out
--- a/tests/test-mq-qpush-fail.out
+++ b/tests/test-mq-qpush-fail.out
@@ -1,6 +1,9 @@
 adding foo
 % test qpush on empty series
 no patches in series
+popping bad-patch
+popping patch2
+popping patch1
 patch queue now empty
 applying patch1
 applying patch2
diff --git a/tests/test-mq-symlinks.out b/tests/test-mq-symlinks.out
--- a/tests/test-mq-symlinks.out
+++ b/tests/test-mq-symlinks.out
@@ -1,9 +1,11 @@
 a -> a not a symlink
 a -> b
+popping symlink.patch
 now at: base.patch
 applying symlink.patch
 now at: symlink.patch
 a -> b
+popping removesl.patch
 now at: symlink.patch
 applying removesl.patch
 now at: removesl.patch
diff --git a/tests/test-mq.out b/tests/test-mq.out
--- a/tests/test-mq.out
+++ b/tests/test-mq.out
@@ -108,16 +108,20 @@
  a
 +a
 % qpop
+popping test.patch
 patch queue now empty
 % qpush
 applying test.patch
 now at: test.patch
 % pop/push outside repo
+popping test.patch
 patch queue now empty
 applying test.patch
 now at: test.patch
 % qrefresh in subdir
 % pop/push -a in subdir
+popping test2.patch
+popping test.patch
 patch queue now empty
 applying test.patch
 applying test2.patch
@@ -125,6 +129,7 @@
 % qseries
 test.patch
 test2.patch
+popping test2.patch
 now at: test.patch
 0 A test.patch: foo bar
 1 U test2.patch: 
@@ -140,6 +145,7 @@
 % qnext
 all patches applied
 % pop, qnext, qprev, qapplied
+popping test2.patch
 now at: test.patch
 test2.patch
 only one patch applied
@@ -156,17 +162,24 @@
 % qpush/qpop with index
 applying test2.patch
 now at: test2.patch
+popping test2.patch
+popping test1b.patch
 now at: test.patch
 applying test1b.patch
 now at: test1b.patch
 applying test2.patch
 now at: test2.patch
+popping test2.patch
 now at: test1b.patch
+popping test1b.patch
 now at: test.patch
 applying test1b.patch
 applying test2.patch
 now at: test2.patch
 % push should succeed
+popping test2.patch
+popping test1b.patch
+popping test.patch
 patch queue now empty
 pushing to ../../k
 searching for changes
@@ -180,6 +193,9 @@
 applying test2.patch
 now at: test2.patch
   % pops all patches and succeeds
+popping test2.patch
+popping test1b.patch
+popping test.patch
 patch queue now empty
   qpop -a succeeds
   % does nothing and succeeds
@@ -193,6 +209,7 @@
 now at: test.patch
   qpush succeeds
   % pops a patch and succeeds
+popping test.patch
 patch queue now empty
   qpop succeeds
   % pushes up to test1b.patch and succeeds
@@ -213,6 +230,7 @@
 abort: patch test2.patch is not applied
   qpop test2.patch fails
   % pops up to test.patch and succeeds
+popping test1b.patch
 now at: test.patch
   qpop test.patch succeeds
   % pushes all patches and succeeds
@@ -269,6 +287,8 @@
 +f
 M a
 % qpush failure
+popping bar
+popping foo
 patch queue now empty
 applying foo
 applying bar
@@ -284,6 +304,7 @@
 1 qbase foo
 2 qtip bar tip
 % bad node in status
+popping bar
 now at: foo
 changeset:   0:cb9a9f314b8b
 mq status file refers to unknown node
@@ -308,6 +329,7 @@
 diff --git a/new b/copy
 copy from new
 copy to copy
+popping copy
 now at: new
 applying copy
 now at: copy
@@ -320,6 +342,7 @@
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
 created new head
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+popping bar
 adding branch
 adding changesets
 adding manifests
@@ -354,6 +377,7 @@
 
 1 files updated, 0 files merged, 2 files removed, 0 files unresolved
 2 files updated, 0 files merged, 1 files removed, 0 files unresolved
+popping bar
 adding branch
 adding changesets
 adding manifests
@@ -386,6 +410,7 @@
 % refresh omitting an added file
 C newfile
 A newfile
+popping baz
 now at: bar
 % create a git patch
 diff --git a/alexander b/alexander
@@ -393,6 +418,7 @@
 8ba2a2f3e77b55d03051ff9c24ad65e7  bucephalus
 diff --git a/bucephalus b/bucephalus
 % check binary patches can be popped and pushed
+popping addbucephalus
 now at: addalexander
 applying addbucephalus
 now at: addbucephalus
@@ -461,6 +487,7 @@
     rev 0: add foo
 patch repo:
     rev 0: checkpoint
+popping patch1
 patch queue now empty
 main repo:
     rev 0: add foo
@@ -475,12 +502,14 @@
     rev 0: checkpoint
 % test applying on an empty file (issue 1033)
 adding a
+popping changea
 patch queue now empty
 applying changea
 now at: changea
 % test qpush with --force, issue1087
 adding bye.txt
 adding hello.txt
+popping empty
 patch queue now empty
 % qpush should fail, local changes
 abort: local changes found, refresh first
@@ -510,6 +539,7 @@
 summary:     imported patch empty
 
 
+popping empty
 patch queue now empty
 % qpush should fail, local changes
 abort: local changes found, refresh first
@@ -539,4 +569,5 @@
 % test popping revisions not in working dir ancestry
 0 A empty
 1 files updated, 0 files merged, 0 files removed, 0 files unresolved
+popping empty
 patch queue now empty


More information about the Mercurial-devel mailing list