Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.3rc1, 0.3, and 0.4rc1

hggtk/vis: add generic author coloring feature

Changeset 0fd0fcc15287

Parent 6d7bb6f17b97

by Steve Borho

Changes to 2 files · Browse files at 0fd0fcc15287 Showing diff from parent 6d7bb6f17b97 Diff from another changeset...

 
80
81
82
83
 
 
 
 
 
84
85
86
 
80
81
82
 
83
84
85
86
87
88
89
90
@@ -80,7 +80,11 @@
  'Specify the visual diff tool; must be extdiff command'),   ('Visual Editor', 'tortoisehg.editor', [],   'Specify the visual editor used to view files, etc'), - ('Log Batch Size', 'tortoisehg.graphlimit', [], + ('Author Coloring', 'tortoisehg.authorcolor', ['False', 'True'], + 'Color changesets by author name. If not enabled,' + ' the changes are colored green for merge, red for' + ' non-trivial parents, black for normal. Default: False'), + ('Log Batch Size', 'tortoisehg.graphlimit', ['500'],   'The number of revisions to read and display in the'   ' changelog viewer in a single batch. Default: 500'))   self.tortoise_frame = self.add_page(notebook, 'TortoiseHG')
 
266
267
268
269
 
 
270
271
272
 
394
395
396
 
 
 
 
397
398
399
400
401
 
 
 
 
402
403
404
 
266
267
268
 
269
270
271
272
273
 
395
396
397
398
399
400
401
402
403
404
405
 
406
407
408
409
410
411
412
@@ -266,7 +266,8 @@
  if not k.startswith('authorcolor.'): continue   pat = k[12:]   self.author_pats.append((re.compile(pat, re.I), v)) - if self.author_pats: + if self.author_pats or self.repo.ui.configbool('tortoisehg', + 'authorcolor'):   self.color_func = self.text_color_author   else:   self.color_func = self.text_color_orig @@ -394,11 +395,18 @@
  else:   return 'black'   + colors = '''black blue deeppink mediumorchid blue burlywood4 goldenrod + slateblue red2 navy dimgrey'''.split() + color_cache = {} +   def text_color_author(self, parents, rev, author):   for re, v in self.author_pats:   if (re.search(author)):   return v - return 'black' + if author not in self.color_cache: + color = self.colors[len(self.color_cache.keys()) % len(self.colors)] + self.color_cache[author] = color + return self.color_cache[author]     def _on_selection_changed(self, treeview):   """callback for when the treeview changes."""