Commits

Yuya Nishihara  committed 94b4298

thgrepo: move control of enabling filesystem monitor to RepoAgent (refs #1783)

  • Participants
  • Parent commits 27597e5

Comments (0)

Files changed (1)

File tortoisehg/hgqt/thgrepo.py

         self.recordState()
         self._uimtime = time.time()
 
-        monitorrepo = repo.ui.config('tortoisehg', 'monitorrepo', 'always')
-        if monitorrepo == 'never':
-            dbgoutput('watching of F/S events is disabled by configuration')
-        elif isinstance(repo, bundlerepo.bundlerepository):
-            dbgoutput('not watching F/S events for bundle repository')
-        elif monitorrepo == 'localonly' and paths.netdrive_status(repo.path):
-            dbgoutput('not watching F/S events for network drive')
-        else:
-            self.startMonitoring()
-
     def startMonitoring(self):
         """Start filesystem monitoring to notify changes automatically"""
         if not self._fswatcher:
         watcher.repositoryDestroyed.connect(self.repositoryDestroyed)
         watcher.workingDirectoryChanged.connect(self.workingDirectoryChanged)
         watcher.workingBranchChanged.connect(self.workingBranchChanged)
+        self.startMonitoringIfEnabled()
+
+    def startMonitoringIfEnabled(self):
+        repo = self._repo
+        monitorrepo = repo.ui.config('tortoisehg', 'monitorrepo', 'always')
+        if monitorrepo == 'never':
+            dbgoutput('watching of F/S events is disabled by configuration')
+        elif isinstance(repo, bundlerepo.bundlerepository):
+            dbgoutput('not watching F/S events for bundle repository')
+        elif monitorrepo == 'localonly' and paths.netdrive_status(repo.path):
+            dbgoutput('not watching F/S events for network drive')
+        else:
+            self._watcher.startMonitoring()
 
     def rawRepo(self):
         return self._repo