Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 1.9, 1.9.1, and 1.9.2

workbench: don't reload multiple times on modifed repo

the previous code called reload() again while the repo was already being loaded
after it detected a modified repo.

Fixed by introducing a _loading flag and initializing the repomtime when the
model has finished loading.

Changeset 673cfdf39e33

Parent afc5cd7e1c74

by Adrian Buehlmann

Changes to 2 files · Browse files at 673cfdf39e33 Showing diff from parent afc5cd7e1c74 Diff from another changeset...

 
205
206
207
 
208
209
210
 
213
214
215
 
216
217
218
 
205
206
207
208
209
210
211
 
214
215
216
217
218
219
220
@@ -205,6 +205,7 @@
  self.killTimer(self._fill_timer)   self._fill_timer = None   self.emit(SIGNAL('showMessage'), '') + self.emit(SIGNAL('loaded'))   # we only fill the graph data strctures without telling   # views (until we atually did the full job), to keep   # maximal GUI reactivity @@ -213,6 +214,7 @@
  self._fill_timer = None   self.updateRowCount()   self.emit(SIGNAL('showMessage'), '') + self.emit(SIGNAL('loaded'))     def updateRowCount(self):   currentlen = self.rowcount
 
54
55
56
 
57
58
59
 
99
100
101
 
 
102
103
104
 
106
107
108
 
 
 
 
 
 
 
 
109
110
111
 
370
371
372
 
 
373
374
375
 
486
487
488
 
489
 
490
491
492
 
54
55
56
57
58
59
60
 
100
101
102
103
104
105
106
107
 
109
110
111
112
113
114
115
116
117
118
119
120
121
122
 
381
382
383
384
385
386
387
388
 
499
500
501
502
503
504
505
506
507
@@ -54,6 +54,7 @@
  # these are used to know where to go after a reload   self._reload_rev = None   self._reload_file = None + self._loading = True     QtGui.QMainWindow.__init__(self)   HgDialogMixin.__init__(self) @@ -99,6 +100,8 @@
    def timerEvent(self, event):   if event.timerId() == self._watchrepotimer: + if self.loading(): + return   mtime = self._getrepomtime()   if mtime > self._repodate:   self.statusBar().showMessage("Repository has been modified, " @@ -106,6 +109,14 @@
    self.reload()   + def loading(self): + return self._loading + + def loaded(self): + print "loaded()" + self._repodate = self._getrepomtime() + self._loading = False +   def setupBranchCombo(self, *args):   allbranches = sorted(self.repo.branchtags().items())   if self._closed_branch_supp: @@ -370,6 +381,8 @@
  self.repomodel = HgRepoListModel(self.repo, fromhead=fromhead)   connect(self.repomodel, SIGNAL('filled'),   self.on_filled) + connect(self.repomodel, SIGNAL('loaded'), + self.loaded)   connect(self.repomodel, SIGNAL('showMessage'),   self.statusBar().showMessage,   Qt.QueuedConnection) @@ -486,7 +499,9 @@
    def reload(self):   """Reload the repository""" + print "reload() called"   self._reload_rev = self.tableView_revisions.current_rev + self._loading = True   self._reload_file = self.tableView_filelist.currentFile()   self.repo = hg.repository(self.repo.ui, self.repo.root)   self._repodate = self._getrepomtime()