Commit ac9ff209 authored by André Spiegel's avatar André Spiegel
Browse files

Add new optional BUFFER argument to vc-BACKEND-print-log and

vc-BACKEND-diff.
(vc-print-log): If the print-log implementation supports it, use the
new BUFFER argument to direct output to *vc-change-log*, not *vc*.
(vc-version-diff, vc-diff-internal): Doc fixes.
parent 942269e7
...@@ -7,7 +7,7 @@ ...@@ -7,7 +7,7 @@
;; Maintainer: Andre Spiegel <spiegel@gnu.org> ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
;; Keywords: tools ;; Keywords: tools
;; $Id: vc.el,v 1.367 2004/02/08 22:42:42 uid65629 Exp $ ;; $Id: vc.el,v 1.368 2004/03/15 03:55:24 monnier Exp $
;; This file is part of GNU Emacs. ;; This file is part of GNU Emacs.
...@@ -264,9 +264,10 @@ ...@@ -264,9 +264,10 @@
;; ;;
;; HISTORY FUNCTIONS ;; HISTORY FUNCTIONS
;; ;;
;; * print-log (file) ;; * print-log (file &optional buffer)
;; ;;
;; Insert the revision log of FILE into the *vc* buffer. ;; Insert the revision log of FILE into BUFFER, or the *vc* buffer
;; if BUFFER is nil.
;; ;;
;; - show-log-entry (version) ;; - show-log-entry (version)
;; ;;
...@@ -301,17 +302,17 @@ ...@@ -301,17 +302,17 @@
;; default implementation runs rcs2log, which handles RCS- and ;; default implementation runs rcs2log, which handles RCS- and
;; CVS-style logs. ;; CVS-style logs.
;; ;;
;; * diff (file &optional rev1 rev2) ;; * diff (file &optional rev1 rev2 buffer)
;; ;;
;; Insert the diff for FILE into the *vc-diff* buffer. If REV1 and ;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if
;; REV2 are non-nil, report differences from REV1 to REV2. If REV1 ;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences
;; is nil, use the current workfile version (as found in the ;; from REV1 to REV2. If REV1 is nil, use the current workfile
;; repository) as the older version; if REV2 is nil, use the current ;; version (as found in the repository) as the older version; if
;; workfile contents as the newer version. This function should ;; REV2 is nil, use the current workfile contents as the newer
;; pass the value of (vc-switches BACKEND 'diff) to the backend ;; version. This function should pass the value of (vc-switches
;; command. It should return a status of either 0 (no differences ;; BACKEND 'diff) to the backend command. It should return a status
;; found), or 1 (either non-empty diff or the diff is run ;; of either 0 (no differences found), or 1 (either non-empty diff
;; asynchronously). ;; or the diff is run asynchronously).
;; ;;
;; - diff-tree (dir &optional rev1 rev2) ;; - diff-tree (dir &optional rev1 rev2)
;; ;;
...@@ -1727,7 +1728,9 @@ versions of all registered files in or below it." ...@@ -1727,7 +1728,9 @@ versions of all registered files in or below it."
'diff-tree dir rel1 rel2)) 'diff-tree dir rel1 rel2))
(vc-exec-after `(let ((inhibit-read-only t)) (vc-exec-after `(let ((inhibit-read-only t))
(insert "\nEnd of diffs.\n")))) (insert "\nEnd of diffs.\n"))))
;; single file diff ;; Single file diff. It is important that the vc-controlled buffer
;; is still current at this time, because any local settings in that
;; buffer should affect the diff command.
(vc-diff-internal file rel1 rel2)) (vc-diff-internal file rel1 rel2))
(set-buffer "*vc-diff*") (set-buffer "*vc-diff*")
(if (and (zerop (buffer-size)) (if (and (zerop (buffer-size))
...@@ -1752,8 +1755,8 @@ versions of all registered files in or below it." ...@@ -1752,8 +1755,8 @@ versions of all registered files in or below it."
(defun vc-diff-internal (file rel1 rel2) (defun vc-diff-internal (file rel1 rel2)
"Run diff to compare FILE's revisions REL1 and REL2. "Run diff to compare FILE's revisions REL1 and REL2.
Output goes to the current buffer, which is assumed properly set up. Diff output goes to the *vc-diff* buffer. The exit status of the diff
The exit status of the diff command is returned. command is returned.
This function takes care to set up a proper coding system for diff output. This function takes care to set up a proper coding system for diff output.
If both revisions are available as local files, then it also does not If both revisions are available as local files, then it also does not
...@@ -2322,14 +2325,26 @@ allowed and simply skipped)." ...@@ -2322,14 +2325,26 @@ allowed and simply skipped)."
;;;###autoload ;;;###autoload
(defun vc-print-log (&optional focus-rev) (defun vc-print-log (&optional focus-rev)
"List the change log of the current buffer in a window. If "List the change log of the current buffer in a window.
FOCUS-REV is non-nil, leave the point at that revision." If FOCUS-REV is non-nil, leave the point at that revision."
(interactive) (interactive)
(vc-ensure-vc-buffer) (vc-ensure-vc-buffer)
(let ((file buffer-file-name)) (let* ((file buffer-file-name)
(print-log-args-length
(length (cadr (symbol-function
(vc-find-backend-function (vc-backend file)
'print-log))))))
(or focus-rev (setq focus-rev (vc-workfile-version file))) (or focus-rev (setq focus-rev (vc-workfile-version file)))
(vc-call print-log file) ;; Don't switch to the output buffer before running the command,
(set-buffer "*vc*") ;; so that any buffer-local settings in the vc-controlled
;; buffer can be accessed by the command.
(if (> print-log-args-length 1)
(progn
(vc-call print-log file "*vc-change-log*")
(set-buffer "*vc-change-log*"))
;; for backward compatibility
(vc-call print-log file)
(set-buffer "*vc*"))
(pop-to-buffer (current-buffer)) (pop-to-buffer (current-buffer))
(log-view-mode) (log-view-mode)
(vc-exec-after (vc-exec-after
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment