# HG changeset patch # User Bryan O'Sullivan # Date 2012-06-25 22:14:06 # Node ID d592759aabc7f1675a6c9c7b287219f8265ced10 # Parent 54da604fefee8f10bab61e4e420050e86114ef43 store: abstract out how we retrieve a file's size diff --git a/mercurial/store.py b/mercurial/store.py --- a/mercurial/store.py +++ b/mercurial/store.py @@ -391,15 +391,16 @@ class fncachestore(basicstore): def join(self, f): return self.path + '/' + self.encode(f) + def getsize(self, path): + return os.stat(self.path + '/' + path).st_size + def datafiles(self): rewrite = False existing = [] - spath = self.path for f in self.fncache: ef = self.encode(f) try: - st = os.stat(spath + '/' + ef) - yield f, ef, st.st_size + yield f, ef, self.getsize(ef) existing.append(f) except OSError: # nonexistent entry