2 * Copyright (c) 1992, Brian Berliner and Jeff Polk
3 * Copyright (c) 1989-1992, Brian Berliner
5 * You may distribute under the terms of the GNU General Public License as
6 * specified in the README file that comes with the CVS source distribution.
8 * RCS source control definitions needed by rcs.c and friends
13 /* Strings which indicate a conflict if they occur at the start of a line. */
14 #define RCS_MERGE_PAT_1 "<<<<<<< "
15 #define RCS_MERGE_PAT_2 "=======\n"
16 #define RCS_MERGE_PAT_3 ">>>>>>> "
20 #define RCSHEAD "head"
21 #define RCSBRANCH "branch"
22 #define RCSSYMBOLS "symbols"
23 #define RCSDATE "date"
24 #define RCSDESC "desc"
25 #define RCSEXPAND "expand"
27 /* Used by the version of death support which resulted from old
28 versions of CVS (e.g. 1.5 if you define DEATH_SUPPORT and not
29 DEATH_STATE). Only a hacked up RCS (used by those old versions of
30 CVS) will put this into RCS files. Considered obsolete. */
31 #define RCSDEAD "dead"
33 #define DATEFORM "%02d.%02d.%02d.%02d.%02d.%02d"
34 #define SDATEFORM "%d.%d.%d.%d.%d.%d"
37 * Opaque structure definitions used by RCS specific lookup routines
39 #define VALID 0x1 /* flags field contains valid data */
40 #define INATTIC 0x2 /* RCS file is located in the Attic */
41 #define PARTIAL 0x4 /* RCS file not completly parsed */
43 /* All the "char *" fields in RCSNode, Deltatext, and RCSVers are
44 '\0'-terminated (except "text" in Deltatext). This means that we
45 can't deal with fields containing '\0', which is a limitation that
46 RCS does not have. Would be nice to fix this some day. */
50 /* Reference count for this structure. Used to deal with the
51 fact that there might be a pointer from the Vers_TS or might
52 not. Callers who increment this field are responsible for
53 calling freercsnode when they are done with their reference. */
56 /* Flags (INATTIC, PARTIAL, &c), see above. */
59 /* File name of the RCS file. This is not necessarily the name
60 as specified by the user, but it is a name which can be passed to
61 system calls and a name which is OK to print in error messages
62 (the various names might differ in case). */
65 /* Value for head keyword from RCS header, or NULL if empty. */
68 /* Value for branch keyword from RCS header, or NULL if omitted. */
71 /* Raw data on symbolic revisions. The first time that RCS_symbols is
72 called, we parse these into ->symbols, and free ->symbols_data. */
75 /* Value for expand keyword from RCS header, or NULL if omitted. */
78 /* List of nodes, the key of which is the symbolic name and the data
79 of which is the numeric revision that it corresponds to (malloc'd). */
82 /* List of nodes (type RCSVERS), the key of which the numeric revision
83 number, and the data of which is an RCSVers * for the revision. */
86 /* Value for access keyword from RCS header, or NULL if empty.
87 FIXME: RCS_delaccess would also seem to use "" for empty. We
88 should pick one or the other. */
91 /* Raw data on locked revisions. The first time that RCS_getlocks is
92 called, we parse these into ->locks, and free ->locks_data. */
95 /* List of nodes, the key of which is the numeric revision and the
96 data of which is the user that it corresponds to (malloc'd). */
99 /* Set for the strict keyword from the RCS header. */
102 /* Value for the comment keyword from RCS header (comment leader), or
106 /* Value for the desc field in the RCS file, or NULL if empty. */
109 /* File offset of the first deltatext node, so we can seek there. */
112 /* Newphrases from the RCS header. List of nodes, the key of which
113 is the "id" which introduces the newphrase, and the value of which
114 is the value from the newphrase. */
118 typedef struct rcsnode RCSNode;
123 /* Log message, or NULL if we do not intend to change the log message
124 (that is, RCS_copydeltas should just use the log message from the
128 /* Change text, or NULL if we do not intend to change the change text
129 (that is, RCS_copydeltas should just use the change text from the
130 file). Note that it is perfectly legal to have log be NULL and
131 text non-NULL, or vice-versa. */
135 /* Newphrase fields from deltatext nodes. FIXME: duplicates the
136 other field in the rcsversnode, I think. */
139 typedef struct deltatext Deltatext;
143 /* Duplicate of the key by which this structure is indexed. */
154 /* Newphrase fields from deltatext nodes. Also contains ";add" and
155 ";delete" magic fields (see rcs.c, log.c). I think this is
156 only used by log.c (where it looks up "log"). Duplicates the
157 other field in struct deltatext, I think. */
159 /* Newphrase fields from delta nodes. */
161 #ifdef PRESERVE_PERMISSIONS_SUPPORT
162 /* Hard link information for each revision. */
166 typedef struct rcsversnode RCSVers;
169 * CVS reserves all even-numbered branches for its own use. "magic" branches
170 * (see rcs.c) are contained as virtual revision numbers (within symbolic
171 * tags only) off the RCS_MAGIC_BRANCH, which is 0. CVS also reserves the
172 * ".1" branch for vendor revisions. So, if you do your own branching, you
173 * should limit your use to odd branch numbers starting at 3.
175 #define RCS_MAGIC_BRANCH 0
177 /* The type of a function passed to RCS_checkout. */
178 typedef void (*RCSCHECKOUTPROC) PROTO ((void *, const char *, size_t));
184 /* What RCS_deltas is supposed to do. */
185 enum rcs_delta_op {RCS_ANNOTATE, RCS_FETCH};
188 * exported interfaces
190 RCSNode *RCS_parse PROTO((const char *file, const char *repos));
191 RCSNode *RCS_parsercsfile PROTO((const char *rcsfile));
192 void RCS_fully_parse PROTO((RCSNode *));
193 void RCS_reparsercsfile PROTO((RCSNode *, FILE **, struct rcsbuffer *));
194 extern int RCS_setattic PROTO ((RCSNode *, int));
196 char *RCS_check_kflag PROTO((const char *arg));
197 char *RCS_getdate PROTO((RCSNode * rcs, const char *date,
198 int force_tag_match));
199 char *RCS_gettag PROTO((RCSNode * rcs, const char *symtag, int force_tag_match,
201 int RCS_exist_rev PROTO((RCSNode *rcs, char *rev));
202 int RCS_exist_tag PROTO((RCSNode *rcs, char *tag));
203 char *RCS_tag2rev PROTO((RCSNode *rcs, char *tag));
204 char *RCS_getversion PROTO((RCSNode * rcs, const char *tag, const char *date,
205 int force_tag_match, int *simple_tag));
206 char *RCS_magicrev PROTO((RCSNode *rcs, char *rev));
207 int RCS_isbranch PROTO((RCSNode *rcs, const char *rev));
208 int RCS_nodeisbranch PROTO((RCSNode *rcs, const char *tag));
209 char *RCS_whatbranch PROTO((RCSNode *rcs, const char *tag));
210 char *RCS_head PROTO((RCSNode * rcs));
211 int RCS_datecmp PROTO((const char *date1, const char *date2));
212 time_t RCS_getrevtime PROTO((RCSNode * rcs, const char *rev, char *date,
214 List *RCS_symbols PROTO((RCSNode *rcs));
215 void RCS_check_tag PROTO((const char *tag));
216 int RCS_valid_rev PROTO ((char *rev));
217 List *RCS_getlocks PROTO((RCSNode *rcs));
218 void freercsnode PROTO((RCSNode ** rnodep));
219 char *RCS_getbranch PROTO((RCSNode * rcs, const char *tag,
220 int force_tag_match));
221 char *RCS_branch_head PROTO ((RCSNode *rcs, char *rev));
223 int RCS_isdead PROTO((RCSNode *, const char *));
224 char *RCS_getexpand PROTO ((RCSNode *));
225 void RCS_setexpand PROTO ((RCSNode *, const char *));
226 int RCS_checkout PROTO ((RCSNode *, const char *, const char *, const char *,
227 const char *, const char *, RCSCHECKOUTPROC, void *));
228 int RCS_checkin PROTO ((RCSNode *rcs, const char *workfile,
229 const char *message, const char *rev, int flags));
230 int RCS_cmp_file PROTO((RCSNode *, const char *, char **, const char *,
231 const char *, const char *));
232 int RCS_settag PROTO ((RCSNode *, const char *, const char *));
233 int RCS_deltag PROTO ((RCSNode *, const char *));
234 int RCS_setbranch PROTO((RCSNode *, const char *));
235 int RCS_lock PROTO ((RCSNode *, const char *, int));
236 int RCS_unlock PROTO ((RCSNode *, char *, int));
237 int RCS_delete_revs PROTO ((RCSNode *, char *, char *, int));
238 void RCS_addaccess PROTO ((RCSNode *, char *));
239 void RCS_delaccess PROTO ((RCSNode *, char *));
240 char *RCS_getaccess PROTO ((RCSNode *));
241 RETSIGTYPE rcs_cleanup PROTO ((void));
242 void RCS_rewrite PROTO ((RCSNode *, Deltatext *, char *));
243 void RCS_abandon PROTO ((RCSNode *));
244 int rcs_change_text PROTO ((const char *, char *, size_t, const char *,
245 size_t, char **, size_t *));
246 void RCS_deltas PROTO ((RCSNode *, FILE *, struct rcsbuffer *, const char *,
247 enum rcs_delta_op, char **, size_t *,
249 void RCS_setincexc PROTO ((const char *arg));
250 void RCS_setlocalid PROTO ((const char *arg));
251 char *make_file_label PROTO ((const char *, const char *, RCSNode *));
254 extern int preserve_perms;
257 extern int add_rcs_file PROTO ((const char *, const char *, const char *,
258 const char *, const char *, const char *,
259 const char *, int, char **, const char *,