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