##// END OF EJS Templates
dirstate: fix in memory dirstate entries for 1-second race...
Benoit Boissinot -
r10836:e5aaa454 stable
parent child Browse files
Show More
@@ -391,16 +391,8 b' class dirstate(object):'
391 # use the modification time of the newly created temporary file as the
391 # use the modification time of the newly created temporary file as the
392 # filesystem's notion of 'now'
392 # filesystem's notion of 'now'
393 now = int(util.fstat(st).st_mtime)
393 now = int(util.fstat(st).st_mtime)
394
394 for f in self._map.keys():
395 cs = cStringIO.StringIO()
395 e = self._map[f]
396 copymap = self._copymap
397 pack = struct.pack
398 write = cs.write
399 write("".join(self._pl))
400 for f, e in self._map.iteritems():
401 if f in copymap:
402 f = "%s\0%s" % (f, copymap[f])
403
404 if e[0] == 'n' and e[3] == now:
396 if e[0] == 'n' and e[3] == now:
405 # The file was last modified "simultaneously" with the current
397 # The file was last modified "simultaneously" with the current
406 # write to dirstate (i.e. within the same second for file-
398 # write to dirstate (i.e. within the same second for file-
@@ -411,8 +403,16 b' class dirstate(object):'
411 # dirstate, forcing future 'status' calls to compare the
403 # dirstate, forcing future 'status' calls to compare the
412 # contents of the file. This prevents mistakenly treating such
404 # contents of the file. This prevents mistakenly treating such
413 # files as clean.
405 # files as clean.
414 e = (e[0], 0, -1, -1) # mark entry as 'unset'
406 self._map[f] = (e[0], 0, -1, -1) # mark entry as 'unset'
415
407
408 cs = cStringIO.StringIO()
409 copymap = self._copymap
410 pack = struct.pack
411 write = cs.write
412 write("".join(self._pl))
413 for f, e in self._map.iteritems():
414 if f in copymap:
415 f = "%s\0%s" % (f, copymap[f])
416 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
416 e = pack(_format, e[0], e[1], e[2], e[3], len(f))
417 write(e)
417 write(e)
418 write(f)
418 write(f)
General Comments 0
You need to be logged in to leave comments. Login now