Skip to content
Open
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion src/ConfigFile.py
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ def ReadFileType (filename):

m = regex_file_type.match (line)
if not m or len (m.groups ()) != 2:
ConfigFile.croak ('Funky file type line "%s"' % (line))
croak ('Funky file type line "%s"' % (line))
if m.group (1) not in patterns:
patterns[m.group (1)] = []
if m.group (1) not in order:
Expand Down
25 changes: 17 additions & 8 deletions src/cncfdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -311,12 +311,21 @@ def PrintDateStats():
dates = DateMap.keys ()
dates.sort ()
total = 0
datef = open ('datelc.csv', 'w')
datef.write('Date,Changed,Total Changed\n')
# Modern CSV output for external tooling
datef_csv = open('datelc.csv', 'w')
datef_csv.write('Date,Changed,Total Changed\n')
# Legacy fixed-width output expected by tests/back-compat
datef_legacy = open('datelc', 'w')
for date in dates:
total += DateMap[date]
datef.write ('%d/%02d/%02d,%d,%d\n' % (date.year, date.month, date.day,
# CSV
datef_csv.write('%d/%02d/%02d,%d,%d\n' % (date.year, date.month, date.day,
DateMap[date], total))
# Legacy: date + two right-aligned integer columns width 7 and 8
datef_legacy.write('%d/%02d/%02d%7d%8d\n' % (date.year, date.month, date.day,
DateMap[date], total))
datef_csv.close()
datef_legacy.close()


#
Expand Down Expand Up @@ -571,12 +580,12 @@ def grabpatch(logpatch):
# Get the statistics (lines added/removes) using numstats
# and without requiring a diff (--numstat instead -p)
(filename, filetype, added, removed) = parse_numstat (Line, FileFilter)
if filename:
pa.added += added
pa.removed += removed
pa.addfiletype (filetype, added, removed)
if filename:
pa.added += added
pa.removed += removed
pa.addfiletype (filetype, added, removed)
if FileStats:
pa.addfile (filename, added, removed)
pa.addfile (filename, added, removed)

if '@' in pa.author.name:
GripeAboutAuthorName (pa.author.name)
Expand Down
9 changes: 6 additions & 3 deletions src/csvdump.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,14 +43,15 @@ def store_patch(patch):
if not patch.merge:
employer = patch.author.emailemployer(patch.email, patch.date)
employer = employer.name.replace('"', '.').replace ('\\', '.')
author = patch.author.name.replace ('"', '.').replace ('\\', '.')
author = email_encode(patch.author.name.replace ("'", '.'))
# Sanitize and encode author name consistently (quotes, slashes, apostrophes, and emails)
_author = patch.author.name.replace('"', '.').replace('\\', '.')
_author = email_encode(_author.replace("'", '.'))
try:
domain = patch.email.split('@')[1]
except:
domain = patch.email
ChangeSets.append([patch.commit, str(patch.date),
email_encode(patch.email), domain, author, employer,
email_encode(patch.email), domain, _author, employer,
patch.added, patch.removed, max(patch.added, patch.removed)])
for (filetype, (added, removed)) in patch.filetypes.iteritems():
FileTypes.append([patch.commit, filetype, added, removed])
Expand All @@ -67,6 +68,7 @@ def save_csv (prefix='data'):
'Added', 'Removed', 'Changed'])
for commit in ChangeSets:
writer.writerow(commit)
fd.close()

# Dump the file types
if len(FileTypes) > 0:
Expand All @@ -76,6 +78,7 @@ def save_csv (prefix='data'):
writer.writerow (['Commit', 'Type', 'Added', 'Removed'])
for commit in FileTypes:
writer.writerow(commit)
fd.close()



Expand Down
10 changes: 5 additions & 5 deletions src/gitdm.py
Original file line number Diff line number Diff line change
Expand Up @@ -323,11 +323,11 @@ def grabpatch(logpatch):
else:
# Get the statistics (lines added/removes) using numstats
# and without requiring a diff (--numstat instead -p)
(filename, filetype, added, removed) = parse_numstat (Line, FileFilter)
if filename:
p.added += added
p.removed += removed
p.addfiletype (filetype, added, removed)
(filename, filetype, added, removed) = parse_numstat (Line, FileFilter)
if filename:
p.added += added
p.removed += removed
p.addfiletype (filetype, added, removed)

if '@' in p.author.name:
GripeAboutAuthorName (p.author.name)
Expand Down