Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge branch 'i-335'

0.5.29
  • Loading branch information...
commit 5386f85b61abb88ef49d0250d4819f33ce937e88 2 parents 85703c7 + 4c2393a
@scf2k scf2k authored
View
5 ChangeLog.md
@@ -1,5 +1,10 @@
bem-tools changelog
===================
+25.03.2013, Version 0.5.29 (stable)
+-----------------------------------
+
+- bem make: don't update git library form upstream when working copy state satisfies to configured one. git update commands chain altered (no git reset for now) (Closes #335)
+
20.03.2013, Version 0.5.27 (stable)
-----------------------------------
View
66 lib/nodes/lib.js
@@ -333,7 +333,71 @@ registry.decl(GitLibraryNodeName, ScmLibraryNodeName, /** @lends GitLibraryNode.
},
getUpdateCmd: function(url, target) {
- return UTIL.format('cd %s && git fetch origin && git reset --hard %s', target, this.treeish || 'origin/' + this.branch);
+ var onBranch = !this.treeish;
+
+ return UTIL.format('cd %s && git fetch origin %s git checkout %s %s', target,
+ onBranch? ('&& git branch ' + this.branch + '; '): ' && ',
+ this.treeish || this.branch,
+ onBranch? '&& git rebase origin/' + this.branch: '');
+ },
+
+ isValid: function() {
+
+ var _this = this,
+ path = PATH.resolve(this.root, this.target);
+
+ return QFS.exists(path)
+ .then(function(exists) {
+ return exists && _this.getInfo(path)
+ .then(function(info) {
+ var head = info['HEAD'],
+ wanted = _this.treeish || _this.branch;
+
+ LOGGER.verbose('HEAD is at ' + head + ' wanted is ' + wanted);
+
+ // head is at configured hash
+ if (wanted === head) return true;
+
+ var resolves = 'refs/heads/' + wanted;
+ if (info[resolves] !== head) resolves = 'refs/tags/' + wanted;
+ if (info[resolves] !== head) resolves = '';
+
+ if (resolves) LOGGER.fverbose('%s resolves to %s', head, resolves)
+ else LOGGER.fverbose('%s does not resolve to %s', head, wanted);
+
+ return !!resolves;
+ });
+ });
+
+ },
+
+ getInfo: function(path) {
+
+ var _this = this,
+ cmd = UTIL.format('cd %s && git show-ref --head', path),
+ d = Q.defer();
+
+ this.log(cmd);
+
+ CP.exec(cmd, function(err, stdout, stderr) {
+ stderr && _this.log(stderr);
+
+ if (err) return d.reject(err);
+
+ d.resolve(_this._parseInfo(stdout));
+ });
+
+ return d.promise;
+ },
+
+ _parseInfo: function(stdout) {
+ var refs = {};
+ stdout.split('\n').forEach(function(line) {
+ var ref = line.split(' ');
+ refs[ref[1]] = ref[0];
+ })
+
+ return refs;
}
});
View
2  npm-shrinkwrap.json
@@ -1,6 +1,6 @@
{
"name": "bem",
- "version": "0.5.28",
+ "version": "0.5.29",
"dependencies": {
"coa": {
"version": "0.3.9"
View
2  package.json
@@ -1,7 +1,7 @@
{
"name": "bem",
"description": "BEM Tools",
- "version": "0.5.28",
+ "version": "0.5.29",
"homepage": "http://github.com/bem/bem-tools",
"author": "Sergey Berezhnoy <veged@mail.ru> (http://github.com/veged)",
"maintainers": [
Please sign in to comment.
Something went wrong with that request. Please try again.