Mercurial > hg
comparison hgext/mq.py @ 11819:1c00577b0298
qguard: label patch names by status when listing guards
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Thu, 05 Aug 2010 12:25:53 +0200 |
parents | e2bce1c717fa |
children | b8b1e6e78486 |
comparison
equal
deleted
inserted
replaced
11817:d12fe809e1ee | 11819:1c00577b0298 |
---|---|
2170 | 2170 |
2171 hg qguard other.patch -- +2.6.17 -stable | 2171 hg qguard other.patch -- +2.6.17 -stable |
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') |
2179 elif guard.startswith('-'): | 2187 elif guard.startswith('-'): |
2180 ui.write(guard, label='qguard.negative') | 2188 ui.write(guard, label='qguard.negative') |
2182 ui.write(guard, label='qguard.unguarded') | 2190 ui.write(guard, label='qguard.unguarded') |
2183 if i != len(guards) - 1: | 2191 if i != len(guards) - 1: |
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']: |
2190 if args or opts['none']: | 2199 if args or opts['none']: |
2191 raise util.Abort(_('cannot mix -l/--list with options or arguments')) | 2200 raise util.Abort(_('cannot mix -l/--list with options or arguments')) |