At file:///data/jelmer/bzr-stats/trunk/ ------------------------------------------------------------ revno: 28 revision-id: [email protected] parent: [email protected] parent: [email protected] committer: Jelmer Vernooij <[email protected]> branch nick: trunk timestamp: Thu 2009-01-15 00:15:09 +0100 message: Merge support for coping with missing emails. modified: __init__.py __init__.py-20060629132721-mkbaty0vfk4y3v59-1 ------------------------------------------------------------ revno: 23.2.2 revision-id: [email protected] parent: [email protected] committer: Paul Hummer <[email protected]> branch nick: import-branch-support timestamp: Wed 2009-01-14 16:02:15 -0700 message: Fixed a typo per review modified: __init__.py __init__.py-20060629132721-mkbaty0vfk4y3v59-1 ------------------------------------------------------------ revno: 23.2.1 revision-id: [email protected] parent: [email protected] committer: Paul Hummer <[email protected]> branch nick: stats timestamp: Sun 2008-07-27 10:17:02 +1200 message: Revisions with missing emails are no longer all attributed to the same person modified: __init__.py __init__.py-20060629132721-mkbaty0vfk4y3v59-1 === modified file '__init__.py' --- a/__init__.py 2008-08-04 19:49:51 +0000 +++ b/__init__.py 2009-01-14 23:15:09 +0000 @@ -42,7 +42,8 @@ fullname = config.parse_username(committer)[0] counts.setdefault(fullname, 0) counts[fullname] += 1 - return sorted(((count, name) for name,count in counts.iteritems()), reverse=True) + return sorted(((count, name) for name,count in counts.iteritems()), + reverse=True) def collapse_by_person(committers): @@ -101,11 +102,15 @@ revisions = a_repo.get_revisions(revids) for count, rev in enumerate(revisions): pb.update('checking', count, len(revids)) - email = config.parse_username(rev.get_apparent_author())[1] + username = config.parse_username(rev.get_apparent_author()) + if username[1] == '': + email = username[0] + else: + email = username[1] committers.setdefault(email, []).append(rev) finally: pb.finished() - + return committers @@ -127,7 +132,7 @@ def get_diff_info(a_repo, start_rev, end_rev): """Get only the info for new revisions between the two revisions - + This lets us figure out what has actually changed between 2 revisions. """ pb = ui.ui_factory.nested_progress_bar() @@ -168,9 +173,15 @@ sorted_fullnames = sorted(((count, fullname) for fullname,count in fullnames.iteritems()), reverse=True) - to_file.write('%4d %s <%s>\n' - % (count, sorted_fullnames[0][1], - sorted_emails[0][1])) + # There is a chance sometimes with svn imports that the full name and + # email can BOTH be blank. + if sorted_fullnames[0][1] == '': + to_file.write('%4d %s\n' + % (count, 'Unknown')) + else: + to_file.write('%4d %s <%s>\n' + % (count, sorted_fullnames[0][1], + sorted_emails[0][1])) if len(sorted_fullnames) > 1: print ' Other names:' for count, fname in sorted_fullnames[1:]:
-- bazaar-commits mailing list [email protected] https://lists.ubuntu.com/mailman/listinfo/bazaar-commits
