##// END OF EJS Templates
dirstate: no need to iterate twice, a dict can be updated in place
Benoit Boissinot -
r10865:3492f443 stable
parent child Browse files
Show More
@@ -391,8 +391,13 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 for f in self._map.keys():
394
395 e = self._map[f]
395 cs = cStringIO.StringIO()
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():
396 if e[0] == 'n' and e[3] == now:
401 if e[0] == 'n' and e[3] == now:
397 # The file was last modified "simultaneously" with the current
402 # The file was last modified "simultaneously" with the current
398 # write to dirstate (i.e. within the same second for file-
403 # write to dirstate (i.e. within the same second for file-
@@ -403,14 +408,9 b' class dirstate(object):'
403 # dirstate, forcing future 'status' calls to compare the
408 # dirstate, forcing future 'status' calls to compare the
404 # contents of the file. This prevents mistakenly treating such
409 # contents of the file. This prevents mistakenly treating such
405 # files as clean.
410 # files as clean.
406 self._map[f] = (e[0], 0, -1, -1) # mark entry as 'unset'
411 e = (e[0], 0, -1, -1) # mark entry as 'unset'
412 self._map[f] = e
407
413
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:
414 if f in copymap:
415 f = "%s\0%s" % (f, copymap[f])
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))
General Comments 0
You need to be logged in to leave comments. Login now