소스 검색

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 17 년 전
부모
커밋
82e685fbe0
1개의 변경된 파일7개의 추가작업 그리고 6개의 파일을 삭제
  1. 7
    6
      gitstats

+ 7
- 6
gitstats 파일 보기

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