public override void OnExecute(CommandEventArgs e) { using (ProjectCommitDialog dlg = new ProjectCommitDialog()) { dlg.Context = e.Context; dlg.PreserveWindowPlacement = true; dlg.LoadChanges(GetChanges(e)); dlg.LogMessageText = logMessage ?? ""; DialogResult dr = dlg.ShowDialog(e.Context); logMessage = dlg.LogMessageText; if (dr == DialogResult.OK) { PendingChangeCommitArgs pca = new PendingChangeCommitArgs(); pca.StoreMessageOnError = true; // TODO: Commit it! List<PendingChange> toCommit = new List<PendingChange>(dlg.GetSelection()); dlg.FillArgs(pca); if (e.GetService<IPendingChangeHandler>().Commit(toCommit, pca)) { logMessage = null; } } } }
public override void OnExecute(CommandEventArgs e) { using (ProjectCommitDialog pcd = new ProjectCommitDialog()) { pcd.Context = e.Context; pcd.LogMessageText = storedLogMessage; pcd.AmendLastCommit = storedAmendCommit; pcd.PreserveWindowPlacement = true; pcd.LoadItems(e.Selection.GetSelectedGitItems(true)); DialogResult dr = pcd.ShowDialog(e.Context); storedLogMessage = pcd.LogMessageText; storedAmendCommit = pcd.AmendLastCommit; if (dr != DialogResult.OK) return; PendingChangeCommitArgs pca = new PendingChangeCommitArgs(); pca.StoreMessageOnError = true; // TODO: Commit it! List<PendingChange> toCommit = new List<PendingChange>(pcd.GetSelection()); pcd.FillArgs(pca); e.GetService<IPendingChangeHandler>().Commit(toCommit, pca); } // not in the finally, because we want to preserve the message for a // non-successful commit storedLogMessage = null; storedAmendCommit = false; }