Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.0, 2.0.1, and 2.0.2

stable status: improve refresh thread, make more robust (closes #135)

1 - allocate a fresh repo object for the thread, do not use a thgrepo
2 - do not return a wctx if the status() call raised an exception
3 - always return a dictionary for patchecked
4 - use one try/except block for clarity and simplicity

Changeset 2de46fd147d0

Parent df658fdcdf9c

by Steve Borho

Changes to one file · Browse files at 2de46fd147d0 Showing diff from parent df658fdcdf9c Diff from another changeset...

 
323
324
325
326
 
327
328
329
 
334
335
336
337
 
338
339
340
341
 
342
343
344
 
358
359
360
 
361
362
363
364
 
 
 
 
 
 
 
 
 
365
366
367
 
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
 
323
324
325
 
326
327
328
329
 
334
335
336
 
337
338
339
340
 
341
342
343
344
 
358
359
360
361
362
363
364
 
365
366
367
368
369
370
371
372
373
374
375
376
 
379
380
381
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
382
383
384
@@ -323,7 +323,7 @@
  return   path, status, mst, upath, ext, sz = row   wfile = util.pconvert(path) - self.fileview.setContext(self.wctx) + self.fileview.setContext(self.repo[None])   self.fileview.displayFile(wfile, status=status)     @@ -334,11 +334,11 @@
    def __init__(self, repo, pats, opts, parent=None):   super(StatusThread, self).__init__() - self.repo = repo + self.repo = hg.repository(repo.ui, repo.root)   self.pats = pats   self.opts = opts   self.wctx = None - self.patchecked = None + self.patchecked = {}     def run(self):   self.repo.dirstate.invalidate() @@ -358,10 +358,19 @@
  d = dict([(fn, True) for fn in status[i]])   patchecked.update(d)   wctx = context.workingctx(self.repo, changes=status) + self.patchecked = patchecked   else:   wctx = self.repo[None]   wctx.status(**stopts) - except (OSError, IOError), e: + self.wctx = wctx + + wctx.dirtySubrepos = [] + for s in wctx.substate: + if wctx.sub(s).dirty(): + wctx.dirtySubrepos.append(s) + except EnvironmentError, e: + self.showMessage.emit(hglib.tounicode(str(e))) + except (error.RepoLookupError, error.ConfigError), e:   self.showMessage.emit(hglib.tounicode(str(e)))   except util.Abort, e:   if e.hint: @@ -370,22 +379,6 @@
  else:   err = hglib.tounicode(str(e))   self.showMessage.emit(err) - try: - wctx.dirtySubrepos = [] - for s in wctx.substate: - if wctx.sub(s).dirty(): - wctx.dirtySubrepos.append(s) - except (OSError, IOError, error.RepoLookupError, error.ConfigError), e: - self.showMessage.emit(hglib.tounicode(str(e))) - except util.Abort, e: - if e.hint: - err = _('%s (hint: %s)') % (hglib.tounicode(str(e)), - hglib.tounicode(e.hint)) - else: - err = hglib.tounicode(str(e)) - self.showMessage.emit(err) - self.wctx = wctx - self.patchecked = patchecked      class WctxFileTree(QTreeView):