branch: externals/agitate commit 69e8f87214bdc907bcdf28b2afa01d3792050156 Author: Protesilaos Stavrou <i...@protesilaos.com> Commit: Protesilaos Stavrou <i...@protesilaos.com>
Add agitate-vc-git-push --- agitate.el | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/agitate.el b/agitate.el index bb68c6cbf9..59c79d29cf 100644 --- a/agitate.el +++ b/agitate.el @@ -32,6 +32,7 @@ ;;; Code: (require 'log-edit) +(require 'vc-git) (defgroup agitate () "Work-in-progress." @@ -62,5 +63,19 @@ file extension. Else omit it." (interactive "P" log-edit-mode) (insert (format "%s: " (agitate--log-edit-extract-file with-file-extension)))) +;;;; Commands for vc-git (Git backend for the Version Control framework) + +(defun agitate--vc-git-prompt-remote () + "Helper prompt for `agitate-git-push'." + (when-let ((remotes (process-lines vc-git-program "remote"))) + (if (length> remotes 1) + (completing-read "Select Git remote: " remotes nil t) + (car remotes)))) + +;;;###autoload +(defun agitate-vc-git-push (prompt) + "Substitute for `vc-git-push' with the same meaning for PROMPT." + (vc-git--pushpull "push" prompt (unless prompt `(,(agitate--vc-git-prompt-remote))))) + (provide 'agitate) ;;; agitate.el ends here