# HG changeset patch # User Brendan Cully # Date 1227666764 28800 # Node ID efe31fbe6cf0d3fd2949fc2a74e66a7a2d42595a # Parent 0e04753de3ec92bc8857856bfdfeb092130ffdb8 color: don't run status twice for -n Just cut off the status characters. diff -r 0e04753de3ec -r efe31fbe6cf0 hgext/color.py --- a/hgext/color.py Tue Nov 25 18:21:00 2008 -0800 +++ b/hgext/color.py Tue Nov 25 18:32:44 2008 -0800 @@ -94,23 +94,18 @@ delimiter = opts['print0'] and '\0' or '\n' - # run status and capture it's output + nostatus = opts.get('no_status') + opts['no_status'] = False + # run status and capture its output ui.pushbuffer() retval = orig(ui, repo, *pats, **opts) # filter out empty strings - lines = [ line for line in ui.popbuffer().split(delimiter) if line ] + lines_with_status = [ line for line in ui.popbuffer().split(delimiter) if line ] - if opts['no_status']: - # if --no-status, run the command again without that option to get - # output with status abbreviations - opts['no_status'] = False - ui.pushbuffer() - orig(ui, repo, *pats, **opts) - # filter out empty strings - lines_with_status = [ line for - line in ui.popbuffer().split(delimiter) if line ] + if nostatus: + lines = [l[2:] for l in lines_with_status] else: - lines_with_status = lines + lines = lines_with_status # apply color to output and display it for i in xrange(0, len(lines)):