ViewVC logotype

Contents of /meta-cvs/F-9A67B1893CE1CF23455CD1EF0F486B65

Parent Directory Parent Directory | Revision Log Revision Log

Revision 1.17 - (show annotations)
Tue Nov 28 04:12:08 2006 UTC (7 years, 4 months ago) by kaz
Branch: MAIN
Changes since 1.16: +3 -3 lines
Getting rid of mcvs- prefixes.

* code/package.lisp (defpackage): shadow the merge symbol.

* code/purge.lisp (mcvs-purge): renamed to purge
(mcvs-purge-wrapper): renamed to purge-wrapper

* code/restore.lisp (mcvs-restore): renamed to restore
(mcvs-restore-wrapper): renamed to restore-wrapper

* code/update.lisp (mcvs-update): renamed to update
(mcvs-update-wrapper): renamed to update-wrapper

* code/main.lisp (mcvs-help): renamed to help
(*mcvs-command-table*): renamed to *command-table*
(mcvs-terminate catch): renamed to terminate.

* code/execute.lisp (mcvs-execute): renamed to execute

* code/move.lisp (mcvs-move): renamed to move
(mcvs-move-wrapper): renamed to move-wrapper

* code/grab.lisp (mcvs-grab): renamed to grab
(mcvs-grab-wrapper): renamed to grab-wrapper

* code/prop.lisp (mcvs-prop): renamed to prop
(mcvs-prop-wrapper): renamed to prop-wrapper

* code/filt.lisp (mcvs-filt-loop): renamed to filt-loop
(mcvs-filt): renamed to filt
(mcvs-remote-filt): renamed to remote-filt
(mcvs-filt-wrapper): renamed to filt-wrapper
(mcvs-remote-filt-wrapper): renamed to remote-filt-wrapper

* code/branch.lisp (mcvs-branch): renamed to branch
(mcvs-branch-wrapper): renamed to branch-wrapper
(mcvs-merge): renamed to merge
(mcvs-list-branches): renamed to list-branches
(mcvs-merge-wrapper): renamed to merge-wrapper
(mcvs-remerge-wrapper): renamed to remerge-wrapper
(mcvs-list-branches-wrapper): renamed to list-branches-wrapper
(mcvs-switch-wrapper): renamed to switch-wrapper

* code/link.lisp (mcvs-link): renamed to ln
(mcvs-link-wrapper): renamed to link-wrapper

* code/watch.lisp (mcvs-watch): renamed to watch
(mcvs-watch-wrapper): renamed to watch-wrapper

* code/add.lisp (mcvs-add): renamed to add
(mcvs-add-wrapper): renamed to add-wrapper

* code/remove.lisp (mcvs-remove): renamed to rm
(mcvs-remove-wrapper): renamed to remove-wrapper

* code/convert.lisp (mcvs-convert): renamed to convert
(mcvs-convert-wrapper): renamed to convert-wrapper

* code/error.lisp (mcvs-terminate): renamed to terminate
(mcvs-error-handler): renamed to error-handler
(*mcvs-error-treatment*): renamed to *error-treatment*
(*mcvs-errors-occured-p*): renamed to *errors-occured-p*

* code/checkout.lisp (mcvs-checkout): renamed to checkout
(mcvs-checkout-wrapper): renamed to checkout-wrapper
(mcvs-export-wrapper): renamed to export-wrapper

* code/generic.lisp (mcvs-generic): renamed to generic
(mcvs-commit-wrapper): renamed to commit-wrapper
(mcvs-diff-wrapper): renamed to diff-wrapper
(mcvs-tag-wrapper): renamed to tag-wrapper
(mcvs-log-wrapper): renamed to log-wrapper
(mcvs-status-wrapper): renamed to status-wrapper
(mcvs-annotate-wrapper): renamed to annotate-wrapper
(mcvs-watchers-wrapper): renamed to watchers-wrapper
(mcvs-edit-wrapper): renamed to edit-wrapper
(mcvs-unedit-wrapper): renamed to unedit-wrapper
(mcvs-editors-wrapper): renamed to editors-wrapper
(mcvs-sync-to-wrapper): renamed to sync-to-wrapper
(mcvs-sync-from-wrapper): renamed to sync-from-wrapper

* code/create.lisp (mcvs-create): renamed to create
(mcvs-create-wrapper): renamed to create-wrapper

* code/remap.lisp (mcvs-remap): renamed to remap
(mcvs-remap-wrapper): renamed to remap-wrapper

* code/mapping.lisp (mcvs-locate): renamed to locate
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 (in-package :meta-cvs)
7 (defun remove-attic-component (path)
8 (let ((split-path (nreverse (split-fields path "/")))
9 (attic-p nil))
10 (when (string= (first split-path) "Attic")
11 (pop split-path)
12 (setf attic-p t))
13 (values (reduce #'(lambda (x y) (format nil "~a/~a" x y))
14 (nreverse split-path)
15 :initial-value ".")
16 attic-p)))
18 (defun classify-tags (tags)
19 (let (version-tags branch-tags)
20 (dolist (tag tags (values version-tags branch-tags))
21 (destructuring-bind (tag-name tag-value) tag
22 (if (search ".0." tag-value)
23 (push tag-name branch-tags)
24 (push tag-name version-tags))))))
26 (defun convert (source-dir target-dir)
27 (when (ignore-errors (stat target-dir))
28 (error "a directory or file called ~a exists here already."
29 target-dir))
31 (multiple-value-bind (path created)
32 (ensure-directories-exist (path-cat target-dir
33 *mcvs-map-name*))
34 (declare (ignore path))
35 (if (not created)
36 (error "unable to create directory ~a." target-dir)))
38 (let (filemap all-version-tags all-branch-tags attic-made)
39 (current-dir-restore
40 (chdir source-dir)
41 (for-each-file-info (fi ".")
42 (when (and (directory-p fi)
43 (path-equal (basename (file-name fi)) "CVS"))
44 (skip))
45 (when (regular-p fi)
46 (let ((canon-name (canonicalize-path (file-name fi))))
47 (multiple-value-bind (suffix basename dir)
48 (suffix canon-name #\,)
49 (multiple-value-bind (no-attic-dir attic-p)
50 (remove-attic-component (or dir "."))
51 (when (and suffix (string= suffix "v"))
52 (let* ((no-attic-suffix-name
53 (canonicalize-path (path-cat no-attic-dir basename)))
54 (f-name (mapping-generate-id :suffix (suffix basename)
55 :no-dir t))
56 (orig-rcs (path-cat source-dir canon-name))
57 (new-rcs (apply #'path-cat `(,target-dir
58 ,@(if attic-p '("Attic"))
59 ,(format nil "~A,v"
60 f-name)))))
61 (in-original-dir
62 (when attic-p
63 (unless attic-made
64 (ensure-directories-exist new-rcs)
65 (setf attic-made t)))
66 (chatter-info "hard linking ~a -> ~a~%" orig-rcs new-rcs)
67 (link orig-rcs new-rcs))
68 (push (make-mapping-entry :kind :file
69 :id (path-cat *mcvs-dir* f-name)
70 :path no-attic-suffix-name
71 :executable (executable-p fi))
72 filemap)
73 (with-open-file (f (parse-posix-namestring canon-name)
74 :direction :input)
75 (chatter-info "scanning ~a~%" canon-name)
76 (let ((rcs-file (rcs-parse f)))
77 (multiple-value-bind (version-tags branch-tags)
78 (classify-tags (rcs-admin-symbols (rcs-file-admin rcs-file)))
79 (setf all-version-tags (nunion all-version-tags
80 version-tags
81 :test #'string=))
82 (setf all-branch-tags (nunion all-branch-tags branch-tags
83 :test #'string=)))))))))))))
85 (current-dir-restore
86 (chdir target-dir)
87 (chatter-info "writing ~a~%" *mcvs-map-name*)
88 (mapping-write filemap *mcvs-map-name* :sort-map t)
90 (chatter-info "writing ~a~%" *mcvs-types-name*)
91 (with-open-file (f *mcvs-types-name* :direction :output)
92 (prin1 nil f)
93 (terpri f))
95 (chatter-info "writing .cvsignore~%")
96 (with-open-file (f (make-pathname :name ".cvsignore") :direction :output)
97 (write-line *mcvs-map-local-name* f)
98 (write-line *mcvs-displaced-name* f))
100 (execute-program `("ci" "-mCreated by Meta-CVS convert operation."
101 "-t/dev/null" ,*mcvs-map-name*
102 ,*mcvs-types-name* ".cvsignore"))
103 (execute-program `("chmod" "ug+rw" ,(format nil "~A,v" *mcvs-map-name*)))
105 (chatter-info "setting up version and branch tags in ~a, ~a and .cvsignore~%"
106 *mcvs-map-name* *mcvs-types-name*)
107 (unless (null all-version-tags)
108 (execute-program-xargs '("rcs")
109 (mapcar #'(lambda (tag)
110 (format nil "-n~A:1.1" tag))
111 all-version-tags)
112 (list *mcvs-map-name* *mcvs-types-name*
113 ".cvsignore")))
115 (let ((branch-counter 0))
116 (unless (null all-branch-tags)
117 (execute-program-xargs '("rcs")
118 (mapcar #'(lambda (tag)
119 (format nil
120 "-n~A:1.1.0.~A"
121 tag (incf branch-counter
122 2)))
123 all-branch-tags)
124 (list *mcvs-map-name* *mcvs-types-name*
125 ".cvsignore")))))))
127 (defun convert-wrapper (cvs-options cvs-command-options mcvs-args)
128 (declare (ignore cvs-options cvs-command-options))
129 (if (/= (length mcvs-args) 2)
130 (error "specify cvs source dir and new target dir."))
131 (convert (first mcvs-args) (second mcvs-args)))
133 (defconstant *convert-help*
134 "Syntax:
136 mcvs convert source-cvs-module target-mcvs-module
138 Options:
140 None.
142 Semantics:
144 The convert command builds a Meta-CVS module directly out of the RCS files of
145 a CVS module. The source-cvs-module is the pathname to an existing
146 module directory in the CVS repository containing an ordinary CVS module.
147 The target-mcvs-module is the pathname of a new Meta-CVS module directory to
148 be created.
150 The source and target paths have to be on the same filesystem volume.
152 The chmod and rcs programs are required.
154 The algorithm is extremely naive:
156 - A list of the pathnames of the RCS files is collected, as the basis for
157 creating the MAP file. The Attic directory components are removed from these
158 paths, and the ,v suffixes are stripped.
160 - The execute property of files is lifted from the permission bits on
161 the RCS files.
163 - The MAP,v file is created using the ``rcs ci'' command.
165 - The F- files are generated as hard links to the RCS files, to save space
166 and avoid the overhead of copying.
168 - All of the RCS files are scanned to find version and branch tags. Quite
169 naively, the version tags are installed in the MAP file, all pointing to
170 revision 1.1. The branch tags are installed in MAP, pointing to revisions
171,, ... This is a lame attempt to make it possible to check
172 out past baselines. But note that the contents of MAP don't vary: only a
173 single version node is generated with a fixed set of files. It is not taken
174 into consideration that some of the CVS files may be deleted in the head
175 revision or some branches. Therefore, when the resulting Meta-CVS project is
176 checked out, or when past versions are retrieved, there may be complaints
177 from Meta-CVS about nonexistent files.
179 The complaints about nonexistent files may be fixed at the tips of the
180 main trunk or branches using the ``mcvs remap'' command which will purge
181 the working MAP of entries for F- files for which no working copy is found.
182 A commit will then commit the change so that subsequent work may continue
183 without any more complaints.
185 The hard linking of the original RCS objects under F- names means that any
186 permission, ownership or time-stamp changes done in the CVS module will
187 affect the content of the Meta-CVS module and vice versa. Destructive
188 modifications to the file contents, ditto. Be careful!
190 If the hard links make you nervous, do a deep copy of the module,
191 using ``cp -a source-dir target-dir''.
193 Note that CVS does not destructively manipulate RCS files. A commit
194 or tagging operation creates a new RCS object which atomically replaces the
195 old hard link. This means that a commit to a file in the Meta-CVS module will
196 not affect the CVS module and vice versa.")

  ViewVC Help
Powered by ViewVC 1.1.5