Example #1
0
        private static CommitRow CreateCommitRow(IVssRequestContext requestContext, ITeamFoundationGitCommitService commitService,
                                                 ITfsGitRepository repository, TfsGitCommit gitCommit, CommitRowType rowType, PushNotification pushNotification, Dictionary <Sha1Id, List <GitRef> > refLookup)
        {
            var    commitManifest = commitService.GetCommitManifest(requestContext, repository, gitCommit.ObjectId);
            string repoUri        = repository.GetRepositoryUri();

            var commitRow = new CommitRow()
            {
                CommitId     = gitCommit.ObjectId,
                Type         = rowType,
                CommitUri    = repoUri + "/commit/" + gitCommit.ObjectId.ToHexString(),
                AuthorTime   = gitCommit.GetAuthor().LocalTime,
                Author       = gitCommit.GetAuthor().NameAndEmail,
                AuthorName   = gitCommit.GetAuthor().Name,
                AuthorEmail  = gitCommit.GetAuthor().Email,
                Comment      = gitCommit.GetComment(),
                ChangeCounts = commitManifest.ChangeCounts
            };
            List <GitRef> refs;

            refLookup.TryGetValue(gitCommit.ObjectId, out refs);
            commitRow.Refs = refs;

            return(commitRow);
        }
Example #2
0
        private static CommitRow CreateCommitRow(TeamFoundationRequestContext requestContext, TeamFoundationGitCommitService commitService,
                                                 TfsGitCommit gitCommit, CommitRowType rowType, PushNotification pushNotification, Dictionary <byte[], List <string> > refNames)
        {
            var    commitManifest = commitService.GetCommitManifest(requestContext, gitCommit.Repository, gitCommit.ObjectId);
            string repoUri        = gitCommit.Repository.GetRepositoryUri(requestContext);

            var commitRow = new CommitRow()
            {
                CommitId     = gitCommit.ObjectId,
                Type         = rowType,
                CommitUri    = repoUri + "/commit/" + gitCommit.ObjectId.ToHexString(),
                AuthorTime   = gitCommit.GetLocalAuthorTime(requestContext),
                Author       = gitCommit.GetAuthor(requestContext),
                AuthorName   = gitCommit.GetAuthorName(requestContext),
                AuthorEmail  = gitCommit.GetAuthorEmail(requestContext),
                Comment      = gitCommit.GetComment(requestContext),
                ChangeCounts = commitManifest.ChangeCounts
            };
            List <string> refs = null;

            refNames.TryGetValue(gitCommit.ObjectId, out refs);
            commitRow.RefNames = refs;

            return(commitRow);
        }
Example #3
0
        private string CommitToString(TeamFoundationRequestContext requestContext, TfsGitCommit gitCommit, string action, PushNotification pushNotification,
                                      Dictionary <byte[], List <string> > refNames)
        {
            DateTime      authorTime = gitCommit.GetLocalAuthorTime(requestContext);
            string        authorName = gitCommit.GetAuthor(requestContext);
            string        comment    = gitCommit.GetComment(requestContext);
            StringBuilder sb         = new StringBuilder();
            List <string> names      = null;

            if (refNames.TryGetValue(gitCommit.ObjectId, out names))
            {
                sb.AppendFormat("{0} ", String.Join("", names));
            }
            sb.AppendFormat("{0} {1} {2} {3} {4}", action, gitCommit.ObjectId.ToShortHexString(), authorTime.ToString(), authorName,
                            comment.Truncate(COMMENT_MAX_LENGTH));

            return(sb.ToString());
        }
Example #4
0
        private string CommitToString(TeamFoundationRequestContext requestContext, TfsGitCommit gitCommit, string action, PushNotification pushNotification, 
            Dictionary<byte[], List<string>> refNames)
        {
            DateTime authorTime = gitCommit.GetLocalAuthorTime(requestContext);
            string authorName = gitCommit.GetAuthor(requestContext);
            string comment = gitCommit.GetComment(requestContext);
            StringBuilder sb = new StringBuilder();
            List<string> names = null;
            if (refNames.TryGetValue(gitCommit.ObjectId, out names)) sb.AppendFormat("{0} ", String.Join("", names));
            sb.AppendFormat("{0} {1} {2} {3} {4}", action, gitCommit.ObjectId.ToShortHexString(), authorTime.ToString(), authorName,
                comment.Truncate(COMMENT_MAX_LENGTH));

            return sb.ToString();
        }