comparison lisp/vc.el @ 33562:7c20a27966ae

Updated backend documentation. (vc-default-check-headers): New function.
author André Spiegel <spiegel@gnu.org>
date Thu, 16 Nov 2000 18:17:26 +0000
parents 840460ecad6f
children d8c822512b62
comparison
equal deleted inserted replaced
33561:044ca47ee3d1 33562:7c20a27966ae
3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc. 3 ;; Copyright (C) 1992,93,94,95,96,97,98,2000 Free Software Foundation, Inc.
4 4
5 ;; Author: FSF (see below for full credits) 5 ;; Author: FSF (see below for full credits)
6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org> 6 ;; Maintainer: Andre Spiegel <spiegel@gnu.org>
7 7
8 ;; $Id: vc.el,v 1.287 2000/11/16 15:26:37 spiegel Exp $ 8 ;; $Id: vc.el,v 1.288 2000/11/16 16:40:59 spiegel 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
72 72
73 ;;; Code: 73 ;;; Code:
74 74
75 ;;;;;;;;;;;;;;;;; Backend-specific functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; 75 ;;;;;;;;;;;;;;;;; Backend-specific functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
76 ;; 76 ;;
77 ;; for each operation FUN, the backend should provide a function vc-BACKEND-FUN. 77 ;; For each operation FUN, the backend should provide a function
78 ;; Operations marked with a `-' instead of a `*' are optional. 78 ;; vc-BACKEND-FUN. Operations marked with a `-' instead of a `*'
79 ;; are optional.
80
81 ;;;
82 ;;; State-querying functions
83 ;;;
79 84
80 ;; * registered (file) 85 ;; * registered (file)
81 ;; * state (file) 86 ;; * state (file)
82 ;; - state-heuristic (file) 87 ;; - state-heuristic (file)
83 ;; The default behavior delegates to `state'. 88 ;; The default behavior delegates to `state'.
84 ;; - dir-state (dir) 89 ;; - dir-state (dir)
90 ;; * workfile-version (file)
91 ;; * latest-on-branch-p (file)
85 ;; * checkout-model (file) 92 ;; * checkout-model (file)
93 ;; - workfile-unchanged-p (file)
94 ;; Return non-nil if FILE is unchanged from its current workfile version.
95 ;; This function should do a brief comparison of FILE's contents
96 ;; with those of the master version. If the backend does not have
97 ;; such a brief-comparison feature, the default implementation of this
98 ;; function can be used, which delegates to a full vc-BACKEND-diff.
86 ;; - mode-line-string (file) 99 ;; - mode-line-string (file)
87 ;; * workfile-version (file) 100 ;; - dired-state-info (file)
88 ;; * revert (file) 101
89 ;; - merge-news (file) 102 ;;;
90 ;; Only needed if state `needs-merge' is possible. 103 ;;; State-changing functions
91 ;; - merge (file rev1 rev2) 104 ;;;
92 ;; - steal-lock (file &optional version) 105
93 ;; Only required if files can be locked by somebody else.
94 ;; * register (file rev comment) 106 ;; * register (file rev comment)
95 ;; * unregister (file backend)
96 ;; - receive-file (file rev)
97 ;; - responsible-p (file) 107 ;; - responsible-p (file)
98 ;; Should also work if FILE is a directory (ends with a slash). 108 ;; Should also work if FILE is a directory (ends with a slash).
99 ;; - could-register (file) 109 ;; - could-register (file)
110 ;; - receive-file (file rev)
111 ;; - unregister (file backend)
112 ;; * checkin (file rev comment)
100 ;; * checkout (file writable &optional rev destfile) 113 ;; * checkout (file writable &optional rev destfile)
101 ;; Checkout revision REV of FILE into DESTFILE. 114 ;; Checkout revision REV of FILE into DESTFILE.
102 ;; DESTFILE defaults to FILE. 115 ;; DESTFILE defaults to FILE.
103 ;; The file should be made writable if WRITABLE is non-nil. 116 ;; The file should be made writable if WRITABLE is non-nil.
104 ;; REV can be nil (BASE) or "" (HEAD) or any other revision. 117 ;; REV can be nil (BASE) or "" (HEAD) or any other revision.
105 ;; * checkin (file rev comment) 118 ;; * revert (file)
119 ;; - cancel-version (file writable)
120 ;; - merge (file rev1 rev2)
121 ;; - merge-news (file)
122 ;; Only needed if state `needs-merge' is possible.
123 ;; - steal-lock (file &optional version)
124 ;; Only required if files can be locked by somebody else.
125
126 ;;;
127 ;;; History functions
128 ;;;
129
130 ;; * print-log (file)
131 ;; Insert the revision log of FILE into the current buffer.
132 ;; - show-log-entry (version)
133 ;; - wash-log (file)
134 ;; Remove all non-comment information from the output of print-log
106 ;; - logentry-check () 135 ;; - logentry-check ()
136 ;; - comment-history (file)
137 ;; - update-changelog (files)
138 ;; Find changelog entries for FILES, or for all files at or below
139 ;; the default-directory if FILES is nil.
107 ;; * diff (file &optional rev1 rev2) 140 ;; * diff (file &optional rev1 rev2)
108 ;; Insert the diff for FILE into the current buffer. 141 ;; Insert the diff for FILE into the current buffer.
109 ;; REV1 should default to workfile-version. 142 ;; REV1 should default to workfile-version.
110 ;; REV2 should default to the current workfile 143 ;; REV2 should default to the current workfile
111 ;; Return a status of either 0 (i.e. no diff) or 1 (i.e. either non-empty 144 ;; Return a status of either 0 (i.e. no diff) or 1 (i.e. either non-empty
112 ;; diff or the diff is run asynchronously). 145 ;; diff or the diff is run asynchronously).
113 ;; - workfile-unchanged-p (file) 146 ;; - annotate-command (file buf rev)
114 ;; Return non-nil if FILE is unchanged from its current workfile version. 147 ;; - annotate-difference (pos)
115 ;; This function should do a brief comparison of FILE's contents 148 ;; Only required if `annotate-command' is defined for the backend.
116 ;; with those of the master version. If the backend does not have 149
117 ;; such a brief-comparison feature, the default implementation of this 150 ;;;
118 ;; function can be used, which delegates to a full vc-BACKEND-diff. 151 ;;; Snapshot system
119 ;; - clear-headers () 152 ;;;
120 ;; * check-headers () 153
121 ;; - dired-state-info (file)
122 ;; - create-snapshot (dir name branchp) 154 ;; - create-snapshot (dir name branchp)
123 ;; Take a snapshot of the current state of files under DIR and name it NAME. 155 ;; Take a snapshot of the current state of files under DIR and
124 ;; This should make sure that files are up-to-date before proceeding 156 ;; name it NAME. This should make sure that files are up-to-date
125 ;; with the action. 157 ;; before proceeding with the action. DIR can also be a file and
126 ;; DIR can also be a file and if BRANCHP is specified, NAME 158 ;; if BRANCHP is specified, NAME should be created as a branch and
127 ;; should be created as a branch and DIR should be checked out under 159 ;; DIR should be checked out under this new branch. The default
128 ;; this new branch. The default behavior does not support branches 160 ;; behavior does not support branches but does a sanity check, a
129 ;; but does a sanity check, a tree traversal and for each file calls 161 ;; tree traversal and for each file calls `assign-name'.
130 ;; `assign-name'.
131 ;; * assign-name (file name) 162 ;; * assign-name (file name)
132 ;; Give name NAME to the current version of FILE, assuming it is 163 ;; Give name NAME to the current version of FILE, assuming it is
133 ;; up-to-date. Only used by the default version of `create-snapshot'. 164 ;; up-to-date. Only used by the default version of `create-snapshot'.
134 ;; - retrieve-snapshot (dir name update) 165 ;; - retrieve-snapshot (dir name update)
135 ;; Retrieve a named snapshot of all registered files at or below DIR. 166 ;; Retrieve a named snapshot of all registered files at or below DIR.
136 ;; If UPDATE is non-nil, then update buffers of any files in the snapshot 167 ;; If UPDATE is non-nil, then update buffers of any files in the snapshot
137 ;; that are currently visited. 168 ;; that are currently visited.
138 ;; * print-log (file) 169
139 ;; Insert the revision log of FILE into the current buffer. 170 ;;;
140 ;; - show-log-entry (version) 171 ;;; Miscellaneous
141 ;; - wash-log (file) 172 ;;;
142 ;; Remove all non-comment information from the output of print-log 173
143 ;; - comment-history (file) 174 ;; - make-version-backups-p (file)
144 ;; - update-changelog (files) 175 ;; - check-headers ()
145 ;; Find changelog entries for FILES, or for all files at or below 176 ;; - clear-headers ()
146 ;; the default-directory if FILES is nil.
147 ;; * latest-on-branch-p (file)
148 ;; - cancel-version (file writable)
149 ;; - rename-file (old new) 177 ;; - rename-file (old new)
150 ;; - annotate-command (file buf rev) 178
151 ;; - annotate-difference (pos) 179
152 ;; Only required if `annotate-command' is defined for the backend. 180 ;;;;;;;;;;;;;;; End of backend-specific functions ;;;;;;;;;;;;;;;;;;;;;;;;;;;;
153 181
154 (require 'vc-hooks) 182 (require 'vc-hooks)
155 (require 'ring) 183 (require 'ring)
156 (eval-when-compile 184 (eval-when-compile
157 (require 'cl) 185 (require 'cl)
2760 (defun vc-check-headers () 2788 (defun vc-check-headers ()
2761 "Check if the current file has any headers in it." 2789 "Check if the current file has any headers in it."
2762 (interactive) 2790 (interactive)
2763 (vc-call-backend (vc-backend buffer-file-name) 'check-headers)) 2791 (vc-call-backend (vc-backend buffer-file-name) 'check-headers))
2764 2792
2793 (defun vc-default-check-headers (backend)
2794 "Default implementation of check-headers; always returns nil."
2795 nil)
2796
2765 ;; Back-end-dependent stuff ends here. 2797 ;; Back-end-dependent stuff ends here.
2766 2798
2767 ;; Set up key bindings for use while editing log messages 2799 ;; Set up key bindings for use while editing log messages
2768 2800
2769 (define-derived-mode vc-log-mode text-mode "VC-Log" 2801 (define-derived-mode vc-log-mode text-mode "VC-Log"