comparison hgext/color.py @ 6855:09db2b8236ec

Apply color to output of qseries --verbose Fixes issue 1173.
author Kevin Christen <kevin.christen@gmail.com>
date Wed, 23 Jul 2008 20:33:23 -0500
parents 9d11faecb0f1
children c6890cfc2253
comparison
equal deleted inserted replaced
6854:9d11faecb0f1 6855:09db2b8236ec
38 status.removed = red bold blue_background 38 status.removed = red bold blue_background
39 status.deleted = cyan bold underline 39 status.deleted = cyan bold underline
40 status.unknown = magenta bold underline 40 status.unknown = magenta bold underline
41 status.ignored = black bold 41 status.ignored = black bold
42 42
43 'none' turns off all effects 43 # 'none' turns off all effects
44 status.clean = none 44 status.clean = none
45 status.copied = none 45 status.copied = none
46 46
47 qseries.applied = blue bold underline 47 qseries.applied = blue bold underline
48 qseries.unapplied = black bold 48 qseries.unapplied = black bold
142 '''run the qseries command with colored output''' 142 '''run the qseries command with colored output'''
143 ui.pushbuffer() 143 ui.pushbuffer()
144 retval = qseriesfunc(ui, repo, **opts) 144 retval = qseriesfunc(ui, repo, **opts)
145 patches = ui.popbuffer().splitlines() 145 patches = ui.popbuffer().splitlines()
146 for patch in patches: 146 for patch in patches:
147 patchname = patch
148 if opts['summary']:
149 patchname = patchname.split(': ')[0]
150 if ui.verbose:
151 patchname = patchname.split(' ', 2)[-1]
152
147 if opts['missing']: 153 if opts['missing']:
148 effects = _patch_effects['missing'] 154 effects = _patch_effects['missing']
149 # Determine if patch is applied. Search for beginning of output 155 # Determine if patch is applied.
150 # line in the applied patch list, in case --summary has been used
151 # and output line isn't just the patch name.
152 elif [ applied for applied in repo.mq.applied 156 elif [ applied for applied in repo.mq.applied
153 if patch.startswith(applied.name) ]: 157 if patchname == applied.name ]:
154 effects = _patch_effects['applied'] 158 effects = _patch_effects['applied']
155 else: 159 else:
156 effects = _patch_effects['unapplied'] 160 effects = _patch_effects['unapplied']
157 sys.stdout.write(render_effects(patch, *effects) + '\n') 161 sys.stdout.write(render_effects(patch, *effects) + '\n')
158 return retval 162 return retval