mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-07-09 22:24:26 +02:00
ugh annoying teardown bug
This commit is contained in:
parent
33e5060ac7
commit
906216d98b
5 changed files with 135 additions and 48 deletions
|
@ -339,12 +339,19 @@ GitEngine.prototype.makeOrigin = function(treeString) {
|
|||
this.animationFactory.playRefreshAnimationAndFinish(this.gitVisuals, this.animationQueue);
|
||||
}, this);
|
||||
|
||||
// we only clone from our current state, so we can safely assume all of our
|
||||
// local commits are on origin
|
||||
var originTree = JSON.parse(unescape(treeString));
|
||||
// make an origin branch for each branch mentioned in the tree
|
||||
_.each(originTree.branches, function(branchJSON, branchName) {
|
||||
var originTarget = branchJSON.target;
|
||||
|
||||
// now this is tricky -- our remote could have commits that we do
|
||||
// not have. so lets go upwards until we find one that we have
|
||||
while (!this.refs[originTarget]) {
|
||||
var parents = originTree.commits[originTarget].parents;
|
||||
originTarget = parents[0];
|
||||
}
|
||||
|
||||
// now we have something in common, lets make the tracking branch
|
||||
var originBranch = this.makeBranch(
|
||||
ORIGIN_PREFIX + branchName,
|
||||
this.getCommitFromRef(originTarget)
|
||||
|
@ -358,6 +365,11 @@ GitEngine.prototype.setLocalToTrackRemote = function(localBranch, remoteBranch)
|
|||
remoteBranch.addLocalBranchThatTracksThis(localBranch);
|
||||
localBranch.setRemoteTrackingBranchID(remoteBranch.get('id'));
|
||||
|
||||
if (!this.command) {
|
||||
// during init we have no command
|
||||
return;
|
||||
}
|
||||
|
||||
// same for local TODO intl
|
||||
var msg = 'local branch "' +
|
||||
localBranch.get('id') +
|
||||
|
@ -436,8 +448,12 @@ GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
|||
};
|
||||
|
||||
GitEngine.prototype.tearDown = function() {
|
||||
if (this.tornDown) {
|
||||
return;
|
||||
}
|
||||
this.eventBaton.releaseBaton('processGitCommand', this.dispatch, this);
|
||||
this.removeAll();
|
||||
this.tornDown = true;
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
|
|
|
@ -1,7 +1,8 @@
|
|||
var _ = require('underscore');
|
||||
|
||||
function EventBaton() {
|
||||
function EventBaton(options) {
|
||||
this.eventMap = {};
|
||||
this.options = options || {};
|
||||
}
|
||||
|
||||
// this method steals the "baton" -- aka, only this method will now
|
||||
|
|
|
@ -38,7 +38,7 @@ var Visualization = Backbone.View.extend({
|
|||
// make a new event baton so git engine steals something that no one
|
||||
// is broadcasting to
|
||||
this.eventBaton = (options.noKeyboardInput) ?
|
||||
new EventBaton():
|
||||
new EventBaton({noInput: true}) :
|
||||
Main.getEventBaton();
|
||||
|
||||
this.commitCollection = new CommitCollection();
|
||||
|
@ -219,7 +219,9 @@ var Visualization = Backbone.View.extend({
|
|||
}
|
||||
},
|
||||
|
||||
tearDown: function() {
|
||||
tearDown: function(options) {
|
||||
options = options || {};
|
||||
|
||||
this.gitEngine.tearDown();
|
||||
this.gitVisuals.tearDown();
|
||||
delete this.paper;
|
||||
|
@ -230,7 +232,7 @@ var Visualization = Backbone.View.extend({
|
|||
this.fadeTreeOut();
|
||||
setTimeout(_.bind(function() {
|
||||
if (!this.shown) {
|
||||
this.tearDown();
|
||||
this.tearDown({fromDie: true});
|
||||
}
|
||||
}, this), this.getAnimationTime());
|
||||
this.originToo('die', arguments);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue