]> xenbits.xensource.com Git - people/larsk/xenproject-org-gitdm.git/commitdiff
Added functionality to count ACKED-by
authorLars Kurth <lars.kurth@xenproject.org>
Tue, 14 Jul 2015 18:01:27 +0000 (14:01 -0400)
committerLars Kurth <lars.kurth@xenproject.org>
Tue, 14 Jul 2015 18:01:27 +0000 (14:01 -0400)
README
database.py
gitdm
patterns.py
reports.py

diff --git a/README b/README
index dab372e4711db4b04a3ce21dd9c1ee65ea43ed18..91ad92b95bf0a63910bd30da664a5a73710c69ab 100644 (file)
--- a/README
+++ b/README
@@ -39,21 +39,21 @@ be:
                only.
 
        -D      Rather than create the usual statistics, create a file (datelc.csv)
-           providing lines changed per day, where the first column displays
-           the changes happened only on that day and the second sums the day it
-           happnened with the previous ones. This option is suitable for
-           feeding to a tool like gnuplot.
+               providing lines changed per day, where the first column displays
+               the changes happened only on that day and the second sums the day it
+               happened with the previous ones. This option is suitable for
+               feeding to a tool like gnuplot.
 
        -h file Generate HTML output to the given file
 
        -l num  Only list the top <num> entries in each report.
 
-    -n  Use --numstat instead of generated patches to get the statistics.
+        -n      Use --numstat instead of generated patches to get the statistics.
 
        -o file Write text output to the given file (default is stdout).
 
-    -p prefix Dump out the database categorized by changeset and by file type.
-           It requires -n, otherwise it is not possible to get separated results.
+        -p prefix Dump out the database categorized by changeset and by file type.
+               It requires -n, otherwise it is not possible to get separated results.
 
        -r pat  Only generate statistics for changes to files whose 
                name matches the given regular expression.
@@ -62,16 +62,16 @@ be:
                each patch.
 
        -t      Generate a report by type of contribution (code, documentation, etc.).
-           It requires -n, otherwise this option is ignored silently.
+               It requires -n, otherwise this option is ignored silently.
 
 
        -u      Group all unknown developers under the "(Unknown)"
                employer. 
 
-    -x file  Export raw statistics as CSV.
+        -x file Export raw statistics as CSV.
 
-    -w  Aggregate the data by weeks instead of months in the
-        CSV file when -x is used.
+        -w      Aggregate the data by weeks instead of months in the
+                CSV file when -x is used.
 
        -z      Dump out the hacker database to "database.dump".
 
index 321c5bfb95addd615bd12677a88138037babae95..0bede164af110ee8def51ba2ee7cea2d62285150 100644 (file)
@@ -22,6 +22,7 @@ class Hacker:
         self.patches = [ ]
         self.signoffs = [ ]
         self.reviews = [ ]
+        self.acks = [ ]
         self.tested = [ ]
         self.reports = [ ]
         self.testcred = self.repcred = 0
@@ -59,6 +60,8 @@ class Hacker:
         self.signoffs.append (patch)
     def addreview (self, patch):
         self.reviews.append (patch)
+    def addacked (self, patch):
+        self.acks.append (patch)
     def addtested (self, patch):
         self.tested.append (patch)
     def addreport (self, patch):
diff --git a/gitdm b/gitdm
index 25ffafbc26d9733375bc1057d28c6ebec1f7c56a..836b7ec265450fbb270c931137200a2ba0cd39a7 100755 (executable)
--- a/gitdm
+++ b/gitdm
@@ -55,15 +55,15 @@ ReportUnknowns = False
 # -D           Output date statistics
 # -h hfile     HTML output to hfile
 # -l count     Maximum length for output lists
-# -n        Use numstats instead of generated patch from git log
+# -n            Use numstats instead of generated patch from git log
 # -o file      File for text output
-# -p prefix Prefix for CSV output
+# -p prefix     Prefix for CSV output
 # -r pattern   Restrict to files matching pattern
 # -s           Ignore author SOB lines
 # -u           Map unknown employers to '(Unknown)'
 # -U           Dump unknown hackers in report
 # -x file.csv   Export raw statistics as CSV
-# -w        Aggregrate the raw statistics by weeks instead of months
+# -w            Aggregrate the raw statistics by weeks instead of months
 # -y            Aggregrate the raw statistics by years instead of months
 # -z           Dump out the hacker database at completion
 
@@ -170,6 +170,7 @@ class patch:
         self.email = 'unknown@hacker.net'
         self.sobs = [ ]
         self.reviews = [ ]
+        self.acks = [ ]
         self.testers = [ ]
         self.reports = [ ]
         self.filetypes = {}
@@ -177,6 +178,9 @@ class patch:
     def addreviewer (self, reviewer):
         self.reviews.append (reviewer)
 
+    def addacker (self, reviewer):
+        self.acks.append (reviewer)
+
     def addtester (self, tester):
         self.testers.append (tester)
 
@@ -250,11 +254,20 @@ def grabpatch(logpatch):
         #
         # Various other tags of interest.
         #
+
+        # Reviewed-by:
         m = patterns['reviewed-by'].match (Line)
         if m:
             email = database.RemapEmail (m.group (2))
             p.addreviewer (LookupStoreHacker(m.group (1), email))
             continue
+        # Acked-by:
+        m = patterns['acked-by'].match (Line)
+        if m:
+            email = database.RemapEmail (m.group (2))
+            p.addacker (LookupStoreHacker(m.group (1), email))
+            continue
+        # Tested-by:
         m = patterns['tested-by'].match (Line)
         if m:
             email = database.RemapEmail (m.group (2))
@@ -452,6 +465,11 @@ for logpatch in patches:
             sob.addsob (p)
         for hacker in p.reviews:
             hacker.addreview (p)
+        for hacker in p.acks:
+            # An ACK also counts as a review
+            # (but there is no easy way to not double count, if there are both)
+            hacker.addacked (p)
+            hacker.addreview (p)
         for hacker in p.testers:
             hacker.addtested (p)
         for hacker in p.reports:
index 4d4a347713b2cd284315fde58e16de98b2edd12b..9f687b9c49a1935b2391959600738703e73ceaf4 100644 (file)
@@ -33,6 +33,7 @@ patterns = {
     'filea': re.compile (r'^---\s+(.*)$'),
     'fileb': re.compile (r'^\+\+\+\s+(.*)$'),
     'reviewed-by': re.compile (r'^\s+Reviewed-by:' + _pemail+ '.*$'),
+    'acked-by': re.compile (r'^\s+Acked-by:' + _pemail+ '.*$'),
     'tested-by': re.compile (r'^\s+tested-by:' + _pemail + '.*$', re.I),
     'reported-by': re.compile (r'^\s+Reported-by:' + _pemail + '.*$'),
     'reported-and-tested-by': re.compile (r'^\s+reported-and-tested-by:' + _pemail + '.*$', re.I),
index bc1e18cdf4107e1ee70344fa69c19ec2e980f043..b50af2b1a46b0ce3c1b6397ca62f89c8c76e4195 100644 (file)
@@ -205,7 +205,7 @@ def ReportByRevs (hlist):
     for h in hlist:
         totalrevs += len (h.reviews)
     count = 0
-    BeginReport ('Developers with the most reviews (total %d)' % totalrevs)
+    BeginReport ('Developers with the most reviews, including ACKs (total %d)' % totalrevs)
     for h in hlist:
         scount = len (h.reviews)
         if scount > 0:
@@ -215,6 +215,25 @@ def ReportByRevs (hlist):
             break
     EndReport ()
 
+def CompareAcks (h1, h2):
+    return len (h2.acks) - len (h1.acks)
+
+def ReportByAcks (hlist):
+    hlist.sort (CompareAcks)
+    totalacks = 0
+    for h in hlist:
+        totalacks += len (h.acks)
+    count = 0
+    BeginReport ('Developers with the most ACKs (total %d)' % totalacks)
+    for h in hlist:
+        scount = len (h.acks)
+        if scount > 0:
+            ReportLine (h.name, scount, (scount*100.0)/totalacks)
+        count += 1
+        if count >= ListCount:
+            break
+    EndReport ()
+
 #
 # tester reporting.
 #
@@ -371,6 +390,7 @@ def DevReports (hlist, totalchanged, cscount, totalremoved):
     ReportByLRemoved (hlist, totalremoved)
     ReportBySOBs (hlist)
     ReportByRevs (hlist)
+    ReportByAcks (hlist)
     ReportByTests (hlist)
     ReportByTestCreds (hlist)
     ReportByReports (hlist)