debug now

This commit is contained in:
Peter Cottle 2012-12-12 10:43:55 -08:00
parent e1ccf4afae
commit d2f3c05794
3 changed files with 141 additions and 133 deletions

View file

@ -4249,6 +4249,98 @@ function blendHueStrings(hueStrings) {
exports.Visualization = Visualization;
});
require.define("/levels.js",function(require,module,exports,__dirname,__filename,process,global){// static class...
function LevelEngine() {
}
LevelEngine.prototype.compareBranchesWithinTrees = function(treeA, treeB, branches) {
var result = true;
_.each(branches, function(branchName) {
result = result && this.compareBranchWithinTrees(treeA, treeB, branchName);
}, this);
return result;
};
LevelEngine.prototype.compareBranchWithinTrees = function(treeA, treeB, branchName) {
treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB);
this.stripTreeFields([treeA, treeB]);
// we need a recursive comparison function to bubble up the branch
var recurseCompare = function(commitA, commitB) {
// this is the short-circuit base case
var result = _.isEqual(commitA, commitB);
if (!result) {
return false;
}
// we loop through each parent ID. we sort the parent ID's beforehand
// so the index lookup is valid
_.each(commitA.parents, function(pAid, index) {
var pBid = commitB.parents[index];
var childA = treeA.commits[pAid];
var childB = treeB.commits[pBid];
result = result && recurseCompare(childA, childB);
}, this);
// if each of our children recursively are equal, we are good
return result;
};
var branchA = treeA.branches[branchName];
var branchB = treeB.branches[branchName];
return _.isEqual(branchA, branchB) &&
recurseCompare(treeA.commits[branchA.target], treeB.commits[branchB.target]);
};
LevelEngine.prototype.convertTreeSafe = function(tree) {
if (typeof tree == 'string') {
return JSON.parse(unescape(tree));
}
return tree;
};
LevelEngine.prototype.stripTreeFields = function(trees) {
var stripFields = ['createTime', 'author', 'commitMessage'];
var sortFields = ['children', 'parents'];
_.each(trees, function(tree) {
_.each(tree.commits, function(commit) {
_.each(stripFields, function(field) {
commit[field] = undefined;
});
_.each(sortFields, function(field) {
if (commit[field]) {
commit[field] = commit[field].sort();
}
});
});
});
};
LevelEngine.prototype.compareTrees = function(treeA, treeB) {
treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB);
// now we need to strip out the fields we don't care about, aka things
// like createTime, message, author
this.stripTreeFields([treeA, treeB]);
return _.isEqual(treeA, treeB);
};
var levelEngine = new LevelEngine();
exports.LevelEngine = LevelEngine;
});
require.define("/tree.js",function(require,module,exports,__dirname,__filename,process,global){var Main = require('./main');
@ -5219,98 +5311,6 @@ exports.VisEdge = VisEdge;
exports.VisBranch = VisBranch;
});
require.define("/levels.js",function(require,module,exports,__dirname,__filename,process,global){// static class...
function LevelEngine() {
}
LevelEngine.prototype.compareBranchesWithinTrees = function(treeA, treeB, branches) {
var result = true;
_.each(branches, function(branchName) {
result = result && this.compareBranchWithinTrees(treeA, treeB, branchName);
}, this);
return result;
};
LevelEngine.prototype.compareBranchWithinTrees = function(treeA, treeB, branchName) {
treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB);
this.stripTreeFields([treeA, treeB]);
// we need a recursive comparison function to bubble up the branch
var recurseCompare = function(commitA, commitB) {
// this is the short-circuit base case
var result = _.isEqual(commitA, commitB);
if (!result) {
return false;
}
// we loop through each parent ID. we sort the parent ID's beforehand
// so the index lookup is valid
_.each(commitA.parents, function(pAid, index) {
var pBid = commitB.parents[index];
var childA = treeA.commits[pAid];
var childB = treeB.commits[pBid];
result = result && recurseCompare(childA, childB);
}, this);
// if each of our children recursively are equal, we are good
return result;
};
var branchA = treeA.branches[branchName];
var branchB = treeB.branches[branchName];
return _.isEqual(branchA, branchB) &&
recurseCompare(treeA.commits[branchA.target], treeB.commits[branchB.target]);
};
LevelEngine.prototype.convertTreeSafe = function(tree) {
if (typeof tree == 'string') {
return JSON.parse(unescape(tree));
}
return tree;
};
LevelEngine.prototype.stripTreeFields = function(trees) {
var stripFields = ['createTime', 'author', 'commitMessage'];
var sortFields = ['children', 'parents'];
_.each(trees, function(tree) {
_.each(tree.commits, function(commit) {
_.each(stripFields, function(field) {
commit[field] = undefined;
});
_.each(sortFields, function(field) {
if (commit[field]) {
commit[field] = commit[field].sort();
}
});
});
});
};
LevelEngine.prototype.compareTrees = function(treeA, treeB) {
treeA = this.convertTreeSafe(treeA);
treeB = this.convertTreeSafe(treeB);
// now we need to strip out the fields we don't care about, aka things
// like createTime, message, author
this.stripTreeFields([treeA, treeB]);
return _.isEqual(treeA, treeB);
};
var levelEngine = new LevelEngine();
exports.LevelEngine = LevelEngine;
});
require.define("/git.js",function(require,module,exports,__dirname,__filename,process,global){var AnimationFactoryModule = require('./animationFactory');
@ -10184,22 +10184,25 @@ var GitError = exports.GitError = MyError.extend({
});
require("/errors.js");
require.define("/debug.js",function(require,module,exports,__dirname,__filename,process,global){var toGlobalize = [
require('./tree'),
require('./visuals'),
require('./git'),
require('./commandModel'),
require('./levels'),
require('./constants'),
require('./collections'),
require('./async'),
require('./animationFactory')
];
require.define("/debug.js",function(require,module,exports,__dirname,__filename,process,global){var toGlobalize = {
Tree: require('./tree'),
Visuals: require('./visuals'),
Git: require('./git'),
CommandModel: require('./commandModel'),
Levels: require('./levels'),
Constants: require('./constants'),
Collections: require('./collections'),
Async: require('./async'),
AnimationFactory: require('./animationFactory'),
Main: require('./main')
};
_.each(toGlobalize, function(module) {
_.extend(window, module);
});
window.events = toGlobalize.Main.getEvents();
});
require("/debug.js");

View file

@ -1,16 +1,19 @@
var toGlobalize = [
require('./tree'),
require('./visuals'),
require('./git'),
require('./commandModel'),
require('./levels'),
require('./constants'),
require('./collections'),
require('./async'),
require('./animationFactory')
];
var toGlobalize = {
Tree: require('./tree'),
Visuals: require('./visuals'),
Git: require('./git'),
CommandModel: require('./commandModel'),
Levels: require('./levels'),
Constants: require('./constants'),
Collections: require('./collections'),
Async: require('./async'),
AnimationFactory: require('./animationFactory'),
Main: require('./main')
};
_.each(toGlobalize, function(module) {
_.extend(window, module);
});
window.events = toGlobalize.Main.getEvents();

View file

@ -127,32 +127,34 @@
</li>
</script>
<!-- My files! -->
<!-- <script src="async.js"></script> -->
<!-- <script src="constants.js"></script> -->
<!-- <script src="errors.js"></script> -->
<!--
My files!
<script src="async.js"></script>
<script src="constants.js"></script>
<script src="errors.js"></script>
<!-- <script src="miscViews.js"></script> -->
<script src="miscViews.js"></script>
<!-- the beefy git engine -->
<!-- <script src="git.js"></script> -->
the beefy git engine
<script src="git.js"></script>
<!-- command line -->
<!-- <script src="commandModel.js"></script> -->
<!-- <script src="commandViews.js"></script> -->
command line
<script src="commandModel.js"></script>
<script src="commandViews.js"></script>
<!-- vis -->
<!-- <script src="collections.js"></script> -->
<!-- <script src="visuals.js"></script> -->
<!-- <script src="tree.js"></script> -->
<!--<script src="animationFactory.js"></script> -->
vis
<script src="collections.js"></script>
<script src="visuals.js"></script>
<script src="tree.js"></script>
<script src="animationFactory.js"></script>
<!-- levels -->
<!-- <script src="levels.js"></script> -->
levels
<script src="levels.js"></script>
<!-- on ready -->
<!-- <script src="main.js"></script> -->
on ready
<script src="main.js"></script>
-->
<!-- build -->
<script src="../build/bundle.js"></script>
</body>