void ProcessCodeReviewChangedEvent(string message) { CodeReviewChangeEvent e = ParseEvent.Parse <CodeReviewChangeEvent>(message); if (!ShouldBeProcessed( e.Repository, e.BranchFullName, mMultilinerBotConfig.Repository, mMultilinerBotConfig.BranchPrefix)) { return; } Review review = new Review( e.Repository, e.CodeReviewId, e.BranchId, e.CodeReviewStatus, e.CodeReviewTitle); if (review.IsDeleted()) { ReviewsStorage.DeleteReview(review, mCodeReviewsTrackedFilePath); if (!mMultilinerBotConfig.Plastic.IsBranchAttrFilterEnabled) { List <Review> remainingBranchReviews = ReviewsStorage.GetBranchReviews( e.Repository, e.BranchId, mCodeReviewsTrackedFilePath); if (remainingBranchReviews != null && remainingBranchReviews.Count > 0) { return; } lock (mSyncLock) { BranchesQueueStorage.RemoveBranch( e.Repository, e.BranchId, mBranchesQueueFilePath); } } return; } ReviewsStorage.WriteReview(review, mCodeReviewsTrackedFilePath); if (mMultilinerBotConfig.Plastic.IsBranchAttrFilterEnabled) { return; } lock (mSyncLock) { EnqueueBranch( mBranchesQueueFilePath, e.Repository, e.BranchId, e.BranchFullName, e.BranchOwner, e.BranchComment); Monitor.Pulse(mSyncLock); } }
void ProcessBranchAttributeChangedEvent(string message) { BranchAttributeChangeEvent e = ParseEvent.Parse <BranchAttributeChangeEvent>(message); if (!ShouldBeProcessed( e.Repository, e.BranchFullName, mMultilinerBotConfig.Repository, mMultilinerBotConfig.BranchPrefix)) { return; } if (!IsRelevantAttribute( e.AttributeName, mMultilinerBotConfig.Plastic.StatusAttribute)) { return; } lock (mSyncLock) { if (!IsAttributeValueResolved( e.AttributeValue, mMultilinerBotConfig.Plastic.StatusAttribute)) { BranchesQueueStorage.RemoveBranch( e.Repository, e.BranchId, mBranchesQueueFilePath); return; } EnqueueBranch( mBranchesQueueFilePath, e.Repository, e.BranchId, e.BranchFullName, e.BranchOwner, e.BranchComment); Monitor.Pulse(mSyncLock); } }