cordova-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From agri...@apache.org
Subject [2/2] cordova-coho git commit: Make create-archive work when output files already exist, and have it restore origin branch
Date Thu, 09 Apr 2015 16:15:06 GMT
Make create-archive work when output files already exist, and have it restore origin branch


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

Branch: refs/heads/master
Commit: 08aa4c0b13024ff03957c47d0375ffe862d1c6dc
Parents: b2e3e25
Author: Andrew Grieve <agrieve@chromium.org>
Authored: Thu Apr 9 12:14:37 2015 -0400
Committer: Andrew Grieve <agrieve@chromium.org>
Committed: Thu Apr 9 12:14:37 2015 -0400

----------------------------------------------------------------------
 src/create-verify-archive.js | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/08aa4c0b/src/create-verify-archive.js
----------------------------------------------------------------------
diff --git a/src/create-verify-archive.js b/src/create-verify-archive.js
index eafbeb7..f499e28 100644
--- a/src/create-verify-archive.js
+++ b/src/create-verify-archive.js
@@ -79,18 +79,21 @@ exports.createCommand = function*(argv) {
         if (!tag) {
             apputil.fatal('Could not find most recent tag. Try running with --tag');
         }
+        if (!argv['allow-pending'] && (yield gitutil.pendingChangesExist())) {
+            apputil.fatal('Aborting because pending changes exist in ' + repo.repoName +
' (run "git status")');
+        }
+        var origBranch = yield gitutil.retrieveCurrentBranchName(true);
+
         yield gitutil.gitCheckout(tag);
         print('Creating archive of ' + repo.repoName + '@' + tag);
 
         if (!(repo.id==='mobile-spec')) {
-            if (!argv['allow-pending'] && (yield gitutil.pendingChangesExist()))
{
-                apputil.fatal('Aborting because pending changes exist in ' + repo.repoName);
-            }
             var pkgInfo = require(path.resolve('package'));
             var tgzname = pkgInfo.name + '-' + pkgInfo.version + '.tgz';
             yield executil.execHelper(executil.ARGS('npm pack'), 1, false);
             var outPath = path.join(absOutDir, tgzname);
             if (path.resolve(tgzname) != outPath) {
+                shelljs.rm('-f', outPath + "*");
                 shelljs.mv(tgzname, outPath);
             }
             print('Created archive: ' + outPath);
@@ -104,6 +107,9 @@ exports.createCommand = function*(argv) {
             fs.writeFileSync(outPath + '.md5', (yield computeHash(outPath, 'MD5')) + '\n');
             fs.writeFileSync(outPath + '.sha', (yield computeHash(outPath, 'SHA512')) + '\n');
         }
+        if (origBranch) {
+            yield gitutil.gitCheckout(origBranch);
+        }
     });
     print();
     print('Archives created.');


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


Mime
View raw message