diff --git a/src/js/git/headless.js b/src/js/git/headless.js index 7c20f89c..798c1ec8 100644 --- a/src/js/git/headless.js +++ b/src/js/git/headless.js @@ -124,11 +124,17 @@ HeadlessGit.prototype.sendCommand = function(value, entireCommandPromise) { chain.then(function() { var nowTime = new Date().getTime(); - // .log('done with command "' + value + '", took ', nowTime - startTime); if (entireCommandPromise) { entireCommandPromise.resolve(); } }); + + chain.fail(function(err) { + console.log('!!!!!!!! error !!!!!!!'); + console.log(err); + console.log(err.stack); + console.log('!!!!!!!!!!!!!!!!!!!!!!'); + }); deferred.resolve(); }; diff --git a/src/js/git/index.js b/src/js/git/index.js index e46d2016..5c09f97a 100644 --- a/src/js/git/index.js +++ b/src/js/git/index.js @@ -2046,25 +2046,8 @@ GitEngine.prototype.getUpstreamDiffSetFromSet = function(stopSet, location) { }; GitEngine.prototype.getUpstreamDiffFromSet = function(stopSet, location) { - // now BFS from here on out - var result = []; - 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')); - } + var result = Graph.bfsFromLocationWithSet(this, location, stopSet); + result.sort(this.dateSortFunc); return result; }; diff --git a/src/js/graph/index.js b/src/js/graph/index.js index 06f206a0..660ace0d 100644 --- a/src/js/graph/index.js +++ b/src/js/graph/index.js @@ -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) { var unique = {}; var result = [];