# HG changeset patch # User Alexis S. L. Carvalho # Date 2006-12-02 20:41:07 # Node ID 955475d237fc975f7374e21da779056ba514634e # Parent b9d3e12da485aac9a8b16386991ede5037841935 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 diff --git a/hgext/mq.py b/hgext/mq.py --- a/hgext/mq.py +++ b/hgext/mq.py @@ -1124,21 +1124,21 @@ class queue: 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 = [] diff --git a/tests/test-mq-guards b/tests/test-mq-guards --- a/tests/test-mq-guards +++ b/tests/test-mq-guards @@ -106,4 +106,12 @@ echo % b.patch: +2 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 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 @@ -89,3 +89,15 @@ c.patch 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