mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 23:48:34 +02:00
git originInit
This commit is contained in:
parent
90b8679d19
commit
9173e75c1a
6 changed files with 230 additions and 169 deletions
342
build/bundle.js
342
build/bundle.js
|
@ -6975,11 +6975,14 @@ var TreeCompare = require('./treeCompare').TreeCompare;
|
|||
var Errors = require('../util/errors');
|
||||
var GitError = Errors.GitError;
|
||||
var CommandResult = Errors.CommandResult;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
|
||||
function GitEngine(options) {
|
||||
this.rootCommit = null;
|
||||
this.refs = {};
|
||||
this.HEAD = null;
|
||||
this.origin = null;
|
||||
this.localRepo = options.localRepro;
|
||||
|
||||
this.branchCollection = options.branches;
|
||||
this.commitCollection = options.collection;
|
||||
|
@ -7010,11 +7013,15 @@ GitEngine.prototype.initUniqueID = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.defaultInit = function() {
|
||||
// lol 80 char limit
|
||||
var defaultTree = JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
var defaultTree = this.getDefaultTree();
|
||||
this.loadTree(defaultTree);
|
||||
};
|
||||
|
||||
GitEngine.prototype.getDefaultTree = function() {
|
||||
// lol 80 char limit
|
||||
return JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
};
|
||||
|
||||
GitEngine.prototype.init = function() {
|
||||
// make an initial commit and a master branch
|
||||
this.rootCommit = this.makeCommit(null, null, {rootCommit: true});
|
||||
|
@ -7032,7 +7039,7 @@ GitEngine.prototype.init = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.hasOrigin = function() {
|
||||
return false;
|
||||
return !!this.origin;
|
||||
};
|
||||
|
||||
GitEngine.prototype.isOrigin = function() {
|
||||
|
@ -7147,17 +7154,12 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
|||
}, this);
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
GitEngine.prototype.makeOrigin = function(tree) {
|
||||
this.origin = new GitEngine({
|
||||
localRepo: this,
|
||||
// dont let it intercept commands
|
||||
eventBaton: new EventBaton()
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||
|
@ -7233,6 +7235,19 @@ GitEngine.prototype.tearDown = function() {
|
|||
this.removeAll();
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
};
|
||||
|
||||
GitEngine.prototype.removeAll = function() {
|
||||
this.branchCollection.reset();
|
||||
this.commitCollection.reset();
|
||||
|
@ -7429,6 +7444,10 @@ GitEngine.prototype.revertStarter = function() {
|
|||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.originInitStarter = function() {
|
||||
this.makeOrigin(this.getDefaultTree());
|
||||
};
|
||||
|
||||
GitEngine.prototype.revert = function(whichCommits) {
|
||||
// for each commit, we want to revert it
|
||||
var toRebase = [];
|
||||
|
@ -9405,6 +9424,124 @@ TreeCompare.prototype.compareTrees = function(treeA, treeB) {
|
|||
exports.TreeCompare = TreeCompare;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/util/eventBaton.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
||||
function EventBaton() {
|
||||
this.eventMap = {};
|
||||
}
|
||||
|
||||
// this method steals the "baton" -- aka, only this method will now
|
||||
// get called. analogous to events.on
|
||||
// EventBaton.prototype.on = function(name, func, context) {
|
||||
EventBaton.prototype.stealBaton = function(name, func, context) {
|
||||
if (!name) { throw new Error('need name'); }
|
||||
if (!func) { throw new Error('need func!'); }
|
||||
|
||||
var listeners = this.eventMap[name] || [];
|
||||
listeners.push({
|
||||
func: func,
|
||||
context: context
|
||||
});
|
||||
this.eventMap[name] = listeners;
|
||||
};
|
||||
|
||||
EventBaton.prototype.sliceOffArgs = function(num, args) {
|
||||
var newArgs = [];
|
||||
for (var i = num; i < args.length; i++) {
|
||||
newArgs.push(args[i]);
|
||||
}
|
||||
return newArgs;
|
||||
};
|
||||
|
||||
EventBaton.prototype.trigger = function(name) {
|
||||
// arguments is weird and doesnt do slice right
|
||||
var argsToApply = this.sliceOffArgs(1, arguments);
|
||||
|
||||
var listeners = this.eventMap[name];
|
||||
if (!listeners || !listeners.length) {
|
||||
console.warn('no listeners for', name);
|
||||
return;
|
||||
}
|
||||
|
||||
// call the top most listener with context and such
|
||||
var toCall = listeners.slice(-1)[0];
|
||||
toCall.func.apply(toCall.context, argsToApply);
|
||||
};
|
||||
|
||||
EventBaton.prototype.getNumListeners = function(name) {
|
||||
var listeners = this.eventMap[name] || [];
|
||||
return listeners.length;
|
||||
};
|
||||
|
||||
EventBaton.prototype.getListenersThrow = function(name) {
|
||||
var listeners = this.eventMap[name];
|
||||
if (!listeners || !listeners.length) {
|
||||
throw new Error('no one has that baton!' + name);
|
||||
}
|
||||
return listeners;
|
||||
};
|
||||
|
||||
EventBaton.prototype.passBatonBackSoft = function(name, func, context, args) {
|
||||
try {
|
||||
return this.passBatonBack(name, func, context, args);
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
|
||||
EventBaton.prototype.passBatonBack = function(name, func, context, args) {
|
||||
// this method will call the listener BEFORE the name/func pair. this
|
||||
// basically allows you to put in shims, where you steal batons but pass
|
||||
// them back if they don't meet certain conditions
|
||||
var listeners = this.getListenersThrow(name);
|
||||
|
||||
var indexBefore;
|
||||
_.each(listeners, function(listenerObj, index) {
|
||||
// skip the first
|
||||
if (index === 0) { return; }
|
||||
if (listenerObj.func === func && listenerObj.context === context) {
|
||||
indexBefore = index - 1;
|
||||
}
|
||||
}, this);
|
||||
if (indexBefore === undefined) {
|
||||
throw new Error('you are the last baton holder! or i didnt find you');
|
||||
}
|
||||
var toCallObj = listeners[indexBefore];
|
||||
|
||||
toCallObj.func.apply(toCallObj.context, args);
|
||||
};
|
||||
|
||||
EventBaton.prototype.releaseBaton = function(name, func, context) {
|
||||
// might be in the middle of the stack, so we have to loop instead of
|
||||
// just popping blindly
|
||||
var listeners = this.getListenersThrow(name);
|
||||
|
||||
var newListeners = [];
|
||||
var found = false;
|
||||
_.each(listeners, function(listenerObj) {
|
||||
if (listenerObj.func === func && listenerObj.context === context) {
|
||||
if (found) {
|
||||
console.warn('woah duplicates!!!');
|
||||
console.log(listeners);
|
||||
}
|
||||
found = true;
|
||||
} else {
|
||||
newListeners.push(listenerObj);
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (!found) {
|
||||
console.log('did not find that function', func, context, name, arguments);
|
||||
console.log(this.eventMap);
|
||||
throw new Error('cant releasebaton if yu dont have it');
|
||||
}
|
||||
this.eventMap[name] = newListeners;
|
||||
};
|
||||
|
||||
exports.EventBaton = EventBaton;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/views/rebaseView.js",function(require,module,exports,__dirname,__filename,process,global){var GitError = require('../util/errors').GitError;
|
||||
|
@ -12913,7 +13050,8 @@ var regexMap = {
|
|||
'git merge': /^git +merge($|\s)/,
|
||||
'git show': /^git +show($|\s)/,
|
||||
'git status': /^git +status($|\s)/,
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/,
|
||||
'git originInit': /^git +originInit *?$/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
@ -12997,7 +13135,8 @@ GitOptionParser.prototype.getMasterOptionMap = function() {
|
|||
'-i': false // the mother of all options
|
||||
},
|
||||
revert: {},
|
||||
show: {}
|
||||
show: {},
|
||||
originInit: {}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -14709,124 +14848,6 @@ require.define("/src/js/dialogs/levelBuilder.js",function(require,module,exports
|
|||
}]
|
||||
};
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/util/eventBaton.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
||||
function EventBaton() {
|
||||
this.eventMap = {};
|
||||
}
|
||||
|
||||
// this method steals the "baton" -- aka, only this method will now
|
||||
// get called. analogous to events.on
|
||||
// EventBaton.prototype.on = function(name, func, context) {
|
||||
EventBaton.prototype.stealBaton = function(name, func, context) {
|
||||
if (!name) { throw new Error('need name'); }
|
||||
if (!func) { throw new Error('need func!'); }
|
||||
|
||||
var listeners = this.eventMap[name] || [];
|
||||
listeners.push({
|
||||
func: func,
|
||||
context: context
|
||||
});
|
||||
this.eventMap[name] = listeners;
|
||||
};
|
||||
|
||||
EventBaton.prototype.sliceOffArgs = function(num, args) {
|
||||
var newArgs = [];
|
||||
for (var i = num; i < args.length; i++) {
|
||||
newArgs.push(args[i]);
|
||||
}
|
||||
return newArgs;
|
||||
};
|
||||
|
||||
EventBaton.prototype.trigger = function(name) {
|
||||
// arguments is weird and doesnt do slice right
|
||||
var argsToApply = this.sliceOffArgs(1, arguments);
|
||||
|
||||
var listeners = this.eventMap[name];
|
||||
if (!listeners || !listeners.length) {
|
||||
console.warn('no listeners for', name);
|
||||
return;
|
||||
}
|
||||
|
||||
// call the top most listener with context and such
|
||||
var toCall = listeners.slice(-1)[0];
|
||||
toCall.func.apply(toCall.context, argsToApply);
|
||||
};
|
||||
|
||||
EventBaton.prototype.getNumListeners = function(name) {
|
||||
var listeners = this.eventMap[name] || [];
|
||||
return listeners.length;
|
||||
};
|
||||
|
||||
EventBaton.prototype.getListenersThrow = function(name) {
|
||||
var listeners = this.eventMap[name];
|
||||
if (!listeners || !listeners.length) {
|
||||
throw new Error('no one has that baton!' + name);
|
||||
}
|
||||
return listeners;
|
||||
};
|
||||
|
||||
EventBaton.prototype.passBatonBackSoft = function(name, func, context, args) {
|
||||
try {
|
||||
return this.passBatonBack(name, func, context, args);
|
||||
} catch (e) {
|
||||
}
|
||||
};
|
||||
|
||||
EventBaton.prototype.passBatonBack = function(name, func, context, args) {
|
||||
// this method will call the listener BEFORE the name/func pair. this
|
||||
// basically allows you to put in shims, where you steal batons but pass
|
||||
// them back if they don't meet certain conditions
|
||||
var listeners = this.getListenersThrow(name);
|
||||
|
||||
var indexBefore;
|
||||
_.each(listeners, function(listenerObj, index) {
|
||||
// skip the first
|
||||
if (index === 0) { return; }
|
||||
if (listenerObj.func === func && listenerObj.context === context) {
|
||||
indexBefore = index - 1;
|
||||
}
|
||||
}, this);
|
||||
if (indexBefore === undefined) {
|
||||
throw new Error('you are the last baton holder! or i didnt find you');
|
||||
}
|
||||
var toCallObj = listeners[indexBefore];
|
||||
|
||||
toCallObj.func.apply(toCallObj.context, args);
|
||||
};
|
||||
|
||||
EventBaton.prototype.releaseBaton = function(name, func, context) {
|
||||
// might be in the middle of the stack, so we have to loop instead of
|
||||
// just popping blindly
|
||||
var listeners = this.getListenersThrow(name);
|
||||
|
||||
var newListeners = [];
|
||||
var found = false;
|
||||
_.each(listeners, function(listenerObj) {
|
||||
if (listenerObj.func === func && listenerObj.context === context) {
|
||||
if (found) {
|
||||
console.warn('woah duplicates!!!');
|
||||
console.log(listeners);
|
||||
}
|
||||
found = true;
|
||||
} else {
|
||||
newListeners.push(listenerObj);
|
||||
}
|
||||
}, this);
|
||||
|
||||
if (!found) {
|
||||
console.log('did not find that function', func, context, name, arguments);
|
||||
console.log(this.eventMap);
|
||||
throw new Error('cant releasebaton if yu dont have it');
|
||||
}
|
||||
this.eventMap[name] = newListeners;
|
||||
};
|
||||
|
||||
exports.EventBaton = EventBaton;
|
||||
|
||||
|
||||
});
|
||||
|
||||
require.define("/src/js/visuals/index.js",function(require,module,exports,__dirname,__filename,process,global){var _ = require('underscore');
|
||||
|
@ -22148,7 +22169,8 @@ var regexMap = {
|
|||
'git merge': /^git +merge($|\s)/,
|
||||
'git show': /^git +show($|\s)/,
|
||||
'git status': /^git +status($|\s)/,
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/,
|
||||
'git originInit': /^git +originInit *?$/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
@ -22232,7 +22254,8 @@ GitOptionParser.prototype.getMasterOptionMap = function() {
|
|||
'-i': false // the mother of all options
|
||||
},
|
||||
revert: {},
|
||||
show: {}
|
||||
show: {},
|
||||
originInit: {}
|
||||
};
|
||||
};
|
||||
|
||||
|
@ -22440,11 +22463,14 @@ var TreeCompare = require('./treeCompare').TreeCompare;
|
|||
var Errors = require('../util/errors');
|
||||
var GitError = Errors.GitError;
|
||||
var CommandResult = Errors.CommandResult;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
|
||||
function GitEngine(options) {
|
||||
this.rootCommit = null;
|
||||
this.refs = {};
|
||||
this.HEAD = null;
|
||||
this.origin = null;
|
||||
this.localRepo = options.localRepro;
|
||||
|
||||
this.branchCollection = options.branches;
|
||||
this.commitCollection = options.collection;
|
||||
|
@ -22475,11 +22501,15 @@ GitEngine.prototype.initUniqueID = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.defaultInit = function() {
|
||||
// lol 80 char limit
|
||||
var defaultTree = JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
var defaultTree = this.getDefaultTree();
|
||||
this.loadTree(defaultTree);
|
||||
};
|
||||
|
||||
GitEngine.prototype.getDefaultTree = function() {
|
||||
// lol 80 char limit
|
||||
return JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
};
|
||||
|
||||
GitEngine.prototype.init = function() {
|
||||
// make an initial commit and a master branch
|
||||
this.rootCommit = this.makeCommit(null, null, {rootCommit: true});
|
||||
|
@ -22497,7 +22527,7 @@ GitEngine.prototype.init = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.hasOrigin = function() {
|
||||
return false;
|
||||
return !!this.origin;
|
||||
};
|
||||
|
||||
GitEngine.prototype.isOrigin = function() {
|
||||
|
@ -22612,17 +22642,12 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
|||
}, this);
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
GitEngine.prototype.makeOrigin = function(tree) {
|
||||
this.origin = new GitEngine({
|
||||
localRepo: this,
|
||||
// dont let it intercept commands
|
||||
eventBaton: new EventBaton()
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||
|
@ -22698,6 +22723,19 @@ GitEngine.prototype.tearDown = function() {
|
|||
this.removeAll();
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
};
|
||||
|
||||
GitEngine.prototype.removeAll = function() {
|
||||
this.branchCollection.reset();
|
||||
this.commitCollection.reset();
|
||||
|
@ -22894,6 +22932,10 @@ GitEngine.prototype.revertStarter = function() {
|
|||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.originInitStarter = function() {
|
||||
this.makeOrigin(this.getDefaultTree());
|
||||
};
|
||||
|
||||
GitEngine.prototype.revert = function(whichCommits) {
|
||||
// for each commit, we want to revert it
|
||||
var toRebase = [];
|
||||
|
|
File diff suppressed because one or more lines are too long
1
build/bundle.min.js
vendored
1
build/bundle.min.js
vendored
File diff suppressed because one or more lines are too long
|
@ -426,7 +426,7 @@
|
|||
For a much easier time perusing the source, see the individual files at:
|
||||
https://github.com/pcottle/learnGitBranching
|
||||
-->
|
||||
<script src="build/bundle.min.e6e15cd1.js"></script>
|
||||
<script src="build/bundle.js"></script>
|
||||
|
||||
<!-- The advantage of github pages: super-easy, simple, slick static hostic.
|
||||
The downside? No raw logs to parse for analytics, so I have to include
|
||||
|
|
|
@ -61,7 +61,8 @@ var regexMap = {
|
|||
'git merge': /^git +merge($|\s)/,
|
||||
'git show': /^git +show($|\s)/,
|
||||
'git status': /^git +status($|\s)/,
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/
|
||||
'git cherry-pick': /^git +cherry-pick($|\s)/,
|
||||
'git originInit': /^git +originInit *?$/
|
||||
};
|
||||
|
||||
var parse = function(str) {
|
||||
|
@ -145,7 +146,8 @@ GitOptionParser.prototype.getMasterOptionMap = function() {
|
|||
'-i': false // the mother of all options
|
||||
},
|
||||
revert: {},
|
||||
show: {}
|
||||
show: {},
|
||||
originInit: {}
|
||||
};
|
||||
};
|
||||
|
||||
|
|
|
@ -12,11 +12,14 @@ var TreeCompare = require('./treeCompare').TreeCompare;
|
|||
var Errors = require('../util/errors');
|
||||
var GitError = Errors.GitError;
|
||||
var CommandResult = Errors.CommandResult;
|
||||
var EventBaton = require('../util/eventBaton').EventBaton;
|
||||
|
||||
function GitEngine(options) {
|
||||
this.rootCommit = null;
|
||||
this.refs = {};
|
||||
this.HEAD = null;
|
||||
this.origin = null;
|
||||
this.localRepo = options.localRepro;
|
||||
|
||||
this.branchCollection = options.branches;
|
||||
this.commitCollection = options.collection;
|
||||
|
@ -47,11 +50,15 @@ GitEngine.prototype.initUniqueID = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.defaultInit = function() {
|
||||
// lol 80 char limit
|
||||
var defaultTree = JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
var defaultTree = this.getDefaultTree();
|
||||
this.loadTree(defaultTree);
|
||||
};
|
||||
|
||||
GitEngine.prototype.getDefaultTree = function() {
|
||||
// lol 80 char limit
|
||||
return JSON.parse(unescape("%7B%22branches%22%3A%7B%22master%22%3A%7B%22target%22%3A%22C1%22%2C%22id%22%3A%22master%22%2C%22type%22%3A%22branch%22%7D%7D%2C%22commits%22%3A%7B%22C0%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C0%22%2C%22rootCommit%22%3Atrue%7D%2C%22C1%22%3A%7B%22type%22%3A%22commit%22%2C%22parents%22%3A%5B%22C0%22%5D%2C%22author%22%3A%22Peter%20Cottle%22%2C%22createTime%22%3A%22Mon%20Nov%2005%202012%2000%3A56%3A47%20GMT-0800%20%28PST%29%22%2C%22commitMessage%22%3A%22Quick%20Commit.%20Go%20Bears%21%22%2C%22id%22%3A%22C1%22%7D%7D%2C%22HEAD%22%3A%7B%22id%22%3A%22HEAD%22%2C%22target%22%3A%22master%22%2C%22type%22%3A%22general%20ref%22%7D%7D"));
|
||||
};
|
||||
|
||||
GitEngine.prototype.init = function() {
|
||||
// make an initial commit and a master branch
|
||||
this.rootCommit = this.makeCommit(null, null, {rootCommit: true});
|
||||
|
@ -69,7 +76,7 @@ GitEngine.prototype.init = function() {
|
|||
};
|
||||
|
||||
GitEngine.prototype.hasOrigin = function() {
|
||||
return false;
|
||||
return !!this.origin;
|
||||
};
|
||||
|
||||
GitEngine.prototype.isOrigin = function() {
|
||||
|
@ -184,17 +191,12 @@ GitEngine.prototype.instantiateFromTree = function(tree) {
|
|||
}, this);
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
GitEngine.prototype.makeOrigin = function(tree) {
|
||||
this.origin = new GitEngine({
|
||||
localRepo: this,
|
||||
// dont let it intercept commands
|
||||
eventBaton: new EventBaton()
|
||||
});
|
||||
};
|
||||
|
||||
GitEngine.prototype.getOrMakeRecursive = function(tree, createdSoFar, objID) {
|
||||
|
@ -270,6 +272,19 @@ GitEngine.prototype.tearDown = function() {
|
|||
this.removeAll();
|
||||
};
|
||||
|
||||
GitEngine.prototype.reloadGraphics = function() {
|
||||
// get the root commit
|
||||
this.gitVisuals.rootCommit = this.refs['C0'];
|
||||
// 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... one day
|
||||
this.gitVisuals.initHeadBranch();
|
||||
|
||||
// when the paper is ready
|
||||
this.gitVisuals.drawTreeFromReload();
|
||||
|
||||
this.gitVisuals.refreshTreeHarsh();
|
||||
};
|
||||
|
||||
GitEngine.prototype.removeAll = function() {
|
||||
this.branchCollection.reset();
|
||||
this.commitCollection.reset();
|
||||
|
@ -466,6 +481,10 @@ GitEngine.prototype.revertStarter = function() {
|
|||
}
|
||||
};
|
||||
|
||||
GitEngine.prototype.originInitStarter = function() {
|
||||
this.makeOrigin(this.getDefaultTree());
|
||||
};
|
||||
|
||||
GitEngine.prototype.revert = function(whichCommits) {
|
||||
// for each commit, we want to revert it
|
||||
var toRebase = [];
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue