Bug fix for vc-dispatcher split.
[bpt/emacs.git] / lisp / pcvs-parse.el
CommitLineData
3afbc435 1;;; pcvs-parse.el --- the CVS output parser
5b467bf4 2
80a831bc 3;; Copyright (C) 1991, 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999,
409cc4a3 4;; 2000, 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc.
5b467bf4 5
cc1eecfd 6;; Author: Stefan Monnier <monnier@iro.umontreal.ca>
5b467bf4 7;; Keywords: pcl-cvs
5b467bf4
SM
8
9;; This file is part of GNU Emacs.
10
11;; GNU Emacs is free software; you can redistribute it and/or modify
12;; it under the terms of the GNU General Public License as published by
b4aa6026 13;; the Free Software Foundation; either version 3, or (at your option)
5b467bf4
SM
14;; any later version.
15
16;; GNU Emacs is distributed in the hope that it will be useful,
17;; but WITHOUT ANY WARRANTY; without even the implied warranty of
18;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
19;; GNU General Public License for more details.
20
21;; You should have received a copy of the GNU General Public License
22;; along with GNU Emacs; see the file COPYING. If not, write to the
086add15
LK
23;; Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor,
24;; Boston, MA 02110-1301, USA.
5b467bf4
SM
25
26;;; Commentary:
27
1e98637e
SM
28;;; Bugs:
29
30;; - when merging a modified file, if the merge says that the file already
31;; contained in the changes, it marks the file as `up-to-date' although
32;; it might still contain further changes.
33;; Example: merging a zero-change commit.
5b467bf4
SM
34
35;;; Code:
36
37(eval-when-compile (require 'cl))
38
39(require 'pcvs-util)
40(require 'pcvs-info)
41
42;; imported from pcvs.el
43(defvar cvs-execute-single-dir)
44
45;; parse vars
46
47(defcustom cvs-update-prog-output-skip-regexp "$"
48 "*A regexp that matches the end of the output from all cvs update programs.
49That is, output from any programs that are run by CVS (by the flag -u
50in the `modules' file - see cvs(5)) when `cvs update' is performed should
51terminate with a line that this regexp matches. It is enough that
52some part of the line is matched.
53
54The default (a single $) fits programs without output."
55 :group 'pcl-cvs
56 :type '(regexp :value "$"))
57
58(defcustom cvs-parse-ignored-messages
59 '("Executing ssh-askpass to query the password.*$"
60 ".*Remote host denied X11 forwarding.*$")
61 "*A list of regexps matching messages that should be ignored by the parser.
62Each regexp should match a whole set of lines and should hence be terminated
63by `$'."
64 :group 'pcl-cvs
65 :type '(repeat regexp))
66
67;; a few more defvars just to shut up the compiler
68(defvar cvs-start)
69(defvar cvs-current-dir)
70(defvar cvs-current-subdir)
71(defvar dont-change-disc)
72
73;;;; The parser
74
75(defconst cvs-parse-known-commands
76 '("status" "add" "commit" "update" "remove" "checkout" "ci")
77 "List of CVS commands whose output is understood by the parser.")
78
79(defun cvs-parse-buffer (parse-spec dont-change-disc &optional subdir)
80 "Parse current buffer according to PARSE-SPEC.
81PARSE-SPEC is a function of no argument advancing the point and returning
82 either a fileinfo or t (if the matched text should be ignored) or
83 nil if it didn't match anything.
84DONT-CHANGE-DISC just indicates whether the command was changing the disc
6be6d579
SM
85 or not (useful to tell the difference between `cvs-examine' and `cvs-update'
86 output.
5b467bf4
SM
87The path names should be interpreted as relative to SUBDIR (defaults
88 to the `default-directory').
6be6d579 89Return a list of collected entries, or t if an error occurred."
5b467bf4
SM
90 (goto-char (point-min))
91 (let ((fileinfos ())
92 (cvs-current-dir "")
93 (case-fold-search nil)
94 (cvs-current-subdir (or subdir "")))
95 (while (not (or (eobp) (eq fileinfos t)))
96 (let ((ret (cvs-parse-run-table parse-spec)))
97 (cond
98 ;; it matched a known information message
99 ((cvs-fileinfo-p ret) (push ret fileinfos))
100 ;; it didn't match anything at all (impossible)
101 ((and (consp ret) (cvs-fileinfo-p (car ret)))
102 (setq fileinfos (append ret fileinfos)))
103 ((null ret) (setq fileinfos t))
104 ;; it matched something that should be ignored
105 (t nil))))
106 (nreverse fileinfos)))
107
108
109;; All those parsing macros/functions should return a success indicator
110(defsubst cvs-parse-msg () (buffer-substring cvs-start (1- (point))))
111
112;;(defsubst COLLECT (exp) (push exp *result*))
113;;(defsubst PROG (e) t)
114;;(defmacro SEQ (&rest seqs) (cons 'and seqs))
115
116(defmacro cvs-match (re &rest matches)
117 "Try to match RE and extract submatches.
118If RE matches, advance the point until the line after the match and
119then assign the variables as specified in MATCHES (via `setq')."
120 (cons 'cvs-do-match
121 (cons re (mapcar (lambda (match)
122 `(cons ',(first match) ,(second match)))
123 matches))))
124
125(defun cvs-do-match (re &rest matches)
126 "Internal function for the `cvs-match' macro.
127Match RE and if successful, execute MATCHES."
128 ;; Is it a match?
129 (when (looking-at re)
130 (goto-char (match-end 0))
131 ;; Skip the newline (unless we already are at the end of the buffer).
132 (when (and (eolp) (< (point) (point-max))) (forward-char))
133 ;; assign the matches
134 (dolist (match matches t)
135 (let ((val (cdr match)))
136 (set (car match) (if (integerp val) (match-string val) val))))))
137
138(defmacro cvs-or (&rest alts)
139 "Try each one of the ALTS alternatives until one matches."
140 `(let ((-cvs-parse-point (point)))
141 ,(cons 'or
142 (mapcar (lambda (es)
143 `(or ,es (ignore (goto-char -cvs-parse-point))))
144 alts))))
145(def-edebug-spec cvs-or t)
146
147;; This is how parser tables should be executed
148(defun cvs-parse-run-table (parse-spec)
149 "Run PARSE-SPEC and provide sensible default behavior."
150 (unless (bolp) (forward-line 1)) ;this should never be needed
151 (let ((cvs-start (point)))
152 (cvs-or
153 (funcall parse-spec)
154
155 (dolist (re cvs-parse-ignored-messages)
156 (when (cvs-match re) (return t)))
157
158 ;; This is a parse error. Create a message-type fileinfo.
159 (and
160 (cvs-match ".*$")
161 (cvs-create-fileinfo 'MESSAGE cvs-current-dir " "
6be6d579
SM
162 ;; (concat " Unknown msg: '"
163 (cvs-parse-msg) ;; "'")
5b467bf4
SM
164 :subtype 'ERROR)))))
165
166\f
167(defun cvs-parsed-fileinfo (type path &optional directory &rest keys)
168 "Create a fileinfo.
169TYPE can either be a type symbol or a cons of the form (TYPE . SUBTYPE).
170PATH is the filename.
171DIRECTORY influences the way PATH is interpreted:
172- if it's a string, it denotes the directory in which PATH (which should then be
173 a plain file name with no directory component) resides.
174- if it's nil, the PATH should not be trusted: if it has a directory
175 component, use it, else, assume it is relative to the current directory.
176- else, the PATH should be trusted to be relative to the root
177 directory (i.e. if there is no directory component, it means the file
178 is inside the main directory).
179The remaining KEYS are passed directly to `cvs-create-fileinfo'."
180 (let ((dir directory)
181 (file path))
182 ;; only trust the directory if it's a string
183 (unless (stringp directory)
184 ;; else, if the directory is true, the path should be trusted
185 (setq dir (or (file-name-directory path) (if directory "")))
186 (setq file (file-name-nondirectory path)))
187
188 (let ((type (if (consp type) (car type) type))
189 (subtype (if (consp type) (cdr type))))
190 (when dir (setq cvs-current-dir dir))
191 (apply 'cvs-create-fileinfo type
192 (concat cvs-current-subdir (or dir cvs-current-dir))
193 file (cvs-parse-msg) :subtype subtype keys))))
5b467bf4
SM
194\f
195;;;; CVS Process Parser Tables:
196;;;;
197;;;; The table for status and update could actually be merged since they
198;;;; don't conflict. But they don't overlap much either.
199
200(defun cvs-parse-table ()
201 "Table of message objects for `cvs-parse-process'."
0ded0280 202 (let (c file dir path base-rev subtype)
5b467bf4 203 (cvs-or
f1180544 204
5b467bf4
SM
205 (cvs-parse-status)
206 (cvs-parse-merge)
207 (cvs-parse-commit)
208
209 ;; this is not necessary because the fileinfo merging will remove
210 ;; such duplicate info and luckily the second info is the one we want.
211 ;; (and (cvs-match "M \\(.*\\)$" (path 1))
212 ;; (cvs-parse-merge path))
f1180544 213
5b467bf4
SM
214 ;; Normal file state indicator.
215 (and
216 (cvs-match "\\([MARCUPNJ?]\\) \\(.*\\)$" (c 1) (path 2))
217 ;; M: The file is modified by the user, and untouched in the repository.
218 ;; A: The file is "cvs add"ed, but not "cvs ci"ed.
219 ;; R: The file is "cvs remove"ed, but not "cvs ci"ed.
220 ;; C: Conflict
221 ;; U: The file is copied from the repository.
222 ;; P: The file was patched from the repository.
223 ;; ?: Unknown file.
224 (let ((code (aref c 0)))
e6a4ba73
SM
225 (cvs-parsed-fileinfo
226 (case code
227 (?M 'MODIFIED)
228 (?A 'ADDED)
229 (?R 'REMOVED)
230 (?? 'UNKNOWN)
231 (?C
232 (if (not dont-change-disc) 'CONFLICT
233 ;; This is ambiguous. We should look for conflict markers in the
234 ;; file to decide between CONFLICT and NEED-MERGE. With CVS-1.10
235 ;; servers, this should not be necessary, because they return
236 ;; a complete merge output.
237 (with-temp-buffer
cc39740b 238 (ignore-errors (insert-file-contents path))
e6a4ba73
SM
239 (goto-char (point-min))
240 (if (re-search-forward "^<<<<<<< " nil t)
241 'CONFLICT 'NEED-MERGE))))
242 (?J 'NEED-MERGE) ;not supported by standard CVS
243 ((?U ?P)
244 (if dont-change-disc 'NEED-UPDATE
245 (cons 'UP-TO-DATE (if (eq code ?U) 'UPDATED 'PATCHED)))))
246 path 'trust)))
5b467bf4
SM
247
248 (and
249 (cvs-match "pcl-cvs: descending directory \\(.*\\)$" (dir 1))
250 (setq cvs-current-subdir dir))
251
252 ;; A special cvs message
253 (and
1f3d429d
SM
254 (let ((case-fold-search t))
255 (cvs-match "cvs[.a-z]* [a-z]+: "))
5b467bf4
SM
256 (cvs-or
257
258 ;; CVS is descending a subdirectory
259 ;; (status says `examining' while update says `updating')
260 (and
261 (cvs-match "\\(Examining\\|Updating\\) \\(.*\\)$" (dir 2))
262 (let ((dir (if (string= "." dir) "" (file-name-as-directory dir))))
263 (cvs-parsed-fileinfo 'DIRCHANGE "." dir)))
264
265 ;; [-n update] A new (or pruned) directory appeared but isn't traversed
266 (and
267 (cvs-match "New directory `\\(.*\\)' -- ignored$" (dir 1))
f9e7890c 268 ;; (cvs-parsed-fileinfo 'MESSAGE " " (file-name-as-directory dir))
0ded0280
SM
269 ;; These messages either correspond to a true new directory
270 ;; that an update will bring in, or to a directory that's empty
271 ;; on the current branch (either because it only exists in other
272 ;; branches, or because it's been removed).
273 (if (ignore-errors
501719af 274 (with-temp-buffer
cc39740b
SM
275 (ignore-errors
276 (insert-file-contents
277 (expand-file-name ".cvsignore" (file-name-directory dir))))
0ded0280
SM
278 (goto-char (point-min))
279 (re-search-forward
280 (concat "^" (regexp-quote (file-name-nondirectory dir)) "/$")
281 nil t)))
282 t ;The user requested to ignore those messages.
283 (cvs-parsed-fileinfo '(NEED-UPDATE . NEW-DIR) dir t)))
5b467bf4
SM
284
285 ;; File removed, since it is removed (by third party) in repository.
286 (and
287 (cvs-or
a6631b3a
JB
288 ;; some cvs versions output quotes around these files
289 (cvs-match "warning: `\\(.*\\)' is not (any longer) pertinent$" (file 1))
5b467bf4 290 (cvs-match "warning: \\(.*\\) is not (any longer) pertinent$" (file 1))
bce848ed
SM
291 (cvs-match "`\\(.*\\)' is no longer in the repository$" (file 1))
292 (cvs-match "\\(.*\\) is no longer in the repository$" (file 1)))
389fe888
SM
293 (cvs-parsed-fileinfo
294 (if dont-change-disc '(NEED-UPDATE . REMOVED) 'DEAD) file))
5b467bf4
SM
295
296 ;; [add]
297 (and
298 (cvs-or
299 (cvs-match "scheduling file `\\(.*\\)' for addition.*$" (path 1))
300 (cvs-match "re-adding file \\(.*\\) (in place of .*)$" (path 1)))
301 (cvs-parsed-fileinfo 'ADDED path))
302
303 ;; [add] this will also show up as a `U <file>'
304 (and
571e4e61 305 (cvs-match "`?\\(.*?\\)'?, version \\(.*\\), resurrected$"
5b467bf4 306 (path 1) (base-rev 2))
f9e7890c
SM
307 ;; FIXME: resurrection only brings back the original version,
308 ;; not the latest on the branch, so `up-to-date' is not always
309 ;; what we want.
5b467bf4
SM
310 (cvs-parsed-fileinfo '(UP-TO-DATE . RESURRECTED) path nil
311 :base-rev base-rev))
312
313 ;; [remove]
314 (and
315 (cvs-match "removed `\\(.*\\)'$" (path 1))
316 (cvs-parsed-fileinfo 'DEAD path))
317
318 ;; [remove,merge]
319 (and
320 (cvs-match "scheduling `\\(.*\\)' for removal$" (file 1))
321 (cvs-parsed-fileinfo 'REMOVED file))
322
323 ;; [update] File removed by you, but not cvs rm'd
324 (and
325 (cvs-match "warning: \\(.*\\) was lost$" (path 1))
326 (cvs-match (concat "U " (regexp-quote path) "$"))
327 (cvs-parsed-fileinfo (if dont-change-disc
328 'MISSING
329 '(UP-TO-DATE . UPDATED))
330 path))
f1180544 331
5b467bf4
SM
332 ;; Mode conflicts (rather than contents)
333 (and
334 (cvs-match "conflict: ")
335 (cvs-or
336 (cvs-match "removed \\(.*\\) was modified by second party$"
337 (path 1) (subtype 'REMOVED))
338 (cvs-match "\\(.*\\) created independently by second party$"
339 (path 1) (subtype 'ADDED))
340 (cvs-match "\\(.*\\) is modified but no longer in the repository$"
341 (path 1) (subtype 'MODIFIED)))
342 (cvs-match (concat "C " (regexp-quote path)))
343 (cvs-parsed-fileinfo (cons 'CONFLICT subtype) path))
344
345 ;; Messages that should be shown to the user
346 (and
347 (cvs-or
348 (cvs-match "move away \\(.*\\); it is in the way$" (file 1))
349 (cvs-match "warning: new-born \\(.*\\) has disappeared$" (file 1))
350 (cvs-match "sticky tag .* for file `\\(.*\\)' is not a branch$"
351 (file 1)))
352 (cvs-parsed-fileinfo 'MESSAGE file))
f1180544 353
5b467bf4
SM
354 ;; File unknown.
355 (and (cvs-match "use `.+ add' to create an entry for \\(.*\\)$" (path 1))
356 (cvs-parsed-fileinfo 'UNKNOWN path))
357
cb3430a1
SM
358 ;; [commit]
359 (and (cvs-match "Up-to-date check failed for `\\(.+\\)'$" (file 1))
360 (cvs-parsed-fileinfo 'NEED-MERGE file))
361
5b467bf4
SM
362 ;; We use cvs-execute-multi-dir but cvs can't handle it
363 ;; Probably because the cvs-client can but the cvs-server can't
364 (and (cvs-match ".* files with '?/'? in their name.*$")
365 (not cvs-execute-single-dir)
366 (setq cvs-execute-single-dir t)
367 (cvs-create-fileinfo
368 'MESSAGE "" " "
369 "*** Add (setq cvs-execute-single-dir t) to your .emacs ***
370 See the FAQ file or the variable's documentation for more info."))
f1180544 371
5b467bf4
SM
372 ;; Cvs waits for a lock. Ignored: already handled by the process filter
373 (cvs-match "\\[..:..:..\\] \\(waiting for\\|obtained\\) .*lock in .*$")
374 ;; File you removed still exists. Ignore (will be noted as removed).
375 (cvs-match ".* should be removed and is still there$")
376 ;; just a note
80a831bc 377 (cvs-match "use ['`].+ commit' to \\sw+ th\\sw+ files? permanently$")
5b467bf4 378 ;; [add,status] followed by a more complete status description anyway
ed297fd6
SM
379 (and (cvs-match "nothing known about \\(.*\\)$" (path 1))
380 (cvs-parsed-fileinfo 'DEAD path 'trust))
5b467bf4
SM
381 ;; [update] problem with patch
382 (cvs-match "checksum failure after patch to .*; will refetch$")
383 (cvs-match "refetching unpatchable files$")
384 ;; [commit]
385 (cvs-match "Rebuilding administrative file database$")
1e98637e
SM
386 ;; ???
387 (cvs-match "--> Using per-directory sticky tag `.*'")
f1180544 388
5b467bf4
SM
389 ;; CVS is running a *info program.
390 (and
391 (cvs-match "Executing.*$")
392 ;; Skip by any output the program may generate to stdout.
393 ;; Note that pcl-cvs will get seriously confused if the
394 ;; program prints anything to stderr.
395 (re-search-forward cvs-update-prog-output-skip-regexp))))
396
397 (and
398 (cvs-match "cvs[.ex]* \\[[a-z]+ aborted\\]:.*$")
399 (cvs-parsed-fileinfo 'MESSAGE ""))
f1180544 400
5b467bf4
SM
401 ;; sadly you can't do much with these since the path is in the repository
402 (cvs-match "Directory .* added to the repository$")
403 )))
404
405
406(defun cvs-parse-merge ()
0ded0280 407 (let (path base-rev head-rev type)
5b467bf4
SM
408 ;; A merge (maybe with a conflict).
409 (and
410 (cvs-match "RCS file: .*$")
411 ;; Squirrel away info about the files that were retrieved for merging
412 (cvs-match "retrieving revision \\([0-9.]+\\)$" (base-rev 1))
413 (cvs-match "retrieving revision \\([0-9.]+\\)$" (head-rev 1))
414 (cvs-match "Merging differences between [0-9.]+ and [0-9.]+ into \\(.*\\)$"
415 (path 1))
416
417 ;; eat up potential conflict warnings
418 (cvs-or (cvs-match "\\(rcs\\)?merge:?\\( warning\\)?: \\(overlaps\\|conflicts\\) \\(or other problems \\)?during merge$" (type 'CONFLICT)) t)
419 (cvs-or
420 (and
421 (cvs-match "cvs[.ex]* [a-z]+: ")
422 (cvs-or
423 (cvs-match "conflicts found in \\(.*\\)$" (path 1) (type 'CONFLICT))
424 (cvs-match "could not merge .*$")
425 (cvs-match "restoring \\(.*\\) from backup file .*$" (path 1))))
426 t)
427
428 ;; Is it a succesful merge?
429 ;; Figure out result of merging (ie, was there a conflict?)
430 (let ((qfile (regexp-quote path)))
431 (cvs-or
432 ;; Conflict
433 (and
434 (cvs-match (concat "C \\(.*" qfile "\\)$") (path 1) (type 'CONFLICT))
435 ;; C might be followed by a "suprious" U for non-mergeable files
436 (cvs-or (cvs-match (concat "U \\(.*" qfile "\\)$")) t))
437 ;; Successful merge
438 (cvs-match (concat "M \\(.*" qfile "\\)$") (path 1))
439 ;; The file already contained the modifications
440 (cvs-match (concat "^\\(.*" qfile
441 "\\) already contains the differences between .*$")
442 (path 1) (type '(UP-TO-DATE . MERGED)))
443 t)
1e98637e
SM
444 ;; FIXME: PATH might not be set yet. Sometimes the only path
445 ;; information is in `RCS file: ...' (yuck!!).
5b467bf4
SM
446 (cvs-parsed-fileinfo (if dont-change-disc 'NEED-MERGE
447 (or type '(MODIFIED . MERGED))) path nil
448 :merge (cons base-rev head-rev))))))
449
450(defun cvs-parse-status ()
451 (let (nofile path base-rev head-rev type)
452 (and
453 (cvs-match
454 "===================================================================$")
455 (cvs-match "File: \\(no file \\)?\\(.*[^ \t]\\)[ \t]+Status: "
456 (nofile 1) (path 2))
457 (cvs-or
458 (cvs-match "Needs \\(Checkout\\|Patch\\)$"
459 (type (if nofile 'MISSING 'NEED-UPDATE)))
460 (cvs-match "Up-to-date$"
461 (type (if nofile '(UP-TO-DATE . REMOVED) 'UP-TO-DATE)))
1f3d429d 462 (cvs-match "File had conflicts on merge$" (type 'MODIFIED))
5b467bf4 463 (cvs-match ".*[Cc]onflict.*$" (type 'CONFLICT))
36317f13 464 (cvs-match "Locally Added$" (type 'ADDED))
5b467bf4
SM
465 (cvs-match "Locally Removed$" (type 'REMOVED))
466 (cvs-match "Locally Modified$" (type 'MODIFIED))
467 (cvs-match "Needs Merge$" (type 'NEED-MERGE))
f9e7890c 468 (cvs-match "Entry Invalid" (type '(NEED-MERGE . REMOVED)))
36317f13 469 (cvs-match ".*$" (type 'UNKNOWN)))
5b467bf4
SM
470 (cvs-match "$")
471 (cvs-or
472 (cvs-match " *Version:[ \t]*\\([0-9.]+\\).*$" (base-rev 1))
473 ;; NOTE: there's no date on the end of the following for server mode...
474 (cvs-match " *Working revision:[ \t]*-?\\([0-9.]+\\).*$" (base-rev 1))
475 ;; Let's not get all worked up if the format changes a bit
476 (cvs-match " *Working revision:.*$"))
477 (cvs-or
478 (cvs-match " *RCS Version:[ \t]*\\([0-9.]+\\)[ \t]*.*$" (head-rev 1))
479 (cvs-match " *Repository revision:[ \t]*\\([0-9.]+\\)[ \t]*\\(.*\\)$"
480 (head-rev 1))
481 (cvs-match " *Repository revision:.*"))
36317f13
SM
482 (cvs-or (cvs-match " *Expansion option:.*") t) ;Optional CVSNT thingie.
483 (cvs-or (cvs-match " *Commit Identifier:.*") t) ;Optional CVSNT thingie.
5b467bf4 484 (cvs-or
36317f13
SM
485 (and ;; Sometimes those fields are missing.
486 (cvs-match " *Sticky Tag:[ \t]*\\(.*\\)$") ; FIXME: use it.
487 (cvs-match " *Sticky Date:[ \t]*\\(.*\\)$") ; FIXME: use it.
488 (cvs-match " *Sticky Options:[ \t]*\\(.*\\)$")) ; FIXME: use it.
5b467bf4 489 t)
36317f13 490 (cvs-or (cvs-match " *Merge From:.*") t) ;Optional CVSNT thingie.
5b467bf4
SM
491 (cvs-match "$")
492 ;; ignore the tags-listing in the case of `status -v'
493 (cvs-or (cvs-match " *Existing Tags:\n\\(\t.*\n\\)*$") t)
494 (cvs-parsed-fileinfo type path nil
495 :base-rev base-rev
496 :head-rev head-rev))))
497
498(defun cvs-parse-commit ()
80a831bc 499 (let (path file base-rev subtype)
5b467bf4
SM
500 (cvs-or
501
502 (and
80a831bc
SM
503 (cvs-or
504 (cvs-match "\\(Checking in\\|Removing\\) \\(.*\\);$" (path 2))
505 t)
506 (cvs-match ".*,v <-- \\(.*\\)$" (file 1))
5b467bf4
SM
507 (cvs-or
508 ;; deletion
509 (cvs-match "new revision: delete; previous revision: \\([0-9.]*\\)$"
510 (subtype 'REMOVED) (base-rev 1))
511 ;; addition
512 (cvs-match "initial revision: \\([0-9.]*\\)$"
513 (subtype 'ADDED) (base-rev 1))
514 ;; update
515 (cvs-match "new revision: \\([0-9.]*\\); previous revision: .*$"
516 (subtype 'COMMITTED) (base-rev 1)))
80a831bc 517 (cvs-or (cvs-match "done$") t)
3a4653dc
SM
518 ;; In cvs-1.12.9 commit messages have been changed and became
519 ;; ambiguous. More specifically, the `path' above is not given.
520 ;; We assume here that in future releases the corresponding info will
521 ;; be put into `file'.
2f8e4cab
SM
522 (progn
523 ;; Try to remove the temp files used by VC.
3a4653dc 524 (vc-delete-automatic-version-backups (expand-file-name (or path file)))
2f8e4cab
SM
525 ;; it's important here not to rely on the default directory management
526 ;; because `cvs commit' might begin by a series of Examining messages
527 ;; so the processing of the actual checkin messages might begin with
528 ;; a `current-dir' set to something different from ""
80a831bc 529 (cvs-parsed-fileinfo (cons 'UP-TO-DATE subtype)
3a4653dc 530 (or path file) 'trust
2f8e4cab 531 :base-rev base-rev)))
f1180544 532
5b467bf4
SM
533 ;; useless message added before the actual addition: ignored
534 (cvs-match "RCS file: .*\ndone$"))))
535
536
537(provide 'pcvs-parse)
538
80a831bc 539;; arch-tag: 35418375-1a23-40a0-957d-96b0262f91d6
3afbc435 540;;; pcvs-parse.el ends here