Example #1
0
 ///<summary>Updates all bugIds for given bugSubmissionNums.</summary>
 public static void UpdateBugIds(long bugId, List <BugSubmission> listBugSubs)
 {
     if (listBugSubs.IsNullOrEmpty())
     {
         return;
     }
     if (RemotingClient.RemotingRole == RemotingRole.ClientWeb)
     {
         Meth.GetVoid(MethodBase.GetCurrentMethod(), bugId, listBugSubs);
         return;
     }
     DataAction.RunBugsHQ(() => {
         Db.NonQ("UPDATE bugsubmission SET BugId=" + POut.Long(bugId)
                 + " WHERE BugSubmissionNum IN (" + string.Join(",", listBugSubs.Select(x => POut.Long(x.BugSubmissionNum))) + ")");
     }, false);
     BugSubmissionHashes.UpdateBugIds(listBugSubs, bugId);
 }
Example #2
0
        ///<summary>Attempts to insert the given BugSubmission.</summary>
        public static BugSubmissionResult TryInsertBugSubmission(BugSubmission sub, out string matchedFixedVersion, Func <BugSubmission, bool> funcFilterValidation, bool doFilterValidation = true)
        {
            //No need to check RemotingRole; out parameter.
            BugSubmissionResult result = BugSubmissionResult.None;

            matchedFixedVersion = null;
            if (!doFilterValidation || funcFilterValidation(sub))
            {
                result = BugSubmissionHashes.ProcessSubmission(sub, out long matchedBugId, out matchedFixedVersion, out long matchedBugSubmissionHashNum);
                switch (result)
                {
                default:
                case BugSubmissionResult.SuccessMatched:                        //Hash found and points to valid bugId, but associated bug not flagged as fixed.
                case BugSubmissionResult.SuccessMatchedFixed:                   //Same as above but bug is flagged as fixed, matchedVersionsFixed is set also.
                    sub.BugId = matchedBugId;
                    sub.BugSubmissionHashNum = matchedBugSubmissionHashNum;
                    break;

                case BugSubmissionResult.SuccessHashFound:                        //Seen this submission before but no attached bug found. BugId=0.
                    sub.BugSubmissionHashNum = matchedBugSubmissionHashNum;
                    break;

                case BugSubmissionResult.SuccessHashNeeded:                        //New submission we do not have a hash for. BugId=0.
                    long bugSubmissionHashNum = BugSubmissionHashes.Insert(new BugSubmissionHash()
                    {
                        FullHash    = sub.HashedStackTrace,
                        PartialHash = sub.HashedSimpleStackTrace
                    });
                    sub.BugSubmissionHashNum = bugSubmissionHashNum;
                    break;

                case BugSubmissionResult.Failed:
                    break;
                }
                Insert(sub);
            }
            else
            {
                result = BugSubmissionResult.UpdateRequired;
            }
            return(result);
        }