Ver código fonte

Merge e53043d00b79451e2b2dc7049b9ab5fb6793b987 into 55c5c285558c410bb35ebf421245d320ab9ee9fa

MiopeCiclope 8 anos atrás
pai
commit
223e842cb5
1 arquivos alterados com 7 adições e 7 exclusões
  1. 7
    7
      gitstats

+ 7
- 7
gitstats Ver arquivo

@@ -124,14 +124,14 @@ def getnumoffilesfromrev(time_rev):
124 124
 	Get number of files changed in commit
125 125
 	"""
126 126
 	time, rev = time_rev
127
-	return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, 'wc -l']).split('\n')[0]))
127
+	return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split('\n')[0]))
128 128
 
129 129
 def getnumoflinesinblob(ext_blob):
130 130
 	"""
131 131
 	Get number of lines in blob
132 132
 	"""
133 133
 	ext, blob_id = ext_blob
134
-	return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, 'wc -l']).split()[0]))
134
+	return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split()[0]))
135 135
 
136 136
 class DataCollector:
137 137
 	"""Manages data collection from a revision control repository."""
@@ -286,10 +286,10 @@ class GitDataCollector(DataCollector):
286 286
 	def collect(self, dir):
287 287
 		DataCollector.collect(self, dir)
288 288
 
289
-		self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l']))
290
-		#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l'))
289
+		self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), ('find /c /v ""', 'wc -l')[ON_LINUX]]))
290
+		#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |find /c /v ""'))
291 291
 
292
-		# tags
292
+		# tags		
293 293
 		lines = getpipeoutput(['git show-ref --tags']).split('\n')
294 294
 		for line in lines:
295 295
 			if len(line) == 0:
@@ -327,7 +327,7 @@ class GitDataCollector(DataCollector):
327 327
 
328 328
 		# Collect revision statistics
329 329
 		# Outputs "<stamp> <date> <time> <timezone> <author> '<' <mail> '>'"
330
-		lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), 'grep -v ^commit']).split('\n')
330
+		lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), ('findstr /v ', 'grep -v ')[ON_LINUX] + '^commit']).split('\n')
331 331
 		for line in lines:
332 332
 			parts = line.split(' ', 4)
333 333
 			author = ''
@@ -434,7 +434,7 @@ class GitDataCollector(DataCollector):
434 434
 			self.commits_by_timezone[timezone] = self.commits_by_timezone.get(timezone, 0) + 1
435 435
 
436 436
 		# outputs "<stamp> <files>" for each revision
437
-		revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getlogrange('HEAD'), 'grep -v ^commit']).strip().split('\n')
437
+		revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getlogrange('HEAD'), ('findstr /v ',  'grep -v ')[ON_LINUX] + '^commit']).strip().split('\n')
438 438
 		lines = []
439 439
 		revs_to_read = []
440 440
 		time_rev_count = []