コード例 #1
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);
        }
コード例 #2
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());
        }
コード例 #3
0
ファイル: NotificationSubscriber.cs プロジェクト: kria/TfsBot
        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();
        }