[PATCH 2 of 2] color: add support for log --diffstat

Yuya Nishihara yuya at tcha.org
Wed Mar 31 10:38:04 CDT 2010


# HG changeset patch
# User Yuya Nishihara <yuya at tcha.org>
# Date 1270049761 -32400
# Node ID 817a10a715b58eaaf7e6d662343d9863be2a3f7b
# Parent  bf6163e171310bab5eab6a1f562fb1eaae706e14
color: add support for log --diffstat

diff --git a/hgext/color.py b/hgext/color.py
--- a/hgext/color.py
+++ b/hgext/color.py
@@ -230,7 +230,11 @@ def colorwrap(orig, *args):
 
 def colorshowpatch(orig, self, node):
     '''wrap cmdutil.changeset_printer.showpatch with colored output'''
-    oldwrite = extensions.wrapfunction(self.ui, 'write', colorwrap)
+    def getwrapper(opts):
+        return opts.get('diffstat') and colordiffstat or colorwrap
+
+    oldwrite = extensions.wrapfunction(self.ui, 'write',
+                                       getwrapper(self.diffopts))
     try:
         orig(self, node)
     finally:


More information about the Mercurial-devel mailing list