[Pkg-bazaar-commits] ./bzr/unstable r524: - add version marker at top of statcache
Martin Pool
mbp at sourcefrog.net
Fri Apr 10 08:18:59 UTC 2009
------------------------------------------------------------
revno: 524
committer: Martin Pool <mbp at sourcefrog.net>
timestamp: Tue 2005-05-17 17:18:44 +1000
message:
- add version marker at top of statcache
modified:
bzrlib/statcache.py
-------------- next part --------------
=== modified file 'bzrlib/statcache.py'
--- a/bzrlib/statcache.py 2005-05-16 04:32:21 +0000
+++ b/bzrlib/statcache.py 2005-05-17 07:18:44 +0000
@@ -88,6 +88,10 @@
SC_DEV = 7
+
+CACHE_HEADER = "### bzr statcache v2"
+
+
def fingerprint(abspath):
try:
fs = os.lstat(abspath)
@@ -107,6 +111,7 @@
cachefn = os.path.join(basedir, '.bzr', 'stat-cache')
outf = AtomicFile(cachefn, 'wb')
+ outf.write(CACHE_HEADER + '\n')
try:
for entry in entry_iter:
if len(entry) != 8:
@@ -136,10 +141,15 @@
try:
cachefn = os.path.join(basedir, '.bzr', 'stat-cache')
- cachefile = open(cachefn, 'r')
+ cachefile = open(cachefn, 'rb')
except IOError:
return cache
-
+
+ line1 = cachefile.readline().rstrip('\r\n')
+ if line1 != CACHE_HEADER:
+ mutter('cache header marker not found at top of %s' % cachefn)
+ return cache
+
for l in cachefile:
f = l.split(' ')
More information about the Pkg-bazaar-commits
mailing list