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

Contents of /meta-cvs/F-233AD6EEE14894A7303F09519A2AB734

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.38 - (hide annotations)
Tue Apr 2 23:38:20 2002 UTC (12 years ago) by kaz
Branch: MAIN
Changes since 1.37: +10 -1 lines
First cut at implementing more automated branching and merging.

* mcvs-main.lisp (*branch-options*, *merge-options*): New constants.
(*mcvs-command-table*): New entries for branch and merge commands.
(*usage*): New help text.

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

  ViewVC Help
Powered by ViewVC 1.1.5