Ejemplo n.º 1
0
        /// <summary>
        /// Gets the commit info from CommitData.
        /// </summary>
        /// <returns></returns>
        public static CommitInformation GetCommitInfo(IGitRevisionProvider module, CommitData data, bool showRevisionsAsLinks)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            string header = data.GetHeader(module, showRevisionsAsLinks);
            string body   = "\n" + WebUtility.HtmlEncode(data.Body.Trim());

            return(new CommitInformation(header, body));
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Gets the commit info for module.
        /// </summary>
        /// <param name="module">Git module.</param>
        /// <param name="sha1">The sha1.</param>
        /// <returns></returns>
        public static CommitInformation GetCommitInfo(GitModule module, string sha1)
        {
            string     error = "";
            CommitData data  = CommitData.GetCommitData(module, sha1, ref error);

            if (data == null)
            {
                return(new CommitInformation(error, ""));
            }

            string header = data.GetHeader(module, false);
            string body   = "\n" + WebUtility.HtmlEncode(data.Body.Trim());

            return(new CommitInformation(header, body));
        }
Ejemplo n.º 3
0
        /// <summary>
        /// Gets the commit info from CommitData.
        /// </summary>
        /// <returns></returns>
        public static CommitInformation GetCommitInfo(CommitData data, bool showRevisionsAsLinks, GitModule module = null)
        {
            if (data == null)
            {
                throw new ArgumentNullException("data");
            }

            string header = data.GetHeader(showRevisionsAsLinks);
            string body   = "\n" + WebUtility.HtmlEncode(data.Body.Trim());

            if (showRevisionsAsLinks)
            {
                body = GitRevision.Sha1HashShortRegex.Replace(body, match => ProcessHashCandidate(module, hash: match.Value));
            }
            return(new CommitInformation(header, body));
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Gets the commit info for module.
        /// </summary>
        /// <param name="module">Git module.</param>
        /// <param name="linkFactory"></param>
        /// <param name="sha1">The sha1.</param>
        /// <returns></returns>
        public static CommitInformation GetCommitInfo(GitModule module, LinkFactory linkFactory, string sha1)
        {
            // TEMP, will be moved in the follow up refactor
            ICommitDataManager commitDataManager = new CommitDataManager(() => module);

            string     error = "";
            CommitData data  = commitDataManager.GetCommitData(sha1, ref error);

            if (data == null)
            {
                return(new CommitInformation(error, ""));
            }

            string header = data.GetHeader(linkFactory, false);
            string body   = "\n" + WebUtility.HtmlEncode(data.Body.Trim());

            return(new CommitInformation(header, body));
        }