Show More
@@ -162,22 +162,24 b' def colorqseries(orig, ui, repo, *dummy,' | |||||
162 | _patch_effects = { 'applied': ['blue', 'bold', 'underline'], |
|
162 | _patch_effects = { 'applied': ['blue', 'bold', 'underline'], | |
163 | 'missing': ['red', 'bold'], |
|
163 | 'missing': ['red', 'bold'], | |
164 | 'unapplied': ['black', 'bold'], } |
|
164 | 'unapplied': ['black', 'bold'], } | |
165 | def colorwrap(orig, s): |
|
165 | def colorwrap(orig, *args): | |
166 | '''wrap ui.write for colored diff output''' |
|
166 | '''wrap ui.write for colored diff output''' | |
167 | lines = s.split('\n') |
|
167 | def _colorize(s): | |
168 | for i, line in enumerate(lines): |
|
168 | lines = s.split('\n') | |
169 |
|
|
169 | for i, line in enumerate(lines): | |
170 | if line and line[0] in '+-': |
|
170 | stripline = line | |
171 | # highlight trailing whitespace, but only in changed lines |
|
171 | if line and line[0] in '+-': | |
172 | stripline = line.rstrip() |
|
172 | # highlight trailing whitespace, but only in changed lines | |
173 | for prefix, style in _diff_prefixes: |
|
173 | stripline = line.rstrip() | |
174 | if stripline.startswith(prefix): |
|
174 | for prefix, style in _diff_prefixes: | |
175 | lines[i] = render_effects(stripline, _diff_effects[style]) |
|
175 | if stripline.startswith(prefix): | |
176 | break |
|
176 | lines[i] = render_effects(stripline, _diff_effects[style]) | |
177 | if line != stripline: |
|
177 | break | |
178 | lines[i] += render_effects( |
|
178 | if line != stripline: | |
179 | line[len(stripline):], _diff_effects['trailingwhitespace']) |
|
179 | lines[i] += render_effects( | |
180 | orig('\n'.join(lines)) |
|
180 | line[len(stripline):], _diff_effects['trailingwhitespace']) | |
|
181 | return '\n'.join(lines) | |||
|
182 | orig(*[_colorize(s) for s in args]) | |||
181 |
|
183 | |||
182 | def colorshowpatch(orig, self, node): |
|
184 | def colorshowpatch(orig, self, node): | |
183 | '''wrap cmdutil.changeset_printer.showpatch with colored output''' |
|
185 | '''wrap cmdutil.changeset_printer.showpatch with colored output''' |
General Comments 0
You need to be logged in to leave comments.
Login now