# HG changeset patch # User Dan Villiom Podlaski Christiansen # Date 1249477244 -7200 # Node ID e37e9904bf1069b1fb5413cb2bad21066ad3b479 # Parent 5724cd7b36886173282b559b9ec0620d3f90e064 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. diff -r 5724cd7b3688 -r e37e9904bf10 hgext/color.py --- a/hgext/color.py Wed Aug 05 14:44:36 2009 +0200 +++ b/hgext/color.py Wed Aug 05 15:00:44 2009 +0200 @@ -59,6 +59,7 @@ ''' import os, sys +import itertools from mercurial import cmdutil, commands, extensions, error from mercurial.i18n import _ @@ -142,14 +143,10 @@ '''run the qseries command with colored output''' ui.pushbuffer() retval = orig(ui, repo, **opts) - patches = ui.popbuffer().splitlines() - for patch in patches: - patchname = patch - if opts['summary']: - patchname = patchname.split(': ', 1)[0] - if ui.verbose: - patchname = patchname.lstrip().split(' ', 2)[-1] + patchlines = ui.popbuffer().splitlines() + patchnames = repo.mq.series + for patch, patchname in itertools.izip(patchlines, patchnames): if opts['missing']: effects = _patch_effects['missing'] # Determine if patch is applied.