Commits

Yuya Nishihara committed 2be30d7

repowatcher: detect removal of repository files (fixes #3697)

If the repository rollback to null revision, 00changelog.i will be removed.

  • Participants
  • Parent commits 546a2cd

Comments (0)

Files changed (2)

tests/qt_repoagent_test.py

 
     def setUp(self):
         testname = self.id().split('.')[-1]
-        self.srchg.clone('.', testname)
+        self.srchg.clone('--pull', '.', testname)  # --pull for rollback
         self.hg = helpers.HgClient(os.path.join(self.srchg.path, testname))
         ui = uimod.ui()
         ui.setconfig('tortoisehg', 'monitorrepo', 'always')
         self.wait_changed(thgrepo.WorkingParentChanged
                           | thgrepo.WorkingStateChanged)
 
+    def test_rollback_to_null(self):
+        self.agent.runCommand(['rollback'])
+        # it seems "rollback" does not touch dirstate
+        self.wait_changed(thgrepo.LogChanged)
+
     def test_branch_changed(self):
         self.agent.runCommand(['branch', 'foo'])
         self.wait_changed(thgrepo.WorkingBranchChanged)

tortoisehg/hgqt/thgrepo.py

                     curdata[readmeth] = readmeth(self)
                 except EnvironmentError:
                     pass
-            elif readmeth in self._lastdata:
+            elif cur >= 0 and readmeth in self._lastdata:
                 curdata[readmeth] = self._lastdata[readmeth]
 
         return curmtimes, curdata
         for path, (flag, _watched) in self._filesmap.iteritems():
             last = self._lastmtimes.get(path, -1)
             cur = curmtimes.get(path, -1)
-            if last < cur:
+            if last < cur or (last >= 0 and cur < 0):
                 self._ui.debug(' mtime: %s (%r -> %r)\n' % (path, last, cur))
                 changeflags |= flag
         for readmeth, (flag, _path) in self._datamap.iteritems():