Пример #1
0
        public BranchInfoActor()
        {
            Receive<GetBranchInfo>(message =>
            {
                Logger.WriteLine($"Starting Branch info {message.DirPath} -> {message.BranchName}");
                using (var repository = new Repository(message.RepositoryPath))
                {
                    var branch = repository.Branches[message.BranchName];
                    var branchLastCommit = branch.Tip;
                    var branchInfo = new BranchInfo
                    {
                        Name = branch.Name,
                        CommitterDate = branchLastCommit.Committer.When,
                        CommitterName = branchLastCommit.Committer.Name,
                        CommitterEmail = branchLastCommit.Committer.Email,
                        Message = branchLastCommit.Message,
                        Sha = branchLastCommit.Sha,
                    };

                    var repoAndBranchInfo = new RepoAndBranchInfo(message.DirPath, branchInfo);

                    Context.ActorSelection(ActorSelectionRouting.BranchInfoAggregationActorPath)
                        .Tell(new RepositoryAndBranchInfo(repoAndBranchInfo));

                }
            });
        }
Пример #2
0
        public string BuildBranchEmail(RepoAndBranchInfo repoAndBranchInfo)
        {
            var sb = new StringBuilder();
            var repoName = repoAndBranchInfo.DirPath.Split('\\').Last();
            var branchInfo = repoAndBranchInfo.BranchInfo;
            sb.Append($"<p>Old un-merged branch <b>'{branchInfo.Name}'</b> in <b>{repoName}</b> repository.</p>");

            sb.Append(
                table(
                    AddColumnHeaders() +
                    AddBranchInfo(branchInfo, branchInfo.Name, branchInfo.Message)
                )
            );

            sb.Append($"<p>This branch is not merged into the branch '{Constants.ComparisonBranchName}' and is older than {Constants.MonthsPriorToNow} months.</p>");
            sb.Append("<p>Please review whether this branch is useful and move to the z-archives folder or delete it if it is not.</p>");

            var allHtml = htmlMain(sb.ToString());
            return allHtml;
        }
Пример #3
0
        private string GetSubject(RepoAndBranchInfo reposAndBranchInfo)
        {
            var repoName = reposAndBranchInfo.DirPath.Split('\\').Last();

            return $"{repoName} - {reposAndBranchInfo.BranchInfo.Name} - possibly stale";
        }
Пример #4
0
 private string GetContent(RepoAndBranchInfo reposAndBranchInfo)
 {
     return _emailBuilder.BuildBranchEmail(reposAndBranchInfo);
 }
Пример #5
0
 public RepositoryAndBranchInfo(RepoAndBranchInfo repoAndBranchInfo)
 {
     RepoAndBranchInfo = repoAndBranchInfo;
 }