Procházet zdrojové kódy

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).
Heikki Hokkanen před 17 roky
rodič
revize
82e685fbe0
1 změnil soubory, kde provedl 7 přidání a 6 odebrání
  1. 7
    6
      gitstats

+ 7
- 6
gitstats Zobrazit soubor

64
 	
64
 	
65
 	##
65
 	##
66
 	# Load cacheable data
66
 	# Load cacheable data
67
-	def loadCache(self, dir):
68
-		cachefile = os.path.join(dir, '.git', 'gitstats.cache')
67
+	def loadCache(self, cachefile):
69
 		if not os.path.exists(cachefile):
68
 		if not os.path.exists(cachefile):
70
 			return
69
 			return
71
 		print 'Loading cache...'
70
 		print 'Loading cache...'
125
 	
124
 	
126
 	##
125
 	##
127
 	# Save cacheable data
126
 	# Save cacheable data
128
-	def saveCache(self, dir):
127
+	def saveCache(self, filename):
129
 		print 'Saving cache...'
128
 		print 'Saving cache...'
130
-		f = open(os.path.join(dir, '.git', 'gitstats.cache'), 'w')
129
+		f = open(cachefile, 'w')
131
 		#pickle.dump(self.cache, f)
130
 		#pickle.dump(self.cache, f)
132
 		data = zlib.compress(pickle.dumps(self.cache))
131
 		data = zlib.compress(pickle.dumps(self.cache))
133
 		f.write(data)
132
 		f.write(data)
901
 
900
 
902
 os.chdir(gitpath)
901
 os.chdir(gitpath)
903
 
902
 
903
+cachefile = os.path.join(outputpath, 'gitstats.cache')
904
+
904
 print 'Collecting data...'
905
 print 'Collecting data...'
905
 data = GitDataCollector()
906
 data = GitDataCollector()
906
-data.loadCache(gitpath)
907
+data.loadCache(cachefile)
907
 data.collect(gitpath)
908
 data.collect(gitpath)
908
 print 'Refining data...'
909
 print 'Refining data...'
909
-data.saveCache(gitpath)
910
+data.saveCache(cachefile)
910
 data.refine()
911
 data.refine()
911
 
912
 
912
 os.chdir(rundir)
913
 os.chdir(rundir)