Show More
@@ -56,6 +56,8 b' Default effects may be overridden from t' | |||
|
56 | 56 | diff.inserted = green |
|
57 | 57 | diff.changed = white |
|
58 | 58 | diff.trailingwhitespace = bold red_background |
|
59 | ||
|
60 | bookmarks.current = green | |
|
59 | 61 | ''' |
|
60 | 62 | |
|
61 | 63 | import os, sys |
@@ -138,6 +140,21 b' def colorstatus(orig, ui, repo, *pats, *' | |||
|
138 | 140 | 'clean': ['none'], |
|
139 | 141 | 'copied': ['none'], } |
|
140 | 142 | |
|
143 | _bookmark_effects = { 'current': ['green'] } | |
|
144 | ||
|
145 | def colorbookmarks(orig, ui, repo, *pats, **opts): | |
|
146 | def colorize(orig, s): | |
|
147 | lines = s.split('\n') | |
|
148 | for i, line in enumerate(lines): | |
|
149 | if line.startswith(" *"): | |
|
150 | lines[i] = render_effects(line, _bookmark_effects['current']) | |
|
151 | orig('\n'.join(lines)) | |
|
152 | oldwrite = extensions.wrapfunction(ui, 'write', colorize) | |
|
153 | try: | |
|
154 | orig(ui, repo, *pats, **opts) | |
|
155 | finally: | |
|
156 | ui.write = oldwrite | |
|
157 | ||
|
141 | 158 | def colorqseries(orig, ui, repo, *dummy, **opts): |
|
142 | 159 | '''run the qseries command with colored output''' |
|
143 | 160 | ui.pushbuffer() |
@@ -275,6 +292,14 b' def extsetup(ui):' | |||
|
275 | 292 | except KeyError: |
|
276 | 293 | churn = None |
|
277 | 294 | |
|
295 | try: | |
|
296 | bookmarks = extensions.find('bookmarks') | |
|
297 | _setupcmd(ui, 'bookmarks', bookmarks.cmdtable, colorbookmarks, | |
|
298 | _bookmark_effects) | |
|
299 | except KeyError: | |
|
300 | # The bookmarks extension is not enabled | |
|
301 | pass | |
|
302 | ||
|
278 | 303 | def _setupcmd(ui, cmd, table, func, effectsmap): |
|
279 | 304 | '''patch in command to command table and load effect map''' |
|
280 | 305 | def nocolor(orig, *args, **opts): |
General Comments 0
You need to be logged in to leave comments.
Login now