Mercurial > hg-stable
changeset 10836:e5aaa4543289 stable
dirstate: fix in memory dirstate entries for 1-second race
Only the on-disk file was modified, we need to modify the in-memory dirstate
as well.
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Mon, 05 Apr 2010 18:13:20 +0200 |
parents | 37a5a397f150 |
children | 1fdeab02350c 07dbafd3a0e2 |
files | mercurial/dirstate.py |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/dirstate.py Thu Apr 01 17:49:38 2010 -0500 +++ b/mercurial/dirstate.py Mon Apr 05 18:13:20 2010 +0200 @@ -391,16 +391,8 @@ # use the modification time of the newly created temporary file as the # filesystem's notion of 'now' now = int(util.fstat(st).st_mtime) - - cs = cStringIO.StringIO() - copymap = self._copymap - pack = struct.pack - write = cs.write - write("".join(self._pl)) - for f, e in self._map.iteritems(): - if f in copymap: - f = "%s\0%s" % (f, copymap[f]) - + for f in self._map.keys(): + e = self._map[f] if e[0] == 'n' and e[3] == now: # The file was last modified "simultaneously" with the current # write to dirstate (i.e. within the same second for file- @@ -411,8 +403,16 @@ # dirstate, forcing future 'status' calls to compare the # contents of the file. This prevents mistakenly treating such # files as clean. - e = (e[0], 0, -1, -1) # mark entry as 'unset' + self._map[f] = (e[0], 0, -1, -1) # mark entry as 'unset' + cs = cStringIO.StringIO() + copymap = self._copymap + pack = struct.pack + write = cs.write + write("".join(self._pl)) + for f, e in self._map.iteritems(): + if f in copymap: + f = "%s\0%s" % (f, copymap[f]) e = pack(_format, e[0], e[1], e[2], e[3], len(f)) write(e) write(f)