Show More
@@ -373,13 +373,9 b' class dirstate(object):' | |||||
373 | return |
|
373 | return | |
374 | st = self._opener("dirstate", "w", atomictemp=True) |
|
374 | st = self._opener("dirstate", "w", atomictemp=True) | |
375 |
|
375 | |||
376 | try: |
|
376 | # use the modification time of the newly created temporary file as the | |
377 | gran = int(self._ui.config('dirstate', 'granularity', 1)) |
|
377 | # filesystem's notion of 'now' | |
378 | except ValueError: |
|
378 | now = int(util.fstat(st).st_mtime) | |
379 | gran = 1 |
|
|||
380 | if gran > 0: |
|
|||
381 | hlimit = util.fstat(st).st_mtime |
|
|||
382 | llimit = hlimit - gran |
|
|||
383 |
|
379 | |||
384 | cs = cStringIO.StringIO() |
|
380 | cs = cStringIO.StringIO() | |
385 | copymap = self._copymap |
|
381 | copymap = self._copymap | |
@@ -389,9 +385,19 b' class dirstate(object):' | |||||
389 | for f, e in self._map.iteritems(): |
|
385 | for f, e in self._map.iteritems(): | |
390 | if f in copymap: |
|
386 | if f in copymap: | |
391 | f = "%s\0%s" % (f, copymap[f]) |
|
387 | f = "%s\0%s" % (f, copymap[f]) | |
392 | if gran > 0 and e[0] == 'n' and llimit < e[3] <= hlimit: |
|
388 | ||
393 | # file was updated too recently, ignore stat data |
|
389 | if e[0] == 'n' and e[3] == now: | |
394 | e = (e[0], 0, -1, -1) |
|
390 | # The file was last modified "simultaneously" with the current | |
|
391 | # write to dirstate (i.e. within the same second for file- | |||
|
392 | # systems with a granularity of 1 sec). This commonly happens | |||
|
393 | # for at least a couple of files on 'update'. | |||
|
394 | # The user could change the file without changing its size | |||
|
395 | # within the same second. Invalidate the file's stat data in | |||
|
396 | # dirstate, forcing future 'status' calls to compare the | |||
|
397 | # contents of the file. This prevents mistakenly treating such | |||
|
398 | # files as clean. | |||
|
399 | e = (e[0], 0, -1, -1) # mark entry as 'unset' | |||
|
400 | ||||
395 | e = pack(_format, e[0], e[1], e[2], e[3], len(f)) |
|
401 | e = pack(_format, e[0], e[1], e[2], e[3], len(f)) | |
396 | write(e) |
|
402 | write(e) | |
397 | write(f) |
|
403 | write(f) |
General Comments 0
You need to be logged in to leave comments.
Login now