diff options
author | Dan Nicolaescu <dann@ics.uci.edu> | 2009-09-14 04:38:49 +0000 |
---|---|---|
committer | Dan Nicolaescu <dann@ics.uci.edu> | 2009-09-14 04:38:49 +0000 |
commit | 32ba3abcc148f356994a77b72052cca9da85ee4b (patch) | |
tree | 80b02f751f602b61e02e0ad58bb32a4e149639b6 /lisp/vc-git.el | |
parent | 31cd2dd4e14916714a5178b57dfda171a219cc93 (diff) | |
download | emacs-32ba3abcc148f356994a77b72052cca9da85ee4b.tar.gz emacs-32ba3abcc148f356994a77b72052cca9da85ee4b.tar.bz2 emacs-32ba3abcc148f356994a77b72052cca9da85ee4b.zip |
* vc.el (top): print-log method now takes an optional SHORTLOG
argument. Add a new method: root.
* vc-hooks.el (vc-prefix-map, vc-menu-map): Add bindings for
vc-print-root-log and vc-print-root-diff.
* vc-bzr.el (vc-bzr-log-view-mode, vc-bzr-print-log):
* vc-git.el (vc-git-print-log, vc-git-log-view-mode):
* vc-hg.el (vc-hg-print-log, vc-hg-log-view-mode): Add support for
short logs.
* vc-cvs.el (vc-cvs-print-log):
* vc-mtn.el (vc-mtn-print-log):
* vc-rcs.el (vc-rcs-print-log):
* vc-sccs.el (vc-sccs-print-log):
* vc-svn.el (vc-svn-print-log): Add an optional argument shortlog
that is ignored for now.
Diffstat (limited to 'lisp/vc-git.el')
-rw-r--r-- | lisp/vc-git.el | 31 |
1 files changed, 24 insertions, 7 deletions
diff --git a/lisp/vc-git.el b/lisp/vc-git.el index d4b65127c3c..5230d54216e 100644 --- a/lisp/vc-git.el +++ b/lisp/vc-git.el @@ -471,7 +471,7 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." ;;; HISTORY FUNCTIONS -(defun vc-git-print-log (files &optional buffer) +(defun vc-git-print-log (files &optional buffer shortlog) "Get change log associated with FILES." (let ((coding-system-for-read git-commits-coding-system) ;; Support both the old print-log interface that passes a @@ -485,22 +485,38 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (let ((inhibit-read-only t)) (with-current-buffer buffer + (if shortlog (vc-git-command buffer 'async files - "rev-list" "--pretty" "HEAD" "--"))))) + "log" ;; "--graph" + "--date=short" "--pretty=format:%h %ad %s" "--abbrev-commit" + "--") + (vc-git-command buffer 'async files + "rev-list" ;; "--graph" + "--pretty" "HEAD" "--")))))) (defvar log-view-message-re) (defvar log-view-file-re) (defvar log-view-font-lock-keywords) (defvar log-view-per-file-logs) +;; Dynamically bound. +(defvar vc-short-log) + (define-derived-mode vc-git-log-view-mode log-view-mode "Git-Log-View" (require 'add-log) ;; we need the faces add-log ;; Don't have file markers, so use impossible regexp. (set (make-local-variable 'log-view-file-re) "\\`a\\`") (set (make-local-variable 'log-view-per-file-logs) nil) (set (make-local-variable 'log-view-message-re) - "^commit *\\([0-9a-z]+\\)") + (if vc-short-log + "^\\(?:[*/\\| ]+ \\)?\\([0-9a-z]+\\) \\([-a-z0-9]+\\) \\(.*\\)" + "^[ */\\|]+commit *\\([0-9a-z]+\\)")) (set (make-local-variable 'log-view-font-lock-keywords) + (if vc-short-log + (append + `((,log-view-message-re + (1 'change-log-acknowledgement) + (2 'change-log-date)))) (append `((,log-view-message-re (1 'change-log-acknowledgement))) ;; Handle the case: @@ -521,7 +537,8 @@ If nil, use the value of `vc-diff-switches'. If t, use no switches." (1 'change-log-acknowledgement) (2 'change-log-acknowledgement)) ("^Date: \\(.+\\)" (1 'change-log-date)) - ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) + ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message))))))) + (defun vc-git-show-log-entry (revision) "Move to the log entry for REVISION. @@ -678,6 +695,9 @@ or BRANCH^ (where \"^\" can be repeated)." (defun vc-git-extra-status-menu () vc-git-extra-menu-map) +(defun vc-git-root (file) + (vc-find-root file ".git")) + (defun vc-git-toggle-signoff () (interactive) (setq vc-git-add-signoff (not vc-git-add-signoff))) @@ -763,9 +783,6 @@ This command shares argument histories with \\[rgrep] and \\[grep]." ;;; Internal commands -(defun vc-git-root (file) - (vc-find-root file ".git")) - (defun vc-git-command (buffer okstatus file-or-list &rest flags) "A wrapper around `vc-do-command' for use in vc-git.el. The difference to vc-do-command is that this function always invokes `git'." |