You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by ag...@apache.org on 2014/04/24 17:40:56 UTC

git commit: print-tags module

Repository: cordova-coho
Updated Branches:
  refs/heads/master c41020ff4 -> 1795102f5


print-tags module


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

Branch: refs/heads/master
Commit: 1795102f5db26074a3dfb581126cf3772004995b
Parents: c41020f
Author: Andrew Grieve <ag...@chromium.org>
Authored: Thu Apr 24 11:40:46 2014 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Thu Apr 24 11:40:46 2014 -0400

----------------------------------------------------------------------
 src/main.js       | 24 +-----------------------
 src/print-tags.js | 51 ++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 52 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/1795102f/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index 714e68a..aab09da 100644
--- a/src/main.js
+++ b/src/main.js
@@ -74,28 +74,6 @@ function createRepoUrl(repo) {
     return 'https://git-wip-us.apache.org/repos/asf/' + repo.repoName + '.git';
 }
 
-function *printTagsCommand(argv) {
-    var opt = flagutil.registerRepoFlag(optimist)
-    opt = flagutil.registerHelpFlag(opt);
-    var argv = opt
-        .usage('Prints out tags & hashes for the given repos. Used in VOTE emails.\n' +
-               '\n' +
-               'Usage: $0 print-tags -r plugman -r cli')
-        .argv;
-
-    if (argv.h) {
-        optimist.showHelp();
-        process.exit(1);
-    }
-    var repos = flagutil.computeReposFromFlag(argv.r);
-
-    yield repoutil.forEachRepo(repos, function*(repo) {
-        var tag = yield gitutil.findMostRecentTag();
-        var ref = yield executil.execHelper(executil.ARGS('git show-ref ' + tag), true);
-        console.log('    ' + repo.repoName + ': ' + tag.replace(/^r/, '') + ' (' + ref.slice(0, 10) + ')');
-    });
-}
-
 function *listReleaseUrls(argv) {
     var opt = flagutil.registerRepoFlag(optimist)
     opt = opt
@@ -811,7 +789,7 @@ function main() {
         }, {
             name: 'print-tags',
             desc: 'Prints out tags & hashes for the given repos. Used in VOTE emails.',
-            entryPoint: printTagsCommand
+            entryPoint: require('./print-tags')
         }, {
             name: 'last-week',
             desc: 'Prints out git logs of things that happened last week.',

http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/1795102f/src/print-tags.js
----------------------------------------------------------------------
diff --git a/src/print-tags.js b/src/print-tags.js
new file mode 100644
index 0000000..1f50334
--- /dev/null
+++ b/src/print-tags.js
@@ -0,0 +1,51 @@
+/*
+Licensed to the Apache Software Foundation (ASF) under one
+or more contributor license agreements.  See the NOTICE file
+distributed with this work for additional information
+regarding copyright ownership.  The ASF licenses this file
+to you under the Apache License, Version 2.0 (the
+"License"); you may not use this file except in compliance
+with the License.  You may obtain a copy of the License at
+
+http://www.apache.org/licenses/LICENSE-2.0
+
+Unless required by applicable law or agreed to in writing,
+software distributed under the License is distributed on an
+"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+KIND, either express or implied.  See the License for the
+specific language governing permissions and limitations
+under the License.
+*/
+
+var optimist = require('optimist');
+var executil = require('./executil');
+var flagutil = require('./flagutil');
+var gitutil = require('./gitutil');
+var repoutil = require('./repoutil');
+
+module.exports = function*(argv) {
+    var opt = flagutil.registerRepoFlag(optimist)
+    opt = flagutil.registerHelpFlag(opt);
+    var argv = opt
+        .usage('Prints out tags & hashes for the given repos. Used in VOTE emails.\n' +
+               '\n' +
+               'Usage: $0 print-tags -r plugman -r cli')
+        .argv;
+
+    if (argv.h) {
+        optimist.showHelp();
+        process.exit(1);
+    }
+    var repos = flagutil.computeReposFromFlag(argv.r);
+
+    yield repoutil.forEachRepo(repos, function*(repo) {
+        var tag = yield gitutil.findMostRecentTag();
+        if (!tag) {
+            console.log('    ' + repo.repoName + ': NO TAGS');
+            return;
+        }
+        var ref = yield executil.execHelper(executil.ARGS('git show-ref ' + tag), true);
+        console.log('    ' + repo.repoName + ': ' + tag.replace(/^r/, '') + ' (' + ref.slice(0, 10) + ')');
+    });
+}
+