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

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

[elpa] externals/agitate a9a8339126 46/67: Add PROOF OF CONCEPT vc-git-f


From: ELPA Syncer
Subject: [elpa] externals/agitate a9a8339126 46/67: Add PROOF OF CONCEPT vc-git-find-revision
Date: Wed, 28 Sep 2022 16:57:29 -0400 (EDT)

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

    Add PROOF OF CONCEPT vc-git-find-revision
---
 agitate.el | 17 +++++++++++++++++
 1 file changed, 17 insertions(+)

diff --git a/agitate.el b/agitate.el
index f4bdd0f4db..249efae604 100644
--- a/agitate.el
+++ b/agitate.el
@@ -279,6 +279,23 @@ With optional FILE, limit the commits to those pertinent 
to it."
        (process-lines vc-git-program "log" "--oneline" "--")
        nil t))))
 
+(defvar agitate-vc-git-show-buffer "*agitate-vc-git-show*"
+  "Buffer for showing a git commit.")
+
+;;;###autoload
+(defun vc-git-find-revision ()
+  "PROOF OF CONCEPT.
+
+Prompt for commit and visit it as a file."
+  (interactive)
+  (when-let* ((file (caadr (vc-deduce-fileset))) ; FIXME 2022-09-27: Better 
way to get current file?
+              (revision (agitate--vc-git-get-hash-from-string
+                         (agitate--vc-git-commit-prompt file)))
+              (buf "*agitate-vc-git-show*"))
+    (apply 'vc-git-command (get-buffer-create buf) nil file (list "show" 
revision))
+    (with-current-buffer (pop-to-buffer buf)
+      (diff-mode))))
+
 ;;;###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]