|
|
@@ -241,11 +241,17 @@ class DataCollector:
|
|
241
|
241
|
# Save cacheable data
|
|
242
|
242
|
def saveCache(self, cachefile):
|
|
243
|
243
|
print 'Saving cache...'
|
|
244
|
|
- f = open(cachefile, 'wb')
|
|
|
244
|
+ tempfile = cachefile + '.tmp'
|
|
|
245
|
+ f = open(tempfile, 'wb')
|
|
245
|
246
|
#pickle.dump(self.cache, f)
|
|
246
|
247
|
data = zlib.compress(pickle.dumps(self.cache))
|
|
247
|
248
|
f.write(data)
|
|
248
|
249
|
f.close()
|
|
|
250
|
+ try:
|
|
|
251
|
+ os.remove(cachefile)
|
|
|
252
|
+ except OSError:
|
|
|
253
|
+ pass
|
|
|
254
|
+ os.rename(tempfile, cachefile)
|
|
249
|
255
|
|
|
250
|
256
|
class GitDataCollector(DataCollector):
|
|
251
|
257
|
def collect(self, dir):
|