comparison lisp/vc-bzr.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 7c3b132bf9bb
children 136cf2d23c90
comparison
equal deleted inserted replaced
105009:b520d55cdd72 105010:b3c2589ed19e
451 (defvar log-view-message-re) 451 (defvar log-view-message-re)
452 (defvar log-view-file-re) 452 (defvar log-view-file-re)
453 (defvar log-view-font-lock-keywords) 453 (defvar log-view-font-lock-keywords)
454 (defvar log-view-current-tag-function) 454 (defvar log-view-current-tag-function)
455 (defvar log-view-per-file-logs) 455 (defvar log-view-per-file-logs)
456 (defvar vc-short-log)
456 457
457 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" 458 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
458 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 459 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
459 (require 'add-log) 460 (require 'add-log)
460 (set (make-local-variable 'log-view-per-file-logs) nil) 461 (set (make-local-variable 'log-view-per-file-logs) nil)
461 (set (make-local-variable 'log-view-file-re) "\\`a\\`") 462 (set (make-local-variable 'log-view-file-re) "\\`a\\`")
462 (set (make-local-variable 'log-view-message-re) 463 (set (make-local-variable 'log-view-message-re)
463 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)") 464 (if vc-short-log
465 "^ +\\([0-9]+\\) \\(.*?\\)[ \t]+\\([0-9]\\{4\\}-[0-9]\\{2\\}-[0-9]\\{2\\}\\)\\( \\[merge\\]\\)?"
466 "^ *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)"))
464 (set (make-local-variable 'log-view-font-lock-keywords) 467 (set (make-local-variable 'log-view-font-lock-keywords)
465 ;; log-view-font-lock-keywords is careful to use the buffer-local 468 ;; log-view-font-lock-keywords is careful to use the buffer-local
466 ;; value of log-view-message-re only since Emacs-23. 469 ;; value of log-view-message-re only since Emacs-23.
467 (append `((,log-view-message-re . 'log-view-message-face)) 470 (if vc-short-log
468 ;; log-view-font-lock-keywords 471 (append `((,log-view-message-re
469 '(("^ *committer: \ 472 (1 'log-view-message-face)
473 (2 'change-log-name)
474 (3 'change-log-date)
475 (4 'change-log-list))))
476 (append `((,log-view-message-re . 'log-view-message-face))
477 ;; log-view-font-lock-keywords
478 '(("^ *committer: \
470 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" 479 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]"
471 (1 'change-log-name) 480 (1 'change-log-name)
472 (2 'change-log-email)) 481 (2 'change-log-email))
473 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) 482 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))))
474 483
475 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22 484 (defun vc-bzr-print-log (files &optional buffer shortlog) ; get buffer arg in Emacs 22
476 "Get bzr change log for FILES into specified BUFFER." 485 "Get bzr change log for FILES into specified BUFFER."
477 ;; `vc-do-command' creates the buffer, but we need it before running 486 ;; `vc-do-command' creates the buffer, but we need it before running
478 ;; the command. 487 ;; the command.
479 (vc-setup-buffer buffer) 488 (vc-setup-buffer buffer)
480 ;; If the buffer exists from a previous invocation it might be 489 ;; If the buffer exists from a previous invocation it might be
482 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so 491 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so
483 ;; the log display may not what the user wants - but I see no other 492 ;; the log display may not what the user wants - but I see no other
484 ;; way of getting the above regexps working. 493 ;; way of getting the above regexps working.
485 (with-current-buffer buffer 494 (with-current-buffer buffer
486 (apply 'vc-bzr-command "log" buffer 'async files 495 (apply 'vc-bzr-command "log" buffer 'async files
496 (if shortlog "--short")
487 (if (stringp vc-bzr-log-switches) 497 (if (stringp vc-bzr-log-switches)
488 (list vc-bzr-log-switches) 498 (list vc-bzr-log-switches)
489 vc-bzr-log-switches)))) 499 vc-bzr-log-switches))))
490 500
491 (defun vc-bzr-show-log-entry (revision) 501 (defun vc-bzr-show-log-entry (revision)