示例#1
0
        static List <GitLogElems> parseGitLogFileIntoGitLogElemsList(string gitLogFilePath)
        {
            GitRepositoryInfo gitRepoInfo = new GitRepositoryInfo();

            string        gitLog = File.ReadAllText(gitLogFilePath);
            List <string> lines  = gitLog.Split(new string[] { _lineSeparatorString }, StringSplitOptions.RemoveEmptyEntries).ToList();

            //List<string> lines = System.IO.File.ReadLines(gitLogFilePath).ToList();
            List <string> logElemList = new List <string>();

            GitLogElems        gitLogElems;
            List <GitLogElems> gitLogElemsList = new List <GitLogElems>();

            foreach (string line in lines)
            {
                logElemList = line.Split(new string[] { _elemSeparatorString }, StringSplitOptions.None).ToList();

                gitLogElems = new GitLogElems();
                gitLogElems.commitNumber = logElemList[0];
                gitLogElems.author       = logElemList[1];
                gitLogElems.date         = logElemList[2];
                gitLogElems.comment      = logElemList[3];
                gitLogElems.authorEmail  = logElemList[4];

                gitLogElemsList.Add(gitLogElems);
            }

            return(gitLogElemsList);
        }
示例#2
0
        static void mergeNewGitLogFileToGitRepositoryInfo(GitRepositoryInfo gitRepoInfo, EnumBranch eBranch, string gitLogFile, string buildSessionId, string buildResult, string branchName, bool hasPackageFile, bool hasBuildFailFile)
        {
            if (!File.Exists(gitLogFile))
            {
                return;
            }

            //List<GitLogElems> newLogList = parseGitLogFileIntoGitLogElemsList(gitLogFile);
            List <GitLogElems> newLogList = parseGitLogFileIntoGitLogElemsListNew(gitLogFile);

            updateFirstCommitBuildResult(newLogList, buildSessionId, buildResult, hasPackageFile, hasBuildFailFile);

            if (eBranch == EnumBranch.Master)
            {
                gitRepoInfo.master.InsertRange(0, newLogList);
            }
            else if (eBranch == EnumBranch.Tag)
            {
                if (newLogList != null && newLogList.Count > 0)
                {
                    GitLogElems gle = newLogList[0];
                    gle.commitNumber = branchName;
                    gitRepoInfo.tags.Insert(0, gle);
                }
            }
        }
示例#3
0
        static void UpdateGitLogElem(List <GitLogElems> gitLogElemsList, ENUM_LOG_FIELD eLogField, int elemIndex, string value)
        {
            GitLogElems gitLog = gitLogElemsList[elemIndex];

            switch (eLogField)
            {
            case ENUM_LOG_FIELD.commitNumber:
                gitLog.commitNumber = value;
                break;

            case ENUM_LOG_FIELD.author:
                gitLog.author = value;
                break;

            case ENUM_LOG_FIELD.authorEmail:
                gitLog.authorEmail = value;
                break;

            case ENUM_LOG_FIELD.date:
                gitLog.date = value;
                break;

            case ENUM_LOG_FIELD.comment:
                gitLog.comment += value.Replace(" ", "&nbsp") + "<br>";
                break;

            default:
                break;
            }
            gitLogElemsList[elemIndex] = gitLog;
        }
示例#4
0
        static void updateFirstCommitBuildResult(List <GitLogElems> lst, string buildSessionId, string buildResult, bool hasPackageFile, bool hasBuildFailFile)
        {
            if (lst == null || lst.Count == 0)
            {
                return;
            }

            GitLogElems elem = lst[0];

            elem.buildSessionId  = buildSessionId;
            elem.buildResult     = buildResult;
            elem.hasPackageFile  = (hasPackageFile) ? "yes" : "no";
            elem.hasBuildFailLog = (hasBuildFailFile) ? "yes" : "no";

            lst[0] = elem;
        }