emacs-elpa-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[elpa] externals/agitate c54fe94ac1 55/67: Add agitate-vc-git-prompt-for


From: ELPA Syncer
Subject: [elpa] externals/agitate c54fe94ac1 55/67: Add agitate-vc-git-prompt-format-patch-single cmd
Date: Wed, 28 Sep 2022 16:57:29 -0400 (EDT)

branch: externals/agitate
commit c54fe94ac19262c58fae1260c07b8f880785c03f
Author: Protesilaos Stavrou <info@protesilaos.com>
Commit: Protesilaos Stavrou <info@protesilaos.com>

    Add agitate-vc-git-prompt-format-patch-single cmd
---
 README.org | 13 +++++++++++++
 agitate.el | 18 ++++++++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/README.org b/README.org
index 17d9b61f30..26cf0e3eef 100644
--- a/README.org
+++ b/README.org
@@ -153,6 +153,19 @@ think most of those are superfluous.  Less is more.
   =git-show(1)= on it. With optional =CURRENT-FILE= as prefix
   argument, limit the commits to those pertaining to the current file.
 
+#+findex: agitate-vc-git-prompt-format-patch-single
++ ~agitate-vc-git-prompt-format-patch-single~ :: Format patch for a
+  single =COMMIT=.  Prompt for =COMMIT= using minibuffer completion.
+  Output the patch file to the return value of the function
+  ~vc-root-dir~.  Relevant except from the source code:
+
+  #+begin_src emacs-lisp
+  ;; TODO 2022-09-27: Handle the output directory better.  Though I am
+  ;; not sure how people work with those.  I normally use the root of
+  ;; the current repo (and then clean it) or put everything in the
+  ;; ~/Desktop or some dedicated "patches" directory.
+  #+end_src
+
 #+findex: agitate-vc-git-grep
 + ~agitate-vc-git-grep~ :: Run ~git-grep(1)~ for =REGEXP= in
   ~vc-root-dir~.  This is a simple wrapper around ~vc-git-grep~ to
diff --git a/agitate.el b/agitate.el
index d73dda4cfb..ca34d3170c 100644
--- a/agitate.el
+++ b/agitate.el
@@ -277,6 +277,24 @@ to those pertaining to the current file."
     (with-current-buffer (pop-to-buffer buf)
       (diff-mode))))
 
+;;;###autoload
+(defun agitate-vc-git-prompt-format-patch-single (commit)
+  "Format patch for a single COMMIT.
+Prompt for COMMIT using minibuffer completion.
+
+Output the patch file to the return value of the function
+`vc-root-dir'."
+  (interactive
+   (list (agitate--vc-git-get-hash-from-string 
(agitate--vc-git-commit-prompt))))
+  ;; TODO 2022-09-27: Handle the output directory better.  Though I am
+  ;; not sure how people work with those.  I normally use the root of
+  ;; the current repo (and then clean it) or put everything in the
+  ;; ~/Desktop or some dedicated "patches" directory.
+  (when-let* ((root (vc-root-dir))
+              (default-directory root))
+    (apply 'vc-git-command nil nil nil
+           (list "format-patch" "-1" commit "--"))))
+
 ;;;###autoload
 (defun agitate-vc-git-grep (regexp)
   "Run `git-grep(1)' for REGEXP in `vc-root-dir'.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]