Ejemplo n.º 1
0
 public RepoCollaborators(GitGraph graph, string repo)
 {
     this.graph = graph;
     Vars ??= new QueryParams {
         { "repo", repo }
     };
 }
Ejemplo n.º 2
0
 public void Refresh(GitGraph graph)
 {
     foreach (var branch in this.repository.Branches)
     {
         if (!branch.CanonicalName.EndsWith("/HEAD"))
         {
             if (AddBranch(graph, branch) == null)
                 return;
         }
     }
 }
Ejemplo n.º 3
0
        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;
        }
Ejemplo n.º 4
0
 public void Reload()
 {
     var g = new GitGraph();
     this.Refresh(g);
     this.Graph = g;
 }
Ejemplo n.º 5
0
        private CommitVertex AddCommit(GitGraph graph, Commit commit, int depth = 0)
        {
            if (depth > 25)
                return null;

            CommitVertex existing;

            if (graph.TryGetCommitVertex(commit.Sha, out existing))
                return existing;

            var vertex = new CommitVertex(commit);
            graph.AddCommitVertex(vertex);

            foreach (var parent in commit.Parents)
            {
                var parentVertex = AddCommit(graph, parent, depth + 1);

                if (parentVertex != null)
                    graph.AddEdge(new CommitEdge(vertex, parentVertex));
            }

            return vertex;
        }