comparison lisp/vc-sccs.el @ 90988:492971a3f31f unicode-xft-base

Merge from emacs--devo--0 Patches applied: * emacs--devo--0 (patch 816-823) - Update from CVS - Merge from emacs--rel--22 * emacs--rel--22 (patch 59-69) - Update from CVS - Merge from gnus--rel--5.10 * gnus--rel--5.10 (patch 237-238) - Update from CVS Revision: emacs@sv.gnu.org/emacs--unicode--0--patch-235
author Miles Bader <miles@gnu.org>
date Tue, 24 Jul 2007 01:23:55 +0000
parents 95d0cdf160ea f9f0d45ce573
children f55f9811f5d7
comparison
equal deleted inserted replaced
90987:b2d8a283f27e 90988:492971a3f31f
24 ;; along with GNU Emacs; see the file COPYING. If not, write to the 24 ;; along with GNU Emacs; see the file COPYING. If not, write to the
25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, 25 ;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
26 ;; Boston, MA 02110-1301, USA. 26 ;; Boston, MA 02110-1301, USA.
27 27
28 ;;; Commentary: 28 ;;; Commentary:
29
30 ;; TODO:
31 ;; - remove call to vc-expand-dirs by implementing our own (which can just
32 ;; list the SCCS subdir instead).
29 33
30 ;;; Code: 34 ;;; Code:
31 35
32 (eval-when-compile 36 (eval-when-compile
33 (require 'vc)) 37 (require 'vc))
83 ;;; 87 ;;;
84 88
85 (defconst vc-sccs-name-assoc-file "VC-names") 89 (defconst vc-sccs-name-assoc-file "VC-names")
86 90
87 91
92 ;;; Properties of the backend
93
94 (defun vc-sccs-revision-granularity ()
95 'file)
96
88 ;;; 97 ;;;
89 ;;; State-querying functions 98 ;;; State-querying functions
90 ;;; 99 ;;;
91 100
92 ;;; The autoload cookie below places vc-sccs-registered directly into 101 ;;; The autoload cookie below places vc-sccs-registered directly into
159 168
160 ;;; 169 ;;;
161 ;;; State-changing functions 170 ;;; State-changing functions
162 ;;; 171 ;;;
163 172
164 (defun vc-sccs-register (file &optional rev comment) 173 (defun vc-sccs-create-repo ()
165 "Register FILE into the SCCS version-control system. 174 "Create a new SCCS repository."
175 ;; SCCS is totally file-oriented, so all we have to do is make the directory
176 (make-directory "SCCS"))
177
178 (defun vc-sccs-register (files &optional rev comment)
179 "Register FILES into the SCCS version-control system.
166 REV is the optional revision number for the file. COMMENT can be used 180 REV is the optional revision number for the file. COMMENT can be used
167 to provide an initial description of FILE. 181 to provide an initial description of FILES.
168 182
169 `vc-register-switches' and `vc-sccs-register-switches' are passed to 183 `vc-register-switches' and `vc-sccs-register-switches' are passed to
170 the SCCS command (in that order). 184 the SCCS command (in that order).
171 185
172 Automatically retrieve a read-only version of the file with keywords 186 Automatically retrieve a read-only version of the files with keywords
173 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile." 187 expanded if `vc-keep-workfiles' is non-nil, otherwise, delete the workfile."
188 (dolist (file files)
174 (let* ((dirname (or (file-name-directory file) "")) 189 (let* ((dirname (or (file-name-directory file) ""))
175 (basename (file-name-nondirectory file)) 190 (basename (file-name-nondirectory file))
176 (project-file (vc-sccs-search-project-dir dirname basename))) 191 (project-file (vc-sccs-search-project-dir dirname basename)))
177 (let ((vc-name 192 (let ((vc-name
178 (or project-file 193 (or project-file
179 (format (car vc-sccs-master-templates) dirname basename)))) 194 (format (car vc-sccs-master-templates) dirname basename))))
180 (apply 'vc-do-command nil 0 "admin" vc-name 195 (apply 'vc-do-command nil 0 "admin" vc-name
181 (and rev (concat "-r" rev)) 196 (and rev (not (string= rev "")) (concat "-r" rev))
182 "-fb" 197 "-fb"
183 (concat "-i" (file-relative-name file)) 198 (concat "-i" (file-relative-name file))
184 (and comment (concat "-y" comment)) 199 (and comment (concat "-y" comment))
185 (vc-switches 'SCCS 'register))) 200 (vc-switches 'SCCS 'register)))
186 (delete-file file) 201 (delete-file file)
187 (if vc-keep-workfiles 202 (if vc-keep-workfiles
188 (vc-do-command nil 0 "get" (vc-name file))))) 203 (vc-do-command nil 0 "get" (vc-name file))))))
189 204
190 (defun vc-sccs-responsible-p (file) 205 (defun vc-sccs-responsible-p (file)
191 "Return non-nil if SCCS thinks it would be responsible for registering FILE." 206 "Return non-nil if SCCS thinks it would be responsible for registering FILE."
192 ;; TODO: check for all the patterns in vc-sccs-master-templates 207 ;; TODO: check for all the patterns in vc-sccs-master-templates
193 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file))) 208 (or (file-directory-p (expand-file-name "SCCS" (file-name-directory file)))
194 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "") 209 (stringp (vc-sccs-search-project-dir (or (file-name-directory file) "")
195 (file-name-nondirectory file))))) 210 (file-name-nondirectory file)))))
196 211
197 (defun vc-sccs-checkin (file rev comment) 212 (defun vc-sccs-checkin (files rev comment)
198 "SCCS-specific version of `vc-backend-checkin'." 213 "SCCS-specific version of `vc-backend-checkin'."
199 (apply 'vc-do-command nil 0 "delta" (vc-name file) 214 (dolist (file files)
200 (if rev (concat "-r" rev)) 215 (apply 'vc-do-command nil 0 "delta" (vc-name file)
201 (concat "-y" comment) 216 (if rev (concat "-r" rev))
202 (vc-switches 'SCCS 'checkin)) 217 (concat "-y" comment)
203 (if vc-keep-workfiles 218 (vc-switches 'SCCS 'checkin))
204 (vc-do-command nil 0 "get" (vc-name file)))) 219 (if vc-keep-workfiles
220 (vc-do-command nil 0 "get" (vc-name file)))))
205 221
206 (defun vc-sccs-find-version (file rev buffer) 222 (defun vc-sccs-find-version (file rev buffer)
207 (apply 'vc-do-command 223 (apply 'vc-do-command
208 buffer 0 "get" (vc-name file) 224 buffer 0 "get" (vc-name file)
209 "-s" ;; suppress diagnostic output 225 "-s" ;; suppress diagnostic output
240 (if editable "-e") 256 (if editable "-e")
241 (and rev (concat "-r" (vc-sccs-lookup-triple file rev))) 257 (and rev (concat "-r" (vc-sccs-lookup-triple file rev)))
242 switches)))) 258 switches))))
243 (message "Checking out %s...done" file))) 259 (message "Checking out %s...done" file)))
244 260
261 (defun vc-sccs-cancel-version (files)
262 "Roll back, undoing the most recent checkins of FILES."
263 (if (not files)
264 (error "SCCS backend doesn't support directory-level rollback."))
265 (dolist (file files)
266 (let ((discard (vc-workfile-version file)))
267 (if (null (yes-or-no-p (format "Remove version %s from %s history? "
268 discard file)))
269 (error "Aborted"))
270 (message "Removing revision %s from %s..." discard file)
271 (vc-do-command nil 0 "rmdel" (vc-name file) (concat "-r" discard))
272 (vc-do-command nil 0 "get" (vc-name file) nil))))
273
245 (defun vc-sccs-revert (file &optional contents-done) 274 (defun vc-sccs-revert (file &optional contents-done)
246 "Revert FILE to the version it was based on." 275 "Revert FILE to the version it was based on."
247 (vc-do-command nil 0 "unget" (vc-name file)) 276 (vc-do-command nil 0 "unget" (vc-name file))
248 (vc-do-command nil 0 "get" (vc-name file)) 277 (vc-do-command nil 0 "get" (vc-name file))
249 ;; Checking out explicit versions is not supported under SCCS, yet. 278 ;; Checking out explicit versions is not supported under SCCS, yet.
250 ;; We always "revert" to the latest version; therefore 279 ;; We always "revert" to the latest version; therefore
251 ;; vc-workfile-version is cleared here so that it gets recomputed. 280 ;; vc-workfile-version is cleared here so that it gets recomputed.
252 (vc-file-setprop file 'vc-workfile-version nil)) 281 (vc-file-setprop file 'vc-workfile-version nil))
253 282
254 (defun vc-sccs-cancel-version (file editable)
255 "Undo the most recent checkin of FILE.
256 EDITABLE non-nil means previous version should be locked."
257 (vc-do-command nil 0 "rmdel"
258 (vc-name file)
259 (concat "-r" (vc-workfile-version file)))
260 (vc-do-command nil 0 "get"
261 (vc-name file)
262 (if editable "-e")))
263
264 (defun vc-sccs-steal-lock (file &optional rev) 283 (defun vc-sccs-steal-lock (file &optional rev)
265 "Steal the lock on the current workfile for FILE and revision REV." 284 "Steal the lock on the current workfile for FILE and revision REV."
266 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev))) 285 (vc-do-command nil 0 "unget" (vc-name file) "-n" (if rev (concat "-r" rev)))
267 (vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev)))) 286 (vc-do-command nil 0 "get" (vc-name file) "-g" (if rev (concat "-r" rev))))
268 287
269 288
270 ;;; 289 ;;;
271 ;;; History functions 290 ;;; History functions
272 ;;; 291 ;;;
273 292
274 (defun vc-sccs-print-log (file &optional buffer) 293 (defun vc-sccs-print-log (files &optional buffer)
275 "Get change log associated with FILE." 294 "Get change log associated with FILES."
276 (vc-do-command buffer 0 "prs" (vc-name file))) 295 (vc-do-command buffer 0 "prs" (mapcar 'vc-name files)))
296
297 (defun vc-sccs-wash-log ()
298 "Remove all non-comment information from log output."
299 ;; FIXME: not implemented for SCCS
300 nil)
277 301
278 (defun vc-sccs-logentry-check () 302 (defun vc-sccs-logentry-check ()
279 "Check that the log entry in the current buffer is acceptable for SCCS." 303 "Check that the log entry in the current buffer is acceptable for SCCS."
280 (when (>= (buffer-size) 512) 304 (when (>= (buffer-size) 512)
281 (goto-char 512) 305 (goto-char 512)
282 (error "Log must be less than 512 characters; point is now at pos 512"))) 306 (error "Log must be less than 512 characters; point is now at pos 512")))
283 307
284 (defun vc-sccs-diff (file &optional oldvers newvers buffer) 308 (defun vc-sccs-diff (files &optional oldvers newvers buffer)
285 "Get a difference report using SCCS between two versions of FILE." 309 "Get a difference report using SCCS between two filesets."
286 (setq oldvers (vc-sccs-lookup-triple file oldvers)) 310 (setq oldvers (vc-sccs-lookup-triple file oldvers))
287 (setq newvers (vc-sccs-lookup-triple file newvers)) 311 (setq newvers (vc-sccs-lookup-triple file newvers))
288 (apply 'vc-do-command (or buffer "*vc-diff*") 1 "vcdiff" (vc-name file) 312 (apply 'vc-do-command (or buffer "*vc-diff*")
313 1 "vcdiff" (mapcar 'vc-name (vc-expand-dirs files))
289 (append (list "-q" 314 (append (list "-q"
290 (and oldvers (concat "-r" oldvers)) 315 (and oldvers (concat "-r" oldvers))
291 (and newvers (concat "-r" newvers))) 316 (and newvers (concat "-r" newvers)))
292 (vc-switches 'SCCS 'diff)))) 317 (vc-switches 'SCCS 'diff))))
293 318