big strides on gitEngine

This commit is contained in:
Peter Cottle 2012-11-03 14:55:57 -07:00
parent 546332a587
commit 343cd37105
2 changed files with 13 additions and 9 deletions

View file

@ -140,7 +140,8 @@ GitEngine.prototype.reloadGraphics = function() {
// this just basically makes the HEAD branch. the head branch really should have been // this just basically makes the HEAD branch. the head branch really should have been
// a member of a collection and not this annoying edge case stuff... // a member of a collection and not this annoying edge case stuff...
this.gitVisuals.whenGitEngineReady(this); // TODO -- hackyyy
this.gitVisuals.grabHeadBranch();
// when the paper is ready // when the paper is ready
this.gitVisuals.drawTreeFromReload(); this.gitVisuals.drawTreeFromReload();

View file

@ -26,6 +26,7 @@ var Visualization = Backbone.View.extend({
gitVisuals: this.gitVisuals gitVisuals: this.gitVisuals
}); });
this.gitEngine = gitEngine; this.gitEngine = gitEngine;
this.gitVisuals.assignGitEngine(this.gitEngine);
// needs to be called before raphael ready // needs to be called before raphael ready
this.myResize(); this.myResize();
@ -77,8 +78,6 @@ function GitVisuals(options) {
events.on('refreshTree', _.bind( events.on('refreshTree', _.bind(
this.refreshTree, this this.refreshTree, this
)); ));
events.on('gitEngineReady', this.whenGitEngineReady, this);
} }
GitVisuals.prototype.resetAll = function() { GitVisuals.prototype.resetAll = function() {
@ -100,11 +99,15 @@ GitVisuals.prototype.resetAll = function() {
this.commitMap = {}; this.commitMap = {};
}; };
GitVisuals.prototype.whenGitEngineReady = function(gitEngine) { GitVisuals.prototype.assignGitEngine = function(gitEngine) {
// seed this with the HEAD pseudo-branch this.gitEngine = gitEngine;
this.grabHeadBranch();
};
GitVisuals.prototype.grabHeadBranch = function() {
// seed this with the HEAD pseudo-branch
var headBranch = new VisBranch({ var headBranch = new VisBranch({
branch: gitEngine.HEAD, branch: this.gitEngine.HEAD,
gitVisuals: this gitVisuals: this
}); });
@ -246,8 +249,8 @@ GitVisuals.prototype.calcGraphicsCoords = function() {
}; };
GitVisuals.prototype.calcUpstreamSets = function() { GitVisuals.prototype.calcUpstreamSets = function() {
this.upstreamBranchSet = gitEngine.getUpstreamBranchSet(); this.upstreamBranchSet = this.gitEngine.getUpstreamBranchSet();
this.upstreamHeadSet = gitEngine.getUpstreamHeadSet(); this.upstreamHeadSet = this.gitEngine.getUpstreamHeadSet();
}; };
GitVisuals.prototype.getCommitUpstreamBranches = function(commit) { GitVisuals.prototype.getCommitUpstreamBranches = function(commit) {
@ -300,7 +303,7 @@ GitVisuals.prototype.getCommitUpstreamStatus = function(commit) {
}; };
GitVisuals.prototype.calcBranchStacks = function() { GitVisuals.prototype.calcBranchStacks = function() {
var branches = gitEngine.getBranches(); var branches = this.gitEngine.getBranches();
var map = {}; var map = {};
_.each(branches, function(branch) { _.each(branches, function(branch) {
var thisId = branch.target.get('id'); var thisId = branch.target.get('id');