Пример #1
0
        internal void LoadBranchesToProcess()
        {
            mLog.Info("Retrieving branches to process...");

            if (mMultilinerBotConfig.Plastic.IsApprovedCodeReviewFilterEnabled)
            {
                List <BranchWithReview> branchesWithReviews =
                    FindQueries.FindPendingBranchesWithReviews(
                        mRestApi,
                        mMultilinerBotConfig.Repository,
                        mMultilinerBotConfig.BranchPrefix ?? string.Empty,
                        mMultilinerBotConfig.Plastic.StatusAttribute.Name,
                        mMultilinerBotConfig.Plastic.StatusAttribute.MergedValue);

                HashSet <string> branchIdsProcessed = new HashSet <string>();
                List <Branch>    branchesToEnqueue  = new List <Branch>();

                foreach (BranchWithReview branchWithReview in branchesWithReviews)
                {
                    ReviewsStorage.WriteReview(
                        branchWithReview.Review,
                        mCodeReviewsTrackedFilePath);

                    if (mMultilinerBotConfig.Plastic.IsBranchAttrFilterEnabled)
                    {
                        continue;
                    }

                    if (branchIdsProcessed.Contains(branchWithReview.Branch.Id))
                    {
                        continue;
                    }

                    branchIdsProcessed.Add(branchWithReview.Branch.Id);
                    branchesToEnqueue.Add(branchWithReview.Branch);
                }

                BranchesQueueStorage.WriteQueuedBranches(
                    branchesToEnqueue, mBranchesQueueFilePath);
            }

            if (!mMultilinerBotConfig.Plastic.IsBranchAttrFilterEnabled)
            {
                return;
            }

            List <Branch> branches = FindQueries.FindResolvedBranches(
                mRestApi,
                mMultilinerBotConfig.Repository,
                mMultilinerBotConfig.BranchPrefix ?? string.Empty,
                mMultilinerBotConfig.Plastic.StatusAttribute.Name,
                mMultilinerBotConfig.Plastic.StatusAttribute.ResolvedValue);

            BranchesQueueStorage.WriteQueuedBranches(branches, mBranchesQueueFilePath);
        }