comparison lisp/vc-bzr.el @ 92938:89f7b102ea85

(vc-bzr-print-log): Insert a file marker. Run the log for each file in the list. (vc-bzr-log-view-mode): Recognize the file marker.
author Dan Nicolaescu <dann@ics.uci.edu>
date Fri, 14 Mar 2008 16:12:31 +0000
parents 62bd4693326e
children ba464718dbd7
comparison
equal deleted inserted replaced
92937:9b852833cd26 92938:89f7b102ea85
373 (defvar log-view-current-tag-function) 373 (defvar log-view-current-tag-function)
374 374
375 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" 375 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
376 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 376 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
377 (require 'add-log) 377 (require 'add-log)
378 ;; Don't have file markers, so use impossible regexp. 378 (set (make-local-variable 'log-view-file-re) "^Working file:[ \t]+\\(.+\\)")
379 (set (make-local-variable 'log-view-file-re) "\\'\\`")
380 (set (make-local-variable 'log-view-message-re) 379 (set (make-local-variable 'log-view-message-re)
381 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)") 380 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)")
382 (set (make-local-variable 'log-view-font-lock-keywords) 381 (set (make-local-variable 'log-view-font-lock-keywords)
383 ;; log-view-font-lock-keywords is careful to use the buffer-local 382 ;; log-view-font-lock-keywords is careful to use the buffer-local
384 ;; value of log-view-message-re only since Emacs-23. 383 ;; value of log-view-message-re only since Emacs-23.
390 (2 'change-log-email)) 389 (2 'change-log-email))
391 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) 390 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))
392 391
393 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22 392 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22
394 "Get bzr change log for FILES into specified BUFFER." 393 "Get bzr change log for FILES into specified BUFFER."
395 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so 394 ;; `vc-do-command' creates the buffer, but we need it before running
396 ;; the log display may not what the user wants - but I see no other 395 ;; the command.
397 ;; way of getting the above regexps working. 396 (vc-setup-buffer buffer)
398 (apply 'vc-bzr-command "log" buffer 0 files 397 ;; If the buffer exists from a previous invocation it might be
399 (if (stringp vc-bzr-log-switches) 398 ;; read-only.
400 (list vc-bzr-log-switches) 399 (let ((inhibit-read-only t))
401 vc-bzr-log-switches)) 400 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so
401 ;; the log display may not what the user wants - but I see no other
402 ;; way of getting the above regexps working.
403 (dolist (file files)
404 (with-current-buffer buffer
405 ;; Insert the file name so that log-view.el can find it.
406 (insert "Working file: " file "\n")) ;; Like RCS/CVS.
407 (apply 'vc-bzr-command "log" buffer 0 file
408 (if (stringp vc-bzr-log-switches)
409 (list vc-bzr-log-switches)
410 vc-bzr-log-switches))))
402 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for 411 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for
403 ;; the buffer, or at least set the regexps right. 412 ;; the buffer, or at least set the regexps right.
404 (unless (fboundp 'vc-default-log-view-mode) 413 (unless (fboundp 'vc-default-log-view-mode)
405 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) 414 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode)))
406 415