changeset 86397:38193bd1ab69

(vc-git-show-log-entry): New func.
author Thien-Thi Nguyen <ttn@gnuvola.org>
date Sat, 24 Nov 2007 13:44:51 +0000
parents 88a00b9cc363
children b569006b8fd3
files lisp/vc-git.el
diffstat 1 files changed, 14 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/lisp/vc-git.el	Sat Nov 24 03:29:25 2007 +0000
+++ b/lisp/vc-git.el	Sat Nov 24 13:44:51 2007 +0000
@@ -81,7 +81,7 @@
 ;; HISTORY FUNCTIONS
 ;; * print-log (files &optional buffer)		   OK
 ;; - log-view-mode ()				   OK
-;; - show-log-entry (revision)			   NOT NEEDED, DEFAULT IS GOOD
+;; - show-log-entry (revision)			   OK
 ;; - wash-log (file)				   COULD BE SUPPORTED
 ;; - logentry-check ()				   NOT NEEDED
 ;; - comment-history (file)			   ??
@@ -312,6 +312,19 @@
 	   ("^Date:   \\(.+\\)" (1 'change-log-date))
 	   ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))
 
+(defun vc-git-show-log-entry (revision)
+  "Move to the log entry for REVISION.
+REVISION may have the form BRANCH, BRANCH~N,
+or BRANCH^ (where \"^\" can be repeated)."
+  (goto-char (point-min))
+  (search-forward "\ncommit" nil t
+                  (cond ((string-match "~\\([0-9]\\)$" revision)
+                         (1+ (string-to-number (match-string 1 revision))))
+                        ((string-match "\\^+$" revision)
+                         (1+ (length (match-string 0 revision))))
+                        (t nil)))
+  (beginning-of-line))
+
 (defun vc-git-diff (files &optional rev1 rev2 buffer)
   (let ((buf (or buffer "*vc-diff*")))
     (if (and rev1 rev2)