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 2013/06/25 18:43:24 UTC

git commit: Add a --pretend flag to tag-release command

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 <ag...@chromium.org>
Authored: Tue Jun 25 12:43:12 2013 -0400
Committer: Andrew Grieve <ag...@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.');
             }