Exemplo n.º 1
0
        private void _printParentsFull(Graph graph, Revision rev,
                                       GetRevisionFx_T getRevisions)
        {
            /* draw each revision in the target branch. */
            foreach (string parentID in rev.Parents)
            {
                Revision parRev = getRevisions(parentID);

                if (parRev != null)
                {
                    if (parRev.Branch == rev.Branch)
                    {
                        _drawRev(graph, parRev, rev);
                    }
                    else
                    {
                        Edge edge = graph.AddEdge(parentID, rev.ID);
                        edge.Attr.Color = EdgeColor;
                        edge.Attr.AddStyle(Style.Dashed);

                        Node node = graph.FindNode(parentID);
                        node.UserData = parRev;
                        if (node.UserData != null)
                        {
                            FormatNodeFromDifferentBranch(node, parRev);
                        }

                        node          = graph.FindNode(rev.ID);
                        node.UserData = rev;
                        FormatNode(node, rev);
                    }
                }
            }
        }
Exemplo n.º 2
0
        private void _printParentsPartial(Graph graph, Revision rev,
                                          GetRevisionFx_T getRevisions)
        {
            /* so, let's collapse some of the history. */
            List <Revision> r = new List <Revision>();

            foreach (string parent in rev.Parents)
            {
                Revision parRev = getRevisions(parent);

                if (parRev != null)
                {
                    if (parRev.Branch == rev.Branch)
                    {
                        _drawRev(graph, parRev, rev);
                    }
                    else
                    {
                        r.Add(parRev);
                    }
                }
            }

            if (r.Count > 0)
            {
                string nodeID = string.Format("others-{0}", rev.ID);
                Edge   edge   = (Edge)graph.AddEdge(nodeID, rev.ID);

                edge.Attr.Color = EdgeColor;
                edge.Attr.AddStyle(Style.Dashed);

                Node node = (Node)graph.FindNode(nodeID);
                node.UserData = r;

                node.Attr.Fontcolor   = Microsoft.Glee.Drawing.Color.Black;
                node.Attr.Fillcolor   = Microsoft.Glee.Drawing.Color.LightGray;
                node.Attr.LabelMargin = 5;

                System.Text.StringBuilder bldr = new System.Text.StringBuilder();

                foreach (Revision rli in r)
                {
                    bldr.AppendLine(rli.ID);
                }

                node.Attr.Label = bldr.ToString();
                node.Attr.Shape = Shape.Box;

                node          = (Node)graph.FindNode(rev.ID);
                node.UserData = rev;
                FormatNode(node, rev);
            }
        }