Esempio n. 1
0
        public void LoadBlame(string guid, string fileName, RevisionGrid revGrid)
        {
            var scrollpos = BlameFile.ScrollPos;

            var blameCommitter = new StringBuilder();
            var blameFile = new StringBuilder();
            _revGrid = revGrid;

            _blame = GitCommandHelpers.Blame(fileName, guid);

            for (int i = 0; i < _blame.Lines.Count; i++ )
            {
                GitBlameLine blameLine = _blame.Lines[i];
                GitBlameHeader blameHeader = _blame.FindHeaderForCommitGuid(blameLine.CommitGuid);
                if (i > 0 && _blame.Lines[i-1].CommitGuid == blameLine.CommitGuid)
                {
                    blameCommitter.AppendLine(new string(' ', 200));
                } else
                {
                    blameCommitter.AppendLine((blameHeader.Author + " - " + blameHeader.AuthorTime.ToString() + " - " + blameHeader.FileName + new string(' ', 100)).Trim(new char[] { '\r', '\n' }));
                }
                if (blameLine.LineText == null )
                    blameFile.AppendLine("");
                else
                    blameFile.AppendLine(blameLine.LineText.Trim(new char[] { '\r', '\n' }));
            }

            BlameCommitter.ViewText("committer.txt", blameCommitter.ToString());
            BlameFile.ViewText(fileName, blameFile.ToString());
            BlameFile.ScrollPos = scrollpos;

            BlameFile_SelectedLineChanged(null, 0);
        }
Esempio n. 2
0
        public void TestFindHeaderForCommitGuid()
        {
            GitBlame blame = new GitBlame();
            string expectedCommitGuid = Guid.NewGuid().ToString();

            GitBlameHeader expectedHeader = new GitBlameHeader { CommitGuid = expectedCommitGuid };

            blame.Headers.Add(expectedHeader);
            Assert.IsTrue(blame.FindHeaderForCommitGuid(expectedCommitGuid).Equals(expectedHeader));
        }