示例#1
0
        void ProcessBranchAttributeChangedEvent(string message)
        {
            BranchAttributeChangeEvent e = EventParser.ParseBranchAttributeChangeEvent(message);

            if (!IsEventOfValidTrackedBranch(e, mBotConfig))
            {
                return;
            }

            if (!AreEqualIgnoreCase(e.AttributeName, mBotConfig.PlasticStatusAttrConfig.Name))
            {
                return;
            }

            lock (mSyncLock)
            {
                if (AreEqualIgnoreCase(e.AttributeValue, mBotConfig.PlasticStatusAttrConfig.MergedValue))
                {
                    if (!mReadyToMergeBranchesStorage.Contains(e.Repository, e.BranchId))
                    {
                        return;
                    }

                    mReadyToMergeBranchesStorage.RemoveBranch(e.Repository, e.BranchId);
                }

                if (AreEqualIgnoreCase(e.AttributeValue, mBotConfig.PlasticStatusAttrConfig.ResolvedValue))
                {
                    if (mResolvedBranchesStorage.Contains(e.Repository, e.BranchId))
                    {
                        return;
                    }

                    Branch branch = new Branch(e.Repository, e.BranchId, e.BranchFullName, e.BranchOwner, e.BranchComment);
                    mResolvedBranchesStorage.EnqueueBranch(branch);
                    return;
                }

                if (!mResolvedBranchesStorage.Contains(e.Repository, e.BranchId))
                {
                    return;
                }

                mResolvedBranchesStorage.RemoveBranch(e.Repository, e.BranchId);
            }
        }
示例#2
0
        void ProcessNewChangesetsEvent(string message)
        {
            NewChangesetsEvent e = EventParser.ParseNewChangesetsEvent(message);

            if (!e.Repository.Equals(mBotConfig.Repository, StringComparison.InvariantCultureIgnoreCase))
            {
                return;
            }

            if (!IsTrackedTrunkBranch(e.BranchFullName, mBotConfig.TrunkBranch))
            {
                return;
            }

            lock (mSyncLock)
            {
                while (mReadyToMergeBranchesStorage.HasQueuedBranches())
                {
                    mResolvedBranchesStorage.EnqueueBranch(
                        mReadyToMergeBranchesStorage.DequeueBranch());
                }
            }
        }