changeset 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 5724cd7b3688
children c5f0825c1dbb
files hgext/color.py
diffstat 1 files changed, 4 insertions(+), 7 deletions(-) [+]
line wrap: on
line diff
--- 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.