/[meta-cvs]/meta-cvs/F-233AD6EEE14894A7303F09519A2AB734
ViewVC logotype

Contents of /meta-cvs/F-233AD6EEE14894A7303F09519A2AB734

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.45 - (hide annotations)
Sun Jun 23 19:18:11 2002 UTC (11 years, 9 months ago) by kaz
Branch: MAIN
Changes since 1.44: +4 -4 lines
The ``import'' command is renamed to ``create''.

* mcvs.main (*create-options*): Renamed to *import-options*.
(*mcvs-command-table*): Updated.
(*usage*): Updated.

* import.lisp: File renamed to create.lisp.
(mcvs-import): Renamed to mcvs-create; some arguments renamed.
(mcvs-import-wrapper): Renamed to mcvs-create-wrapper.

* README: Updated.
1 kaz 1.16 ;;; This source file is part of the Meta-CVS program,
2 kaz 1.7 ;;; which is distributed under the GNU license.
3     ;;; Copyright 2002 Kaz Kylheku
4    
5 kaz 1.45 (require "create")
6 kaz 1.1 (require "checkout")
7     (require "add")
8 kaz 1.3 (require "remove")
9 kaz 1.4 (require "move")
10 kaz 1.1 (require "update")
11 kaz 1.12 (require "filt")
12 kaz 1.21 (require "generic")
13 kaz 1.25 (require "convert")
14 kaz 1.38 (require "branch")
15 kaz 1.44 (require "remap")
16 kaz 1.8 (require "split")
17     (require "restart")
18 kaz 1.27 (require "error")
19 kaz 1.10 (require "options")
20 kaz 1.33 (require "find-bind")
21 kaz 1.6 (provide "mcvs-main")
22 kaz 1.5
23 kaz 1.18 (defconstant *cvs-options*
24 kaz 1.33 '("H" "help" "Q" "q" "r" "w" "l" "n" "t" "v" "f" "version"
25 kaz 1.35 "nometa" "error-continue" "error-terminate"))
26 kaz 1.18
27 kaz 1.33 (defconstant *cvs-options-arg* '("T" "e" "d" "r" "z" "s"))
28 kaz 1.18
29 kaz 1.45 (defconstant *create-options* '(("d") ("k" "I" "b" "m" "W")))
30 kaz 1.18 (defconstant *checkout-options* '(("A" "N" "f") ("r" "D" "d" "k" "j")))
31 kaz 1.30 (defconstant *add-options* '(("R") ("k" "m")))
32 kaz 1.18 (defconstant *remove-options* '(("R") ()))
33 kaz 1.37 (defconstant *update-options* '(("A" "f" "p") ("k" "r" "D" "j" "I" "W")))
34 kaz 1.42 (defconstant *switch-options* '(() ("k" "I" "W")))
35 kaz 1.18 (defconstant *commit-options* '(("f") ("F" "m" "r")))
36     (defconstant *diff-options* '(("a" "b" "B" "brief" "c" "d" "e" "ed"
37     "expand-tabs" "f" "forward-ed" "H" "i"
38     "ignore-all-space" "ignore-blank-lines"
39     "ignore-case" "ignore-space-change"
40     "initial-tab" "l" "left-column" "minimal"
41     "n" "N" "new-file" "p" "P" "--paginate" "q"
42     "rcs" "report-identical-files" "s"
43     "show-c-function" "side-by-side"
44     "speed-large-files" "suppress-common-lines"
45     "t" "T" "text" "u" "unidirectional-new-file"
46     "w" "y")
47 kaz 1.19 ("C" "context" "D" "F" "horizon-lines" "ifdef"
48 kaz 1.18 "ignore-matching-lines" "L" "label"
49     "line-format" "new-group-format"
50     "new-line-format" "old-group-format"
51 kaz 1.19 "old-line-format" "r" "show-function-line"
52 kaz 1.18 "unchanged-group-format" "unchanged-line-format"
53     "U" "unified" "W" "width")))
54 kaz 1.21 (defconstant *tag-options* '(("l" "d" "f" "b" "F" "c") ("r" "D")))
55 kaz 1.22 (defconstant *log-options* '(("R" "h" "t" "N" "b") ("r" "d" "s" "w")))
56     (defconstant *status-options* '(("v") ()))
57 kaz 1.25 (defconstant *annotate-options* '(("f") ("r" "D")))
58 kaz 1.36 (defconstant *filt-options* '(() ("r" "D")))
59 kaz 1.25 (defconstant *convert-options* '(() ()))
60 kaz 1.38 (defconstant *branch-options* '(() ()))
61     (defconstant *merge-options* '(() ()))
62 kaz 1.39 (defconstant *remerge-options* '(() ()))
63 kaz 1.41 (defconstant *list-branches-options* '(() ()))
64 kaz 1.44 (defconstant *remap-options* '(() ()))
65 kaz 1.18
66 kaz 1.5 (defconstant *mcvs-command-table*
67 kaz 1.45 `(("create" ,#'mcvs-create-wrapper ,@*create-options*)
68 kaz 1.18 ("checkout" ,#'mcvs-checkout-wrapper ,@*checkout-options*)
69     ("co" ,#'mcvs-checkout-wrapper ,@*checkout-options*)
70     ("add" ,#'mcvs-add-wrapper ,@*add-options*)
71     ("remove" ,#'mcvs-remove-wrapper ,@*remove-options*)
72     ("rm" ,#'mcvs-remove-wrapper ,@*remove-options*)
73     ("move" ,#'mcvs-move-wrapper nil nil)
74     ("mv" ,#'mcvs-move-wrapper nil nil)
75     ("update" ,#'mcvs-update-wrapper ,@*update-options*)
76     ("up" ,#'mcvs-update-wrapper ,@*update-options*)
77     ("commit" ,#'mcvs-commit-wrapper ,@*commit-options*)
78     ("ci" ,#'mcvs-commit-wrapper ,@*commit-options*)
79     ("diff" ,#'mcvs-diff-wrapper ,@*diff-options*)
80 kaz 1.21 ("tag" ,#'mcvs-tag-wrapper ,@*tag-options*)
81 kaz 1.23 ("log" ,#'mcvs-log-wrapper ,@*log-options*)
82     ("status" ,#'mcvs-status-wrapper ,@*status-options*)
83 kaz 1.26 ("stat" ,#'mcvs-status-wrapper ,@*status-options*)
84 kaz 1.23 ("annotate" ,#'mcvs-annotate-wrapper ,@*annotate-options*)
85 kaz 1.36 ("filt" ,#'mcvs-filt-wrapper ,@*filt-options*)
86     ("fi" ,#'mcvs-filt-wrapper ,@*filt-options*)
87 kaz 1.38 ("convert" ,#'mcvs-convert-wrapper ,@*convert-options*)
88     ("branch" ,#'mcvs-branch-wrapper ,@*branch-options*)
89 kaz 1.42 ("switch" ,#'mcvs-switch-wrapper ,@*switch-options*)
90     ("sw" ,#'mcvs-switch-wrapper ,@*switch-options*)
91 kaz 1.39 ("merge" ,#'mcvs-merge-wrapper ,@*merge-options*)
92 kaz 1.41 ("remerge" ,#'mcvs-remerge-wrapper ,@*remerge-options*)
93     ("list-branches" ,#'mcvs-list-branches-wrapper ,@*list-branches-options*)
94 kaz 1.44 ("lb" ,#'mcvs-list-branches-wrapper ,@*list-branches-options*)
95     ("remap" ,#'mcvs-remap-wrapper ,@*remap-options*)))
96 kaz 1.5
97 kaz 1.33 (defconstant *usage*
98     "Meta-CVS command syntax:
99    
100     mcvs global-options command command-options-and-arguments
101    
102     Global options:
103    
104 kaz 1.35 -H --help Print this help and terminate. If a command is specified,
105     help specific to that command is printed instead.
106     -Q Very quiet, generate output only for serious problems. (*)
107     -q Somewhat quiet, some informational messages suppresed. (*)
108     -r Make working files read-only. (@)
109     -w Make new working files read-write (default). (@)
110     -l Do not log cvs command in command history, but execute
111     it anyway. (@)
112     -t Trace CVS execution. (@)
113     -v --version Display version information and terminate.
114     -f CVS not to read ~/.cvsrc file. (@)
115     --nometa Do not add Meta-CVS metafiles to the set of
116     files to commit, diff, stat, log or annotate.
117     --error-continue Instead of interactive error handling, automatically
118     continue all continuable errors.
119     --error-terminate Terminate without cleanup when an error happens instead
120     of interactive error handling (use with care).
121     -T tempdir Place temporary files in tempdir. (@)
122     -e editor Edit messages with editor. (*)
123     -d root Specify CVSROOT. (@)
124     -z gzip-level Specify compression level. (@)
125 kaz 1.33
126     Notes: (*) option processed by Meta-CVS and passed to CVS too.
127     (@) option merely passed to CVS.
128    
129     Commands:
130    
131 kaz 1.45 create Create new project from an existing file tree.
132 kaz 1.35 checkout (co) Retrieve a Meta-CVS project from CVS and build
133     working copy.
134     add Place files (or directories with add -R) under
135     version control.
136     remove (rm) Remove files or directories.
137     move (mv) Rename files and directories.
138     update (up) Incorporate latest changes from repository into
139     working copy.
140     commit (ci) Incorporate outstanding changes in the working copy
141     into the repository.
142     diff Compute differences between files in the working copy
143     and the repository or between revisions in the repository.
144     tag Associate a symbolic name with file revisions to create
145     an identifiable baseline. By default, tags the
146     revisions that were last synchronized with the
147     directory. A branch is created using tag -b.
148     log Display log information for files.
149     status (stat) Show current status of files.
150     annotate Perform a detailed analysis of files, showing the
151     version information about every individual line of text.
152     filt (fi) Act as a text filter, which converts Meta-CVS F- file
153     names to readable paths, according to the current mapping.
154 kaz 1.38 branch Create a managed branch. Meta-CVS managed branches keep
155     track of what has been merged where, so users don't have
156     to track merges with tags at all.
157     merge Merge a managed branch to the current branch or trunk.
158 kaz 1.40 remerge Re-apply the most recent merge without changing any tags.
159     Useful when a merge goes bad so the local changes have
160     to be discarded and the merge done over again.
161 kaz 1.41 list-branches (lb) List Meta-CVS managed branches.
162 kaz 1.43 switch (sw) Switch to a branch. With no arguments, switch to
163 kaz 1.42 main trunk.
164 kaz 1.44 remap Force Meta-CVS to notice and incorporate moves and
165     deletions that were performed directly on the sandbox.
166 kaz 1.35 convert Convert a CVS module to a Meta-CVS project. This requires
167     filesystem-level access to the repository. This is
168     currently an experimental command that is known not
169     to work 100%.")
170 kaz 1.33
171 kaz 1.5 (defun mcvs-execute (args)
172 kaz 1.27 (handler-bind ((error #'mcvs-error-handler))
173 kaz 1.18 (multiple-value-bind (global-options global-args)
174     (parse-opt args *cvs-options*
175     *cvs-options-arg* "mcvs")
176 kaz 1.33 (setf global-options (filter-global-options global-options))
177    
178     (find-bind (:test #'string= :key #'first)
179     ((help-long "help") (help "H") (quiet "q")
180 kaz 1.34 (very-quiet "Q") (version "v") (version-long "version")
181     (editor "e"))
182 kaz 1.33 global-options
183     (when (or help-long help)
184     (terpri)
185     (write-line *usage*)
186     (terpri)
187     (throw 'mcvs-terminate nil))
188     (when (or version version-long)
189 kaz 1.34 (let* ((vers (split-words "$Name: $" "$:- "))
190 kaz 1.33 (major (third vers))
191     (minor (fourth vers)))
192     (if (and major minor)
193     (format t "Meta-CVS version ~a.~a (c) 2002 Kaz Kylheku~%"
194     major minor)
195     (format t "Meta-CVS unknown version (c) 2002 Kaz Kylheku~%"))
196 kaz 1.34 (throw 'mcvs-terminate nil)))
197     (when editor
198     (setf *editor* (second editor)))
199     (cond
200     (very-quiet (setf *mcvs-chatter-level* *mcvs-silent*))
201     (quiet (setf *mcvs-chatter-level* *mcvs-terse*))
202     (t (setf *mcvs-chatter-level* *mcvs-info*))))
203 kaz 1.33
204 kaz 1.18 (when (not (first global-args))
205 kaz 1.35 (write-line "Meta-CVS requires a command argument.")
206 kaz 1.33 (write-line "Use mcvs -H to view help.")
207     (throw 'mcvs-terminate nil))
208    
209 kaz 1.18 (let ((command (find (first global-args) *mcvs-command-table*
210     :key #'first
211     :test #'string=)))
212 kaz 1.11 (when (not command)
213 kaz 1.18 (error "mcvs: ~a is not a recognized mcvs command."
214     (first global-args)))
215     (destructuring-bind (name func noarg-opts arg-opts) command
216     (declare (ignore name))
217 kaz 1.35 (find-bind (:test #'string= :key #'first)
218     (global-options (ec "error-continue") (et "error-terminate"))
219     global-options
220     (cond
221     (et (setf *mcvs-error-treatment* :terminate))
222     (ec (setf *mcvs-error-treatment* :continue)))
223    
224     (multiple-value-bind (command-options command-args)
225     (parse-opt (rest global-args)
226     noarg-opts arg-opts "mcvs")
227     (funcall func global-options command-options command-args)))))))
228 kaz 1.18 nil)
229 kaz 1.5
230 kaz 1.8 (defun mcvs-debug-shell ()
231 kaz 1.24 (let ((counter 0)
232     (*mcvs-error-treatment* :decline))
233     (loop
234     (format t "~&mcvs[~a]> " (incf counter))
235     (let ((line (string-trim #(#\space #\tab) (read-line))))
236 kaz 1.29 (restart-case
237 kaz 1.24 (cond
238     ((zerop (length line)))
239     ((string-equal line "exit")
240     (return-from mcvs-debug-shell))
241     ((char-equal (char line 0) #\!)
242     (print (eval (read-from-string (subseq line 1)))))
243 kaz 1.29 (t (mcvs-execute (split-words line #(#\space #\tab)))))
244 kaz 1.36 (debug () :report "Return to mcvs debug shell"
245 kaz 1.29 (terpri)))))))
246 kaz 1.10
247 kaz 1.5 #+clisp
248     (defun mcvs ()
249 kaz 1.28 (exit (catch 'mcvs-terminate (or (mcvs-execute ext:*args*)
250     *mcvs-errors-occured-p*))))

  ViewVC Help
Powered by ViewVC 1.1.5