1. TortoiseHg
  2. TortoiseHg
  3. thg

Commits

Yuya Nishihara  committed 1a5ee1c

thgrepo: recreate QFileSystemWatcher to restart monitoring (fixes #3298)

QWindowsFileSystemWatcherEngine seems to have a bug which makes monitoring
of ".hg" and ".hg/store" directory not restartable. After that, it cannot
detect deletion of lock files.

https://bugreports.qt-project.org/browse/QTBUG-32917

  • Participants
  • Parent commits cdf0972
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/thgrepo.py

View file
  • Ignore whitespace
         if files:
             self._fswatcher.removePaths(files)
 
+        # QTBUG-32917: On Windows, removePaths() fails to remove ".hg" and
+        # ".hg/store" from the list, but actually they are not watched.
+        # Thus, they cannot be watched again by the same fswatcher instance.
+        if self._fswatcher.directories() or self._fswatcher.files():
+            dbgoutput('failed to remove paths - destroying watcher')
+            self._fswatcher.setParent(None)
+            self._fswatcher = None
+
     def isMonitoring(self):
         """True if filesystem monitor is running"""
         if not self._fswatcher: