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

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

[elpa] externals/agitate 8459e26050 45/67: Add helper prompt for commit


From: ELPA Syncer
Subject: [elpa] externals/agitate 8459e26050 45/67: Add helper prompt for commit log completion
Date: Wed, 28 Sep 2022 16:57:29 -0400 (EDT)

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

    Add helper prompt for commit log completion
---
 agitate.el | 14 ++++++++++++++
 1 file changed, 14 insertions(+)

diff --git a/agitate.el b/agitate.el
index 9ca24f4b5d..f4bdd0f4db 100644
--- a/agitate.el
+++ b/agitate.el
@@ -265,6 +265,20 @@ to the text at point."
   (when (string-match "\\b\\([0-9a-z]+\\) " string)
     (match-string 1 string)))
 
+(defun agitate--vc-git-commit-prompt (&optional file)
+  "Prompt for Git commit and return it as a string.
+With optional FILE, limit the commits to those pertinent to it."
+  (let ((default-directory (vc-root-dir)))
+    (if file
+        (completing-read
+         (format "Select revision of `%s': " file)
+         (process-lines vc-git-program "log" "--oneline" file)
+         nil t)
+      (completing-read
+       "Select revision: "
+       (process-lines vc-git-program "log" "--oneline" "--")
+       nil t))))
+
 ;;;###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]