BOOM reloadddding fixed

This commit is contained in:
Peter Cottle 2012-11-05 00:36:03 -08:00
parent 3281c88b52
commit 0a9ec17852
3 changed files with 22 additions and 11 deletions

View file

@ -10,10 +10,9 @@ function GitEngine(options) {
this.rootCommit = null; this.rootCommit = null;
this.refs = {}; this.refs = {};
this.HEAD = null; this.HEAD = null;
this.id_gen = 0;
this.branchCollection = options.branches; this.branchCollection = options.branches;
this.commitCollection = options.collection; this.commitCollection = options.collection;
this.gitVisuals = options.gitVisuals; this.gitVisuals = options.gitVisuals;
// global variable to keep track of the options given // global variable to keep track of the options given
@ -115,11 +114,20 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
var branch = this.getOrMakeRecursive(tree, createdSoFar, branchJSON.id); var branch = this.getOrMakeRecursive(tree, createdSoFar, branchJSON.id);
this.branchCollection.add(branch, {silent: true}); this.branchCollection.add(branch, {silent: true});
this.gitVisuals.addBranch(branch, true /* paper override */);
}, this); }, this);
var HEAD = this.getOrMakeRecursive(tree, createdSoFar, tree.HEAD.id); var HEAD = this.getOrMakeRecursive(tree, createdSoFar, tree.HEAD.id);
this.HEAD = HEAD; this.HEAD = HEAD;
this.rootCommit = createdSoFar['C0'];
if (!this.rootCommit) {
throw new Error('Need root commit of C0 for calculations');
}
this.refs = createdSoFar;
this.branchCollection.each(function(branch) {
this.gitVisuals.addBranch(branch);
}, this);
}; };
GitEngine.prototype.reloadGraphics = function() { GitEngine.prototype.reloadGraphics = function() {
@ -213,6 +221,9 @@ GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
GitEngine.prototype.removeAll = function() { GitEngine.prototype.removeAll = function() {
this.branchCollection.reset(); this.branchCollection.reset();
this.commitCollection.reset(); this.commitCollection.reset();
this.refs = {};
this.HEAD = null;
this.rootCommit = null;
this.gitVisuals.resetAll(); this.gitVisuals.resetAll();
}; };
@ -1602,6 +1613,7 @@ var Commit = Backbone.Model.extend({
_.each(this.get('parents'), function(parent) { _.each(this.get('parents'), function(parent) {
parent.get('children').push(this); parent.get('children').push(this);
console.log('adding myself', this.get('id'), 'to parent', parent);
this.addEdgeToVisuals(parent); this.addEdgeToVisuals(parent);
}, this); }, this);
} }

View file

@ -524,6 +524,10 @@ GitVisuals.prototype.canvasResize = function(width, height) {
} }
}; };
GitVisuals.prototype.addCommit = function(commit) {
// TODO
};
GitVisuals.prototype.addNode = function(id, commit) { GitVisuals.prototype.addNode = function(id, commit) {
this.commitMap[id] = commit; this.commitMap[id] = commit;
if (commit.get('rootCommit')) { if (commit.get('rootCommit')) {
@ -541,7 +545,6 @@ GitVisuals.prototype.addNode = function(id, commit) {
if (this.gitReady) { if (this.gitReady) {
visNode.genGraphics(this.paper); visNode.genGraphics(this.paper);
} }
return visNode; return visNode;
}; };

View file

@ -20,14 +20,10 @@ Minor Bugs to fix:
Big Bugs to fix: Big Bugs to fix:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~
- load and save no longer work...
/*************************************
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ** Publish Things **
************************************/
Pre-publish things:
~~~~~~~~~~~~~~~~~~~~~~~~~~~
- cross browser support - cross browser support
- minify JS - minify JS
- fix terminal input when extra long - fix terminal input when extra long