Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 7 additions & 7 deletions gitstats
Original file line number Diff line number Diff line change
Expand Up @@ -124,14 +124,14 @@ def getnumoffilesfromrev(time_rev):
Get number of files changed in commit
"""
time, rev = time_rev
return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, 'wc -l']).split('\n')[0]))
return (int(time), rev, int(getpipeoutput(['git ls-tree -r --name-only "%s"' % rev, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split('\n')[0]))

def getnumoflinesinblob(ext_blob):
"""
Get number of lines in blob
"""
ext, blob_id = ext_blob
return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, 'wc -l']).split()[0]))
return (ext, blob_id, int(getpipeoutput(['git cat-file blob %s' % blob_id, ('find /c /v ""', 'wc -l')[ON_LINUX]]).split()[0]))

class DataCollector:
"""Manages data collection from a revision control repository."""
Expand Down Expand Up @@ -286,10 +286,10 @@ class GitDataCollector(DataCollector):
def collect(self, dir):
DataCollector.collect(self, dir)

self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), 'wc -l']))
#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |wc -l'))
self.total_authors += int(getpipeoutput(['git shortlog -s %s' % getlogrange(), ('find /c /v ""', 'wc -l')[ON_LINUX]]))
#self.total_lines = int(getoutput('git-ls-files -z |xargs -0 cat |find /c /v ""'))

# tags
# tags
lines = getpipeoutput(['git show-ref --tags']).split('\n')
for line in lines:
if len(line) == 0:
Expand Down Expand Up @@ -327,7 +327,7 @@ class GitDataCollector(DataCollector):

# Collect revision statistics
# Outputs "<stamp> <date> <time> <timezone> <author> '<' <mail> '>'"
lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), 'grep -v ^commit']).split('\n')
lines = getpipeoutput(['git rev-list --pretty=format:"%%at %%ai %%aN <%%aE>" %s' % getlogrange('HEAD'), ('findstr /v ', 'grep -v ')[ON_LINUX] + '^commit']).split('\n')
for line in lines:
parts = line.split(' ', 4)
author = ''
Expand Down Expand Up @@ -434,7 +434,7 @@ class GitDataCollector(DataCollector):
self.commits_by_timezone[timezone] = self.commits_by_timezone.get(timezone, 0) + 1

# outputs "<stamp> <files>" for each revision
revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getlogrange('HEAD'), 'grep -v ^commit']).strip().split('\n')
revlines = getpipeoutput(['git rev-list --pretty=format:"%%at %%T" %s' % getlogrange('HEAD'), ('findstr /v ', 'grep -v ')[ON_LINUX] + '^commit']).strip().split('\n')
lines = []
revs_to_read = []
time_rev_count = []
Expand Down