Mercurial > diff-colorize
changeset 2:9eda9139d627
Added support for hunk start markers (@@…@@). For these, we set the whole line in reverse video, in the same color we use for index lines.
author | Peter Hosey |
---|---|
date | Sun, 10 Aug 2008 23:29:08 -0700 |
parents | 44f86539d245 |
children | 10948e4fd070 |
files | diff-colorize.py |
diffstat | 1 files changed, 6 insertions(+), 0 deletions(-) [+] |
line wrap: on
line diff
--- a/diff-colorize.py +++ b/diff-colorize.py @@ -8,6 +8,7 @@ END_REVERSE_FORMAT = '\033[27m' INDEX_COLOR = 32 REMOVED_COLOR = 203 ADDED_COLOR = 2 +HUNK_START_COLOR = 32 class OrderedDict(dict): def __init__(self, input=None): @@ -57,6 +58,11 @@ prefixes['+'] = ( ) prefixes['Index: '] = COLOR_FORMAT % (INDEX_COLOR,) + 'Index: ' prefixes['diff --git '] = COLOR_FORMAT % (INDEX_COLOR,) + 'diff --git ' +prefixes['@@'] = ( + COLOR_FORMAT % (HUNK_START_COLOR,) + + BEGIN_REVERSE_FORMAT + + '@@' +) import sys import fileinput