ViewVC logotype

Contents of /meta-cvs/F-94BF952D29F3DC3FFD457EFFCE570DB2

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.1 - (hide annotations)
Sat Feb 16 19:41:43 2002 UTC (12 years, 2 months ago) by kaz
Branch: MAIN
Support for filetypes in import.

* posix.lisp (suffix): Separator character parameter is optional;
multiple occurences of character lead to one big suffix like
".tar.gz" instead of ".gz".  A leading dot means it's not a suffix but
a hidden file like ".exrc".
(edit-file): New function, brings up text editor for specified file.

* clisp-linux.lisp (env-lookup): New function for environment
variable lookup.

* types.lisp: New source file.
(*mcvs-types-name*, *mcvs-types*): New constants for TYPES filename.
(types-read, types-write, types-sanity-check,
types-to-import-wrapper-args): New functions.

* import.lisp (*types-comments*): New constant.
(mcvs-import): Restructured to build up list of file suffixes,
allow the user to edit the file which determines how they
are treated, filter out ignored files and pass -W options to cvs import
to handle the rest. Failed cvs import is turned into restartable

* mapping.lisp (mapping-generate-name): Takes a suffix parameter.
The F-files now carry a suffix obtained from the original file,
because I have concluded that this was the only reasonable way
to integrate with CVS.
1 kaz 1.1 ;;; This source file is part of the Meta-CVS program,
2     ;;; which is distributed under the GNU license.
3     ;;; Copyright 2002 Kaz Kylheku
5     (require "mapping")
6     (require "system")
7     (provide "types")
9     (eval-when (:compile-toplevel :load-toplevel :execute)
10     (defconstant *mcvs-types-name* "TYPES"))
12     (eval-when (:compile-toplevel :load-toplevel :execute)
13     (defconstant *mcvs-types* #.(path-cat *mcvs-dir* *mcvs-types-name*)))
15     (defun types-read (filename)
16     (with-open-file (file filename :direction :input)
17     (read file)))
19     (defun types-write (types filename &key comments)
20     (with-open-file (file filename :direction :output)
21     (let ((*print-right-margin* 1)
22     (sorted-types (sort (copy-list types)
23     #'string-lessp :key #'first)))
24     (when comments
25     (write-string comments file)
26     (terpri file))
27     (prin1 sorted-types file)
28     (terpri file))))
30     (defun types-sanity-check (types)
31     (cond
32     ((null types)
33     (values))
34     ((consp types)
35     (let ((type-spec (first types)))
36     (when (or (not (stringp (first type-spec)))
37     (not (symbolp (second type-spec))))
38     (error "mcvs: bad syntax in file types specification: ~s" type-spec))
39     (when (not (member (second type-spec)
40     '(:name-only :keep-old :default :value-only
41     :binary :ignore)))
42     (error "mcvs: unrecognized keyword: ~s" type-spec)))
43     (types-sanity-check (rest types)))
44     (t (error "mcvs: bad syntax in file types specification: ~s" types))))
46     (defun types-to-import-wrapper-args (types)
47     (mapcan #'(lambda (type-spec)
48     (destructuring-bind (suffix treatment) type-spec
49     (flet ((gen-option (suf opt) `("-W"
50     ,(format nil "*.~a -k '~a'"
51     suf opt))))
52     (ecase treatment
53     ((:name-only) (gen-option suffix "k"))
54     ((:keep-old) (gen-option suffix "o"))
55     ((:binary) (gen-option suffix "b"))
56     ((:value-only) (gen-option suffix "kv"))
57     ((:ignore) nil)
58     ((:default) nil)))))
59     types))

  ViewVC Help
Powered by ViewVC 1.1.5