Rev 28: Merge support for coping with missing emails. in file:///data/jelmer/bzr-stats/trunk/

Jelmer Vernooij jelmer at samba.org
Wed Jan 14 23:16:40 GMT 2009


At file:///data/jelmer/bzr-stats/trunk/

------------------------------------------------------------
revno: 28
revision-id: jelmer at samba.org-20090114231509-7wut2joqnnnuaasb
parent: v.ladeuil+lp at free.fr-20080929162400-b89zfmmm9wzr7iol
parent: paul at eventuallyanyway.com-20090114230215-8yt1b39qkhd3oh5x
committer: Jelmer Vernooij <jelmer at samba.org>
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: paul at eventuallyanyway.com-20090114230215-8yt1b39qkhd3oh5x
    parent: paul.hummer at canonical.com-20080726221702-wr73kqqapcj448kr
    committer: Paul Hummer <paul at eventuallyanyway.com>
    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: paul.hummer at canonical.com-20080726221702-wr73kqqapcj448kr
    parent: jelmer at samba.org-20080704124331-hg0jgb6cs9boauut
    committer: Paul Hummer <paul.hummer at canonical.com>
    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:]:




More information about the bazaar-commits mailing list