Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.9, 0.9.1, and 0.9.1.1

treeview: optionally load revisions on set_revision_id

Adds an optional parameter 'load' to set_revision_id.

If it is True, revisions are loaded in batches as needed.

If it is False (default), set_revision_id has no effect if the specified
revision is not in self.index (as before this change).

Changeset 7a580a1a2d7b

Parent 10dbfaad55ed

by Adrian Buehlmann

Changes to one file · Browse files at 7a580a1a2d7b Showing diff from parent 10dbfaad55ed Diff from another changeset...

 
95
96
97
 
 
 
98
99
100
 
229
230
231
 
232
233
234
 
307
308
309
310
 
311
312
313
 
316
317
318
 
 
 
 
 
 
 
 
 
 
 
 
 
 
319
320
321
 
95
96
97
98
99
100
101
102
103
 
232
233
234
235
236
237
238
 
311
312
313
 
314
315
316
317
 
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
@@ -95,6 +95,9 @@
  'revisions-loaded': (gobject.SIGNAL_RUN_FIRST,   gobject.TYPE_NONE,   ()), + 'batch-loaded': (gobject.SIGNAL_RUN_FIRST, + gobject.TYPE_NONE, + ()),   'revision-selected': (gobject.SIGNAL_RUN_FIRST,   gobject.TYPE_NONE,   ()) @@ -229,6 +232,7 @@
  #self.graph_column.set_max_width(500)   self.graph_column.set_visible(self.show_graph)   + self.emit('batch-loaded')   if stopped:   self.emit('revisions-loaded')   if revision is not None: @@ -307,7 +311,7 @@
  row = self.index[revid]   self.treeview.scroll_to_cell(row, use_align=True, row_align=0.5)   - def set_revision_id(self, revid): + def set_revision_id(self, revid, load=False):   """Change the currently selected revision.     :param revid: Revision id of revision to display. @@ -316,6 +320,20 @@
  row = self.index[revid]   self.treeview.set_cursor(row)   self.treeview.grab_focus() + elif load: + handler = None + + def loaded(dummy): + if revid in self.index: + if handler is not None: + self.disconnect(handler) + self.set_revision_id(revid) + self.scroll_to_revision(revid) + else: + self.next_revision_batch(self.batchsize) + + handler = self.connect('batch-loaded', loaded) + self.next_revision_batch(self.batchsize)     def get_parents(self):   """Return the parents of the currently selected revision.