comparison lisp/vc-bzr.el @ 106472:6e0f1038bc44

Support showing a single log entry from vc-annotate. * vc.el (print-log): Add a new argument: START-REVISION. (vc-print-log-internal): Add a new optional argument and pass it to the backend. (vc-print-log, vc-print-root-log): Adjust callers. * vc-annotate.el (vc-annotate-show-log-revision-at-line): If a buffer already displays the requested log entry, use it. Otherwise display only the log entry in question. * vc-svn.el (vc-svn-print-log): * vc-mtn.el (log-view-file-re): * vc-hg.el (vc-hg-state): * vc-git.el (vc-git-print-log): Add support for new argument START-REVISION. (vc-git-show-log-entry): Return t on success. * vc-bzr.el (vc-bzr-print-log): Add support new argument START-REVISION. (vc-bzr-show-log-entry): Return t on success. * vc-rcs.el (vc-rcs-print-log): * vc-sccs.el (vc-sccs-print-log): * vc-cvs.el (vc-cvs-print-log): Add new argument, ignore it.
author Dan Nicolaescu <dann@ics.uci.edu>
date Mon, 07 Dec 2009 09:02:11 +0000
parents 5b7b3cac58c5
children 97d377672952
comparison
equal deleted inserted replaced
106471:9fe246ccb486 106472:6e0f1038bc44
479 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]" 479 \\([^<(]+?\\)[ ]*[(<]\\([[:alnum:]_.+-]+@[[:alnum:]_.-]+\\)[>)]"
480 (1 'change-log-name) 480 (1 'change-log-name)
481 (2 'change-log-email)) 481 (2 'change-log-email))
482 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face))))))) 482 ("^ *timestamp: \\(.*\\)" (1 'change-log-date-face)))))))
483 483
484 (defun vc-bzr-print-log (files buffer &optional shortlog limit) 484 (defun vc-bzr-print-log (files buffer &optional shortlog start-revision limit)
485 "Get bzr change log for FILES into specified BUFFER." 485 "Get bzr change log for FILES into specified BUFFER."
486 ;; `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
487 ;; the command. 487 ;; the command.
488 (vc-setup-buffer buffer) 488 (vc-setup-buffer buffer)
489 ;; If the buffer exists from a previous invocation it might be 489 ;; If the buffer exists from a previous invocation it might be
493 ;; way of getting the above regexps working. 493 ;; way of getting the above regexps working.
494 (with-current-buffer buffer 494 (with-current-buffer buffer
495 (apply 'vc-bzr-command "log" buffer 'async files 495 (apply 'vc-bzr-command "log" buffer 'async files
496 (append 496 (append
497 (when shortlog '("--short")) 497 (when shortlog '("--short"))
498 (when start-revision (list (format "-r..%s" start-revision)))
498 (when limit (list "-l" (format "%s" limit))) 499 (when limit (list "-l" (format "%s" limit)))
499 (if (stringp vc-bzr-log-switches) 500 (if (stringp vc-bzr-log-switches)
500 (list vc-bzr-log-switches) 501 (list vc-bzr-log-switches)
501 vc-bzr-log-switches))))) 502 vc-bzr-log-switches)))))
502 503
503 (defun vc-bzr-show-log-entry (revision) 504 (defun vc-bzr-show-log-entry (revision)
504 "Find entry for patch name REVISION in bzr change log buffer." 505 "Find entry for patch name REVISION in bzr change log buffer."
505 (goto-char (point-min)) 506 (goto-char (point-min))
506 (when revision 507 (when revision
507 (let (case-fold-search) 508 (let (case-fold-search
509 found)
508 (if (re-search-forward 510 (if (re-search-forward
509 ;; "revno:" can appear either at the beginning of a line, 511 ;; "revno:" can appear either at the beginning of a line,
510 ;; or indented. 512 ;; or indented.
511 (concat "^[ ]*-+\n[ ]*revno: " 513 (concat "^[ ]*-+\n[ ]*revno: "
512 ;; The revision can contain ".", quote it so that it 514 ;; The revision can contain ".", quote it so that it
513 ;; does not interfere with regexp matching. 515 ;; does not interfere with regexp matching.
514 (regexp-quote revision) "$") nil t) 516 (regexp-quote revision) "$") nil t)
515 (beginning-of-line 0) 517 (progn
516 (goto-char (point-min)))))) 518 (beginning-of-line 0)
519 (setq found t))
520 (goto-char (point-min)))
521 found)))
517 522
518 (defun vc-bzr-diff (files &optional rev1 rev2 buffer) 523 (defun vc-bzr-diff (files &optional rev1 rev2 buffer)
519 "VC bzr backend for diff." 524 "VC bzr backend for diff."
520 ;; `bzr diff' exits with code 1 if diff is non-empty. 525 ;; `bzr diff' exits with code 1 if diff is non-empty.
521 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files 526 (apply #'vc-bzr-command "diff" (or buffer "*vc-diff*") 'async files