cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: Split out pull requests from commits in last-week --me command
Date Mon, 09 Dec 2013 19:22:00 GMT
Updated Branches:
  refs/heads/master dd3168ce5 -> 90a9db4c8


Split out pull requests from commits in last-week --me command


Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/90a9db4c
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/90a9db4c
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/90a9db4c

Branch: refs/heads/master
Commit: 90a9db4c8931254fa5f7979e6ef493975ae60b06
Parents: dd3168c
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Mon Dec 9 14:21:42 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Mon Dec 9 14:21:42 2013 -0500

----------------------------------------------------------------------
 coho | 35 ++++++++++++++++++++++++++++++++---
 1 file changed, 32 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/90a9db4c/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 94c29e4..d104fa2 100755
--- a/coho
+++ b/coho
@@ -1353,10 +1353,12 @@ function lastWeekCommand() {
     var filterByEmail = !!argv.me;
     var days = argv.days || 7;
     var userEmail = filterByEmail && execHelper('git config user.email', true);
+    var commitCount = 0;
+    var pullRequestCount = 0;
 
-    var cmd = 'git log --no-merges --date=short';
+    var cmd = 'git log --no-merges --date=short --all-match --fixed-strings';
     if (filterByEmail) {
-        cmd += ' --committer="' + userEmail + '"';
+        cmd += ' --committer="' + userEmail + '" --author="' + userEmail + '"';
     }
 
     print('Running command: ' + cmd + ' --format="$REPO_NAME %s" --since="' + days + ' days
ago"');
@@ -1365,9 +1367,36 @@ function lastWeekCommand() {
         var output = execHelper(cmd + ' --format="' + repoName + ' %cd %s"' +
             ' --since="' + days + ' days ago"', true);
         if (output) {
-            console.log(output)
+            console.log(output);
+            commitCount += output.split('\n').length;
         }
     });
+
+    if (filterByEmail) {
+        console.log('\nPull requests:');
+        cmd = 'git log --no-merges --date=short --fixed-strings --committer="' + userEmail
+ '"';
+        forEachRepo(repos, function(repo) {
+            var repoName = repo.id + new Array(Math.max(0, 20 - repo.id.length + 1)).join('
');
+            var output = execHelper(cmd + ' --format="%an|' + repoName + ' %cd %s"' +
+                ' --since="' + days + ' days ago"', true);
+            if (output) {
+                output.split('\n').forEach(function(line) {
+                    line = line.replace(/(.*?)\|/, '');
+                    if (RegExp.lastParen.indexOf(userEmail) == -1) {
+                        console.log(line);
+                        pullRequestCount += 1;
+                    }
+                });
+            }
+        });
+    }
+
+    console.log('');
+    if (filterByEmail) {
+        console.log('Total Commits: ' + commitCount + ' Total Pull Requests: ' + pullRequestCount);
+    } else {
+        console.log('Total Commits: ' + commitCount);
+    }
 }
 
 function ratCommand() {


Mime
View raw message