mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
[Origin] wow have tree string and undo working flawlessly, somewhat hacky but very robust all things considered
This commit is contained in:
parent
2938c3fb37
commit
cbcd489a31
10 changed files with 126 additions and 30 deletions
|
@ -197,9 +197,14 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
|||
this.branchCollection.each(function(branch) {
|
||||
this.gitVisuals.addBranch(branch);
|
||||
}, this);
|
||||
|
||||
if (tree.originTree) {
|
||||
var treeString = JSON.stringify(tree.originTree);
|
||||
this.makeOrigin(treeString);
|
||||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.makeOrigin = function(tree) {
|
||||
GitEngine.prototype.makeOrigin = function(treeString) {
|
||||
if (this.hasOrigin()) {
|
||||
throw new GitError({
|
||||
msg: intl.str('git-error-options')
|
||||
|
@ -215,7 +220,7 @@ GitEngine.prototype.makeOrigin = function(tree) {
|
|||
var masterVis = this.gitVisuals.getVisualization();
|
||||
var originVis = masterVis.makeOrigin({
|
||||
localRepo: this,
|
||||
tree: this.getDefaultTree()
|
||||
treeString: treeString || this.printTree()
|
||||
});
|
||||
|
||||
// defer the starting of our animation until origin has been created
|
||||
|
@ -326,6 +331,13 @@ GitEngine.prototype.removeAll = function() {
|
|||
this.HEAD = null;
|
||||
this.rootCommit = null;
|
||||
|
||||
if (this.origin) {
|
||||
// we will restart all this jazz during init from tree
|
||||
this.origin.gitVisuals.getVisualization().tearDown();
|
||||
delete this.origin;
|
||||
this.gitVisuals.getVisualization().clearOrigin();
|
||||
}
|
||||
|
||||
this.gitVisuals.resetAll();
|
||||
};
|
||||
|
||||
|
@ -516,7 +528,7 @@ GitEngine.prototype.revertStarter = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.originInitStarter = function() {
|
||||
this.makeOrigin(this.getDefaultTree());
|
||||
this.makeOrigin(this.printTree());
|
||||
};
|
||||
|
||||
GitEngine.prototype.revert = function(whichCommits) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue