Beispiel #1
0
        /// <summary>
        /// Blames the by line.
        /// </summary>
        /// <param name="blameInfo">The blame information.</param>
        /// <param name="line">The line param.</param>
        /// <returns>Returns null if not found.</returns>
        private BlameLine BlameByLine(BlameHunkCollection blameInfo, int line)
        {
            var enumerator = blameInfo.GetEnumerator();

            enumerator.MoveNext();
            var prev = enumerator.Current;

            while (enumerator.MoveNext())
            {
                var curr = enumerator.Current;

                Debug.WriteLine(prev.FinalSignature.Name + "    " + prev.FinalSignature.When + " === " + prev.FinalStartLineNumber + " === " + curr.FinalStartLineNumber + "     " + line.ToString());

                if (line >= prev.FinalStartLineNumber && line < curr.FinalStartLineNumber)
                {
                    var blame = new BlameLine();
                    blame.Line   = line;
                    blame.Author = prev.FinalSignature.Name;
                    blame.Date   = prev.FinalSignature.When.LocalDateTime;
                    blame.Email  = prev.FinalSignature.Email;
                    return(blame);
                }

                prev = enumerator.Current;
            }

            return(null);
        }
        private static void AssertCorrectHeadBlame(BlameHunkCollection blame)
        {
            Assert.Equal(1, blame.Count());
            Assert.Equal(0, blame[0].FinalStartLineNumber);
            Assert.Equal("*****@*****.**", blame[0].FinalSignature.Email);
            Assert.Equal("4a202b3", blame[0].FinalCommit.Id.ToString(7));

            Assert.Equal(0, blame.HunkForLine(0).FinalStartLineNumber);
            Assert.Equal("*****@*****.**", blame.HunkForLine(0).FinalSignature.Email);
            Assert.Equal("4a202b3", blame.HunkForLine(0).FinalCommit.Id.ToString(7));
        }
Beispiel #3
0
 private void CheckBlame()
 {
     try
     {
         blameHunk      = manager.Repository.Blame(blameLocalPath);
         invalidMessage = null;
     }
     catch (Exception e)
     {
         invalidMessage = e.Message;
     }
 }
Beispiel #4
0
        /// <summary>
        /// Blames the by line.
        /// </summary>
        /// <param name="blameInfo">The blame information.</param>
        /// <param name="line">The line param.</param>
        /// <returns>Returns null if not found.</returns>
        private BlameLine BlameByLine(BlameHunkCollection blameInfo, int line)
        {
            var enumerator = blameInfo.GetEnumerator();
            enumerator.MoveNext();
            var prev = enumerator.Current;
            while (enumerator.MoveNext())
            {
                var curr = enumerator.Current;

                Debug.WriteLine(prev.FinalSignature.Name + "    " + prev.FinalSignature.When + " === " + prev.FinalStartLineNumber + " === " + curr.FinalStartLineNumber + "     " + line.ToString());

                if (line >= prev.FinalStartLineNumber && line < curr.FinalStartLineNumber)
                {
                    var blame = new BlameLine();
                    blame.Line = line;
                    blame.Author = prev.FinalSignature.Name;
                    blame.Date = prev.FinalSignature.When.LocalDateTime;
                    blame.Email = prev.FinalSignature.Email;
                    return blame;
                }

                prev = enumerator.Current;
            }

            return null;
        }