Commits

Yuya Nishihara  committed 6e4949f

thgrepo: exit from 'lock still held' case by exception

  • Participants
  • Parent commits 4b99a89
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/thgrepo.py

         raise error.RepoError('%s is not a valid repository' % path)
     return _repocache[path]
 
+class _LockStillHeld(Exception):
+    'Raised to abort status check due to lock existence'
+
 class ThgRepoWrapper(QObject):
 
     configChanged = pyqtSignal()
         if self.locked():
             dbgoutput('locked, aborting')
             return
-        if self._checkdirstate():
-            dbgoutput('dirstate changed, exiting')
-            return
-        self._checkrepotime()
-        self._checkuimtime()
+        try:
+            if self._checkdirstate():
+                dbgoutput('dirstate changed, exiting')
+                return
+            self._checkrepotime()
+            self._checkuimtime()
+        except _LockStillHeld:
+            dbgoutput('lock still held - ignoring for now')
 
     def locked(self):
         if os.path.lexists(self.repo.join('wlock')):
         if self._repomtime < self._getrepomtime():
             dbgoutput('detected repository change')
             if self.locked():
-                dbgoutput('lock still held - ignoring for now')
-                return
+                raise _LockStillHeld
             self.recordState()
             self.repo.thginvalidate()
             self.repositoryChanged.emit()
         if nodes != self._parentnodes:
             dbgoutput('dirstate change found')
             if self.locked():
-                dbgoutput('lock still held - ignoring for now')
-                return True
+                raise _LockStillHeld
             self.recordState()
             self.repo.thginvalidate()
             self.repositoryChanged.emit()
         if newbranch != self._rawbranch:
             dbgoutput('branch time change')
             if self.locked():
-                dbgoutput('lock still held - ignoring for now')
-                return True
+                raise _LockStillHeld
             self._rawbranch = newbranch
             self.repo.thginvalidate()
             self.workingBranchChanged.emit()