[PATCH 1 of 2] store: abstract out how we retrieve a file's size
Bryan O'Sullivan
bos at serpentine.com
Wed Jun 27 12:37:56 CDT 2012
# HG changeset patch
# User Bryan O'Sullivan <bryano at fb.com>
# Date 1340662446 25200
# Node ID 080b8d275cfe8f355fbe778a175a1c4cf1e08083
# Parent a0c9d840a8948df01be0013f14f9ce5863f7b093
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
More information about the Mercurial-devel
mailing list