2 * Copyright (C) 1986-2005 The Free Software Foundation, Inc.
4 * Portions Copyright (C) 1998-2005 Derek Price, Ximbiot <http://ximbiot.com>,
7 * Portions Copyright (C) 1992, Brian Berliner and Jeff Polk
8 * Portions Copyright (C) 1989-1992, Brian Berliner
10 * You may distribute under the terms of the GNU General Public License as
11 * specified in the README file that comes with the CVS source distribution.
13 * RCS source control definitions needed by rcs.c and friends
18 /* Strings which indicate a conflict if they occur at the start of a line. */
19 #define RCS_MERGE_PAT_1 "<<<<<<< "
20 #define RCS_MERGE_PAT_2 "=======\n"
21 #define RCS_MERGE_PAT_3 ">>>>>>> "
25 #define RCSHEAD "head"
26 #define RCSBRANCH "branch"
27 #define RCSSYMBOLS "symbols"
28 #define RCSDATE "date"
29 #define RCSDESC "desc"
30 #define RCSEXPAND "expand"
32 /* Used by the version of death support which resulted from old
33 versions of CVS (e.g. 1.5 if you define DEATH_SUPPORT and not
34 DEATH_STATE). Only a hacked up RCS (used by those old versions of
35 CVS) will put this into RCS files. Considered obsolete. */
36 #define RCSDEAD "dead"
38 #define DATEFORM "%02d.%02d.%02d.%02d.%02d.%02d"
39 #define SDATEFORM "%d.%d.%d.%d.%d.%d"
42 * Opaque structure definitions used by RCS specific lookup routines
44 #define VALID 0x1 /* flags field contains valid data */
45 #define INATTIC 0x2 /* RCS file is located in the Attic */
46 #define PARTIAL 0x4 /* RCS file not completly parsed */
48 /* All the "char *" fields in RCSNode, Deltatext, and RCSVers are
49 '\0'-terminated (except "text" in Deltatext). This means that we
50 can't deal with fields containing '\0', which is a limitation that
51 RCS does not have. Would be nice to fix this some day. */
55 /* Reference count for this structure. Used to deal with the
56 fact that there might be a pointer from the Vers_TS or might
57 not. Callers who increment this field are responsible for
58 calling freercsnode when they are done with their reference. */
61 /* Flags (INATTIC, PARTIAL, &c), see above. */
64 /* File name of the RCS file. This is not necessarily the name
65 as specified by the user, but it is a name which can be passed to
66 system calls and a name which is OK to print in error messages
67 (the various names might differ in case). */
70 /* Value for head keyword from RCS header, or NULL if empty. */
73 /* Value for branch keyword from RCS header, or NULL if omitted. */
76 /* Raw data on symbolic revisions. The first time that RCS_symbols is
77 called, we parse these into ->symbols, and free ->symbols_data. */
80 /* Value for expand keyword from RCS header, or NULL if omitted. */
83 /* List of nodes, the key of which is the symbolic name and the data
84 of which is the numeric revision that it corresponds to (malloc'd). */
87 /* List of nodes (type RCSVERS), the key of which the numeric revision
88 number, and the data of which is an RCSVers * for the revision. */
91 /* Value for access keyword from RCS header, or NULL if empty.
92 FIXME: RCS_delaccess would also seem to use "" for empty. We
93 should pick one or the other. */
96 /* Raw data on locked revisions. The first time that RCS_getlocks is
97 called, we parse these into ->locks, and free ->locks_data. */
100 /* List of nodes, the key of which is the numeric revision and the
101 data of which is the user that it corresponds to (malloc'd). */
104 /* Set for the strict keyword from the RCS header. */
107 /* Value for the comment keyword from RCS header (comment leader), or
111 /* Value for the desc field in the RCS file, or NULL if empty. */
114 /* File offset of the first deltatext node, so we can seek there. */
117 /* Newphrases from the RCS header. List of nodes, the key of which
118 is the "id" which introduces the newphrase, and the value of which
119 is the value from the newphrase. */
123 typedef struct rcsnode RCSNode;
128 /* Log message, or NULL if we do not intend to change the log message
129 (that is, RCS_copydeltas should just use the log message from the
133 /* Change text, or NULL if we do not intend to change the change text
134 (that is, RCS_copydeltas should just use the change text from the
135 file). Note that it is perfectly legal to have log be NULL and
136 text non-NULL, or vice-versa. */
140 /* Newphrase fields from deltatext nodes. FIXME: duplicates the
141 other field in the rcsversnode, I think. */
144 typedef struct deltatext Deltatext;
148 /* Duplicate of the key by which this structure is indexed. */
159 /* Newphrase fields from deltatext nodes. Also contains ";add" and
160 ";delete" magic fields (see rcs.c, log.c). I think this is
161 only used by log.c (where it looks up "log"). Duplicates the
162 other field in struct deltatext, I think. */
164 /* Newphrase fields from delta nodes. */
166 #ifdef PRESERVE_PERMISSIONS_SUPPORT
167 /* Hard link information for each revision. */
171 typedef struct rcsversnode RCSVers;
174 * CVS reserves all even-numbered branches for its own use. "magic" branches
175 * (see rcs.c) are contained as virtual revision numbers (within symbolic
176 * tags only) off the RCS_MAGIC_BRANCH, which is 0. CVS also reserves the
177 * ".1" branch for vendor revisions. So, if you do your own branching, you
178 * should limit your use to odd branch numbers starting at 3.
180 #define RCS_MAGIC_BRANCH 0
182 /* The type of a function passed to RCS_checkout. */
183 typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t));
189 /* What RCS_deltas is supposed to do. */
190 enum rcs_delta_op {RCS_ANNOTATE, RCS_FETCH};
193 * exported interfaces
195 RCSNode *RCS_parse PROTO((const char *file, const char *repos));
196 RCSNode *RCS_parsercsfile PROTO((const char *rcsfile));
197 void RCS_fully_parse PROTO((RCSNode *));
198 void RCS_reparsercsfile PROTO((RCSNode *, FILE **, struct rcsbuffer *));
199 extern int RCS_setattic PROTO ((RCSNode *, int));
201 char *RCS_check_kflag PROTO((const char *arg));
202 char *RCS_getdate PROTO((RCSNode * rcs, const char *date,
203 int force_tag_match));
204 char *RCS_gettag PROTO((RCSNode * rcs, const char *symtag, int force_tag_match,
206 int RCS_exist_rev PROTO((RCSNode *rcs, char *rev));
207 int RCS_exist_tag PROTO((RCSNode *rcs, char *tag));
208 char *RCS_tag2rev PROTO((RCSNode *rcs, char *tag));
209 char *RCS_getversion PROTO((RCSNode * rcs, const char *tag, const char *date,
210 int force_tag_match, int *simple_tag));
211 char *RCS_magicrev PROTO((RCSNode *rcs, char *rev));
212 int RCS_isbranch PROTO((RCSNode *rcs, const char *rev));
213 int RCS_nodeisbranch PROTO((RCSNode *rcs, const char *tag));
214 char *RCS_whatbranch PROTO((RCSNode *rcs, const char *tag));
215 char *RCS_head PROTO((RCSNode * rcs));
216 int RCS_datecmp PROTO((const char *date1, const char *date2));
217 time_t RCS_getrevtime PROTO((RCSNode * rcs, const char *rev, char *date,
219 List *RCS_symbols PROTO((RCSNode *rcs));
220 void RCS_check_tag PROTO((const char *tag));
221 int RCS_valid_rev PROTO ((char *rev));
222 List *RCS_getlocks PROTO((RCSNode *rcs));
223 void freercsnode PROTO((RCSNode ** rnodep));
224 char *RCS_getbranch PROTO((RCSNode * rcs, const char *tag,
225 int force_tag_match));
226 char *RCS_branch_head PROTO ((RCSNode *rcs, char *rev));
228 int RCS_isdead PROTO((RCSNode *, const char *));
229 char *RCS_getexpand PROTO ((RCSNode *));
230 void RCS_setexpand PROTO ((RCSNode *, const char *));
231 int RCS_checkout PROTO ((RCSNode *, const char *, const char *, const char *,
232 const char *, const char *, RCSCHECKOUTPROC, void *));
233 int RCS_checkin PROTO ((RCSNode *rcs, const char *workfile,
234 const char *message, const char *rev, time_t citime,
236 int RCS_cmp_file PROTO((RCSNode *, const char *, char **, const char *,
237 const char *, const char *));
238 int RCS_settag PROTO ((RCSNode *, const char *, const char *));
239 int RCS_deltag PROTO ((RCSNode *, const char *));
240 int RCS_setbranch PROTO((RCSNode *, const char *));
241 int RCS_lock PROTO ((RCSNode *, const char *, int));
242 int RCS_unlock PROTO ((RCSNode *, char *, int));
243 int RCS_delete_revs PROTO ((RCSNode *, char *, char *, int));
244 void RCS_addaccess PROTO ((RCSNode *, char *));
245 void RCS_delaccess PROTO ((RCSNode *, char *));
246 char *RCS_getaccess PROTO ((RCSNode *));
247 RETSIGTYPE rcs_cleanup PROTO ((void));
248 void RCS_rewrite PROTO ((RCSNode *, Deltatext *, char *));
249 void RCS_abandon PROTO ((RCSNode *));
250 int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
251 size_t, char **, size_t *));
252 void RCS_deltas PROTO ((RCSNode *, FILE *, struct rcsbuffer *, const char *,
253 enum rcs_delta_op, char **, size_t *,
255 void RCS_setincexc PROTO ((const char *arg));
256 void RCS_setlocalid PROTO ((const char *arg));
257 char *make_file_label PROTO ((const char *, const char *, RCSNode *));
260 extern int preserve_perms;
263 extern int add_rcs_file PROTO ((const char *, const char *, const char *,
264 const char *, const char *, const char *,
265 const char *, int, char **, const char *,