got tags making commits not faded out or orphaned anymore

This commit is contained in:
Peter Cottle 2013-11-01 10:01:13 -07:00
parent e9e2cda241
commit 9fbe654cb2
3 changed files with 37 additions and 22 deletions

View file

@ -36,6 +36,7 @@ function GitVisuals(options) {
this.branchStackMap = null;
this.tagStackMap = null;
this.upstreamBranchSet = null;
this.upstreamTagSet = null;
this.upstreamHeadSet = null;
this.paper = options.paper;
@ -451,6 +452,7 @@ GitVisuals.prototype.calcGraphicsCoords = function() {
GitVisuals.prototype.calcUpstreamSets = function() {
this.upstreamBranchSet = this.gitEngine.getUpstreamBranchSet();
this.upstreamHeadSet = this.gitEngine.getUpstreamHeadSet();
this.upstreamTagSet = this.gitEngine.getUpstreamTagSet();
};
GitVisuals.prototype.getCommitUpstreamBranches = function(commit) {
@ -492,9 +494,12 @@ GitVisuals.prototype.getCommitUpstreamStatus = function(commit) {
var id = commit.get('id');
var branch = this.upstreamBranchSet;
var head = this.upstreamHeadSet;
var tag = this.upstreamTagSet;
if (branch[id]) {
return 'branch';
} else if (tag[id]) {
return 'tag';
} else if (head[id]) {
return 'head';
} else {
@ -502,6 +507,23 @@ GitVisuals.prototype.getCommitUpstreamStatus = function(commit) {
}
};
GitVisuals.prototype.calcTagStacks = function() {
var tags = this.gitEngine.getTags();
var map = {};
_.each(tags, function(tag) {
var thisId = tag.target.get('id');
map[thisId] = map[thisId] || [];
map[thisId].push(tag);
map[thisId].sort(function(a, b) {
var aId = a.obj.get('id');
var bId = b.obj.get('id');
return aId.localeCompare(bId);
});
});
this.tagStackMap = map;
};
GitVisuals.prototype.calcBranchStacks = function() {
var branches = this.gitEngine.getBranches();
var map = {};
@ -522,23 +544,6 @@ GitVisuals.prototype.calcBranchStacks = function() {
this.branchStackMap = map;
};
GitVisuals.prototype.calcTagStacks = function() {
var tags = this.gitEngine.getTags();
var map = {};
_.each(tags, function(tag) {
var thisId = tag.target.get('id');
map[thisId] = map[thisId] || [];
map[thisId].push(tag);
map[thisId].sort(function(a, b) {
var aId = a.obj.get('id');
var bId = b.obj.get('id');
return aId.localeCompare(bId);
});
});
this.tagStackMap = map;
};
GitVisuals.prototype.calcWidth = function() {
this.maxWidthRecursive(this.rootCommit);