Mercurial > hg
comparison hgext/color.py @ 9311:e37e9904bf10
color: simplify & improve colorization of qseries
Use 'repo.mq.series' to obtain patch names, instead of deriving them
from the qseries output. This is both simpler and more robust, and
fixes colorization of patches without a message with -s/--summary.
author | Dan Villiom Podlaski Christiansen <danchr@gmail.com> |
---|---|
date | Wed, 05 Aug 2009 15:00:44 +0200 |
parents | acfbb88c6ced |
children | ad73f6986ef5 |
comparison
equal
deleted
inserted
replaced
9310:5724cd7b3688 | 9311:e37e9904bf10 |
---|---|
57 diff.changed = white | 57 diff.changed = white |
58 diff.trailingwhitespace = bold red_background | 58 diff.trailingwhitespace = bold red_background |
59 ''' | 59 ''' |
60 | 60 |
61 import os, sys | 61 import os, sys |
62 import itertools | |
62 | 63 |
63 from mercurial import cmdutil, commands, extensions, error | 64 from mercurial import cmdutil, commands, extensions, error |
64 from mercurial.i18n import _ | 65 from mercurial.i18n import _ |
65 | 66 |
66 # start and stop parameters for effects | 67 # start and stop parameters for effects |
140 | 141 |
141 def colorqseries(orig, ui, repo, *dummy, **opts): | 142 def colorqseries(orig, ui, repo, *dummy, **opts): |
142 '''run the qseries command with colored output''' | 143 '''run the qseries command with colored output''' |
143 ui.pushbuffer() | 144 ui.pushbuffer() |
144 retval = orig(ui, repo, **opts) | 145 retval = orig(ui, repo, **opts) |
145 patches = ui.popbuffer().splitlines() | 146 patchlines = ui.popbuffer().splitlines() |
146 for patch in patches: | 147 patchnames = repo.mq.series |
147 patchname = patch | 148 |
148 if opts['summary']: | 149 for patch, patchname in itertools.izip(patchlines, patchnames): |
149 patchname = patchname.split(': ', 1)[0] | |
150 if ui.verbose: | |
151 patchname = patchname.lstrip().split(' ', 2)[-1] | |
152 | |
153 if opts['missing']: | 150 if opts['missing']: |
154 effects = _patch_effects['missing'] | 151 effects = _patch_effects['missing'] |
155 # Determine if patch is applied. | 152 # Determine if patch is applied. |
156 elif [ applied for applied in repo.mq.applied | 153 elif [ applied for applied in repo.mq.applied |
157 if patchname == applied.name ]: | 154 if patchname == applied.name ]: |