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

filelistmodel: kill fillFileStats

Changeset 4fe2fd09376b

Parent 8425a7e1624b

by Adrian Buehlmann

Changes to one file · Browse files at 4fe2fd09376b Showing diff from parent 8425a7e1624b Diff from another changeset...

 
154
155
156
157
158
159
160
 
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
 
154
155
156
 
157
158
159
 
162
163
164
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
165
166
167
@@ -154,7 +154,6 @@
  _files = self._buildDesc(self.current_ctx.parents()[1], 'right')   self._files += [x for x in _files if x['path'] not in _paths]   self._filesdict = dict([(f['path'], f) for f in self._files]) - self.fillFileStats()     def setSelectedRev(self, ctx):   if ctx != self.current_ctx: @@ -163,65 +162,6 @@
  self.loadFiles()   self.emit(SIGNAL("layoutChanged()"))   - def fillFileStats(self): - """ - Method called to start the background process of computing - file stats, which are to be displayed in the 'Stats' column - """ - self._fill_iter = self._fill() - self._fill_one_step() - - def _fill_one_step(self): - if self._fill_iter is None: - return - try: - nextfill = self._fill_iter.next() - if nextfill is not None: - row, col = nextfill - idx = self.index(row, col) - self.emit(SIGNAL('dataChanged(const QModelIndex &, const QModelIndex &)'), - idx, idx) - QtCore.QTimer.singleShot(10, lambda self=self: self._fill_one_step()) - - except StopIteration: - self._fill_iter = None - - def _fill(self): - # the generator used to fill file stats as a background process - for row, desc in enumerate(self._files): - filename = desc['path'] - if desc['flag'] == '=' and self._displaydiff: - diff = revdiff(self.repo, self.current_ctx, desc['parent'], - files=[filename]) - try: - tot = self.current_ctx.filectx(filename).data().count('\n') - except LookupError: - tot = 0 - add = len(replus.findall(diff)) - rem = len(reminus.findall(diff)) - if tot == 0: - tot = max(add + rem, 1) - desc['stats'] = (tot, add, rem) - yield row, 1 - - if desc['flag'] == '+': - m = self.current_ctx.filectx(filename).renamed() - if m: - removed = self.repo.status(desc['parent'].node(), - self.current_ctx.node())[2] - oldname, node = m - if oldname in removed: - # removed.remove(oldname) XXX - desc['renamedfrom'] = (oldname, node) - desc['flag'] = '=' - desc['desc'] += '\n (was %s)' % oldname - else: - desc['copiedfrom'] = (oldname, node) - desc['flag'] = '=' - desc['desc'] += '\n (copy of %s)' % oldname - yield row, 0 - yield None -   def data(self, index, role):   if not index.isValid() or index.row()>len(self) or not self.current_ctx:   return nullvariant