cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject git commit: Log CWD in every print statement
Date Fri, 15 Nov 2013 18:30:20 GMT
Updated Branches:
  refs/heads/master e19d0ce93 -> 332f7c0f8


Log CWD in every print statement


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

Branch: refs/heads/master
Commit: 332f7c0f84df8f9b9146806eb1f9043e61d44b08
Parents: e19d0ce
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Fri Nov 15 13:30:04 2013 -0500
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Fri Nov 15 13:30:04 2013 -0500

----------------------------------------------------------------------
 coho | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/332f7c0f/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index 1b7c4a5..3b4197b 100755
--- a/coho
+++ b/coho
@@ -328,9 +328,16 @@ function reportGitPushResult(repos, branches) {
 
 function print() {
     var newArgs = Array.prototype.slice.call(arguments);
+    // Prefix any prints() to distinguish them from command output.
     if (newArgs.length > 1 || newArgs[0]) {
-        newArgs.unshift('====');
-        newArgs = newArgs.map(function(val) { return val.replace(/\n/g, '\n==== ') });
+        var curDir = path.relative(origWorkingDir, process.cwd());
+        var prefix = './' + curDir + '/ =';
+        var PREFIX_LEN = 30;
+        if (prefix.length < PREFIX_LEN) {
+            prefix += new Array(PREFIX_LEN - prefix.length + 1).join('=');
+        }
+        newArgs.unshift(prefix);
+        newArgs = newArgs.map(function(val) { return val.replace(/\n/g, '\n' + prefix + '
') });
     }
 
     console.log.apply(console, newArgs);
@@ -383,18 +390,6 @@ function registerHelpFlag(opt) {
     });
 }
 
-var lastLoggedDir = null;
-function logCwd() {
-    var curDir = process.cwd();
-    if (curDir != lastLoggedDir) {
-        lastLoggedDir = curDir;
-        var relPath = path.relative(origWorkingDir, curDir);
-        if (relPath) {
-            print('Changed directory to: ' + relPath);
-        }
-    }
-}
-
 function execHelper(cmd, silent, allowError) {
     // Don't allow failure if being silent.
     allowError = allowError || silent;
@@ -402,8 +397,7 @@ function execHelper(cmd, silent, allowError) {
         gitCommitCount++;
     }
     if (!silent) {
-        logCwd();
-        print('Executing command:', cmd);
+        print('Executing:', cmd);
     }
     // silent==2 is used only when modifying ulimit and re-exec'ing,
     // so don't be silent but allow whatever to happen.


Mime
View raw message