diff options
| -rw-r--r-- | lisp/vc.el | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/lisp/vc.el b/lisp/vc.el index b6953b157a4..943dba229b6 100644 --- a/lisp/vc.el +++ b/lisp/vc.el | |||
| @@ -7,7 +7,7 @@ | |||
| 7 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 7 | ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
| 8 | ;; Keywords: tools | 8 | ;; Keywords: tools |
| 9 | 9 | ||
| 10 | ;; $Id: vc.el,v 1.367 2004/02/08 22:42:42 uid65629 Exp $ | 10 | ;; $Id: vc.el,v 1.368 2004/03/15 03:55:24 monnier Exp $ |
| 11 | 11 | ||
| 12 | ;; This file is part of GNU Emacs. | 12 | ;; This file is part of GNU Emacs. |
| 13 | 13 | ||
| @@ -264,9 +264,10 @@ | |||
| 264 | ;; | 264 | ;; |
| 265 | ;; HISTORY FUNCTIONS | 265 | ;; HISTORY FUNCTIONS |
| 266 | ;; | 266 | ;; |
| 267 | ;; * print-log (file) | 267 | ;; * print-log (file &optional buffer) |
| 268 | ;; | 268 | ;; |
| 269 | ;; Insert the revision log of FILE into the *vc* buffer. | 269 | ;; Insert the revision log of FILE into BUFFER, or the *vc* buffer |
| 270 | ;; if BUFFER is nil. | ||
| 270 | ;; | 271 | ;; |
| 271 | ;; - show-log-entry (version) | 272 | ;; - show-log-entry (version) |
| 272 | ;; | 273 | ;; |
| @@ -301,17 +302,17 @@ | |||
| 301 | ;; default implementation runs rcs2log, which handles RCS- and | 302 | ;; default implementation runs rcs2log, which handles RCS- and |
| 302 | ;; CVS-style logs. | 303 | ;; CVS-style logs. |
| 303 | ;; | 304 | ;; |
| 304 | ;; * diff (file &optional rev1 rev2) | 305 | ;; * diff (file &optional rev1 rev2 buffer) |
| 305 | ;; | 306 | ;; |
| 306 | ;; Insert the diff for FILE into the *vc-diff* buffer. If REV1 and | 307 | ;; Insert the diff for FILE into BUFFER, or the *vc-diff* buffer if |
| 307 | ;; REV2 are non-nil, report differences from REV1 to REV2. If REV1 | 308 | ;; BUFFER is nil. If REV1 and REV2 are non-nil, report differences |
| 308 | ;; is nil, use the current workfile version (as found in the | 309 | ;; from REV1 to REV2. If REV1 is nil, use the current workfile |
| 309 | ;; repository) as the older version; if REV2 is nil, use the current | 310 | ;; version (as found in the repository) as the older version; if |
| 310 | ;; workfile contents as the newer version. This function should | 311 | ;; REV2 is nil, use the current workfile contents as the newer |
| 311 | ;; pass the value of (vc-switches BACKEND 'diff) to the backend | 312 | ;; version. This function should pass the value of (vc-switches |
| 312 | ;; command. It should return a status of either 0 (no differences | 313 | ;; BACKEND 'diff) to the backend command. It should return a status |
| 313 | ;; found), or 1 (either non-empty diff or the diff is run | 314 | ;; of either 0 (no differences found), or 1 (either non-empty diff |
| 314 | ;; asynchronously). | 315 | ;; or the diff is run asynchronously). |
| 315 | ;; | 316 | ;; |
| 316 | ;; - diff-tree (dir &optional rev1 rev2) | 317 | ;; - diff-tree (dir &optional rev1 rev2) |
| 317 | ;; | 318 | ;; |
| @@ -1727,7 +1728,9 @@ versions of all registered files in or below it." | |||
| 1727 | 'diff-tree dir rel1 rel2)) | 1728 | 'diff-tree dir rel1 rel2)) |
| 1728 | (vc-exec-after `(let ((inhibit-read-only t)) | 1729 | (vc-exec-after `(let ((inhibit-read-only t)) |
| 1729 | (insert "\nEnd of diffs.\n")))) | 1730 | (insert "\nEnd of diffs.\n")))) |
| 1730 | ;; single file diff | 1731 | ;; Single file diff. It is important that the vc-controlled buffer |
| 1732 | ;; is still current at this time, because any local settings in that | ||
| 1733 | ;; buffer should affect the diff command. | ||
| 1731 | (vc-diff-internal file rel1 rel2)) | 1734 | (vc-diff-internal file rel1 rel2)) |
| 1732 | (set-buffer "*vc-diff*") | 1735 | (set-buffer "*vc-diff*") |
| 1733 | (if (and (zerop (buffer-size)) | 1736 | (if (and (zerop (buffer-size)) |
| @@ -1752,8 +1755,8 @@ versions of all registered files in or below it." | |||
| 1752 | 1755 | ||
| 1753 | (defun vc-diff-internal (file rel1 rel2) | 1756 | (defun vc-diff-internal (file rel1 rel2) |
| 1754 | "Run diff to compare FILE's revisions REL1 and REL2. | 1757 | "Run diff to compare FILE's revisions REL1 and REL2. |
| 1755 | Output goes to the current buffer, which is assumed properly set up. | 1758 | Diff output goes to the *vc-diff* buffer. The exit status of the diff |
| 1756 | The exit status of the diff command is returned. | 1759 | command is returned. |
| 1757 | 1760 | ||
| 1758 | This function takes care to set up a proper coding system for diff output. | 1761 | This function takes care to set up a proper coding system for diff output. |
| 1759 | If both revisions are available as local files, then it also does not | 1762 | If both revisions are available as local files, then it also does not |
| @@ -2322,14 +2325,26 @@ allowed and simply skipped)." | |||
| 2322 | 2325 | ||
| 2323 | ;;;###autoload | 2326 | ;;;###autoload |
| 2324 | (defun vc-print-log (&optional focus-rev) | 2327 | (defun vc-print-log (&optional focus-rev) |
| 2325 | "List the change log of the current buffer in a window. If | 2328 | "List the change log of the current buffer in a window. |
| 2326 | FOCUS-REV is non-nil, leave the point at that revision." | 2329 | If FOCUS-REV is non-nil, leave the point at that revision." |
| 2327 | (interactive) | 2330 | (interactive) |
| 2328 | (vc-ensure-vc-buffer) | 2331 | (vc-ensure-vc-buffer) |
| 2329 | (let ((file buffer-file-name)) | 2332 | (let* ((file buffer-file-name) |
| 2333 | (print-log-args-length | ||
| 2334 | (length (cadr (symbol-function | ||
| 2335 | (vc-find-backend-function (vc-backend file) | ||
| 2336 | 'print-log)))))) | ||
| 2330 | (or focus-rev (setq focus-rev (vc-workfile-version file))) | 2337 | (or focus-rev (setq focus-rev (vc-workfile-version file))) |
| 2331 | (vc-call print-log file) | 2338 | ;; Don't switch to the output buffer before running the command, |
| 2332 | (set-buffer "*vc*") | 2339 | ;; so that any buffer-local settings in the vc-controlled |
| 2340 | ;; buffer can be accessed by the command. | ||
| 2341 | (if (> print-log-args-length 1) | ||
| 2342 | (progn | ||
| 2343 | (vc-call print-log file "*vc-change-log*") | ||
| 2344 | (set-buffer "*vc-change-log*")) | ||
| 2345 | ;; for backward compatibility | ||
| 2346 | (vc-call print-log file) | ||
| 2347 | (set-buffer "*vc*")) | ||
| 2333 | (pop-to-buffer (current-buffer)) | 2348 | (pop-to-buffer (current-buffer)) |
| 2334 | (log-view-mode) | 2349 | (log-view-mode) |
| 2335 | (vc-exec-after | 2350 | (vc-exec-after |