A commit reference to a commit in the DAG.
Inheritance: GitSharp.Core.RevWalk.RevCommit
Exemple #1
0
 /// <summary>
 /// Determine if the given commit is a child (descendant) of this commit.
 /// </summary>
 /// <param name="c">the commit to test.</param>
 /// <returns>true if the given commit built on top of this commit.</returns>
 public bool isChild(PlotCommit c)
 {
     foreach (PlotCommit a in children)
     {
         if (a == c)
         {
             return(true);
         }
     }
     return(false);
 }
Exemple #2
0
 public void addChild(PlotCommit c)
 {
     int cnt = children.Length;
     if (cnt == 0)
         children = new PlotCommit[] { c };
     else if (cnt == 1)
         children = new PlotCommit[] { children[0], c };
     else
     {
         var n = new PlotCommit[cnt + 1];
         System.Array.Copy(children, 0, n, 0, cnt);
         n[cnt] = c;
         children = n;
     }
 }
Exemple #3
0
        public void addChild(PlotCommit c)
        {
            int cnt = children.Length;

            if (cnt == 0)
            {
                children = new PlotCommit[] { c }
            }
            ;
            else if (cnt == 1)
            {
                children = new PlotCommit[] { children[0], c }
            }
            ;
            else
            {
                var n = new PlotCommit[cnt + 1];
                System.Array.Copy(children, 0, n, 0, cnt);
                n[cnt]   = c;
                children = n;
            }
        }
 private void OnCommitClicked(PlotCommit commit)
 {
     if (CommitClicked==null)
         return;
     var c = new Commit(m_repo, commit.Name);
     m_selection.Update(c);
     CommitClicked(c);
 }
Exemple #5
0
 /// <summary>
 /// Determine if the given commit is a child (descendant) of this commit.
 /// </summary>
 /// <param name="c">the commit to test.</param>
 /// <returns>true if the given commit built on top of this commit.</returns>
 public bool isChild(PlotCommit c)
 {
     foreach (PlotCommit a in children)
         if (a == c)
             return true;
     return false;
 }
Exemple #6
0
        /// <summary>
        /// Paint one commit using the underlying graphics library.
        /// </summary>
        /// <param name="commit">the commit to render in this cell. Must not be null.</param>
        /// <param name="h">total height (in pixels) of this cell.</param>
        protected virtual void paintCommit(PlotCommit commit, int h)
        {
            if (commit == null)
            {
                throw new ArgumentNullException("commit");
            }

            int      dotSize = computeDotSize(h);
            PlotLane myLane  = commit.getLane();
            int      myLaneX = laneC(myLane);
            TColor   myColor = laneColor(myLane);

            int maxCenter = 0;

            foreach (PlotLane passingLane in (PlotLane[])commit.passingLanes)
            {
                int    cx = laneC(passingLane);
                TColor c  = laneColor(passingLane);
                drawLine(c, cx, 0, cx, h, LINE_WIDTH);
                maxCenter = Math.Max(maxCenter, cx);
            }

            int nParent = commit.ParentCount;

            for (int i = 0; i < nParent; i++)
            {
                PlotCommit p;
                PlotLane   pLane;
                TColor     pColor;
                int        cx;

                p     = (PlotCommit)commit.GetParent(i);
                pLane = p.getLane();
                if (pLane == null)
                {
                    continue;
                }

                pColor = laneColor(pLane);
                cx     = laneC(pLane);

                if (Math.Abs(myLaneX - cx) > LANE_WIDTH)
                {
                    if (myLaneX < cx)
                    {
                        int ix = cx - LANE_WIDTH / 2;
                        drawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
                        drawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
                    }
                    else
                    {
                        int ix = cx + LANE_WIDTH / 2;
                        drawLine(pColor, myLaneX, h / 2, ix, h / 2, LINE_WIDTH);
                        drawLine(pColor, ix, h / 2, cx, h, LINE_WIDTH);
                    }
                }
                else
                {
                    drawLine(pColor, myLaneX, h / 2, cx, h, LINE_WIDTH);
                }
                maxCenter = Math.Max(maxCenter, cx);
            }

            int dotX = myLaneX - dotSize / 2 - 1;
            int dotY = (h - dotSize) / 2;

            if (commit.getChildCount() > 0)
            {
                drawLine(myColor, myLaneX, 0, myLaneX, dotY, LINE_WIDTH);
            }

            if (commit.has(RevFlag.UNINTERESTING))
            {
                drawBoundaryDot(dotX, dotY, dotSize, dotSize);
            }
            else
            {
                drawCommitDot(dotX, dotY, dotSize, dotSize);
            }

            int textx = Math.Max(maxCenter + LANE_WIDTH / 2, dotX + dotSize) + 8;
            int n     = commit.refs == null ? 0 : commit.refs.Length;

            for (int i = 0; i < n; ++i)
            {
                textx += drawLabel(textx + dotSize, h / 2, commit.refs[i]);
            }

            String msg = commit.getShortMessage();

            drawText(msg, textx + dotSize + n * 2, h / 2);
        }