Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.1, 1.1.1, and 1.1.2

datamine: color-highlight grep output

Closes #1156

Changeset fb20dc4e763b

Parent b65003fd7e25

by Steve Borho

Changes to 2 files · Browse files at fb20dc4e763b Showing diff from parent b65003fd7e25 Diff from another changeset...

 
365
366
367
368
369
370
371
 
 
 
 
372
373
374
 
378
379
380
381
 
382
383
384
 
461
462
463
464
 
465
466
467
 
492
493
494
495
 
 
 
 
 
496
497
498
 
365
366
367
 
 
 
 
368
369
370
371
372
373
374
 
378
379
380
 
381
382
383
384
 
461
462
463
 
464
465
466
467
 
492
493
494
 
495
496
497
498
499
500
501
502
@@ -365,10 +365,10 @@
  str) # file path (utf-8)   treeview.set_model(results)   treeview.set_search_equal_func(self.search_in_grep) - for title, width, col, emode in ( - (_('Rev'), 10, GCOL_REVID, pango.ELLIPSIZE_NONE), - (_('File'), 25, GCOL_PATH, pango.ELLIPSIZE_START), - (_('Matches'), 80, GCOL_LINE, pango.ELLIPSIZE_END)): + for title, width, ttype, col, emode in ( + (_('Rev'), 10, 'text', GCOL_REVID, pango.ELLIPSIZE_NONE), + (_('File'), 25, 'text', GCOL_PATH, pango.ELLIPSIZE_START), + (_('Matches'), 80, 'markup', GCOL_LINE, pango.ELLIPSIZE_END)):   cell = gtk.CellRendererText()   cell.set_property('width-chars', width)   cell.set_property('ellipsize', emode) @@ -378,7 +378,7 @@
  column.set_sizing(gtk.TREE_VIEW_COLUMN_FIXED)   column.set_fixed_width(cell.get_size(treeview)[2])   column.pack_start(cell, expand=True) - column.add_attribute(cell, 'text', col) + column.add_attribute(cell, ttype, col)   treeview.append_column(column)   if hasattr(treeview, 'set_tooltip_column'):   treeview.set_tooltip_column(GCOL_DESC) @@ -461,7 +461,7 @@
    def threadfunc(q, *args):   try: - hglib.hgcmd_toq(q, *args) + hglib.hgcmd_toq(q, *args, label=True)   except (util.Abort, error.LookupError), e:   self.stbar.set_text(_('Abort: %s') % str(e))   @@ -492,7 +492,11 @@
  """   text = ''   while q.qsize(): - text += q.get(0) + data, label = q.get(0) + if label == 'grep.match': + text += '<span foreground="red"><b>%s</b></span>' % data + else: + text += data     for line in text.splitlines():   try:
 
310
311
312
313
 
314
315
316
317
 
318
319
320
 
325
326
327
328
 
 
 
 
329
330
331
 
310
311
312
 
313
314
315
316
317
318
319
320
321
 
326
327
328
 
329
330
331
332
333
334
335
@@ -310,11 +310,12 @@
  return tools     -def hgcmd_toq(q, *args): +def hgcmd_toq(q, *args, **opts):   '''   Run an hg command in a background thread, pipe all output to a Queue   object. Assumes command is completely noninteractive.   ''' + label = opts.get('label', False)   class Qui(ui.ui):   def __init__(self, src=None):   super(Qui, self).__init__(src) @@ -325,7 +326,10 @@
  self._buffers[-1].extend([str(a) for a in args])   else:   for a in args: - q.put(str(a)) + if label: + q.put((str(a), opts.get('label', ''))) + else: + q.put(str(a))     def plain(self):   return True