better merge commit tree layout algorithm

This commit is contained in:
Peter Cottle 2012-10-25 12:30:09 -07:00
parent 647bba9903
commit 385e3be236
2 changed files with 17 additions and 6 deletions

View file

@ -1070,6 +1070,8 @@ GitEngine.prototype.merge = function(targetSource, currentLocation) {
var msg = 'Merge ' + this.resolveName(targetSource) +
' into ' + this.resolveName(currentLocation);
// since we specify parent 1 as the first parent, it is the "main" parent
// and the node will be displayed below that branch / commit / whatever
var commit = this.makeCommit(
[parent1, parent2],
null,
@ -1493,6 +1495,11 @@ var Commit = Backbone.Model.extend({
gitVisuals.addEdge(this.get('id'), parent.get('id'));
},
isMainParent: function(parent) {
var index = this.get('parents').indexOf(parent);
return index === 0;
},
initialize: function() {
this.validateAtInit();
this.addNodeToVisuals();