Mercurial > emacs
comparison lisp/vc-hooks.el @ 31404:f2ab9420390f
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el: (toplevel): Don't require `dired' at run-time.
(vc-dired-resynch-file): Remove autoload cookie.
2000-09-05 Andre Spiegel <spiegel@gnu.org>
* vc.el: Made several backend functions optional.
(vc-default-responsible-p): New function.
(vc-merge): Use RET for first version to trigger merge-news, not
prefix arg.
(vc-annotate): Handle backends that do not support annotation.
(vc-default-merge-news): Removed. The existence of a merge-news
implementation is now checked on caller sites.
* vc-hooks.el (vc-default-mode-line-string): Removed CVS special
case.
* vc-cvs.el (vc-cvs-mode-line-string): New function, handles the
special case that has been removed from the default in vc-hooks.el.
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el (vc-log-edit): Properly handle the case where FILE is nil.
2000-09-05 Andre Spiegel <spiegel@gnu.org>
* vc-hooks.el: Require vc during compilation.
(vc-file-setprop): Use `vc-touched-properties' if bound by the new
macro `with-vc-properties' in vc.el.
(vc-file-getprop): Doc fix.
(vc-after-save): Call `vc-dired-resynch-file' only if vc is loaded.
* vc.el: Require dired-aux during compilation.
(vc-name-assoc-file): Moved to vc-sccs.el.
(with-vc-properties): New macro.
(vc-checkin, vc-checkout, vc-revert, vc-cancel-version,
vc-finish-steal): Use it.
(vc-cancel-version): Moved RCS-specific code to vc-rcs.el. The call
to the backend-specific function is now supposed to do the checkout,
too.
(vc-log-edit): Handle FILE being nil and added a FIXME for log-edit.
* vc-cvs.el (vc-cvs-checkin, vc-cvs-checkout): Don't bother to
set file properties; that gets done in the generic code now.
* vc-rcs.el (vc-rcs-uncheck): Renamed to `vc-rcs-cancel-version'.
Changed parameter list, added code from vc.el that does the
checkout, possibly with a double-take.
* vc-sccs.el (vc-sccs-name-assoc-file): Moved here from vc.el.
(vc-sccs-add-triple, vc-sccs-rename-file, vc-sccs-lookup-triple): Use
the above under the new name.
(vc-sccs-uncheck): Renamed to `vc-sccs-cancel-version'. Changed
parameter list, added checkout command.
(vc-sccs-checkin, vc-sccs-checkout): Don't bother to set file
properties; that gets done in the generic code now.
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el: Docstring fixes (courtesy of checkdoc).
2000-09-05 Stefan Monnier <monnier@cs.yale.edu>
* vc.el (vc-checkout-writable-buffer-hook)
(vc-checkout-writable-buffer): Remove.
(vc-start-entry): Always call vc-log-edit, never vc-log-mode.
(vc-log-mode): Make it into a clean derived major mode.
(vc-log-edit): Mark buffer unmodified (as vc-log-mode did) and use
vc-log-mode if log-edit is not available.
(vc-dired-mode-map): Don't set-keymap-parent yet.
(vc-dired-mode): Do set-keymap-parent here.
(vc-dired-buffers-for-dir): Nop if dired is not loaded.
author | Stefan Monnier <monnier@iro.umontreal.ca> |
---|---|
date | Tue, 05 Sep 2000 20:08:22 +0000 |
parents | cde9770b21e0 |
children | c1eb46906717 |
comparison
equal
deleted
inserted
replaced
31403:736bba059dd4 | 31404:f2ab9420390f |
---|---|
3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. | 3 ;; Copyright (C) 1992,93,94,95,96,98,99,2000 Free Software Foundation, Inc. |
4 | 4 |
5 ;; Author: FSF (see vc.el for full credits) | 5 ;; Author: FSF (see vc.el for full credits) |
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> | 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> |
7 | 7 |
8 ;; $Id: vc-hooks.el,v 1.53 2000/08/13 11:36:46 spiegel Exp $ | 8 ;; $Id: vc-hooks.el,v 1.116 2000/09/04 19:47:25 gerd Exp $ |
9 | 9 |
10 ;; This file is part of GNU Emacs. | 10 ;; This file is part of GNU Emacs. |
11 | 11 |
12 ;; GNU Emacs is free software; you can redistribute it and/or modify | 12 ;; GNU Emacs is free software; you can redistribute it and/or modify |
13 ;; it under the terms of the GNU General Public License as published by | 13 ;; it under the terms of the GNU General Public License as published by |
30 ;; VC-related activities that are done when you visit a file, so that | 30 ;; VC-related activities that are done when you visit a file, so that |
31 ;; vc.el itself is loaded only when you use a VC command. See the | 31 ;; vc.el itself is loaded only when you use a VC command. See the |
32 ;; commentary of vc.el. | 32 ;; commentary of vc.el. |
33 | 33 |
34 ;;; Code: | 34 ;;; Code: |
35 | |
36 (eval-when-compile | |
37 (require 'vc)) | |
35 | 38 |
36 ;; Customization Variables (the rest is in vc.el) | 39 ;; Customization Variables (the rest is in vc.el) |
37 | 40 |
38 (defvar vc-ignore-vc-files nil "Obsolete -- use `vc-handled-backends'.") | 41 (defvar vc-ignore-vc-files nil "Obsolete -- use `vc-handled-backends'.") |
39 (defvar vc-master-templates () "Obsolete -- use vc-BACKEND-master-templates.") | 42 (defvar vc-master-templates () "Obsolete -- use vc-BACKEND-master-templates.") |
45 file is under that sort of version control. | 48 file is under that sort of version control. |
46 Removing an entry from the list prevents VC from being activated | 49 Removing an entry from the list prevents VC from being activated |
47 when visiting a file managed by that backend. | 50 when visiting a file managed by that backend. |
48 An empty list disables VC altogether." | 51 An empty list disables VC altogether." |
49 :type '(repeat symbol) | 52 :type '(repeat symbol) |
50 :version "20.5" | 53 :version "21.1" |
51 :group 'vc) | 54 :group 'vc) |
52 | 55 |
53 (defcustom vc-path | 56 (defcustom vc-path |
54 (if (file-directory-p "/usr/sccs") | 57 (if (file-directory-p "/usr/sccs") |
55 '("/usr/sccs") | 58 '("/usr/sccs") |
115 (add-to-list 'minor-mode-alist '(vc-mode vc-mode)) | 118 (add-to-list 'minor-mode-alist '(vc-mode vc-mode)) |
116 | 119 |
117 (make-variable-buffer-local 'vc-mode) | 120 (make-variable-buffer-local 'vc-mode) |
118 (put 'vc-mode 'permanent-local t) | 121 (put 'vc-mode 'permanent-local t) |
119 | 122 |
123 (defmacro vc-error-occurred (&rest body) | |
124 (list 'condition-case nil (cons 'progn (append body '(nil))) '(error t))) | |
125 | |
120 ;; We need a notion of per-file properties because the version | 126 ;; We need a notion of per-file properties because the version |
121 ;; control state of a file is expensive to derive --- we compute | 127 ;; control state of a file is expensive to derive --- we compute |
122 ;; them when the file is initially found, keep them up to date | 128 ;; them when the file is initially found, keep them up to date |
123 ;; during any subsequent VC operations, and forget them when | 129 ;; during any subsequent VC operations, and forget them when |
124 ;; the buffer is killed. | 130 ;; the buffer is killed. |
125 | 131 |
126 (defmacro vc-error-occurred (&rest body) | |
127 (list 'condition-case nil (cons 'progn (append body '(nil))) '(error t))) | |
128 | |
129 (defvar vc-file-prop-obarray (make-vector 16 0) | 132 (defvar vc-file-prop-obarray (make-vector 16 0) |
130 "Obarray for per-file properties.") | 133 "Obarray for per-file properties.") |
131 | 134 |
135 (defvar vc-touched-properties nil) | |
136 | |
132 (defun vc-file-setprop (file property value) | 137 (defun vc-file-setprop (file property value) |
133 "Set per-file VC PROPERTY for FILE to VALUE." | 138 "Set per-file VC PROPERTY for FILE to VALUE." |
139 (if (and vc-touched-properties | |
140 (not (memq property vc-touched-properties))) | |
141 (setq vc-touched-properties (append (list property) | |
142 vc-touched-properties))) | |
134 (put (intern file vc-file-prop-obarray) property value)) | 143 (put (intern file vc-file-prop-obarray) property value)) |
135 | 144 |
136 (defun vc-file-getprop (file property) | 145 (defun vc-file-getprop (file property) |
137 "get per-file VC PROPERTY for FILE." | 146 "Get per-file VC PROPERTY for FILE." |
138 (get (intern file vc-file-prop-obarray) property)) | 147 (get (intern file vc-file-prop-obarray) property)) |
139 | 148 |
140 (defun vc-file-clearprops (file) | 149 (defun vc-file-clearprops (file) |
141 "Clear all VC properties of FILE." | 150 "Clear all VC properties of FILE." |
142 (setplist (intern file vc-file-prop-obarray) nil)) | 151 (setplist (intern file vc-file-prop-obarray) nil)) |
460 t) | 469 t) |
461 (vc-up-to-date-p file) | 470 (vc-up-to-date-p file) |
462 (eq (vc-checkout-model file) 'implicit) | 471 (eq (vc-checkout-model file) 'implicit) |
463 (vc-file-setprop file 'vc-state 'edited) | 472 (vc-file-setprop file 'vc-state 'edited) |
464 (vc-mode-line file) | 473 (vc-mode-line file) |
465 (vc-dired-resynch-file file)))) | 474 (if (featurep 'vc) |
475 ;; If VC is not loaded, then there can't be | |
476 ;; any VC Dired buffer to synchronize. | |
477 (vc-dired-resynch-file file))))) | |
466 | 478 |
467 (defun vc-mode-line (file) | 479 (defun vc-mode-line (file) |
468 "Set `vc-mode' to display type of version control for FILE. | 480 "Set `vc-mode' to display type of version control for FILE. |
469 The value is set in the current buffer, which should be the buffer | 481 The value is set in the current buffer, which should be the buffer |
470 visiting FILE." | 482 visiting FILE." |
471 (interactive (list buffer-file-name nil)) | 483 (interactive (list buffer-file-name nil)) |
472 (unless (not (vc-backend file)) | 484 (unless (not (vc-backend file)) |
473 (setq vc-mode (concat " " | 485 (setq vc-mode (concat " " (if vc-display-status |
474 (if vc-display-status | 486 (vc-call mode-line-string file) |
475 (vc-call mode-line-string file) | 487 (symbol-name (vc-backend file))))) |
476 (symbol-name (vc-backend file))))) | |
477 ;; If the file is locked by some other user, make | 488 ;; If the file is locked by some other user, make |
478 ;; the buffer read-only. Like this, even root | 489 ;; the buffer read-only. Like this, even root |
479 ;; cannot modify a file that someone else has locked. | 490 ;; cannot modify a file that someone else has locked. |
480 (and (equal file (buffer-file-name)) | 491 (and (equal file (buffer-file-name)) |
481 (stringp (vc-state file)) | 492 (stringp (vc-state file)) |
497 Format: | 508 Format: |
498 | 509 |
499 \"BACKEND-REV\" if the file is up-to-date | 510 \"BACKEND-REV\" if the file is up-to-date |
500 \"BACKEND:REV\" if the file is edited (or locked by the calling user) | 511 \"BACKEND:REV\" if the file is edited (or locked by the calling user) |
501 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else | 512 \"BACKEND:LOCKER:REV\" if the file is locked by somebody else |
502 \"BACKEND @@\" for a CVS file that is added, but not yet committed | |
503 | 513 |
504 This function assumes that the file is registered." | 514 This function assumes that the file is registered." |
505 (setq backend (symbol-name backend)) | 515 (setq backend (symbol-name backend)) |
506 (let ((state (vc-state file)) | 516 (let ((state (vc-state file)) |
507 (rev (vc-workfile-version file))) | 517 (rev (vc-workfile-version file))) |
508 (cond ((string= "0" rev) | 518 (cond ((or (eq state 'up-to-date) |
509 ;; CVS special case; should go into a CVS-specific implementation | |
510 (concat backend " @@")) | |
511 ((or (eq state 'up-to-date) | |
512 (eq state 'needs-patch)) | 519 (eq state 'needs-patch)) |
513 (concat backend "-" rev)) | 520 (concat backend "-" rev)) |
514 ((stringp state) | 521 ((stringp state) |
515 (concat backend ":" state ":" rev)) | 522 (concat backend ":" state ":" rev)) |
516 (t | 523 (t |