mercurial/dirstate.py
branchstable
changeset 10865 3492f443f579
parent 10836 e5aaa4543289
child 10935 5f10634f9e68
equal deleted inserted replaced
10863:60b42f318a6d 10865:3492f443f579
   389         st = self._opener("dirstate", "w", atomictemp=True)
   389         st = self._opener("dirstate", "w", atomictemp=True)
   390 
   390 
   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-
   399                 # systems with a granularity of 1 sec). This commonly happens
   404                 # systems with a granularity of 1 sec). This commonly happens
   400                 # for at least a couple of files on 'update'.
   405                 # for at least a couple of files on 'update'.
   401                 # The user could change the file without changing its size
   406                 # The user could change the file without changing its size
   402                 # within the same second. Invalidate the file's stat data in
   407                 # within the same second. Invalidate the file's stat data in
   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'
   407 
   412                 self._map[f] = e
   408         cs = cStringIO.StringIO()
   413 
   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))
   417             write(e)
   417             write(e)
   418             write(f)
   418             write(f)