Beispiel #1
0
 /// <summary>
 /// Called just before the changes are committed.
 /// </summary>
 public virtual void PreCommit(PreCommitArgs args)
 {
     if (args == null)
     {
         throw new ArgumentNullException("args");
     }
 }
Beispiel #2
0
 private bool PreCommit_VerifyIssueTracker(PendingCommitState state)
 {
     IAnkhIssueService iService = state.GetService<IAnkhIssueService>();
     if (iService != null)
     {
         IssueRepository iRepo = iService.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;
             iRepo.PreCommit(args);
             if (args.Cancel) { return false; }
             state.LogMessage = args.CommitMessage;
         }
     }
     return true;
 }
Beispiel #3
0
        /// <summary>
        /// Called just before the changes are committed.
        /// </summary>
        public virtual void PreCommit(PreCommitArgs args)
        {
            if (args == null)
                throw new ArgumentNullException("args");

            args.Cancel = false;
        }
        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();
        }