##// END OF EJS Templates
dirstate.write: don't ignore stat data if mtime is in the future (issue1790)...
Adrian Buehlmann -
r9378:1a7bcf58 default
parent child Browse files
Show More
@@ -0,0 +1,13 b''
1 #!/bin/sh
2
3 hg init
4 echo a > a
5 hg add
6 hg ci -m1
7
8 # set mtime of a into the future
9 touch -t 202101011200 a
10
11 # status must not set a's entry to unset (issue1790)
12 hg status
13 hg debugstate
@@ -0,0 +1,2 b''
1 adding a
2 n 644 2 2021-01-01 12:00:00 a
@@ -377,9 +377,9 b' class dirstate(object):'
377 gran = int(self._ui.config('dirstate', 'granularity', 1))
377 gran = int(self._ui.config('dirstate', 'granularity', 1))
378 except ValueError:
378 except ValueError:
379 gran = 1
379 gran = 1
380 limit = sys.maxint
381 if gran > 0:
380 if gran > 0:
382 limit = util.fstat(st).st_mtime - gran
381 hlimit = util.fstat(st).st_mtime
382 llimit = hlimit - gran
383
383
384 cs = cStringIO.StringIO()
384 cs = cStringIO.StringIO()
385 copymap = self._copymap
385 copymap = self._copymap
@@ -389,7 +389,8 b' class dirstate(object):'
389 for f, e in self._map.iteritems():
389 for f, e in self._map.iteritems():
390 if f in copymap:
390 if f in copymap:
391 f = "%s\0%s" % (f, copymap[f])
391 f = "%s\0%s" % (f, copymap[f])
392 if e[3] > limit and e[0] == 'n':
392 if gran > 0 and e[0] == 'n' and llimit < e[3] <= hlimit:
393 # file was updated too recently, ignore stat data
393 e = (e[0], 0, -1, -1)
394 e = (e[0], 0, -1, -1)
394 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
395 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
395 write(e)
396 write(e)
General Comments 0
You need to be logged in to leave comments. Login now