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/05/24 21:30:04 UTC
git commit: Coho - only call git rebase when there is an update.
Updated Branches:
refs/heads/master ea2090ae1 -> 9d6e1f504
Coho - only call git rebase when there is an update.
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/9d6e1f50
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/9d6e1f50
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/9d6e1f50
Branch: refs/heads/master
Commit: 9d6e1f50405f411f762ae6f7d21a8613fbb732d3
Parents: ea2090a
Author: Andrew Grieve <ag...@chromium.org>
Authored: Fri May 24 15:29:40 2013 -0400
Committer: Andrew Grieve <ag...@chromium.org>
Committed: Fri May 24 15:29:40 2013 -0400
----------------------------------------------------------------------
coho | 35 ++++++++++++++++++++++-------------
1 files changed, 22 insertions(+), 13 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/9d6e1f50/coho
----------------------------------------------------------------------
diff --git a/coho b/coho
index dbb9809..5a84c1c 100755
--- a/coho
+++ b/coho
@@ -559,21 +559,30 @@ function updateRepos(repos, branches, noFetch) {
if (branches && branches.length) {
forEachRepo(repos, function(repo) {
- console.log('Updating ' + repo.repoName);
- var curBranch = retrieveCurrentBranchName();
- stashAndPop(repo, function() {
- branches.forEach(function(branchName) {
- if (!remoteBranchExists(repo, branchName)) {
- console.warning('Skipping branch. Remote branch "' + branchName + '" does not exist.');
- } else {
- if (curBranch != branchName) {
- execHelper('git checkout ' + branchName);
- curBranch = branchName;
+ var staleBranches = branches.filter(function(branchName) {
+ var curHash = execHelper('git rev-parse ' + branchName, true, true);
+ var newHash = execHelper('git rev-parse ' + repo.remoteName + '/' + branchName, true, true);
+ return curHash !== newHash;
+ });
+ if (!staleBranches.length) {
+ console.log('Repo already up-to-date: ' + repo.repoName);
+ } else {
+ console.log('Updating ' + repo.repoName);
+ var curBranch = retrieveCurrentBranchName();
+ stashAndPop(repo, function() {
+ staleBranches.forEach(function(branchName) {
+ if (!remoteBranchExists(repo, branchName)) {
+ console.warning('Skipping branch. Remote branch "' + branchName + '" does not exist.');
+ } else {
+ if (curBranch != branchName) {
+ execHelper('git checkout ' + branchName);
+ curBranch = branchName;
+ }
+ execHelper('git rebase ' + repo.remoteName + '/' + branchName);
}
- execHelper('git rebase ' + repo.remoteName + '/' + branchName);
- }
+ });
});
- });
+ }
});
}
}