Commits

Yuya Nishihara  committed 546a2cd

repowatcher: add _-prefix to private fields

  • Participants
  • Parent commits fe47638

Comments (0)

Files changed (1)

File tortoisehg/hgqt/thgrepo.py

 
     def __init__(self, repo, parent=None):
         super(RepoWatcher, self).__init__(parent)
-        self.repo = repo
+        self._repo = repo
         self._ui = repo.ui
         self._fswatcher = None
         self._filesmap = {}  # path: (flag, watched)
             self._fswatcher = QFileSystemWatcher(self)
             self._fswatcher.directoryChanged.connect(self._pollChanges)
             self._fswatcher.fileChanged.connect(self._pollChanges)
-        self._fswatcher.addPath(hglib.tounicode(self.repo.path))
-        self._fswatcher.addPath(hglib.tounicode(self.repo.spath))
+        self._fswatcher.addPath(hglib.tounicode(self._repo.path))
+        self._fswatcher.addPath(hglib.tounicode(self._repo.spath))
         self._addMissingPaths()
         self._fswatcher.blockSignals(False)
 
             if hglib.tounicode(f) not in files:
                 self._ui.debug('add file to watcher: %s\n' % f)
                 self._fswatcher.addPath(hglib.tounicode(f))
-        for f in self.repo.uifiles():
+        for f in self._repo.uifiles():
             if f and os.path.exists(f) and hglib.tounicode(f) not in files:
                 self._ui.debug('add ui file to watcher: %s\n' % f)
                 self._fswatcher.addPath(hglib.tounicode(f))
 
     def pollStatus(self):
-        if not os.path.exists(self.repo.path):
-            self._ui.debug('repository destroyed: %s\n' % self.repo.root)
+        if not os.path.exists(self._repo.path):
+            self._ui.debug('repository destroyed: %s\n' % self._repo.root)
             self.repositoryDestroyed.emit()
             return
         if self._locked():
         self._checkuimtime()
 
     def _locked(self):
-        if os.path.lexists(self.repo.join('wlock')):
+        if os.path.lexists(self._repo.join('wlock')):
             return True
-        if os.path.lexists(self.repo.sjoin('lock')):
+        if os.path.lexists(self._repo.sjoin('lock')):
             return True
         return False
 
     def _fixState(self):
         """Update paths to be checked and record state of new paths"""
-        repo = self.repo
+        repo = self._repo
         q = getattr(repo, 'mq', None)
         newfilesmap = {
             # no need to watch 'bookmarks' because repo._bookmarks.write
         return changeflags
 
     def _readparents(self):
-        return self.repo.opener('dirstate').read(40)
+        return self._repo.opener('dirstate').read(40)
 
     def _readbranch(self):
-        return self.repo.opener('branch').read()
+        return self._repo.opener('branch').read()
 
     def _checkuimtime(self):
         'Check for modified config files, or a new .hg/hgrc file'
         try:
-            files = self.repo.uifiles()
+            files = self._repo.uifiles()
             mtime = max(os.path.getmtime(f) for f in files if os.path.isfile(f))
             if mtime > self._uimtime:
                 self._ui.debug('config change detected\n')