public BranchEdge(BranchVertex source, CommitVertex target) : base(source, target) { this.BranchVertex = source; this.CommitVertex = target; }
private BranchVertex AddBranch(GitGraph graph, Branch branch) { BranchVertex bv; BranchEdge be; CommitVertex cv; if (graph.TryGetBranchVertex(branch.Name, out bv)) { if (bv.Branch.Tip.Sha == branch.Tip.Sha) return bv; // Found the branch but it's pointing to another commit. Let's remove it // and re-add it if (graph.TryGetCommitVertex(bv.Branch.Tip.Sha, out cv)) { GitEdge e; if (this.graph.TryGetEdge(bv, cv, out e)) this.graph.RemoveEdge(e); } this.graph.RemoveVertex(bv); } cv = AddCommit(graph, branch.Tip); if (cv == null) return null; if (bv == null) bv = new BranchVertex(branch); be = new BranchEdge(bv, cv); graph.AddVertex(bv); graph.AddEdge(be); return bv; }