comparison lisp/vc/vc-annotate.el @ 109431:799b50142743

Merge from mainline.
author Katsumi Yamaoka <yamaoka@jpl.org>
date Sun, 11 Jul 2010 22:57:47 +0000
parents ff42e5c5f789 60516122d066
children 1b626601d32d
comparison
equal deleted inserted replaced
109430:0b8608a36b55 109431:799b50142743
313 (vc-annotate-oldest-in-map vc-annotate-color-map)))) 313 (vc-annotate-oldest-in-map vc-annotate-color-map))))
314 (t (error "No such display mode: %s" 314 (t (error "No such display mode: %s"
315 vc-annotate-display-mode)))) 315 vc-annotate-display-mode))))
316 316
317 ;;;###autoload 317 ;;;###autoload
318 (defun vc-annotate (file rev &optional display-mode buf move-point-to) 318 (defun vc-annotate (file rev &optional display-mode buf move-point-to vc-bk)
319 "Display the edit history of the current FILE using colors. 319 "Display the edit history of the current FILE using colors.
320 320
321 This command creates a buffer that shows, for each line of the current 321 This command creates a buffer that shows, for each line of the current
322 file, when it was last edited and by whom. Additionally, colors are 322 file, when it was last edited and by whom. Additionally, colors are
323 used to show the age of each line--blue means oldest, red means 323 used to show the age of each line--blue means oldest, red means
333 should cover. For example, a time span of 20 days means that changes 333 should cover. For example, a time span of 20 days means that changes
334 over the past 20 days are shown in red to blue, according to their 334 over the past 20 days are shown in red to blue, according to their
335 age, and everything that is older than that is shown in blue. 335 age, and everything that is older than that is shown in blue.
336 336
337 If MOVE-POINT-TO is given, move the point to that line. 337 If MOVE-POINT-TO is given, move the point to that line.
338
339 If VC-BK is given used that VC backend.
338 340
339 Customization variables: 341 Customization variables:
340 342
341 `vc-annotate-menu-elements' customizes the menu elements of the 343 `vc-annotate-menu-elements' customizes the menu elements of the
342 mode-specific menu. `vc-annotate-color-map' and 344 mode-specific menu. `vc-annotate-color-map' and
374 (when buf (with-current-buffer buf 376 (when buf (with-current-buffer buf
375 (rename-buffer temp-buffer-name t) 377 (rename-buffer temp-buffer-name t)
376 ;; In case it had to be uniquified. 378 ;; In case it had to be uniquified.
377 (setq temp-buffer-name (buffer-name)))) 379 (setq temp-buffer-name (buffer-name))))
378 (with-output-to-temp-buffer temp-buffer-name 380 (with-output-to-temp-buffer temp-buffer-name
379 (let ((backend (vc-backend file)) 381 (let ((backend (or vc-bk (vc-backend file)))
380 (coding-system-for-read buffer-file-coding-system)) 382 (coding-system-for-read buffer-file-coding-system))
381 (vc-call-backend backend 'annotate-command file 383 (vc-call-backend backend 'annotate-command file
382 (get-buffer temp-buffer-name) rev) 384 (get-buffer temp-buffer-name) rev)
383 ;; we must setup the mode first, and then set our local 385 ;; we must setup the mode first, and then set our local
384 ;; variables before the show-function is called at the exit of 386 ;; variables before the show-function is called at the exit of
460 (message "Cannot be invoked outside of a vc annotate buffer") 462 (message "Cannot be invoked outside of a vc annotate buffer")
461 (let ((rev-at-line (vc-annotate-extract-revision-at-line))) 463 (let ((rev-at-line (vc-annotate-extract-revision-at-line)))
462 (if (not rev-at-line) 464 (if (not rev-at-line)
463 (message "Cannot extract revision number from the current line") 465 (message "Cannot extract revision number from the current line")
464 (switch-to-buffer-other-window 466 (switch-to-buffer-other-window
465 (vc-find-revision (cdr rev-at-line) (car rev-at-line))))))) 467 (vc-find-revision (cdr rev-at-line) (car rev-at-line) vc-annotate-backend))))))
466 468
467 (defun vc-annotate-revision-previous-to-line () 469 (defun vc-annotate-revision-previous-to-line ()
468 "Visit the annotation of the revision before the revision at line." 470 "Visit the annotation of the revision before the revision at line."
469 (interactive) 471 (interactive)
470 (if (not (equal major-mode 'vc-annotate-mode)) 472 (if (not (equal major-mode 'vc-annotate-mode))
525 (fname (cdr rev-at-line))) 527 (fname (cdr rev-at-line)))
526 (if (not rev-at-line) 528 (if (not rev-at-line)
527 (message "Cannot extract revision number from the current line") 529 (message "Cannot extract revision number from the current line")
528 (setq prev-rev 530 (setq prev-rev
529 (vc-call-backend vc-annotate-backend 'previous-revision 531 (vc-call-backend vc-annotate-backend 'previous-revision
530 fname rev)) 532 (if filediff fname nil) rev))
531 (if (not prev-rev) 533 (if (not prev-rev)
532 (message "Cannot diff from any revision prior to %s" rev) 534 (message "Cannot diff from any revision prior to %s" rev)
533 (save-window-excursion 535 (save-window-excursion
534 (vc-diff-internal 536 (vc-diff-internal
535 nil 537 nil
595 buf 597 buf
596 ;; Pass the current line so that vc-annotate will 598 ;; Pass the current line so that vc-annotate will
597 ;; place the point in the line. 599 ;; place the point in the line.
598 (min oldline (progn (goto-char (point-max)) 600 (min oldline (progn (goto-char (point-max))
599 (forward-line -1) 601 (forward-line -1)
600 (line-number-at-pos)))))))) 602 (line-number-at-pos)))
603 vc-annotate-backend)))))
601 604
602 (defun vc-annotate-compcar (threshold a-list) 605 (defun vc-annotate-compcar (threshold a-list)
603 "Test successive cons cells of A-LIST against THRESHOLD. 606 "Test successive cons cells of A-LIST against THRESHOLD.
604 Return the first cons cell with a car that is not less than THRESHOLD, 607 Return the first cons cell with a car that is not less than THRESHOLD,
605 nil if no such cell exists." 608 nil if no such cell exists."