mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-27 08:28:50 +02:00
Opacity working
This commit is contained in:
parent
529fce3209
commit
9c1c9ed664
4 changed files with 87 additions and 15 deletions
40
src/git.js
40
src/git.js
|
@ -308,7 +308,40 @@ GitEngine.prototype.getCommitFromRef = function(ref) {
|
|||
GitEngine.prototype.setLocationTarget = function(ref, target) {
|
||||
var ref = this.getOneBeforeCommit(ref);
|
||||
ref.set('target', target);
|
||||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.getUpstreamBranchSet = function() {
|
||||
// this is expensive!! so only call once in a while
|
||||
var commitToSet = {};
|
||||
|
||||
var bfsSearch = function(commit) {
|
||||
var set = [];
|
||||
var pQueue = [commit];
|
||||
while (pQueue.length) {
|
||||
var popped = pQueue.pop();
|
||||
set.push(popped.get('id'));
|
||||
|
||||
if (popped.get('parents') && popped.get('parents').length) {
|
||||
pQueue = pQueue.concat(popped.get('parents'));
|
||||
}
|
||||
}
|
||||
return set;
|
||||
};
|
||||
|
||||
this.branches.each(function(branch) {
|
||||
var set = bfsSearch(branch.get('target'));
|
||||
_.each(set, function(id) {
|
||||
commitToSet[id] = commitToSet[id] || [];
|
||||
commitToSet[id].push(branch.get('id'));
|
||||
});
|
||||
});
|
||||
|
||||
return commitToSet;
|
||||
};
|
||||
|
||||
GitEngine.prototype.getUpstreamHeadSet = function() {
|
||||
return this.getUpstreamSet('HEAD');
|
||||
};
|
||||
|
||||
GitEngine.prototype.getOneBeforeCommit = function(ref) {
|
||||
// you can call this command on HEAD in detached, HEAD, or on a branch
|
||||
|
@ -726,11 +759,6 @@ GitEngine.prototype.dispatch = function(command, callback) {
|
|||
}
|
||||
}));
|
||||
|
||||
// TODO (get rid of)
|
||||
for (var i = 0; i < 1; i++) {
|
||||
this.animationQueue.add(new Animation({closure: function() { console.log(Math.random()); }}));
|
||||
}
|
||||
|
||||
// animation queue will call the callback when its done
|
||||
this.animationQueue.start();
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue