1. TortoiseHg
  2. TortoiseHg
  3. thg


Yuya Nishihara  committed 082df2c

thgrepo: update old uimtime only in check method

Previously uimtime was remembered as propertycache and cleared by
thginvalidate() or invalidateui(). So, it couldn't detect ui change in the
following case:

1. "Refresh" -> thginvalidate() -> del _uimtime
2. touch .hg/hgrc
3. _checkuimtime() -> update _uimtime
(mtime == _uimtime but it should mtime > _uimtime)

With this change, _uimtime is managed in the same manner as _repomtime, except
for the initial value. It's initialized by the current time for simplicity.

I'll remove deprecated thgrepository._uimtime later by follow-up patch.

  • Participants
  • Parent commits 21ac208
  • Branches stable

Comments (0)

Files changed (1)

File tortoisehg/hgqt/thgrepo.py

View file
 import shutil
 import tempfile
 import re
+import time
 from PyQt4.QtCore import *
         repo.workingDirectoryChanged = self.workingDirectoryChanged
         repo.workingBranchChanged = self.workingBranchChanged
+        self._uimtime = time.time()
         monitorrepo = repo.ui.config('tortoisehg', 'monitorrepo', 'always')
         if isinstance(repo, bundlerepo.bundlerepository):
     def _checkuimtime(self):
         'Check for modified config files, or a new .hg/hgrc file'
-            oldmtime, files = self.repo.uifiles()
-            mtime = [os.path.getmtime(f) for f in files if os.path.isfile(f)]
-            if max(mtime) > oldmtime:
+            files = self.repo.uifiles()[1]
+            mtime = max(os.path.getmtime(f) for f in files if os.path.isfile(f))
+            if mtime > self._uimtime:
                 dbgoutput('config change detected')
+                self._uimtime = mtime
         except (EnvironmentError, ValueError):
             return heads
+        # TODO: remove _uimtime which is superseded by ThgRepoWrapper._uimtime
         def uifiles(self):
             'Returns latest mtime and complete list of config files'
             return self._uimtime, self._uifiles