D5301: store: append to fncache if there are only new files to write
yuja (Yuya Nishihara)
phabricator at mercurial-scm.org
Tue Nov 27 07:24:29 EST 2018
yuja added a comment.
> @@ -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.
REPOSITORY
rHG Mercurial
REVISION DETAIL
https://phab.mercurial-scm.org/D5301
To: pulkit, #hg-reviewers
Cc: yuja, mjpieters, mercurial-devel
More information about the Mercurial-devel
mailing list