You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ni...@apache.org on 2015/05/28 03:18:26 UTC

cordova-coho git commit: Series of improvements to the list-pulls command * Add support for `--short` for shorter more compact display of pull requests by truncating the PR body message * Add PR number at the beginning of the title * Suggest using coh

Repository: cordova-coho
Updated Branches:
  refs/heads/master 0a5bcbec8 -> 4c6b70eb1


Series of improvements to the list-pulls command
 * Add support for `--short` for shorter more compact display of pull requests by truncating the PR body message
 * Add PR number at the beginning of the title
 * Suggest using coho merge-pr for merging PRs
 * Use CWD to find repo if no repo is specified.. This closes #80


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

Branch: refs/heads/master
Commit: 4c6b70eb154ab492446c8509a68dd5a05b5c2e40
Parents: 0a5bcbe
Author: Nikhil Khandelwal <ni...@microsoft.com>
Authored: Thu May 21 18:08:02 2015 -0700
Committer: Nikhil Khandelwal <ni...@microsoft.com>
Committed: Wed May 27 18:17:13 2015 -0700

----------------------------------------------------------------------
 src/flagutil.js   |  4 ++++
 src/list-pulls.js | 19 ++++++++++++++-----
 2 files changed, 18 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/4c6b70eb/src/flagutil.js
----------------------------------------------------------------------
diff --git a/src/flagutil.js b/src/flagutil.js
index baefb98..cc65024 100644
--- a/src/flagutil.js
+++ b/src/flagutil.js
@@ -43,6 +43,10 @@ exports.registerDepthFlag = function(opt) {
 }
 
 exports.computeReposFromFlag = function(flagValue, includeSvn) {
+    if (flagValue === 'auto') {
+        console.log('No repos specified - using repo in CWD');
+        flagValue = '.';
+    }
     var values = flagValue === true ? [] : Array.isArray(flagValue) ? flagValue : [flagValue];
     var ret = [];
     var addedIds = {};

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/4c6b70eb/src/list-pulls.js
----------------------------------------------------------------------
diff --git a/src/list-pulls.js b/src/list-pulls.js
index c0ee899..b0255f7 100644
--- a/src/list-pulls.js
+++ b/src/list-pulls.js
@@ -51,7 +51,7 @@ function addLastCommentInfo(repo, pullRequests, callback) {
     });
 }
 
-function listGitHubPullRequests(repo, maxAge, hideUser, callback) {
+function listGitHubPullRequests(repo, maxAge, hideUser, short, callback) {
     var url = GITHUB_API_URL + 'repos/' + GITHUB_ORGANIZATION + '/' + repo + '/pulls';
 
     request.get({ url: url, headers: { 'User-Agent': 'Cordova Coho' }}, function(err, res, pullRequests) {
@@ -110,17 +110,22 @@ function listGitHubPullRequests(repo, maxAge, hideUser, callback) {
                 var updatedDate = new Date(pullRequest.updated_at);
                 var daysAgo = Math.round((new Date() - updatedDate) / (60 * 60 * 24 * 1000));
                 console.log('\x1B[33m-----------------------------------------------------------------------------------------------\x1B[39m');
-                console.log(pullRequest.user.login + ': ' + pullRequest.title + ' (\x1B[31m' + (pullRequest.lastUpdatedBy || '<no comments>') + ' ' + daysAgo + ' days ago\x1B[39m)');
+                console.log('PR #' + pullRequest.number + ': ' + pullRequest.user.login + ': ' +
+                    pullRequest.title + ' (\x1B[31m' + (pullRequest.lastUpdatedBy || '<no comments>') + ' ' + daysAgo + ' days ago\x1B[39m)');
                 console.log('\x1B[33m-----------------------------------------------------------------------------------------------\x1B[39m');
                 console.log('* ' + pullRequest.html_url);
                 // console.log('To merge: curl "' + pullRequest.patch_url + '" | git am');
                 if (!pullRequest.head.repo) {
                     console.log('NO REPO EXISTS!');
                 } else {
-                    console.log('To merge: git pull ' + pullRequest.head.repo.clone_url + ' ' + pullRequest.head.ref);
+                    console.log('To merge: coho merge-pr --pr ' + pullRequest.number);
                 }
                 if (pullRequest.body) {
-                    console.log(pullRequest.body);
+                    if (short && pullRequest.body.length > 100) {
+                        console.log(pullRequest.body.substring(0, 100) + '...');
+                    } else {
+                        console.log(pullRequest.body);
+                    }
                 }
                 console.log('');
             });
@@ -140,6 +145,10 @@ function *listPullRequestsCommand() {
         .options('hide-user', {
             desc: 'Hide PRs where the last comment\'s is by this github user.',
             type: 'string'
+         })
+         .options('short', {
+            desc: 'Truncates PR body description',
+            type: 'bool'
          });
     opt.usage('Reports what GitHub pull requests are open for the given repositories.\n' +
                '\n' +
@@ -159,7 +168,7 @@ function *listPullRequestsCommand() {
     function next() {
         if (repos.length) {
             var repo = repos.shift();
-            listGitHubPullRequests(repo.repoName, argv['max-age'], argv['hide-user'], next);
+            listGitHubPullRequests(repo.repoName, argv['max-age'], argv['hide-user'], argv.short, next);
         }
     }
     


---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org