Kiln » TortoiseHg » TortoiseHg
Clone URL:  
Pushed to one repository · View In Graph Contained in 2.1, 2.1.1, and 2.1.2

thgrepo: disable the fs watcher when a repository is deleted

Changeset 6105aded6606

Parent 164587e1e0fb

by Steve Borho

Changes to one file · Browse files at 6105aded6606 Showing diff from parent 164587e1e0fb Diff from another changeset...

 
83
84
85
86
87
88
 
89
90
91
 
107
108
109
110
111
112
 
 
 
113
114
115
 
117
118
119
 
 
 
 
 
 
 
120
121
122
 
83
84
85
 
86
87
88
89
90
91
 
107
108
109
 
 
 
110
111
112
113
114
115
 
117
118
119
120
121
122
123
124
125
126
127
128
129
@@ -83,9 +83,9 @@
  else:   self.watcher = QFileSystemWatcher(self)   self.watcher.addPath(repo.path) - self.addMissingPaths()   self.watcher.directoryChanged.connect(self.onDirChange)   self.watcher.fileChanged.connect(self.onFileChange) + self.addMissingPaths()     @pyqtSlot(QString)   def onDirChange(self, directory): @@ -107,9 +107,9 @@
  if hglib.tounicode(f) not in files:   dbgoutput('add file to watcher:', f)   self.watcher.addPath(f) - _, existing = self.repo.uifiles() - for f in existing: - if f and hglib.tounicode(f) not in files: + _, files = self.repo.uifiles() + for f in files: + if f and os.path.exists(f) and hglib.tounicode(f) not in files:   dbgoutput('add ui file to watcher:', f)   self.watcher.addPath(f)   @@ -117,6 +117,13 @@
  if not os.path.exists(self.repo.path):   dbgoutput('Repository destroyed', self.repo.root)   self.repositoryDestroyed.emit() + # disable watcher by removing all watched paths + dirs = self.watcher.directories() + if dirs: + self.watcher.removePaths(dirs) + files = self.watcher.files() + if files: + self.watcher.removePaths(files)   if self.repo.root in _repocache:   del _repocache[self.repo.root]   return