##// END OF EJS Templates
color: Add support for bookmarks
David Soria Parra -
r10046:0c23b0b3 default
parent child Browse files
Show More
@@ -56,6 +56,8 b' Default effects may be overridden from t'
56 diff.inserted = green
56 diff.inserted = green
57 diff.changed = white
57 diff.changed = white
58 diff.trailingwhitespace = bold red_background
58 diff.trailingwhitespace = bold red_background
59
60 bookmarks.current = green
59 '''
61 '''
60
62
61 import os, sys
63 import os, sys
@@ -138,6 +140,21 b' def colorstatus(orig, ui, repo, *pats, *'
138 'clean': ['none'],
140 'clean': ['none'],
139 'copied': ['none'], }
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 def colorqseries(orig, ui, repo, *dummy, **opts):
158 def colorqseries(orig, ui, repo, *dummy, **opts):
142 '''run the qseries command with colored output'''
159 '''run the qseries command with colored output'''
143 ui.pushbuffer()
160 ui.pushbuffer()
@@ -275,6 +292,14 b' def extsetup(ui):'
275 except KeyError:
292 except KeyError:
276 churn = None
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 def _setupcmd(ui, cmd, table, func, effectsmap):
303 def _setupcmd(ui, cmd, table, func, effectsmap):
279 '''patch in command to command table and load effect map'''
304 '''patch in command to command table and load effect map'''
280 def nocolor(orig, *args, **opts):
305 def nocolor(orig, *args, **opts):
General Comments 0
You need to be logged in to leave comments. Login now