now with errors

This commit is contained in:
Peter Cottle 2013-11-01 18:48:13 -07:00
parent 9a86845ead
commit 625c15d51e
3 changed files with 26 additions and 20 deletions

View file

@ -124,11 +124,17 @@ HeadlessGit.prototype.sendCommand = function(value, entireCommandPromise) {
chain.then(function() { chain.then(function() {
var nowTime = new Date().getTime(); var nowTime = new Date().getTime();
// .log('done with command "' + value + '", took ', nowTime - startTime);
if (entireCommandPromise) { if (entireCommandPromise) {
entireCommandPromise.resolve(); entireCommandPromise.resolve();
} }
}); });
chain.fail(function(err) {
console.log('!!!!!!!! error !!!!!!!');
console.log(err);
console.log(err.stack);
console.log('!!!!!!!!!!!!!!!!!!!!!!');
});
deferred.resolve(); deferred.resolve();
}; };

View file

@ -2046,25 +2046,8 @@ GitEngine.prototype.getUpstreamDiffSetFromSet = function(stopSet, location) {
}; };
GitEngine.prototype.getUpstreamDiffFromSet = function(stopSet, location) { GitEngine.prototype.getUpstreamDiffFromSet = function(stopSet, location) {
// now BFS from here on out var result = Graph.bfsFromLocationWithSet(this, location, stopSet);
var result = []; result.sort(this.dateSortFunc);
var pQueue = [this.getCommitFromRef(location)];
while (pQueue.length) {
var popped = pQueue.pop();
// if its in the set, dont add it
if (stopSet[popped.get('id')]) {
continue;
}
// it's not in the set, so we need to rebase this commit
result.push(popped);
result.sort(this.dateSortFunc);
// keep searching
pQueue = pQueue.concat(popped.get('parents'));
}
return result; return result;
}; };

View file

@ -95,6 +95,23 @@ var Graph = {
}); });
}, },
bfsFromLocationWithSet: function(engine, location, set) {
var result = [];
var pQueue = [engine.getCommitFromRef(location)];
while (pQueue.length) {
var popped = pQueue.pop();
if (set[popped.get('id')]) {
continue;
}
result.push(popped);
// keep searching
pQueue = pQueue.concat(popped.get('parents'));
}
return result;
},
getUniqueObjects: function(objects) { getUniqueObjects: function(objects) {
var unique = {}; var unique = {};
var result = []; var result = [];