# HG changeset patch # User Alexander Solovyov # Date 2009-11-30 21:10:21 # Node ID af04a3dea4cd5665f88eb172db61bfea11fd1609 # Parent a1217735dffb29277f555693568a39fa5681d3e0 color: add support for churn --diffstat diff --git a/hgext/color.py b/hgext/color.py --- a/hgext/color.py +++ b/hgext/color.py @@ -213,6 +213,16 @@ def colordiff(orig, ui, repo, *pats, **o finally: ui.write = oldwrite +def colorchurn(orig, ui, repo, *pats, **opts): + '''run the churn command with colored output''' + if not opts.get('diffstat'): + return orig(ui, repo, *pats, **opts) + oldwrite = extensions.wrapfunction(ui, 'write', colordiffstat) + try: + orig(ui, repo, *pats, **opts) + finally: + ui.write = oldwrite + _diff_prefixes = [('diff', 'diffline'), ('copy', 'extended'), ('rename', 'extended'), @@ -259,7 +269,11 @@ def extsetup(ui): if mq and rec: _setupcmd(ui, 'qrecord', rec.cmdtable, colordiff, _diff_effects) - + try: + churn = extensions.find('churn') + _setupcmd(ui, 'churn', churn.cmdtable, colorchurn, _diff_effects) + except KeyError: + churn = None def _setupcmd(ui, cmd, table, func, effectsmap): '''patch in command to command table and load effect map'''