comparison lisp/vc-hg.el @ 105010:b3c2589ed19e

* 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.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 14 Sep 2009 04:38:49 +0000
parents 0c5de07aff62
children 767b63857edd
comparison
equal deleted inserted replaced
105009:b520d55cdd72 105010:b3c2589ed19e
66 ;; - rollback (files) ?? PROBABLY NOT NEEDED 66 ;; - rollback (files) ?? PROBABLY NOT NEEDED
67 ;; - merge (file rev1 rev2) NEEDED 67 ;; - merge (file rev1 rev2) NEEDED
68 ;; - merge-news (file) NEEDED 68 ;; - merge-news (file) NEEDED
69 ;; - steal-lock (file &optional revision) NOT NEEDED 69 ;; - steal-lock (file &optional revision) NOT NEEDED
70 ;; HISTORY FUNCTIONS 70 ;; HISTORY FUNCTIONS
71 ;; * print-log (files &optional buffer) OK 71 ;; * print-log (files &optional buffer shortlog)OK
72 ;; - log-view-mode () OK 72 ;; - log-view-mode () OK
73 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD 73 ;; - show-log-entry (revision) NOT NEEDED, DEFAULT IS GOOD
74 ;; - comment-history (file) NOT NEEDED 74 ;; - comment-history (file) NOT NEEDED
75 ;; - update-changelog (files) NOT NEEDED 75 ;; - update-changelog (files) NOT NEEDED
76 ;; * diff (files &optional rev1 rev2 buffer) OK 76 ;; * diff (files &optional rev1 rev2 buffer) OK
215 :type '(choice (const :tag "None" nil) 215 :type '(choice (const :tag "None" nil)
216 (string :tag "Argument String") 216 (string :tag "Argument String")
217 (repeat :tag "Argument List" :value ("") string)) 217 (repeat :tag "Argument List" :value ("") string))
218 :group 'vc-hg) 218 :group 'vc-hg)
219 219
220 (defun vc-hg-print-log (files &optional buffer) 220 (defun vc-hg-print-log (files &optional buffer shortlog)
221 "Get change log associated with FILES." 221 "Get change log associated with FILES."
222 ;; `log-view-mode' needs to have the file names in order to function 222 ;; `log-view-mode' needs to have the file names in order to function
223 ;; correctly. "hg log" does not print it, so we insert it here by 223 ;; correctly. "hg log" does not print it, so we insert it here by
224 ;; hand. 224 ;; hand.
225 225
229 ;; If the buffer exists from a previous invocation it might be 229 ;; If the buffer exists from a previous invocation it might be
230 ;; read-only. 230 ;; read-only.
231 (let ((inhibit-read-only t)) 231 (let ((inhibit-read-only t))
232 (with-current-buffer 232 (with-current-buffer
233 buffer 233 buffer
234 (apply 'vc-hg-command buffer 0 files "log" vc-hg-log-switches)))) 234 (apply 'vc-hg-command buffer 0 files "log"
235 (if shortlog '("--style" "compact"))
236 vc-hg-log-switches))))
235 237
236 (defvar log-view-message-re) 238 (defvar log-view-message-re)
237 (defvar log-view-file-re) 239 (defvar log-view-file-re)
238 (defvar log-view-font-lock-keywords) 240 (defvar log-view-font-lock-keywords)
239 (defvar log-view-per-file-logs) 241 (defvar log-view-per-file-logs)
242 (defvar vc-short-log)
240 243
241 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View" 244 (define-derived-mode vc-hg-log-view-mode log-view-mode "Hg-Log-View"
242 (require 'add-log) ;; we need the add-log faces 245 (require 'add-log) ;; we need the add-log faces
243 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 246 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
244 (set (make-local-variable 'log-view-per-file-logs) nil) 247 (set (make-local-variable 'log-view-per-file-logs) nil)
245 (set (make-local-variable 'log-view-message-re) 248 (set (make-local-variable 'log-view-message-re)
246 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)") 249 (if vc-short-log
250 "^\\([0-9]+\\)\\(?:\\[.*\\]\\)? +\\([0-9a-z]\\{12\\}\\) +\\(\\(?:[0-9]+\\)-\\(?:[0-9]+\\)-\\(?:[0-9]+\\) \\(?:[0-9]+\\):\\(?:[0-9]+\\) \\(?:[-+0-9]+\\)\\) +\\(.*\\)$"
251 "^changeset:[ \t]*\\([0-9]+\\):\\(.+\\)"))
247 (set (make-local-variable 'log-view-font-lock-keywords) 252 (set (make-local-variable 'log-view-font-lock-keywords)
253 (if vc-short-log
254 (append `((,log-view-message-re
255 (1 'log-view-message-face)
256 (2 'log-view-message-face)
257 (3 'change-log-date)
258 (4 'change-log-name))))
248 (append 259 (append
249 log-view-font-lock-keywords 260 log-view-font-lock-keywords
250 '( 261 '(
251 ;; Handle the case: 262 ;; Handle the case:
252 ;; user: FirstName LastName <foo@bar> 263 ;; user: FirstName LastName <foo@bar>
258 ;; and 269 ;; and
259 ;; user: foo 270 ;; user: foo
260 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)" 271 ("^user:[ \t]+\\([A-Za-z0-9_.+-]+\\(?:@[A-Za-z0-9_.-]+\\)?\\)"
261 (1 'change-log-email)) 272 (1 'change-log-email))
262 ("^date: \\(.+\\)" (1 'change-log-date)) 273 ("^date: \\(.+\\)" (1 'change-log-date))
263 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))) 274 ("^summary:[ \t]+\\(.+\\)" (1 'log-view-message)))))))
264 275
265 (defun vc-hg-diff (files &optional oldvers newvers buffer) 276 (defun vc-hg-diff (files &optional oldvers newvers buffer)
266 "Get a difference report using hg between two revisions of FILES." 277 "Get a difference report using hg between two revisions of FILES."
267 (let* ((firstfile (car files)) 278 (let* ((firstfile (car files))
268 (cwd (if firstfile (file-name-directory firstfile) 279 (cwd (if firstfile (file-name-directory firstfile)