dirstate: fix in memory dirstate entries for 1-second race

Adrian Buehlmann adrian at cadifra.com
Tue Apr 6 06:15:01 CDT 2010


On 06.04.2010 00:59, Adrian Buehlmann wrote:
> (cc-ing mercurial-devel)
> 
> tonfa committed e5aaa4543289 in crew stable:
> 
>> diff --git a/mercurial/dirstate.py b/mercurial/dirstate.py
>> --- a/mercurial/dirstate.py
>> +++ b/mercurial/dirstate.py
>> @@ -391,16 +391,8 @@ class dirstate(object):
>>          # 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]
> 
> Is this really needed? We just need to update an existing entry, why do
> another map lookup by f inside the loop for all f's?
> 

Fixed with
http://hg.intevation.org/mercurial/crew/rev/3492f443f579


More information about the Mercurial-devel mailing list