From 82e685fbe015a34f5ab86e72722d75613139ce8d Mon Sep 17 00:00:00 2001 From: Heikki Hokkanen Date: Sat, 22 Nov 2008 10:32:14 +0200 Subject: [PATCH] Save cache to output directory, not git repository. This closes bug #2184326 on SourceForge. Some people may not have access to their git repository, so we save the cache to the output directory instead (which must always have write access anyway). --- gitstats | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/gitstats b/gitstats index 29bbec6..5a97741 100755 --- a/gitstats +++ b/gitstats @@ -64,8 +64,7 @@ class DataCollector: ## # Load cacheable data - def loadCache(self, dir): - cachefile = os.path.join(dir, '.git', 'gitstats.cache') + def loadCache(self, cachefile): if not os.path.exists(cachefile): return print 'Loading cache...' @@ -125,9 +124,9 @@ class DataCollector: ## # Save cacheable data - def saveCache(self, dir): + def saveCache(self, filename): print 'Saving cache...' - f = open(os.path.join(dir, '.git', 'gitstats.cache'), 'w') + f = open(cachefile, 'w') #pickle.dump(self.cache, f) data = zlib.compress(pickle.dumps(self.cache)) f.write(data) @@ -901,12 +900,14 @@ print 'Output path: %s' % outputpath os.chdir(gitpath) +cachefile = os.path.join(outputpath, 'gitstats.cache') + print 'Collecting data...' data = GitDataCollector() -data.loadCache(gitpath) +data.loadCache(cachefile) data.collect(gitpath) print 'Refining data...' -data.saveCache(gitpath) +data.saveCache(cachefile) data.refine() os.chdir(rundir) -- 2.11.4.GIT