[PATCH 5 of 7 V2] fncache: move fncache writing to be in a transaction

Durham Goode durham at fb.com
Tue Apr 1 01:28:46 UTC 2014


On 3/31/14 6:25 PM, "Pierre-Yves David" <pierre-yves.david at ens-lyon.org>
wrote:

>
>
>On 03/31/2014 04:19 PM, Durham Goode wrote:
>> -    def _write(self, files, atomictemp):
>> -        fp = self.vfs('fncache', mode='wb', atomictemp=atomictemp)
>> -        if files:
>> -            fp.write(encodedir('\n'.join(files) + '\n'))
>> -        fp.close()
>> -        self._dirty = False
>> -
>> -    def write(self):
>> +    def write(self, tr):
>>           if self._dirty:
>> -            self._write(self.entries, True)
>> +            tr.addbackup('fncache')
>> +            fp = self.vfs('fncache', mode='wb', atomictemp=True)
>> +            if self.entries:
>> +                fp.write(encodedir('\n'.join(self.entries) + '\n'))
>> +            fp.close()
>> +            self._dirty = False
>
>
>there was both a `_write` and a `write` function before. It not very
>clear why you are droping it (nor it is very clear why it existed in the
>first place.
>
>Also, not that you looked at it for one week, consider documenting the
>on disk format.

It existed because write() and rewrite() both used to call _write().  Now
that rewrite is gone, I dropped _write() the next time a patch touched it.



More information about the Mercurial-devel mailing list