mirror of
https://github.com/pcottle/learnGitBranching.git
synced 2025-06-25 15:38:33 +02:00
Remove obsolete numBackFrom method
The numBackFrom method is no longer called from anywhere with the changes from the previous commit to change how relative references are handled.
This commit is contained in:
parent
e5de32f977
commit
8da68375dd
1 changed files with 0 additions and 49 deletions
|
@ -782,55 +782,6 @@ GitEngine.prototype.getOneBeforeCommit = function(ref) {
|
|||
return start;
|
||||
};
|
||||
|
||||
GitEngine.prototype.numBackFrom = function(commit, numBack) {
|
||||
// going back '3' from a given ref is not trivial, for you might have
|
||||
// a bunch of merge commits and such. like this situation:
|
||||
//
|
||||
// * merge master into new
|
||||
// |\
|
||||
// | \* commit here
|
||||
// |* \ commit there
|
||||
// | |* commit here
|
||||
// \ /
|
||||
// | * root
|
||||
//
|
||||
//
|
||||
// hence we need to do a BFS search, with the commit date being the
|
||||
// value to sort off of (rather than just purely the level)
|
||||
if (numBack === 0) {
|
||||
return commit;
|
||||
}
|
||||
|
||||
// we use a special sorting function here that
|
||||
// prefers the later commits over the earlier ones
|
||||
var sortQueue = _.bind(function(queue) {
|
||||
queue.sort(this.dateSortFunc);
|
||||
}, this);
|
||||
|
||||
var pQueue = [].concat(commit.get('parents') || []);
|
||||
sortQueue(pQueue);
|
||||
numBack--;
|
||||
|
||||
while (pQueue.length && numBack !== 0) {
|
||||
var popped = pQueue.shift(0);
|
||||
var parents = popped.get('parents');
|
||||
|
||||
if (parents && parents.length) {
|
||||
pQueue = pQueue.concat(parents);
|
||||
}
|
||||
|
||||
sortQueue(pQueue);
|
||||
numBack--;
|
||||
}
|
||||
|
||||
if (numBack !== 0 || pQueue.length === 0) {
|
||||
throw new GitError({
|
||||
msg: "Sorry, I can't go that many commits back"
|
||||
});
|
||||
}
|
||||
return pQueue.shift(0);
|
||||
};
|
||||
|
||||
GitEngine.prototype.scrapeBaseID = function(id) {
|
||||
var results = /^C(\d+)/.exec(id);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue