Patchwork D6030: store: move logic to check for invalid entry in fncache to own function

login
register
mail settings
Submitter phabricator
Date March 17, 2019, 1:39 a.m.
Message ID <d27a79f136b634f455343c0fe5a312a1@localhost.localdomain>
Download mbox | patch
Permalink /patch/39304/
State Not Applicable
Headers show

Comments

phabricator - March 17, 2019, 1:39 a.m.
This revision was automatically updated to reflect the committed changes.
Closed by commit rHGd7ef84e595f8: store: move logic to check for invalid entry in fncache to own function (authored by pulkit, committed by ).

REPOSITORY
  rHG Mercurial

CHANGES SINCE LAST UPDATE
  https://phab.mercurial-scm.org/D6030?vs=14254&id=14533

REVISION DETAIL
  https://phab.mercurial-scm.org/D6030

AFFECTED FILES
  mercurial/store.py

CHANGE DETAILS




To: pulkit, #hg-reviewers
Cc: mercurial-devel

Patch

diff --git a/mercurial/store.py b/mercurial/store.py
--- a/mercurial/store.py
+++ b/mercurial/store.py
@@ -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: