public override void PreCommit(PreCommitArgs args)
        {
            base.PreCommit(args);

            if (!IssuesListView.CheckedWorkItems.Any())
            {
                MessageBox.Show("You must select at least one item before you can commit your changes",
                                "No selection",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Information);

                args.Cancel = true;

                return;
            }

            var commitMessage = new StringBuilder();

            foreach (var workItem in IssuesListView.CheckedWorkItems.SelectMany(Hierarchy).Distinct())
            {
                commitMessage.Append(workItem.DisplayId).Append(" ");
            }

            commitMessage.Append(args.CommitMessage);

            args.CommitMessage = commitMessage.ToString();
        }
Beispiel #2
0
            public override void PreCommit(PreCommitArgs args)
            {
                if (!GlobalSettings.AnkhSvnIntegrationEnabled)
                {
                    return;
                }

                JiraActiveIssueManager.ActiveIssue issue = AtlassianPanel.Instance.Jira.ActiveIssueManager.CurrentActiveIssue;
                if (issue == null || (!String.IsNullOrEmpty(args.CommitMessage)))
                {
                    return;
                }

                string       commitMessage = issue.Key + (issue.Summary != null ? " - " + issue.Summary : "");
                DialogResult res           = MessageBox.Show(
                    "Do you want to set your commit message to\n\n\"" + commitMessage + "\"",
                    Constants.QUESTION_CAPTION, MessageBoxButtons.YesNo, MessageBoxIcon.Question);

                if (res != DialogResult.Yes)
                {
                    return;
                }

                args.CommitMessage = commitMessage;
            }
Beispiel #3
0
        public override void PreCommit(PreCommitArgs args)
        {
            if (_control.SelectedIssues.Any())
            {
                var associatedIssues = new System.Text.StringBuilder();

                foreach (var issue in _control.SelectedIssues)
                {
                    associatedIssues.Append("#" + issue.id + ", ");
                }

                associatedIssues.Remove(associatedIssues.Length - 2, 2);

                args.CommitMessage += "\nAffected issues: " + associatedIssues;
            }

            base.PreCommit(args);
        }
Beispiel #4
0
        private bool PreCommit_VerifyIssueTracker(PendingCommitState state)
        {
            IssueRepository iRepo = IssueService.CurrentIssueRepository;

            if (iRepo != null)
            {
                List <Uri> uris = new List <Uri>();
                foreach (PendingChange pc in state.Changes)
                {
                    uris.Add(pc.Uri);
                }
                PreCommitArgs args = new PreCommitArgs(uris.ToArray(), 1);
                args.CommitMessage = state.LogMessage;
                args.IssueText     = state.IssueText;

                iRepo.PreCommit(args);
                if (args.Cancel)
                {
                    return(false);
                }

                state.LogMessage = args.CommitMessage;
                // BA: It is IssueRepository's responsibility to reset IssueText value to
                // 1) null : if IssueRepository populated log message with the issue numbers,
                // 2) other: if the default AnkhSVN handling is desired (i.e. BugTraq settings).
                // if the value is set to null, it is probably good idea to set SkipIssueVerify to true
                state.IssueText = args.IssueText;

                if (args.SkipIssueVerify)
                {
                    state.SkipIssueVerify = true;
                }

                foreach (KeyValuePair <string, string> kv in args.CustomProperties)
                {
                    state.CustomProperties[kv.Key] = kv.Value;
                }
            }
            return(true);
        }