Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 0.7, 0.7.1, and 0.7.2

history: respect limit option for initial batch

To show the 10 last revisions:
hgtk log -l 10
When the user hit's the 'next N revisions' button, it uses the
tortoisehg.graphlimit value again.

Changeset 587597893dcf

Parent a9dff71adeac

by Steve Borho

Changes to 2 files · Browse files at 587597893dcf Showing diff from parent a9dff71adeac Diff from another changeset...

Change 1 of 5 Show Entire File hggtk/​history.py Stacked
 
69
70
71
72
 
73
74
75
 
221
222
223
 
 
 
 
 
 
 
 
 
 
 
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
 
239
240
 
 
241
242
243
 
613
614
615
616
 
617
618
619
 
622
623
624
625
 
626
627
628
 
641
642
643
 
644
 
69
70
71
 
72
73
74
75
 
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
 
 
 
 
 
 
 
 
 
 
237
238
 
239
240
 
241
242
243
244
245
 
615
616
617
 
618
619
620
621
 
624
625
626
 
627
628
629
630
 
643
644
645
646
647
@@ -69,7 +69,7 @@
  self.graphview.set_property(property, bool)     def _more_clicked(self, button): - self.graphview.next_revision_batch() + self.graphview.next_revision_batch(self.limit)     def _load_all_clicked(self, button):   self.graphview.load_all_revisions() @@ -221,23 +221,25 @@
  self._hpaned.get_position())   return settings   + def get_graphlimit(self, suggestion): + limit_opt = self.repo.ui.config('tortoisehg', 'graphlimit', '500') + limit_opt = suggestion or limit_opt + try: + limit = int(limit_opt) + except ValueError: + return 0 + if limit <= 0: + return 0 + return limit +   def load_settings(self, settings):   '''Called at beginning of display() method''' - limit_opt = self.repo.ui.config('tortoisehg', 'graphlimit', '500') - if limit_opt: - try: - limit = int(limit_opt) - except ValueError: - limit = 0 - if limit <= 0: - limit = None - else: - limit = None     # Allocate TreeView instance to use internally - self.limit = limit + self.limit = self.get_graphlimit(self.opts['limit'])   self.stbar = gtklib.StatusBar() - self.graphview = TreeView(self.repo, limit, self.stbar) + self.graphview = TreeView(self.repo, self.limit, self.stbar) + self.limit = self.get_graphlimit(None)     # Allocate ChangeSet instance to use internally   self.changeview = ChangeSet(self.ui, self.repo, self.cwd, [], @@ -613,7 +615,7 @@
  self._menu.get_children()[0].activate()   return True   -def run(root='', cwd='', files=[], **opts): +def run(root='', cwd='', files=[], limit='', **opts):   u = ui.ui()   u.updateopts(debug=False, traceback=False)   repo = hg.repository(u, path=root) @@ -622,7 +624,7 @@
    cmdoptions = {   'follow':False, 'follow-first':False, 'copies':False, 'keyword':[], - 'limit':0, 'rev':[], 'removed':False, 'no_merges':False, 'date':None, + 'limit':limit, 'rev':[], 'removed':False, 'no_merges':False, 'date':None,   'only_merges':None, 'prune':[], 'git':False, 'verbose':False,   'include':[], 'exclude':[]   } @@ -641,4 +643,5 @@
  path = len(sys.argv) > 1 and sys.argv[1] or os.getcwd()   opts['root'] = os.path.abspath(path)   opts['files'] = [opts['root']] + opts['limit'] = ''   run(**opts)
 
215
216
217
218
 
 
219
220
221
 
215
216
217
 
218
219
220
221
222
@@ -215,7 +215,8 @@
  else:   raise AttributeError, 'unknown property %s' % property.name   - def next_revision_batch(self): + def next_revision_batch(self, size): + self.batchsize = size   self.limit += self.batchsize   self.pbar.begin()   gobject.idle_add(self.populate)