Mercurial > hg-stable
changeset 41978:d7ef84e595f8
store: move logic to check for invalid entry in fncache to own function
This helps separate the original reading logic from the one which finds for an
invalid entry.
Differential Revision: https://phab.mercurial-scm.org/D6030
author | Pulkit Goyal <pulkit@yandex-team.ru> |
---|---|
date | Wed, 27 Feb 2019 16:29:48 +0300 |
parents | 7c86caee3323 |
children | 51685c6dcca3 |
files | mercurial/store.py |
diffstat | 1 files changed, 5 insertions(+), 1 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/store.py Sat Mar 09 02:52:49 2019 +0000 +++ b/mercurial/store.py Wed Feb 27 16:29:48 2019 +0300 @@ -464,13 +464,17 @@ self.entries = set() return self.entries = set(decodedir(fp.read()).splitlines()) + self._checkentries(fp) + fp.close() + + def _checkentries(self, fp): + """ make sure there is no empty string in entries """ if '' in self.entries: fp.seek(0) for n, line in enumerate(util.iterfile(fp)): if not line.rstrip('\n'): t = _('invalid entry in fncache, line %d') % (n + 1) raise error.Abort(t) - fp.close() def write(self, tr): if self._dirty: