[PATCH stable] dirstate: don't mark entries with mtime in the future as unset (issue1790)

Adrian Buehlmann adrian at cadifra.com
Fri Aug 14 10:17:06 CDT 2009


# HG changeset patch
# User Adrian Buehlmann <adrian at cadifra.com>
# Date 1250262783 -7200
# Node ID d11df10a19aaa292ba023e93229d8d20a68f68ce
# Parent  3ac42ca1f3e617438c9fa3732678583ec6888bf6
dirstate: don't mark entries with mtime in the future as unset (issue1790)

diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
--- a/mercurial/dirstate.py
+++ b/mercurial/dirstate.py
@@ -377,9 +377,10 @@ class dirstate(object):
             gran = int(self._ui.config('dirstate', 'granularity', 1))
         except ValueError:
             gran = 1
-        limit = sys.maxint
         if gran > 0:
-            limit = util.fstat(st).st_mtime - gran
+            mt = util.fstat(st).st_mtime
+            ll = mt - gran
+            hl = mt + gran
 
         cs = cStringIO.StringIO()
         copymap = self._copymap
@@ -389,7 +390,7 @@ class dirstate(object):
         for f, e in self._map.iteritems():
             if f in copymap:
                 f = "%s\0%s" % (f, copymap[f])
-            if e[3] > limit and e[0] == 'n':
+            if gran > 0 and e[0] == 'n' and ll <= e[3] <= hl:
                 e = (e[0], 0, -1, -1)
             e = pack(_format, e[0], e[1], e[2], e[3], len(f))
             write(e)


More information about the Mercurial-devel mailing list