Skip to content

Commit

Permalink
tidy and fix unicode regression
Browse files Browse the repository at this point in the history
  • Loading branch information
casperdcl committed Nov 27, 2018
1 parent e59cf70 commit 475c48c
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions gitfame/_gitfame.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@
__license__ = __licence__ # weird foreign language


RE_AUTHS = re.compile('\d+ \d+ (\d+)\nauthor (.+)$', flags=re.M)
RE_AUTHS = re.compile('^\w+ \d+ \d+ (\d+)\nauthor (.+)$', flags=re.M)
# finds all non-escaped commas
# NB: does not support escaping of escaped character
RE_CSPILT = re.compile(r'(?<!\\),')
Expand Down Expand Up @@ -218,25 +218,25 @@ def run(args):
log.warn(fname + ':' + str(e))
continue
log.log(logging.NOTSET, blame_out)
auths = RE_AUTHS.findall(blame_out)
loc_auths = RE_AUTHS.findall(blame_out)

for auth in auths:
nb_lines = int(auth[0])
auth_name = auth[1]
for loc, auth in loc_auths: # for each chunk
loc = int(loc)
auth = _str(auth)
try:
auth_stats[auth_name]["loc"] += nb_lines
auth_stats[auth]["loc"] += loc
except KeyError:
auth_stats[auth_name] = {"loc": nb_lines, "files": set([fname])}
auth_stats[auth] = {"loc": loc, "files": set([fname])}
else:
auth_stats[auth_name]["files"].add(fname)
auth_stats[auth]["files"].add(fname)

if args.bytype:
fext_key = ("." + fext(fname)) if fext(fname) else "._None_ext"
# auth_stats[auth].setdefault(fext_key, 0)
try:
auth_stats[auth_name][fext_key] += nb_lines
auth_stats[auth][fext_key] += loc
except KeyError:
auth_stats[auth_name][fext_key] = nb_lines
auth_stats[auth][fext_key] = loc

log.log(logging.NOTSET, "authors:" + '; '.join(auth_stats.keys()))
auth_commits = check_output(
Expand Down

0 comments on commit 475c48c

Please sign in to comment.