cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: Add a --pretend flag to tag-release command
Date Tue, 25 Jun 2013 16:43:24 GMT
Updated Branches:
  refs/heads/master 395fa1417 -> 9da76568f


Add a --pretend flag to tag-release 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/9da76568
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/9da76568
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/9da76568

Branch: refs/heads/master
Commit: 9da76568fcc1ba78a3d58ddcc8af437eda032c63
Parents: 395fa14
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Tue Jun 25 12:43:12 2013 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Tue Jun 25 12:43:12 2013 -0400

----------------------------------------------------------------------
 coho | 22 ++++++++++++++++++----
 1 file changed, 18 insertions(+), 4 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9da76568/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index dd543ca..7d7c9c7 100755
--- a/coho
+++ b/coho
@@ -326,7 +326,10 @@ function logCwd() {
     var curDir = process.cwd();
     if (curDir != lastLoggedDir) {
         lastLoggedDir = curDir;
-        print('Changed directory to: ' + path.relative(origWorkingDir, curDir));
+        var relPath = path.relative(origWorkingDir, curDir);
+        if (relPath) {
+            print('Changed directory to: ' + relPath);
+        }
     }
 }
 
@@ -1045,14 +1048,25 @@ function tagReleaseBranchCommand(argv) {
         .usage('Tags a release branches.\n' +
                '\n' +
                'Usage: $0 tag-release --version=2.8.0rc1')
+        .options('pretend', {
+            desc: 'Don\'t actually run git commands, just print out what would be run.',
+         })
     );
     var repos = computeReposFromFlag(argv);
     var version = argv.version;
+    var pretend = argv.pretend;
     var branchName = getVersionBranchName(version);
 
     // First - perform precondition checks.
     updateRepos(repos, [], true);
 
+    function execOrPretend(cmd) {
+        if (pretend) {
+            print('PRETENDING TO RUN: ' + cmd);
+        } else {
+            execHelper(cmd);
+        }
+    }
     forEachRepo(repos, function(repo) {
         stashAndPop(repo, function() {
             // git fetch.
@@ -1072,11 +1086,11 @@ function tagReleaseBranchCommand(argv) {
             var tagName = retrieveCurrentTagName();
             if (tagName != version) {
                 if (tagExists(version)) {
-                    execHelper('git tag ' + version + ' --force');
+                    execOrPretend('git tag ' + version + ' --force');
                 } else {
-                    execHelper('git tag ' + version);
+                    execOrPretend('git tag ' + version);
                 }
-                execHelper('git push --tags ' + repo.remoteName + ' ' + branchName);
+                execOrPretend('git push --tags ' + repo.remoteName + ' ' + branchName);
             } else {
                 print('Repo ' + repo.repoName + ' is already tagged.');
             }


Mime
View raw message