##// END OF EJS Templates
qguard: label patch names by status when listing guards
Dan Villiom Podlaski Christiansen -
r11819:1c00577b default
parent child Browse files
Show More
@@ -2172,7 +2172,15 b' def guard(ui, repo, *args, **opts):'
2172 '''
2172 '''
2173 def status(idx):
2173 def status(idx):
2174 guards = q.series_guards[idx] or ['unguarded']
2174 guards = q.series_guards[idx] or ['unguarded']
2175 ui.write('%s: ' % ui.label(q.series[idx], 'qguard.patch'))
2175 if q.series[idx] in applied:
2176 state = 'applied'
2177 elif q.pushable(idx)[0]:
2178 state = 'unapplied'
2179 else:
2180 state = 'guarded'
2181 label = 'qguard.patch qguard.%s qseries.%s' % (state, state)
2182 ui.write('%s: ' % ui.label(q.series[idx], label))
2183
2176 for i, guard in enumerate(guards):
2184 for i, guard in enumerate(guards):
2177 if guard.startswith('+'):
2185 if guard.startswith('+'):
2178 ui.write(guard, label='qguard.positive')
2186 ui.write(guard, label='qguard.positive')
@@ -2184,6 +2192,7 b' def guard(ui, repo, *args, **opts):'
2184 ui.write(' ')
2192 ui.write(' ')
2185 ui.write('\n')
2193 ui.write('\n')
2186 q = repo.mq
2194 q = repo.mq
2195 applied = set(p.name for p in q.applied)
2187 patch = None
2196 patch = None
2188 args = list(args)
2197 args = list(args)
2189 if opts['list']:
2198 if opts['list']:
@@ -97,11 +97,16 b' hg qpop -a'
97
97
98 hg qguard -- a.patch +1 +2 -3
98 hg qguard -- a.patch +1 +2 -3
99 hg qselect 1 2 3
99 hg qselect 1 2 3
100
100 echo % list patches and guards
101 echo % list patches and guards
101 hg qguard -l
102 hg qguard -l
103 echo % have at least one patch applied to test coloring
104 hg qpush
102 echo % list patches and guards with color
105 echo % list patches and guards with color
103 hg --config extensions.color= qguard --config color.mode=ansi \
106 hg --config extensions.color= qguard --config color.mode=ansi \
104 -l --color=always
107 -l --color=always
108 echo % should pop b.patch
109 hg qpop
105 echo % list series
110 echo % list series
106 hg qseries -v
111 hg qseries -v
107 echo % list guards
112 echo % list guards
@@ -84,10 +84,16 b' number of unguarded, unapplied patches h'
84 a.patch: +1 +2 -3
84 a.patch: +1 +2 -3
85 b.patch: +2
85 b.patch: +2
86 c.patch: unguarded
86 c.patch: unguarded
87 % have at least one patch applied to test coloring
88 applying b.patch
89 now at: b.patch
87 % list patches and guards with color
90 % list patches and guards with color
88 a.patch: +1 +2 -3
91 a.patch: +1 +2 -3
89 b.patch: +2
92 b.patch: +2
90 c.patch: unguarded
93 c.patch: unguarded
94 % should pop b.patch
95 popping b.patch
96 patch queue now empty
91 % list series
97 % list series
92 0 G a.patch
98 0 G a.patch
93 1 U b.patch
99 1 U b.patch
General Comments 0
You need to be logged in to leave comments. Login now