]> git.eshelyaron.com Git - emacs.git/commitdiff
(vc-git-show-log-entry): New func.
authorThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 24 Nov 2007 13:46:30 +0000 (13:46 +0000)
committerThien-Thi Nguyen <ttn@gnuvola.org>
Sat, 24 Nov 2007 13:46:30 +0000 (13:46 +0000)
lisp/ChangeLog
lisp/vc-git.el

index 49a08c36ddf1af05aed122c95bd5b7f602d4b218..79836fb9adc8a2c281796457575123ef171b91b5 100644 (file)
@@ -1,3 +1,7 @@
+2007-11-24  Thien-Thi Nguyen  <ttn@gnuvola.org>
+
+       * vc-git.el (vc-git-show-log-entry): New func.
+
 2007-11-24  Glenn Morris  <rgm@gnu.org>
 
        * emacs-lisp/byte-run.el (declare-function): Doc fix.
index 07714b26c32b7e10d4bd3a8cc51698cb0a337965..f891bac8bd132b79dcb166f943e25087812ed9ec 100644 (file)
@@ -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)                       ??
           ("^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)