D5301: store: append to fncache if there are only new files to write
Yuya Nishihara
yuya at tcha.org
Tue Nov 27 07:22:50 EST 2018
> @@ -479,32 +481,45 @@
> fp.write(encodedir('\n'.join(self.entries) + '\n'))
> fp.close()
> self._dirty = False
> + if self.addls:
> + # if we have just new entries, let's append them to the fncache
> + tr.addbackup('fncache')
> + fp = self.vfs('fncache', mode='ab', atomictemp=True)
> + if self.addls:
> + fp.write(encodedir('\n'.join(self.addls) + '\n'))
> + fp.close()
> + self.entries = None
> + self.addls = set()
It's probably better to write `entries | addls` at once if there are both
adds and removes. Appending to an `atomictemp` file means the entire file
is copied first.
More information about the Mercurial-devel
mailing list