/brz/remove-bazaar

To get this branch, use:
bzr branch http://gegoxaren.bato24.eu/bzr/brz/remove-bazaar

« back to all changes in this revision

Viewing changes to bzrlib/statcache.py

  • Committer: Martin Pool
  • Date: 2005-05-17 07:18:44 UTC
  • Revision ID: mbp@sourcefrog.net-20050517071844-bc4e00f4a8ede872
- add version marker at top of statcache

Show diffs side-by-side

added added

removed removed

Lines of Context:
88
88
SC_DEV     = 7
89
89
 
90
90
 
 
91
 
 
92
CACHE_HEADER = "### bzr statcache v2"
 
93
 
 
94
 
91
95
def fingerprint(abspath):
92
96
    try:
93
97
        fs = os.lstat(abspath)
107
111
 
108
112
    cachefn = os.path.join(basedir, '.bzr', 'stat-cache')
109
113
    outf = AtomicFile(cachefn, 'wb')
 
114
    outf.write(CACHE_HEADER + '\n')
110
115
    try:
111
116
        for entry in entry_iter:
112
117
            if len(entry) != 8:
136
141
 
137
142
    try:
138
143
        cachefn = os.path.join(basedir, '.bzr', 'stat-cache')
139
 
        cachefile = open(cachefn, 'r')
 
144
        cachefile = open(cachefn, 'rb')
140
145
    except IOError:
141
146
        return cache
142
 
    
 
147
 
 
148
    line1 = cachefile.readline().rstrip('\r\n')
 
149
    if line1 != CACHE_HEADER:
 
150
        mutter('cache header marker not found at top of %s' % cachefn)
 
151
        return cache
 
152
 
143
153
    for l in cachefile:
144
154
        f = l.split(' ')
145
155