changeset 3763:955475d237fc

fix qseries -v and guards interaction - rename "status" variable to avoid shadowing an argument - use a better test to determine whether a patch is applied
author Alexis S. L. Carvalho <alexis@cecm.usp.br>
date Sat, 02 Dec 2006 18:41:07 -0200
parents b9d3e12da485
children 6ae3685be45d
files hgext/mq.py tests/test-mq-guards tests/test-mq-guards.out
diffstat 3 files changed, 27 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- a/hgext/mq.py	Sat Dec 02 16:08:00 2006 -0200
+++ b/hgext/mq.py	Sat Dec 02 18:41:07 2006 -0200
@@ -1124,21 +1124,21 @@
             else:
                 return self.series[i]
 
-        unapplied = self.series_end(all_patches=True)
+        applied = dict.fromkeys([p.name for p in self.applied])
         if not length:
             length = len(self.series) - start
         if not missing:
             for i in xrange(start, start+length):
                 pfx = ''
+                patch = pname(i)
                 if self.ui.verbose:
-                    if i < unapplied:
-                        status = 'A'
+                    if patch in applied:
+                        stat = 'A'
                     elif self.pushable(i)[0]:
-                        status = 'U'
+                        stat = 'U'
                     else:
-                        status = 'G'
-                    pfx = '%d %s ' % (i, status)
-                patch = pname(i)
+                        stat = 'G'
+                    pfx = '%d %s ' % (i, stat)
                 self.ui.write('%s%s\n' % (pfx, displayname(patch)))
         else:
             msng_list = []
--- a/tests/test-mq-guards	Sat Dec 02 16:08:00 2006 -0200
+++ b/tests/test-mq-guards	Sat Dec 02 18:41:07 2006 -0200
@@ -106,4 +106,12 @@
 echo % c.patch: unguarded
 hg qguard -l
 
+hg qnew d.patch
+hg qpop
+echo % should show new.patch and b.patch as Guarded, c.patch as Applied
+echo % and d.patch as Unapplied
+hg qseries -v
 
+hg qguard d.patch +2
+echo % new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
+hg qseries -v
--- a/tests/test-mq-guards.out	Sat Dec 02 16:08:00 2006 -0200
+++ b/tests/test-mq-guards.out	Sat Dec 02 18:41:07 2006 -0200
@@ -89,3 +89,15 @@
 new.patch: +1 +2 -3
 b.patch: +2
 c.patch: unguarded
+Now at: c.patch
+% should show new.patch and b.patch as Guarded, c.patch as Applied
+% and d.patch as Unapplied
+0 G new.patch
+1 G b.patch
+2 A c.patch
+3 U d.patch
+% new.patch, b.patch: Guarded. c.patch: Applied. d.patch: Guarded.
+0 G new.patch
+1 G b.patch
+2 A c.patch
+3 G d.patch