comparison lisp/vc-bzr.el @ 80343:3c75e19e7ec9

(vc-bzr-print-log): Insert a file marker. Run the log command for each file in the list. (vc-bzr-log-view-mode): Recognize the file marker. (vc-bzr-show-log-entry): Make regexp match more cases.
author Dan Nicolaescu <dann@ics.uci.edu>
date Wed, 19 Mar 2008 03:49:09 +0000
parents 756c7bbc9664
children a88ae58b9053
comparison
equal deleted inserted replaced
80342:b7bed0a77336 80343:3c75e19e7ec9
352 (defvar log-view-current-tag-function) 352 (defvar log-view-current-tag-function)
353 353
354 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View" 354 (define-derived-mode vc-bzr-log-view-mode log-view-mode "Bzr-Log-View"
355 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack. 355 (remove-hook 'log-view-mode-hook 'vc-bzr-log-view-mode) ;Deactivate the hack.
356 (require 'add-log) 356 (require 'add-log)
357 ;; Don't have file markers, so use impossible regexp. 357 (set (make-local-variable 'log-view-file-re) "^Working file:[ \t]+\\(.+\\)")
358 (set (make-local-variable 'log-view-file-re) "\\'\\`")
359 (set (make-local-variable 'log-view-message-re) 358 (set (make-local-variable 'log-view-message-re)
360 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)") 359 "^ *-+\n *\\(?:revno: \\([0-9.]+\\)\\|merged: .+\\)")
361 (set (make-local-variable 'log-view-font-lock-keywords) 360 (set (make-local-variable 'log-view-font-lock-keywords)
362 ;; log-view-font-lock-keywords is careful to use the buffer-local 361 ;; log-view-font-lock-keywords is careful to use the buffer-local
363 ;; value of log-view-message-re only since Emacs-23. 362 ;; value of log-view-message-re only since Emacs-23.
369 (2 'change-log-email)) 368 (2 'change-log-email))
370 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))) 369 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))
371 370
372 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22 371 (defun vc-bzr-print-log (files &optional buffer) ; get buffer arg in Emacs 22
373 "Get bzr change log for FILES into specified BUFFER." 372 "Get bzr change log for FILES into specified BUFFER."
374 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so 373 ;; `vc-do-command' creates the buffer, but we need it before running
375 ;; the log display may not what the user wants - but I see no other 374 ;; the command.
376 ;; way of getting the above regexps working. 375 (vc-setup-buffer buffer)
377 (apply 'vc-bzr-command "log" buffer 0 files 376 ;; If the buffer exists from a previous invocation it might be
378 (if (stringp vc-bzr-log-switches) 377 ;; read-only.
379 (list vc-bzr-log-switches) 378 (let ((inhibit-read-only t))
380 vc-bzr-log-switches)) 379 ;; FIXME: `vc-bzr-command' runs `bzr log' with `LC_MESSAGES=C', so
380 ;; the log display may not what the user wants - but I see no other
381 ;; way of getting the above regexps working.
382 ;; "bzr log" (as of bzr-1.1) can only take a single file argument.
383 ;; Loop through the file list.
384 (dolist (file files)
385 (with-current-buffer buffer
386 ;; Insert the file name so that log-view.el can find it.
387 (insert "Working file: " file "\n")) ;; Like RCS/CVS.
388 (apply 'vc-bzr-command "log" buffer 0 file
389 (if (stringp vc-bzr-log-switches)
390 (list vc-bzr-log-switches)
391 vc-bzr-log-switches))))
381 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for 392 ;; FIXME: Until Emacs-23, VC was missing a hook to sort out the mode for
382 ;; the buffer, or at least set the regexps right. 393 ;; the buffer, or at least set the regexps right.
383 (unless (fboundp 'vc-default-log-view-mode) 394 (unless (fboundp 'vc-default-log-view-mode)
384 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode))) 395 (add-hook 'log-view-mode-hook 'vc-bzr-log-view-mode)))
385 396
386 (defun vc-bzr-show-log-entry (version) 397 (defun vc-bzr-show-log-entry (version)
387 "Find entry for patch name VERSION in bzr change log buffer." 398 "Find entry for patch name VERSION in bzr change log buffer."
388 (goto-char (point-min)) 399 (goto-char (point-min))
389 (let (case-fold-search) 400 (let (case-fold-search)
390 (if (re-search-forward (concat "^-+\nrevno: " version "$") nil t) 401 (if (re-search-forward
402 ;; "revno:" can appear either at the beginning of a line, or indented.
403 (concat "^[ ]*-+\n[ ]*revno: "
404 ;; The revision can contain ".", quote it so that it
405 ;; does not interfere with regexp matching.
406 (regexp-quote revision) "$") nil t)
391 (beginning-of-line 0) 407 (beginning-of-line 0)
392 (goto-char (point-min))))) 408 (goto-char (point-min)))))
393 409
394 (autoload 'vc-diff-switches-list "vc" nil nil t) 410 (autoload 'vc-diff-switches-list "vc" nil nil t)
395 411