summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorThien-Thi Nguyen <ttn@gnuvola.org>2007-11-24 13:46:30 +0000
committerThien-Thi Nguyen <ttn@gnuvola.org>2007-11-24 13:46:30 +0000
commitb16bd82da9f63eaba8129de859be24dac9957283 (patch)
tree6ec7875d7e37dcce18a317385c9a5e187e664423
parentbb78f3526155f0fd8551c1a6461e491133654777 (diff)
downloademacs-b16bd82da9f63eaba8129de859be24dac9957283.tar.gz
(vc-git-show-log-entry): New func.
-rw-r--r--lisp/ChangeLog4
-rw-r--r--lisp/vc-git.el15
2 files changed, 18 insertions, 1 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog
index 49a08c36ddf..79836fb9adc 100644
--- a/lisp/ChangeLog
+++ b/lisp/ChangeLog
@@ -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.
diff --git a/lisp/vc-git.el b/lisp/vc-git.el
index 07714b26c32..f891bac8bd1 100644
--- a/lisp/vc-git.el
+++ b/lisp/vc-git.el
@@ -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)