--- a/hgext/mq.py Wed Aug 11 20:16:22 2010 +0800
+++ b/hgext/mq.py Thu Aug 05 12:25:53 2010 +0200
@@ -2172,7 +2172,15 @@
'''
def status(idx):
guards = q.series_guards[idx] or ['unguarded']
- ui.write('%s: ' % ui.label(q.series[idx], 'qguard.patch'))
+ if q.series[idx] in applied:
+ state = 'applied'
+ elif q.pushable(idx)[0]:
+ state = 'unapplied'
+ else:
+ state = 'guarded'
+ label = 'qguard.patch qguard.%s qseries.%s' % (state, state)
+ ui.write('%s: ' % ui.label(q.series[idx], label))
+
for i, guard in enumerate(guards):
if guard.startswith('+'):
ui.write(guard, label='qguard.positive')
@@ -2184,6 +2192,7 @@
ui.write(' ')
ui.write('\n')
q = repo.mq
+ applied = set(p.name for p in q.applied)
patch = None
args = list(args)
if opts['list']:
--- a/tests/test-mq-guards Wed Aug 11 20:16:22 2010 +0800
+++ b/tests/test-mq-guards Thu Aug 05 12:25:53 2010 +0200
@@ -97,11 +97,16 @@
hg qguard -- a.patch +1 +2 -3
hg qselect 1 2 3
+
echo % list patches and guards
hg qguard -l
+echo % have at least one patch applied to test coloring
+hg qpush
echo % list patches and guards with color
hg --config extensions.color= qguard --config color.mode=ansi \
-l --color=always
+echo % should pop b.patch
+hg qpop
echo % list series
hg qseries -v
echo % list guards
--- a/tests/test-mq-guards.out Wed Aug 11 20:16:22 2010 +0800
+++ b/tests/test-mq-guards.out Thu Aug 05 12:25:53 2010 +0200
@@ -84,10 +84,16 @@
a.patch: +1 +2 -3
b.patch: +2
c.patch: unguarded
+% have at least one patch applied to test coloring
+applying b.patch
+now at: b.patch
% list patches and guards with color
-a.patch: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m
-b.patch: [0;33m+2[0m
-c.patch: [0;32munguarded[0m
+[0;30;1ma.patch[0m: [0;33m+1[0m [0;33m+2[0m [0;31m-3[0m
+[0;34;1;4mb.patch[0m: [0;33m+2[0m
+[0;30;1mc.patch[0m: [0;32munguarded[0m
+% should pop b.patch
+popping b.patch
+patch queue now empty
% list series
0 G a.patch
1 U b.patch