Function: cvs-parse-table

cvs-parse-table is a byte-compiled function defined in pcvs-parse.el.gz.

Signature

(cvs-parse-table)

Documentation

Table of message objects for cvs-parse-process.

Source Code

;; Defined in /usr/src/emacs/lisp/vc/pcvs-parse.el.gz
;;;; CVS Process Parser Tables:
;;
;; The table for status and update could actually be merged since they
;; don't conflict.  But they don't overlap much either.

(defun cvs-parse-table ()
  "Table of message objects for `cvs-parse-process'."
  (with-suppressed-warnings ((lexical c file dir path base-rev subtype))
    (defvar c) (defvar file) (defvar dir) (defvar path) (defvar base-rev)
    (defvar subtype))
  (let (c file dir path base-rev subtype)
    (cvs-or

     (cvs-parse-status)
     (cvs-parse-merge)
     (cvs-parse-commit)

     ;; this is not necessary because the fileinfo merging will remove
     ;; such duplicate info and luckily the second info is the one we want.
     ;; (and (cvs-match "M \\(.*\\)$" (path 1))
     ;;      (cvs-parse-merge path))

     ;; Normal file state indicator.
     (and
      (cvs-match "\\([MARCUPNJ?]\\) \\(.*\\)$" (c 1) (path 2))
      ;; M: The file is modified by the user, and untouched in the repository.
      ;; A: The file is "cvs add"ed, but not "cvs ci"ed.
      ;; R: The file is "cvs remove"ed, but not "cvs ci"ed.
      ;; C: Conflict
      ;; U: The file is copied from the repository.
      ;; P: The file was patched from the repository.
      ;; ?: Unknown file.
      (let ((code (aref c 0)))
	(cvs-parsed-fileinfo
	 (pcase code
	   (?M 'MODIFIED)
	   (?A 'ADDED)
	   (?R 'REMOVED)
	   (?? 'UNKNOWN)
	   (?C
	    (if (not dont-change-disc) 'CONFLICT
	      ;; This is ambiguous.  We should look for conflict markers in the
	      ;; file to decide between CONFLICT and NEED-MERGE.  With CVS-1.10
	      ;; servers, this should not be necessary, because they return
	      ;; a complete merge output.
	      (with-temp-buffer
		(ignore-errors (insert-file-contents path))
		(goto-char (point-min))
		(if (re-search-forward "^<<<<<<< " nil t)
		    'CONFLICT 'NEED-MERGE))))
	   (?J 'NEED-MERGE)		;not supported by standard CVS
	   ((or ?U ?P)
	    (if dont-change-disc 'NEED-UPDATE
	      (cons 'UP-TO-DATE (if (eq code ?U) 'UPDATED 'PATCHED)))))
	 path 'trust)))

     (and
      (cvs-match "pcl-cvs: descending directory \\(.*\\)$" (dir 1))
      (setq cvs-current-subdir dir))

     ;; A special cvs message
     (and
      (let ((case-fold-search t))
	(cvs-match "cvs[.a-z]* [a-z]+: "))
      (cvs-or

       ;; CVS is descending a subdirectory
       ;; (status says `examining' while update says `updating')
       (and
	(cvs-match "\\(Examining\\|Updating\\) \\(.*\\)$" (dir 2))
	(let ((dir (if (string= "." dir) "" (file-name-as-directory dir))))
	  (cvs-parsed-fileinfo 'DIRCHANGE "." dir)))

       ;; [-n update] A new (or pruned) directory appeared but isn't traversed
       (and
	(cvs-match "New directory `\\(.*\\)' -- ignored$" (dir 1))
	;; (cvs-parsed-fileinfo 'MESSAGE " " (file-name-as-directory dir))
	;; These messages either correspond to a true new directory
	;; that an update will bring in, or to a directory that's empty
	;; on the current branch (either because it only exists in other
	;; branches, or because it's been removed).
	(if (ignore-errors
	      (with-temp-buffer
                (ignore-errors
                  (insert-file-contents
                   (expand-file-name ".cvsignore" (file-name-directory dir))))
		(goto-char (point-min))
		(re-search-forward
		 (concat "^" (regexp-quote (file-name-nondirectory dir)) "/$")
		 nil t)))
	    t		       ;The user requested to ignore those messages.
	  (cvs-parsed-fileinfo '(NEED-UPDATE . NEW-DIR) dir t)))

       ;; File removed, since it is removed (by third party) in repository.
       (and
	(cvs-or
         ;; some cvs versions output quotes around these files
	 (cvs-match "warning: `\\(.*\\)' is not (any longer) pertinent$" (file 1))
	 (cvs-match "warning: \\(.*\\) is not (any longer) pertinent$" (file 1))
	 (cvs-match "`\\(.*\\)' is no longer in the repository$" (file 1))
         (cvs-match "\\(.*\\) is no longer in the repository$" (file 1)))
	(cvs-parsed-fileinfo
	 (if dont-change-disc '(NEED-UPDATE . REMOVED) 'DEAD) file))

       ;; [add]
       (and
	(cvs-or
	 (cvs-match "scheduling file `\\(.*\\)' for addition.*$" (path 1))
	 (cvs-match "re-adding file \\(.*\\) (in place of .*)$" (path 1)))
	(cvs-parsed-fileinfo 'ADDED path))

       ;; [add] this will also show up as a `U <file>'
       (and
	(cvs-match "`?\\(.*?\\)'?, version \\(.*\\), resurrected$"
		   (path 1) (base-rev 2))
	;; FIXME: resurrection only brings back the original version,
	;; not the latest on the branch, so `up-to-date' is not always
	;; what we want.
	(cvs-parsed-fileinfo '(UP-TO-DATE . RESURRECTED) path nil
			     :base-rev base-rev))

       ;; [remove]
       (and
	(cvs-match "removed `\\(.*\\)'$" (path 1))
	(cvs-parsed-fileinfo 'DEAD path))

       ;; [remove,merge]
       (and
	(cvs-match "scheduling `\\(.*\\)' for removal$" (file 1))
	(cvs-parsed-fileinfo 'REMOVED file))

       ;; [update] File removed by you, but not cvs rm'd
       (and
	(cvs-match "warning: \\(.*\\) was lost$" (path 1))
	(cvs-match (concat "U " (regexp-quote path) "$"))
	(cvs-parsed-fileinfo (if dont-change-disc
				 'MISSING
			       '(UP-TO-DATE . UPDATED))
			     path))

       ;; Mode conflicts (rather than contents)
       (and
	(cvs-match "conflict: ")
	(cvs-or
	 (cvs-match "removed \\(.*\\) was modified by second party$"
		    (path 1) (subtype 'REMOVED))
	 (cvs-match "\\(.*\\) created independently by second party$"
		    (path 1) (subtype 'ADDED))
	 (cvs-match "\\(.*\\) is modified but no longer in the repository$"
		    (path 1) (subtype 'MODIFIED)))
	(cvs-match (concat "C " (regexp-quote path)))
	(cvs-parsed-fileinfo (cons 'CONFLICT subtype) path))

       ;; Messages that should be shown to the user
       (and
	(cvs-or
	 (cvs-match "move away \\(.*\\); it is in the way$" (file 1))
	 (cvs-match "warning: new-born \\(.*\\) has disappeared$" (file 1))
	 (cvs-match "sticky tag .* for file `\\(.*\\)' is not a branch$"
		    (file 1)))
	(cvs-parsed-fileinfo 'MESSAGE file))

       ;; File unknown.
       (and (cvs-match "use `.+ add' to create an entry for \\(.*\\)$" (path 1))
	    (cvs-parsed-fileinfo 'UNKNOWN path))

       ;; [commit]
       (and (cvs-match "Up-to-date check failed for `\\(.+\\)'$" (file 1))
	    (cvs-parsed-fileinfo 'NEED-MERGE file))

       ;; We use cvs-execute-multi-dir but cvs can't handle it
       ;; Probably because the cvs-client can but the cvs-server can't
       (and (cvs-match ".* files with '?/'? in their name.*$")
	    (not cvs-execute-single-dir)
	    (setq cvs-execute-single-dir t)
	    (cvs-create-fileinfo
	     'MESSAGE "" " "
	     "*** Add (setq cvs-execute-single-dir t) to your .emacs ***
	See the FAQ file or the variable's documentation for more info."))

       ;; Cvs waits for a lock.  Ignored: already handled by the process filter
       (cvs-match "\\[..:..:..\\] \\(waiting for\\|obtained\\) .*lock in .*$")
       ;; File you removed still exists.  Ignore (will be noted as removed).
       (cvs-match ".* should be removed and is still there$")
       ;; just a note
       (cvs-match "use ['`].+ commit' to \\sw+ th\\sw+ files? permanently$")
       ;; [add,status] followed by a more complete status description anyway
       (and (cvs-match "nothing known about \\(.*\\)$" (path 1))
	    (cvs-parsed-fileinfo 'DEAD path 'trust))
       ;; [update] problem with patch
       (cvs-match "checksum failure after patch to .*; will refetch$")
       (cvs-match "refetching unpatchable files$")
       ;; [commit]
       (cvs-match "Rebuilding administrative file database$")
       ;; ???
       (cvs-match "--> Using per-directory sticky tag `.*'")

       ;; CVS is running a *info program.
       (and
	(cvs-match "Executing.*$")
	;; Skip by any output the program may generate to stdout.
	;; Note that pcl-cvs will get seriously confused if the
	;; program prints anything to stderr.
	(re-search-forward cvs-update-prog-output-skip-regexp))))

     (and
      (cvs-match "cvs[.ex]* \\[[a-z]+ aborted\\]:.*$")
      (cvs-parsed-fileinfo 'MESSAGE ""))

     ;; sadly you can't do much with these since the path is in the repository
     (cvs-match "Directory .* added to the repository$")
     )))