Exemple #1
0
 public bool ValidateParameters(IntPtr hParentWnd, string parameters)
 {
     var hwnd = hParentWnd != IntPtr.Zero ? new Win32Window(hParentWnd) : null;
     this.parameters = new ParseParameters(this, hwnd, parameters);
     return true;
 }
Exemple #2
0
        public string OnCommitFinished(IntPtr hParentWnd, string commonRoot, string[] pathList, string logMessage, int revision)
        {
            var hwnd = hParentWnd != IntPtr.Zero ? new Win32Window(hParentWnd) : null;
            rootpath = commonRoot;
            if (logMessage.ToLower().IndexOf("fixed") >= 0)
            {
                var regexObj = new Regex(@"[\s;,.]([0-9a-f]{3}/[0-9a-f]{3})[\s;,.]", RegexOptions.IgnoreCase);
                var matches = regexObj.Matches(logMessage);

                if (matches.Count > 0)
                {
                    bool modified = false;
                    if(parameters==null) parameters = new ParseParameters(this, hwnd, "");
                    if (VCSAuthor == null)
                    {
                        string VCSUser_ = callBEcmd(rootpath, new string[1] { "vcs get_user_id" })[0];
                        if (-1 != VCSUser_.IndexOf("RESULT:"))
                            this.parameters.DefaultAuthor = VCSAuthor = VCSUser_.Substring(VCSUser_.IndexOf("RESULT:") + 8);
                    }
                    if (issues == null && !loadIssues(hwnd))
                        throw new Exception("Failed to load BE issues for checking commit message against");
                    var openstatuses=new List<string>() { "unconfirmed", "open", "assigned", "test" };
                    var itemsdone = new List<string>();
                    foreach (Match match in matches)
                    {
                        string shortname = match.Groups[1].ToString();
                        if (!itemsdone.Contains(shortname))
                        {
                            BEIssue issue = findIssues(new string[1] { shortname })[0];
                            if (openstatuses.Contains(issue.status))
                            {
                                var result = MessageBox.Show(hwnd, "Commit message implies issue " + shortname + " (" + issue.summary + ")\nwith status " + issue.status + " is now fixed. Shall I mark it as fixed for you?", "Question", MessageBoxButtons.YesNoCancel, MessageBoxIcon.Question);
                                if (DialogResult.Cancel == result)
                                    break;
                                else if (DialogResult.Yes == result)
                                {
                                    string[] outputs;
                                    if(parameters.AddCommitAsComment)
                                        outputs = callBEcmd(rootpath, new string[1] { "comment -a \"BEurtle auto issue closer\" " + shortname + " -" }, new string[1] { "Fixed in commit "+revision.ToString("x")+" (decimal "+revision.ToString()+")" });
                                    outputs = callBEcmd(rootpath, new string[1] { "status fixed " + shortname });
                                    if (outputs[0].Length > 0) MessageBox.Show(hwnd, "Command output: " + outputs[0]);
                                    else
                                    {
                                        itemsdone.Add(shortname);
                                        modified = true;
                                    }
                                }
                            }
                        }
                    }
                    if (modified)
                        writeHTML(hwnd, rootpath);
                }
            }
            return null;
        }
Exemple #3
0
 public string GetLinkText(IntPtr hParentWnd, string parameters)
 {
     var hwnd = hParentWnd != IntPtr.Zero ? new Win32Window(hParentWnd) : null;
     this.parameters = new ParseParameters(this, hwnd, parameters);
     return "Bugs, Bugs, Bugs!";
 }
Exemple #4
0
 public string GetCommitMessage(IntPtr hParentWnd, string parameters, string commonRoot, string[] pathList, string originalMessage)
 {
     var hwnd=hParentWnd != IntPtr.Zero ? new Win32Window(hParentWnd) : null;
     try
     {
         rootpath = commonRoot;
         this.parameters = new ParseParameters(this, hwnd, parameters);
         if (VCSAuthor == null)
         {
             string VCSUser_ = callBEcmd(rootpath, new string[1] { "vcs get_user_id" })[0];
             if (-1 != VCSUser_.IndexOf("RESULT:"))
                 this.parameters.DefaultAuthor = VCSAuthor = VCSUser_.Substring(VCSUser_.IndexOf("RESULT:") + 8);
         }
         var form = new IssuesForm(this, commonRoot, originalMessage);
         if (form.ShowDialog(hwnd) != DialogResult.OK)
             return originalMessage;
         var issues = form.selectedIssues();
         if (issues.Count == 0)
             return originalMessage;
         string result = originalMessage+"\n\n";
         foreach (var issue in issues)
             result += "* Issue " + issue.shortname + " (" + issue.summary + ") fixed.\n";
         return result;
     }
     catch (Exception e)
     {
         MessageBox.Show(hwnd, e.ToString());
         throw;
     }
 }
Exemple #5
0
 public string CheckCommit(IntPtr hParentWnd, string parameters, string commonUrl, string commonRoot, string[] pathList, string commitMessage)
 {
     var hwnd = hParentWnd != IntPtr.Zero ? new Win32Window(hParentWnd) : null;
     rootpath = commonRoot;
     this.parameters = new ParseParameters(this, hwnd, parameters);
     return null;
 }
Exemple #6
0
        private void OptionsDialog_Shown(object sender, EventArgs e)
        {
            try
            {
                initialising = true;
                DefaultAuthorChanged = false;
                BoxDefaultAuthor.Text = "";
                BoxDefaultAuthor.ForeColor = Color.FromArgb(0, 0, 0);
                DumpHTMLPathChanged = false;
                BoxDumpHTMLPath.Text = "";
                BoxDumpHTMLPath.ForeColor = Color.FromArgb(0, 0, 0);
                if (parameters != null)
                {
                    ParseParameters parsed = new ParseParameters(plugin, this, parameters, false);
                    if (parsed.DefaultAuthor.Length > 0)
                        DefaultAuthorChanged = true;
                    else
                        BoxDefaultAuthor.ForeColor = Color.FromArgb(192, 192, 192);
                    if (parsed.DumpHTMLPath.Length > 0)
                        DumpHTMLPathChanged = true;
                    else
                        BoxDumpHTMLPath.ForeColor = Color.FromArgb(192, 192, 192);
                    parsed.FillInDefaults(this);

                    BEPath = parsed.BEPath;
                    BoxDefaultAuthor.Text = parsed.DefaultAuthor;
                    CheckDumpHTML.Checked = parsed.DumpHTML;
                    BoxDumpHTMLPath.Text = parsed.DumpHTMLPath;
                    CheckAddCommitAsComment.Checked = parsed.AddCommitAsComment;
                    CheckFilterOutClosedIssues.Checked = parsed.FilterOutClosedIssues;
                    CheckBEXMLCache.Checked = parsed.CacheBEXML;
                    switch(parsed.ShowCommentCount)
                    {
                        case ShowCommentCountType.DontShow:
                            CheckShowCommentCount.CheckState = CheckState.Unchecked;
                            break;
                        case ShowCommentCountType.ShowEasy:
                            CheckShowCommentCount.CheckState = CheckState.Indeterminate;
                            break;
                        case ShowCommentCountType.ShowAll:
                            CheckShowCommentCount.CheckState = CheckState.Checked;
                            break;
                    }
                    CheckUseBEXML.Checked = parsed.UseBEXML;
                }
                else
                {
                    this.Text = "About BEurtle";
                    OptionsGroupBox.Enabled = false;
                    ButtonReset.Visible = false;
                    ButtonCancel.Visible = false;
                }
            }
            finally
            {
                initialising = false;
            }
        }