Mercurial > emacs
comparison lisp/vc.el @ 83082:108bb5537c12
Merged in changes from CVS HEAD
Patches applied:
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-161
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-162
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-163
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-164
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-165
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-166
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-167
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-168
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-169
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-170
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-171
Update from CVS
* miles@gnu.org--gnu-2004/emacs--cvs-trunk--0--patch-172
Update from CVS
git-archimport-id: lorentey@elte.hu--2004/emacs--multi-tty--0--patch-122
author | Karoly Lorentey <lorentey@elte.hu> |
---|---|
date | Thu, 25 Mar 2004 22:21:45 +0000 |
parents | fac24544c283 c862ab7552a4 |
children | c0e839b60d0b |
comparison
equal
deleted
inserted
replaced
83081:32a426d0a0e3 | 83082:108bb5537c12 |
---|---|
5 | 5 |
6 ;; Author: FSF (see below for full credits) | 6 ;; Author: FSF (see below for full credits) |
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.368 2004/03/15 03:55:24 monnier Exp $ | 10 ;; $Id: vc.el,v 1.371 2004/03/25 15:39:03 sds Exp $ |
11 | 11 |
12 ;; This file is part of GNU Emacs. | 12 ;; This file is part of GNU Emacs. |
13 | 13 |
14 ;; GNU Emacs is free software; you can redistribute it and/or modify | 14 ;; GNU Emacs is free software; you can redistribute it and/or modify |
15 ;; it under the terms of the GNU General Public License as published by | 15 ;; it under the terms of the GNU General Public License as published by |
262 ;; locking is used for files under this backend, and if files can | 262 ;; locking is used for files under this backend, and if files can |
263 ;; indeed be locked by other users. | 263 ;; indeed be locked by other users. |
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 ;; |
273 ;; If provided, search the log entry for VERSION in the current buffer, | 274 ;; If provided, search the log entry for VERSION in the current buffer, |
274 ;; and make sure it is displayed in the buffer's window. The default | 275 ;; and make sure it is displayed in the buffer's window. The default |
299 ;; Using recent log entries, create ChangeLog entries for FILES, or for | 300 ;; Using recent log entries, create ChangeLog entries for FILES, or for |
300 ;; all files at or below the default-directory if FILES is nil. The | 301 ;; all files at or below the default-directory if FILES is nil. The |
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 ;; |
318 ;; Insert the diff for all files at and below DIR into the *vc-diff* | 319 ;; Insert the diff for all files at and below DIR into the *vc-diff* |
319 ;; buffer. The meaning of REV1 and REV2 is the same as for | 320 ;; buffer. The meaning of REV1 and REV2 is the same as for |
432 ;; repository. If this function is not provided, the renaming | 433 ;; repository. If this function is not provided, the renaming |
433 ;; will be done by (vc-delete-file old) and (vc-register new). | 434 ;; will be done by (vc-delete-file old) and (vc-register new). |
434 ;; | 435 ;; |
435 ;; - find-file-hook () | 436 ;; - find-file-hook () |
436 ;; | 437 ;; |
437 ;; Operation called in current buffer when opening a new file. This can | 438 ;; Operation called in current buffer when opening a file. This can |
438 ;; be used by the backend to setup some local variables it might need. | 439 ;; be used by the backend to setup some local variables it might need. |
440 ; | |
441 ;; - find-file-not-found-hook () | |
442 ;; | |
443 ;; Operation called in current buffer when opening a non-existing file. | |
444 ;; By default, this asks the user if she wants to check out the file. | |
439 | 445 |
440 ;;; Code: | 446 ;;; Code: |
441 | 447 |
442 (require 'vc-hooks) | 448 (require 'vc-hooks) |
443 (require 'ring) | 449 (require 'ring) |
1725 (let ((dir (file-name-as-directory file))) | 1731 (let ((dir (file-name-as-directory file))) |
1726 (vc-call-backend (vc-responsible-backend dir) | 1732 (vc-call-backend (vc-responsible-backend dir) |
1727 'diff-tree dir rel1 rel2)) | 1733 'diff-tree dir rel1 rel2)) |
1728 (vc-exec-after `(let ((inhibit-read-only t)) | 1734 (vc-exec-after `(let ((inhibit-read-only t)) |
1729 (insert "\nEnd of diffs.\n")))) | 1735 (insert "\nEnd of diffs.\n")))) |
1730 ;; single file diff | 1736 ;; Single file diff. It is important that the vc-controlled buffer |
1737 ;; is still current at this time, because any local settings in that | |
1738 ;; buffer should affect the diff command. | |
1731 (vc-diff-internal file rel1 rel2)) | 1739 (vc-diff-internal file rel1 rel2)) |
1732 (set-buffer "*vc-diff*") | 1740 (set-buffer "*vc-diff*") |
1733 (if (and (zerop (buffer-size)) | 1741 (if (and (zerop (buffer-size)) |
1734 (not (get-buffer-process (current-buffer)))) | 1742 (not (get-buffer-process (current-buffer)))) |
1735 (progn | 1743 (progn |
1750 (shrink-window-if-larger-than-buffer))) | 1758 (shrink-window-if-larger-than-buffer))) |
1751 t)) | 1759 t)) |
1752 | 1760 |
1753 (defun vc-diff-internal (file rel1 rel2) | 1761 (defun vc-diff-internal (file rel1 rel2) |
1754 "Run diff to compare FILE's revisions REL1 and REL2. | 1762 "Run diff to compare FILE's revisions REL1 and REL2. |
1755 Output goes to the current buffer, which is assumed properly set up. | 1763 Diff output goes to the *vc-diff* buffer. The exit status of the diff |
1756 The exit status of the diff command is returned. | 1764 command is returned. |
1757 | 1765 |
1758 This function takes care to set up a proper coding system for diff output. | 1766 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 | 1767 If both revisions are available as local files, then it also does not |
1760 actually call the backend, but performs a local diff." | 1768 actually call the backend, but performs a local diff." |
1761 (if (or (not rel1) (string-equal rel1 "")) | 1769 (if (or (not rel1) (string-equal rel1 "")) |
2320 | 2328 |
2321 ;; Miscellaneous other entry points | 2329 ;; Miscellaneous other entry points |
2322 | 2330 |
2323 ;;;###autoload | 2331 ;;;###autoload |
2324 (defun vc-print-log (&optional focus-rev) | 2332 (defun vc-print-log (&optional focus-rev) |
2325 "List the change log of the current buffer in a window. If | 2333 "List the change log of the current buffer in a window. |
2326 FOCUS-REV is non-nil, leave the point at that revision." | 2334 If FOCUS-REV is non-nil, leave the point at that revision." |
2327 (interactive) | 2335 (interactive) |
2328 (vc-ensure-vc-buffer) | 2336 (vc-ensure-vc-buffer) |
2329 (let ((file buffer-file-name)) | 2337 (let* ((file buffer-file-name) |
2338 (backend-function | |
2339 (symbol-function | |
2340 (vc-find-backend-function (vc-backend file) 'print-log))) | |
2341 (print-log-args | |
2342 (if (byte-code-function-p backend-function) | |
2343 (aref backend-function 0) | |
2344 (cadr backend-function)))) | |
2330 (or focus-rev (setq focus-rev (vc-workfile-version file))) | 2345 (or focus-rev (setq focus-rev (vc-workfile-version file))) |
2331 (vc-call print-log file) | 2346 ;; Don't switch to the output buffer before running the command, |
2332 (set-buffer "*vc*") | 2347 ;; so that any buffer-local settings in the vc-controlled |
2348 ;; buffer can be accessed by the command. | |
2349 (if (cdr print-log-args) | |
2350 (progn | |
2351 (vc-call print-log file "*vc-change-log*") | |
2352 (set-buffer "*vc-change-log*")) | |
2353 ;; for backward compatibility | |
2354 (vc-call print-log file) | |
2355 (set-buffer "*vc*")) | |
2333 (pop-to-buffer (current-buffer)) | 2356 (pop-to-buffer (current-buffer)) |
2334 (log-view-mode) | 2357 (log-view-mode) |
2335 (vc-exec-after | 2358 (vc-exec-after |
2336 `(let ((inhibit-read-only t)) | 2359 `(let ((inhibit-read-only t)) |
2337 (goto-char (point-max)) (forward-line -1) | 2360 (goto-char (point-max)) (forward-line -1) |
3041 (set-buffer temp-buffer-name) | 3064 (set-buffer temp-buffer-name) |
3042 (set (make-local-variable 'vc-annotate-parent-file) bfn) | 3065 (set (make-local-variable 'vc-annotate-parent-file) bfn) |
3043 (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version) | 3066 (set (make-local-variable 'vc-annotate-parent-rev) vc-annotate-version) |
3044 (set (make-local-variable 'vc-annotate-parent-display-mode) | 3067 (set (make-local-variable 'vc-annotate-parent-display-mode) |
3045 vc-annotate-display-mode)) | 3068 vc-annotate-display-mode)) |
3046 | 3069 |
3047 ;; Don't use the temp-buffer-name until the buffer is created | 3070 ;; Don't use the temp-buffer-name until the buffer is created |
3048 ;; (only after `with-output-to-temp-buffer'.) | 3071 ;; (only after `with-output-to-temp-buffer'.) |
3049 (setq vc-annotate-buffers | 3072 (setq vc-annotate-buffers |
3050 (append vc-annotate-buffers | 3073 (append vc-annotate-buffers |
3051 (list (cons (get-buffer temp-buffer-name) vc-annotate-backend)))) | 3074 (list (cons (get-buffer temp-buffer-name) vc-annotate-backend)))) |
3096 (if (equal rev-at-line vc-annotate-parent-rev) | 3119 (if (equal rev-at-line vc-annotate-parent-rev) |
3097 (message "Already at version %s" rev-at-line) | 3120 (message "Already at version %s" rev-at-line) |
3098 (vc-annotate-warp-version rev-at-line)))))) | 3121 (vc-annotate-warp-version rev-at-line)))))) |
3099 | 3122 |
3100 (defun vc-annotate-revision-previous-to-line () | 3123 (defun vc-annotate-revision-previous-to-line () |
3101 "Visit the annotation of the version before the version at line." | 3124 "Visit the annotation of the version before the version at line." |
3102 (interactive) | 3125 (interactive) |
3103 (if (not (equal major-mode 'vc-annotate-mode)) | 3126 (if (not (equal major-mode 'vc-annotate-mode)) |
3104 (message "Cannot be invoked outside of a vc annotate buffer") | 3127 (message "Cannot be invoked outside of a vc annotate buffer") |
3105 (let ((rev-at-line (vc-annotate-extract-revision-at-line)) | 3128 (let ((rev-at-line (vc-annotate-extract-revision-at-line)) |
3106 (prev-rev nil)) | 3129 (prev-rev nil)) |