]> CyberLeo.Net >> Repos - FreeBSD/releng/10.0.git/blob - contrib/subversion/subversion/include/svn_types.h
- Copy stable/10 (r259064) to releng/10.0 as part of the
[FreeBSD/releng/10.0.git] / contrib / subversion / subversion / include / svn_types.h
1 /**
2  * @copyright
3  * ====================================================================
4  *    Licensed to the Apache Software Foundation (ASF) under one
5  *    or more contributor license agreements.  See the NOTICE file
6  *    distributed with this work for additional information
7  *    regarding copyright ownership.  The ASF licenses this file
8  *    to you under the Apache License, Version 2.0 (the
9  *    "License"); you may not use this file except in compliance
10  *    with the License.  You may obtain a copy of the License at
11  *
12  *      http://www.apache.org/licenses/LICENSE-2.0
13  *
14  *    Unless required by applicable law or agreed to in writing,
15  *    software distributed under the License is distributed on an
16  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17  *    KIND, either express or implied.  See the License for the
18  *    specific language governing permissions and limitations
19  *    under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_types.h
24  * @brief Subversion's data types
25  */
26
27 #ifndef SVN_TYPES_H
28 #define SVN_TYPES_H
29
30 /* ### this should go away, but it causes too much breakage right now */
31 #include <stdlib.h>
32 #include <limits.h> /* for ULONG_MAX */
33
34 #include <apr.h>         /* for apr_size_t, apr_int64_t, ... */
35 #include <apr_errno.h>   /* for apr_status_t */
36 #include <apr_pools.h>   /* for apr_pool_t */
37 #include <apr_hash.h>    /* for apr_hash_t */
38 #include <apr_tables.h>  /* for apr_array_push() */
39 #include <apr_time.h>    /* for apr_time_t */
40 #include <apr_strings.h> /* for apr_atoi64() */
41
42 #ifdef __cplusplus
43 extern "C" {
44 #endif /* __cplusplus */
45
46
47 \f
48 /** Macro used to mark deprecated functions.
49  *
50  * @since New in 1.6.
51  */
52 #ifndef SVN_DEPRECATED
53 # if !defined(SWIGPERL) && !defined(SWIGPYTHON) && !defined(SWIGRUBY)
54 #  if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__==3 && __GNUC_MINOR__>=1))
55 #   define SVN_DEPRECATED __attribute__((deprecated))
56 #  elif defined(_MSC_VER) && _MSC_VER >= 1300
57 #   define SVN_DEPRECATED __declspec(deprecated)
58 #  else
59 #   define SVN_DEPRECATED
60 #  endif
61 # else
62 #  define SVN_DEPRECATED
63 # endif
64 #endif
65
66 \f
67 /** Indicate whether the current platform supports unaligned data access.
68  *
69  * On the majority of machines running SVN (x86 / x64), unaligned access
70  * is much cheaper than repeated aligned access. Define this macro to 1
71  * on those machines.
72  * Unaligned access on other machines (e.g. IA64) will trigger memory
73  * access faults or simply misbehave.
74  *
75  * Note: Some platforms may only support unaligned access for integers
76  * (PowerPC).  As a result this macro should only be used to determine
77  * if unaligned access is supported for integers.
78  *
79  * @since New in 1.7.
80  */
81 #ifndef SVN_UNALIGNED_ACCESS_IS_OK
82 # if defined(_M_IX86) || defined(i386) \
83      || defined(_M_X64) || defined(__x86_64) \
84      || defined(__powerpc__) || defined(__ppc__)
85 #  define SVN_UNALIGNED_ACCESS_IS_OK 1
86 # else
87 #  define SVN_UNALIGNED_ACCESS_IS_OK 0
88 # endif
89 #endif
90
91
92 \f
93 /** YABT:  Yet Another Boolean Type */
94 typedef int svn_boolean_t;
95
96 #ifndef TRUE
97 /** uhh... true */
98 #define TRUE 1
99 #endif /* TRUE */
100
101 #ifndef FALSE
102 /** uhh... false */
103 #define FALSE 0
104 #endif /* FALSE */
105
106
107 \f
108 /** Subversion error object.
109  *
110  * Defined here, rather than in svn_error.h, to avoid a recursive @#include
111  * situation.
112  */
113 typedef struct svn_error_t
114 {
115   /** APR error value; possibly an SVN_ custom error code (see
116    * `svn_error_codes.h' for a full listing).
117    */
118   apr_status_t apr_err;
119
120   /** Details from the producer of error.
121    *
122    * Note that if this error was generated by Subversion's API, you'll
123    * probably want to use svn_err_best_message() to get a single
124    * descriptive string for this error chain (see the @a child member)
125    * or svn_handle_error2() to print the error chain in full.  This is
126    * because Subversion's API functions sometimes add many links to
127    * the error chain that lack details (used only to produce virtual
128    * stack traces).  (Use svn_error_purge_tracing() to remove those
129    * trace-only links from the error chain.)
130    */
131   const char *message;
132
133   /** Pointer to the error we "wrap" (may be @c NULL).  Via this
134    * member, individual error object can be strung together into an
135    * "error chain".
136    */
137   struct svn_error_t *child;
138
139   /** The pool in which this error object is allocated.  (If
140    * Subversion's APIs are used to manage error chains, then this pool
141    * will contain the whole error chain of which this object is a
142    * member.) */
143   apr_pool_t *pool;
144
145   /** Source file where the error originated (iff @c SVN_DEBUG;
146    * undefined otherwise).
147    */
148   const char *file;
149
150   /** Source line where the error originated (iff @c SVN_DEBUG;
151    * undefined otherwise).
152    */
153   long line;
154
155 } svn_error_t;
156
157
158 \f
159 /* See svn_version.h.
160    Defined here to avoid including svn_version.h from all public headers. */
161 typedef struct svn_version_t svn_version_t;
162
163
164 \f
165 /** @defgroup APR_ARRAY_compat_macros APR Array Compatibility Helper Macros
166  * These macros are provided by APR itself from version 1.3.
167  * Definitions are provided here for when using older versions of APR.
168  * @{
169  */
170
171 /** index into an apr_array_header_t */
172 #ifndef APR_ARRAY_IDX
173 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
174 #endif
175
176 /** easier array-pushing syntax */
177 #ifndef APR_ARRAY_PUSH
178 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
179 #endif
180
181 /** @} */
182
183
184 \f
185 /** @defgroup apr_hash_utilities APR Hash Table Helpers
186  * These functions enable the caller to dereference an APR hash table index
187  * without type casts or temporary variables.
188  *
189  * ### These are private, and may go away when APR implements them natively.
190  * @{
191  */
192
193 /** Return the key of the hash table entry indexed by @a hi. */
194 const void *
195 svn__apr_hash_index_key(const apr_hash_index_t *hi);
196
197 /** Return the key length of the hash table entry indexed by @a hi. */
198 apr_ssize_t
199 svn__apr_hash_index_klen(const apr_hash_index_t *hi);
200
201 /** Return the value of the hash table entry indexed by @a hi. */
202 void *
203 svn__apr_hash_index_val(const apr_hash_index_t *hi);
204
205 /** @} */
206
207
208 \f
209 /** On Windows, APR_STATUS_IS_ENOTDIR includes several kinds of
210  * invalid-pathname error but not ERROR_INVALID_NAME, so we include it.
211  * We also include ERROR_DIRECTORY as that was not included in apr versions
212  * before 1.4.0 and this fix is not backported */
213 /* ### These fixes should go into APR. */
214 #ifndef WIN32
215 #define SVN__APR_STATUS_IS_ENOTDIR(s)  APR_STATUS_IS_ENOTDIR(s)
216 #else
217 #define SVN__APR_STATUS_IS_ENOTDIR(s)  (APR_STATUS_IS_ENOTDIR(s) \
218                       || ((s) == APR_OS_START_SYSERR + ERROR_DIRECTORY) \
219                       || ((s) == APR_OS_START_SYSERR + ERROR_INVALID_NAME))
220 #endif
221
222 /** @} */
223
224
225 \f
226 /** The various types of nodes in the Subversion filesystem. */
227 typedef enum svn_node_kind_t
228 {
229   /** absent */
230   svn_node_none,
231
232   /** regular file */
233   svn_node_file,
234
235   /** directory */
236   svn_node_dir,
237
238   /** something's here, but we don't know what */
239   svn_node_unknown,
240
241   /**
242    * symbolic link
243    * @note This value is not currently used by the public API.
244    * @since New in 1.8.
245    */
246   svn_node_symlink
247 } svn_node_kind_t;
248
249 /** Return a constant string expressing @a kind as an English word, e.g.,
250  * "file", "dir", etc.  The string is not localized, as it may be used for
251  * client<->server communications.  If the kind is not recognized, return
252  * "unknown".
253  *
254  * @since New in 1.6.
255  */
256 const char *
257 svn_node_kind_to_word(svn_node_kind_t kind);
258
259 /** Return the appropriate node_kind for @a word.  @a word is as
260  * returned from svn_node_kind_to_word().  If @a word does not
261  * represent a recognized kind or is @c NULL, return #svn_node_unknown.
262  *
263  * @since New in 1.6.
264  */
265 svn_node_kind_t
266 svn_node_kind_from_word(const char *word);
267
268 \f
269 /** Generic three-state property to represent an unknown value for values
270  * that are just like booleans.  The values have been set deliberately to
271  * make tristates disjoint from #svn_boolean_t.
272  *
273  * @note It is unsafe to use apr_pcalloc() to allocate these, since '0' is
274  * not a valid value.
275  *
276  * @since New in 1.7. */
277 typedef enum svn_tristate_t
278 {
279   /** state known to be false (the constant does not evaulate to false) */
280   svn_tristate_false = 2,
281   /** state known to be true */
282   svn_tristate_true,
283   /** state could be true or false */
284   svn_tristate_unknown
285 } svn_tristate_t;
286
287 /** Return a constant string "true", "false" or NULL representing the value of
288  * @a tristate.
289  *
290  * @since New in 1.7.
291  */
292 const char *
293 svn_tristate__to_word(svn_tristate_t tristate);
294
295 /** Return the appropriate tristate for @a word. If @a word is "true", returns
296  * #svn_tristate_true; if @a word is "false", returns #svn_tristate_false,
297  * for all other values (including NULL) returns #svn_tristate_unknown.
298  *
299  * @since New in 1.7.
300  */
301 svn_tristate_t
302 svn_tristate__from_word(const char * word);
303
304
305 \f
306 /** About Special Files in Subversion
307  *
308  * Subversion denotes files that cannot be portably created or
309  * modified as "special" files (svn_node_special).  It stores these
310  * files in the repository as a plain text file with the svn:special
311  * property set.  The file contents contain: a platform-specific type
312  * string, a space character, then any information necessary to create
313  * the file on a supported platform.  For example, if a symbolic link
314  * were being represented, the repository file would have the
315  * following contents:
316  *
317  * "link /path/to/link/target"
318  *
319  * Where 'link' is the identifier string showing that this special
320  * file should be a symbolic link and '/path/to/link/target' is the
321  * destination of the symbolic link.
322  *
323  * Special files are stored in the text-base exactly as they are
324  * stored in the repository.  The platform specific files are created
325  * in the working copy at EOL/keyword translation time using
326  * svn_subst_copy_and_translate2().  If the current platform does not
327  * support a specific special file type, the file is copied into the
328  * working copy as it is seen in the repository.  Because of this,
329  * users of other platforms can still view and modify the special
330  * files, even if they do not have their unique properties.
331  *
332  * New types of special files can be added by:
333  *  1. Implementing a platform-dependent routine to create a uniquely
334  *     named special file and one to read the special file in
335  *     libsvn_subr/io.c.
336  *  2. Creating a new textual name similar to
337  *     SVN_SUBST__SPECIAL_LINK_STR in libsvn_subr/subst.c.
338  *  3. Handling the translation/detranslation case for the new type in
339  *     create_special_file and detranslate_special_file, using the
340  *     routines from 1.
341  */
342
343
344 \f
345 /** A revision number. */
346 typedef long int svn_revnum_t;
347
348 /** Valid revision numbers begin at 0 */
349 #define SVN_IS_VALID_REVNUM(n) ((n) >= 0)
350
351 /** The 'official' invalid revision num */
352 #define SVN_INVALID_REVNUM ((svn_revnum_t) -1)
353
354 /** Not really invalid...just unimportant -- one day, this can be its
355  * own unique value, for now, just make it the same as
356  * #SVN_INVALID_REVNUM.
357  */
358 #define SVN_IGNORED_REVNUM ((svn_revnum_t) -1)
359
360 /** Convert NULL-terminated C string @a str to a revision number. */
361 #define SVN_STR_TO_REV(str) ((svn_revnum_t) atol(str))
362
363 /**
364  * Parse NULL-terminated C string @a str as a revision number and
365  * store its value in @a rev.  If @a endptr is non-NULL, then the
366  * address of the first non-numeric character in @a str is stored in
367  * it.  If there are no digits in @a str, then @a endptr is set (if
368  * non-NULL), and the error #SVN_ERR_REVNUM_PARSE_FAILURE error is
369  * returned.  Negative numbers parsed from @a str are considered
370  * invalid, and result in the same error.
371  *
372  * @since New in 1.5.
373  */
374 svn_error_t *
375 svn_revnum_parse(svn_revnum_t *rev,
376                  const char *str,
377                  const char **endptr);
378
379 /** Originally intended to be used in printf()-style functions to format
380  * revision numbers.  Deprecated due to incompatibilities with language
381  * translation tools (e.g. gettext).
382  *
383  * New code should use a bare "%ld" format specifier for formatting revision
384  * numbers.
385  *
386  * @deprecated Provided for backward compatibility with the 1.0 API.
387  */
388 #define SVN_REVNUM_T_FMT "ld"
389
390
391 \f
392 /** The size of a file in the Subversion FS. */
393 typedef apr_int64_t svn_filesize_t;
394
395 /** The 'official' invalid file size constant. */
396 #define SVN_INVALID_FILESIZE ((svn_filesize_t) -1)
397
398 /** In printf()-style functions, format file sizes using this. */
399 #define SVN_FILESIZE_T_FMT APR_INT64_T_FMT
400
401 #ifndef DOXYGEN_SHOULD_SKIP_THIS
402 /* Parse a base-10 numeric string into a 64-bit unsigned numeric value. */
403 /* NOTE: Private. For use by Subversion's own code only. See issue #1644. */
404 /* FIXME: APR should supply a function to do this, such as "apr_atoui64". */
405 #define svn__atoui64(X) ((apr_uint64_t) apr_atoi64(X))
406 #endif
407
408
409 \f
410 /** An enum to indicate whether recursion is needed. */
411 enum svn_recurse_kind
412 {
413   svn_nonrecursive = 1,
414   svn_recursive
415 };
416
417 /** The concept of depth for directories.
418  *
419  * @note This is similar to, but not exactly the same as, the WebDAV
420  * and LDAP concepts of depth.
421  *
422  * @since New in 1.5.
423  */
424 typedef enum svn_depth_t
425 {
426   /* The order of these depths is important: the higher the number,
427      the deeper it descends.  This allows us to compare two depths
428      numerically to decide which should govern. */
429
430   /** Depth undetermined or ignored.  In some contexts, this means the
431       client should choose an appropriate default depth.  The server
432       will generally treat it as #svn_depth_infinity. */
433   svn_depth_unknown    = -2,
434
435   /** Exclude (i.e., don't descend into) directory D.
436       @note In Subversion 1.5, svn_depth_exclude is *not* supported
437       anywhere in the client-side (libsvn_wc/libsvn_client/etc) code;
438       it is only supported as an argument to set_path functions in the
439       ra and repos reporters.  (This will enable future versions of
440       Subversion to run updates, etc, against 1.5 servers with proper
441       svn_depth_exclude behavior, once we get a chance to implement
442       client-side support for svn_depth_exclude.)
443   */
444   svn_depth_exclude    = -1,
445
446   /** Just the named directory D, no entries.  Updates will not pull in
447       any files or subdirectories not already present. */
448   svn_depth_empty      =  0,
449
450   /** D + its file children, but not subdirs.  Updates will pull in any
451       files not already present, but not subdirectories. */
452   svn_depth_files      =  1,
453
454   /** D + immediate children (D and its entries).  Updates will pull in
455       any files or subdirectories not already present; those
456       subdirectories' this_dir entries will have depth-empty. */
457   svn_depth_immediates =  2,
458
459   /** D + all descendants (full recursion from D).  Updates will pull
460       in any files or subdirectories not already present; those
461       subdirectories' this_dir entries will have depth-infinity.
462       Equivalent to the pre-1.5 default update behavior. */
463   svn_depth_infinity   =  3
464
465 } svn_depth_t;
466
467 /** Return a constant string expressing @a depth as an English word,
468  * e.g., "infinity", "immediates", etc.  The string is not localized,
469  * as it may be used for client<->server communications.
470  *
471  * @since New in 1.5.
472  */
473 const char *
474 svn_depth_to_word(svn_depth_t depth);
475
476 /** Return the appropriate depth for @a depth_str.  @a word is as
477  * returned from svn_depth_to_word().  If @a depth_str does not
478  * represent a recognized depth, return #svn_depth_unknown.
479  *
480  * @since New in 1.5.
481  */
482 svn_depth_t
483 svn_depth_from_word(const char *word);
484
485 /** Return #svn_depth_infinity if boolean @a recurse is TRUE, else
486  * return #svn_depth_files.
487  *
488  * @note New code should never need to use this, it is called only
489  * from pre-depth APIs, for compatibility.
490  *
491  * @since New in 1.5.
492  */
493 #define SVN_DEPTH_INFINITY_OR_FILES(recurse) \
494   ((recurse) ? svn_depth_infinity : svn_depth_files)
495
496 /** Return #svn_depth_infinity if boolean @a recurse is TRUE, else
497  * return #svn_depth_immediates.
498  *
499  * @note New code should never need to use this, it is called only
500  * from pre-depth APIs, for compatibility.
501  *
502  * @since New in 1.5.
503  */
504 #define SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse) \
505   ((recurse) ? svn_depth_infinity : svn_depth_immediates)
506
507 /** Return #svn_depth_infinity if boolean @a recurse is TRUE, else
508  * return #svn_depth_empty.
509  *
510  * @note New code should never need to use this, it is called only
511  * from pre-depth APIs, for compatibility.
512  *
513  * @since New in 1.5.
514  */
515 #define SVN_DEPTH_INFINITY_OR_EMPTY(recurse) \
516   ((recurse) ? svn_depth_infinity : svn_depth_empty)
517
518 /** Return a recursion boolean based on @a depth.
519  *
520  * Although much code has been converted to use depth, some code still
521  * takes a recurse boolean.  In most cases, it makes sense to treat
522  * unknown or infinite depth as recursive, and any other depth as
523  * non-recursive (which in turn usually translates to #svn_depth_files).
524  */
525 #define SVN_DEPTH_IS_RECURSIVE(depth)                              \
526   ((depth) == svn_depth_infinity || (depth) == svn_depth_unknown)
527
528
529 \f
530 /**
531  * It is sometimes convenient to indicate which parts of an #svn_dirent_t
532  * object you are actually interested in, so that calculating and sending
533  * the data corresponding to the other fields can be avoided.  These values
534  * can be used for that purpose.
535  *
536  * @defgroup svn_dirent_fields Dirent fields
537  * @{
538  */
539
540 /** An indication that you are interested in the @c kind field */
541 #define SVN_DIRENT_KIND        0x00001
542
543 /** An indication that you are interested in the @c size field */
544 #define SVN_DIRENT_SIZE        0x00002
545
546 /** An indication that you are interested in the @c has_props field */
547 #define SVN_DIRENT_HAS_PROPS   0x00004
548
549 /** An indication that you are interested in the @c created_rev field */
550 #define SVN_DIRENT_CREATED_REV 0x00008
551
552 /** An indication that you are interested in the @c time field */
553 #define SVN_DIRENT_TIME        0x00010
554
555 /** An indication that you are interested in the @c last_author field */
556 #define SVN_DIRENT_LAST_AUTHOR 0x00020
557
558 /** A combination of all the dirent fields */
559 #define SVN_DIRENT_ALL ~((apr_uint32_t ) 0)
560
561 /** @} */
562
563 /** A general subversion directory entry.
564  *
565  * @note To allow for extending the #svn_dirent_t structure in future
566  * releases, always use svn_dirent_create() to allocate the stucture.
567  *
568  * @since New in 1.6.
569  */
570 typedef struct svn_dirent_t
571 {
572   /** node kind */
573   svn_node_kind_t kind;
574
575   /** length of file text, or 0 for directories */
576   svn_filesize_t size;
577
578   /** does the node have props? */
579   svn_boolean_t has_props;
580
581   /** last rev in which this node changed */
582   svn_revnum_t created_rev;
583
584   /** time of created_rev (mod-time) */
585   apr_time_t time;
586
587   /** author of created_rev */
588   const char *last_author;
589
590   /* IMPORTANT: If you extend this struct, check svn_dirent_dup(). */
591 } svn_dirent_t;
592
593 /** Return a deep copy of @a dirent, allocated in @a pool.
594  *
595  * @since New in 1.4.
596  */
597 svn_dirent_t *
598 svn_dirent_dup(const svn_dirent_t *dirent,
599                apr_pool_t *pool);
600
601 /**
602  * Create a new svn_dirent_t instance with all values initialized to their
603  * not-available values.
604  *
605  * @since New in 1.8.
606  */
607 svn_dirent_t *
608 svn_dirent_create(apr_pool_t *result_pool);
609
610 \f
611 /** Keyword substitution.
612  *
613  * All the keywords Subversion recognizes.
614  *
615  * Note that there is a better, more general proposal out there, which
616  * would take care of both internationalization issues and custom
617  * keywords (e.g., $NetBSD$).  See
618  *
619  * @verbatim
620       http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=8921
621       =====
622       From: "Jonathan M. Manning" <jmanning@alisa-jon.net>
623       To: dev@subversion.tigris.org
624       Date: Fri, 14 Dec 2001 11:56:54 -0500
625       Message-ID: <87970000.1008349014@bdldevel.bl.bdx.com>
626       Subject: Re: keywords @endverbatim
627  *
628  * and Eric Gillespie's support of same:
629  *
630  * @verbatim
631       http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=8757
632       =====
633       From: "Eric Gillespie, Jr." <epg@pretzelnet.org>
634       To: dev@subversion.tigris.org
635       Date: Wed, 12 Dec 2001 09:48:42 -0500
636       Message-ID: <87k7vsebp1.fsf@vger.pretzelnet.org>
637       Subject: Re: Customizable Keywords @endverbatim
638  *
639  * However, it is considerably more complex than the scheme below.
640  * For now we're going with simplicity, hopefully the more general
641  * solution can be done post-1.0.
642  *
643  * @defgroup svn_types_keywords Keyword definitions
644  * @{
645  */
646
647 /** The maximum size of an expanded or un-expanded keyword. */
648 #define SVN_KEYWORD_MAX_LEN    255
649
650 /** The most recent revision in which this file was changed. */
651 #define SVN_KEYWORD_REVISION_LONG    "LastChangedRevision"
652
653 /** Short version of LastChangedRevision */
654 #define SVN_KEYWORD_REVISION_SHORT   "Rev"
655
656 /** Medium version of LastChangedRevision, matching the one CVS uses.
657  * @since New in 1.1. */
658 #define SVN_KEYWORD_REVISION_MEDIUM  "Revision"
659
660 /** The most recent date (repository time) when this file was changed. */
661 #define SVN_KEYWORD_DATE_LONG        "LastChangedDate"
662
663 /** Short version of LastChangedDate */
664 #define SVN_KEYWORD_DATE_SHORT       "Date"
665
666 /** Who most recently committed to this file. */
667 #define SVN_KEYWORD_AUTHOR_LONG      "LastChangedBy"
668
669 /** Short version of LastChangedBy */
670 #define SVN_KEYWORD_AUTHOR_SHORT     "Author"
671
672 /** The URL for the head revision of this file. */
673 #define SVN_KEYWORD_URL_LONG         "HeadURL"
674
675 /** Short version of HeadURL */
676 #define SVN_KEYWORD_URL_SHORT        "URL"
677
678 /** A compressed combination of the other four keywords. */
679 #define SVN_KEYWORD_ID               "Id"
680
681 /** A full combination of the first four keywords.
682  * @since New in 1.6. */
683 #define SVN_KEYWORD_HEADER           "Header"
684
685 /** @} */
686
687
688 \f
689 /** All information about a commit.
690  *
691  * @note Objects of this type should always be created using the
692  * svn_create_commit_info() function.
693  *
694  * @since New in 1.3.
695  */
696 typedef struct svn_commit_info_t
697 {
698   /** just-committed revision. */
699   svn_revnum_t revision;
700
701   /** server-side date of the commit. */
702   const char *date;
703
704   /** author of the commit. */
705   const char *author;
706
707   /** error message from post-commit hook, or NULL. */
708   const char *post_commit_err;
709
710   /** repository root, may be @c NULL if unknown.
711       @since New in 1.7. */
712   const char *repos_root;
713
714 } svn_commit_info_t;
715
716 /**
717  * Allocate an object of type #svn_commit_info_t in @a pool and
718  * return it.
719  *
720  * The @c revision field of the new struct is set to #SVN_INVALID_REVNUM.
721  * All other fields are initialized to @c NULL.
722  *
723  * @note Any object of the type #svn_commit_info_t should
724  * be created using this function.
725  * This is to provide for extending the svn_commit_info_t in
726  * the future.
727  *
728  * @since New in 1.3.
729  */
730 svn_commit_info_t *
731 svn_create_commit_info(apr_pool_t *pool);
732
733 /**
734  * Return a deep copy @a src_commit_info allocated in @a pool.
735  *
736  * @since New in 1.4.
737  */
738 svn_commit_info_t *
739 svn_commit_info_dup(const svn_commit_info_t *src_commit_info,
740                     apr_pool_t *pool);
741
742
743 \f
744 /**
745  * A structure to represent a path that changed for a log entry.
746  *
747  * @note To allow for extending the #svn_log_changed_path2_t structure in
748  * future releases, always use svn_log_changed_path2_create() to allocate
749  * the structure.
750  *
751  * @since New in 1.6.
752  */
753 typedef struct svn_log_changed_path2_t
754 {
755   /** 'A'dd, 'D'elete, 'R'eplace, 'M'odify */
756   char action;
757
758   /** Source path of copy (if any). */
759   const char *copyfrom_path;
760
761   /** Source revision of copy (if any). */
762   svn_revnum_t copyfrom_rev;
763
764   /** The type of the node, may be svn_node_unknown. */
765   svn_node_kind_t node_kind;
766
767   /** Is the text modified, may be svn_tristate_unknown.
768    * @since New in 1.7. */
769   svn_tristate_t text_modified;
770
771   /** Are properties modified, may be svn_tristate_unknown.
772    * @since New in 1.7. */
773   svn_tristate_t props_modified;
774
775   /* NOTE: Add new fields at the end to preserve binary compatibility.
776      Also, if you add fields here, you have to update
777      svn_log_changed_path2_dup(). */
778 } svn_log_changed_path2_t;
779
780 /**
781  * Returns an #svn_log_changed_path2_t, allocated in @a pool with all fields
782  * initialized to NULL, None or empty values.
783  *
784  * @note To allow for extending the #svn_log_changed_path2_t structure in
785  * future releases, this function should always be used to allocate the
786  * structure.
787  *
788  * @since New in 1.6.
789  */
790 svn_log_changed_path2_t *
791 svn_log_changed_path2_create(apr_pool_t *pool);
792
793 /**
794  * Return a deep copy of @a changed_path, allocated in @a pool.
795  *
796  * @since New in 1.6.
797  */
798 svn_log_changed_path2_t *
799 svn_log_changed_path2_dup(const svn_log_changed_path2_t *changed_path,
800                           apr_pool_t *pool);
801
802 /**
803  * A structure to represent a path that changed for a log entry.  Same as
804  * the first three fields of #svn_log_changed_path2_t.
805  *
806  * @deprecated Provided for backward compatibility with the 1.5 API.
807  */
808 typedef struct svn_log_changed_path_t
809 {
810   /** 'A'dd, 'D'elete, 'R'eplace, 'M'odify */
811   char action;
812
813   /** Source path of copy (if any). */
814   const char *copyfrom_path;
815
816   /** Source revision of copy (if any). */
817   svn_revnum_t copyfrom_rev;
818
819 } svn_log_changed_path_t;
820
821 /**
822  * Return a deep copy of @a changed_path, allocated in @a pool.
823  *
824  * @since New in 1.3.
825  * @deprecated Provided for backward compatibility with the 1.5 API.
826  */
827 SVN_DEPRECATED
828 svn_log_changed_path_t *
829 svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
830                          apr_pool_t *pool);
831
832 /**
833  * A structure to represent all the information about a particular log entry.
834  *
835  * @note To allow for extending the #svn_log_entry_t structure in future
836  * releases, always use svn_log_entry_create() to allocate the structure.
837  *
838  * @since New in 1.5.
839  */
840 typedef struct svn_log_entry_t
841 {
842   /** A hash containing as keys every path committed in @a revision; the
843    * values are (#svn_log_changed_path_t *) structures.
844    *
845    * The subversion core libraries will always set this field to the same
846    * value as changed_paths2 for compatibility reasons.
847    *
848    * @deprecated Provided for backward compatibility with the 1.5 API.
849    */
850   apr_hash_t *changed_paths;
851
852   /** The revision of the commit. */
853   svn_revnum_t revision;
854
855   /** The hash of requested revision properties, which may be NULL if it
856    * would contain no revprops.  Maps (const char *) property name to
857    * (svn_string_t *) property value. */
858   apr_hash_t *revprops;
859
860   /**
861    * Whether or not this message has children.
862    *
863    * When a log operation requests additional merge information, extra log
864    * entries may be returned as a result of this entry.  The new entries, are
865    * considered children of the original entry, and will follow it.  When
866    * the HAS_CHILDREN flag is set, the receiver should increment its stack
867    * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which
868    * indicates the end of the children.
869    *
870    * For log operations which do not request additional merge information, the
871    * HAS_CHILDREN flag is always FALSE.
872    *
873    * For more information see:
874    * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting
875    */
876   svn_boolean_t has_children;
877
878   /** A hash containing as keys every path committed in @a revision; the
879    * values are (#svn_log_changed_path2_t *) structures.
880    *
881    * If this value is not @c NULL, it MUST have the same value as
882    * changed_paths or svn_log_entry_dup() will not create an identical copy.
883    *
884    * The subversion core libraries will always set this field to the same
885    * value as changed_paths for compatibility with users assuming an older
886    * version.
887    *
888    * @note See http://svn.haxx.se/dev/archive-2010-08/0362.shtml for
889    * further explanation.
890    *
891    * @since New in 1.6.
892    */
893   apr_hash_t *changed_paths2;
894
895   /**
896    * Whether @a revision should be interpreted as non-inheritable in the
897    * same sense of #svn_merge_range_t.
898    *
899    * Only set when this #svn_log_entry_t instance is returned by the
900    * libsvn_client mergeinfo apis. Currently always FALSE when the
901    * #svn_log_entry_t instance is reported by the ra layer.
902    *
903    * @since New in 1.7.
904    */
905   svn_boolean_t non_inheritable;
906
907   /**
908    * Whether @a revision is a merged revision resulting from a reverse merge.
909    *
910    * @since New in 1.7.
911    */
912   svn_boolean_t subtractive_merge;
913
914   /* NOTE: Add new fields at the end to preserve binary compatibility.
915      Also, if you add fields here, you have to update
916      svn_log_entry_dup(). */
917 } svn_log_entry_t;
918
919 /**
920  * Returns an #svn_log_entry_t, allocated in @a pool with all fields
921  * initialized to NULL values.
922  *
923  * @note To allow for extending the #svn_log_entry_t structure in future
924  * releases, this function should always be used to allocate the structure.
925  *
926  * @since New in 1.5.
927  */
928 svn_log_entry_t *
929 svn_log_entry_create(apr_pool_t *pool);
930
931 /** Return a deep copy of @a log_entry, allocated in @a pool.
932  *
933  * The resulting svn_log_entry_t has @c changed_paths set to the same
934  * value as @c changed_path2. @c changed_paths will be @c NULL if
935  * @c changed_paths2 was @c NULL.
936  *
937  * @since New in 1.6.
938  */
939 svn_log_entry_t *
940 svn_log_entry_dup(const svn_log_entry_t *log_entry, apr_pool_t *pool);
941
942 /** The callback invoked by log message loopers, such as
943  * #svn_ra_plugin_t.get_log() and svn_repos_get_logs().
944  *
945  * This function is invoked once on each log message, in the order
946  * determined by the caller (see above-mentioned functions).
947  *
948  * @a baton is what you think it is, and @a log_entry contains relevant
949  * information for the log message.  Any of @a log_entry->author,
950  * @a log_entry->date, or @a log_entry->message may be @c NULL.
951  *
952  * If @a log_entry->date is neither NULL nor the empty string, it was
953  * generated by svn_time_to_cstring() and can be converted to
954  * @c apr_time_t with svn_time_from_cstring().
955  *
956  * If @a log_entry->changed_paths is non-@c NULL, then it contains as keys
957  * every path committed in @a log_entry->revision; the values are
958  * (#svn_log_changed_path_t *) structures.
959  *
960  * If @a log_entry->has_children is @c TRUE, the message will be followed
961  * immediately by any number of merged revisions (child messages), which are
962  * terminated by an invocation with SVN_INVALID_REVNUM.  This usage may
963  * be recursive.
964  *
965  * Use @a pool for temporary allocation.  If the caller is iterating
966  * over log messages, invoking this receiver on each, we recommend the
967  * standard pool loop recipe: create a subpool, pass it as @a pool to
968  * each call, clear it after each iteration, destroy it after the loop
969  * is done.  (For allocation that must last beyond the lifetime of a
970  * given receiver call, use a pool in @a baton.)
971  *
972  * @since New in 1.5.
973  */
974 typedef svn_error_t *(*svn_log_entry_receiver_t)(
975   void *baton,
976   svn_log_entry_t *log_entry,
977   apr_pool_t *pool);
978
979 /**
980  * Similar to #svn_log_entry_receiver_t, except this uses separate
981  * parameters for each part of the log entry.
982  *
983  * @deprecated Provided for backward compatibility with the 1.4 API.
984  */
985 typedef svn_error_t *(*svn_log_message_receiver_t)(
986   void *baton,
987   apr_hash_t *changed_paths,
988   svn_revnum_t revision,
989   const char *author,
990   const char *date,  /* use svn_time_from_cstring() if need apr_time_t */
991   const char *message,
992   apr_pool_t *pool);
993
994
995 \f
996 /** Callback function type for commits.
997  *
998  * When a commit succeeds, an instance of this is invoked with the
999  * @a commit_info, along with the @a baton closure.
1000  * @a pool can be used for temporary allocations.
1001  *
1002  * @since New in 1.4.
1003  */
1004 typedef svn_error_t *(*svn_commit_callback2_t)(
1005   const svn_commit_info_t *commit_info,
1006   void *baton,
1007   apr_pool_t *pool);
1008
1009 /** Same as #svn_commit_callback2_t, but uses individual
1010  * data elements instead of the #svn_commit_info_t structure
1011  *
1012  * @deprecated Provided for backward compatibility with the 1.3 API.
1013  */
1014 typedef svn_error_t *(*svn_commit_callback_t)(
1015   svn_revnum_t new_revision,
1016   const char *date,
1017   const char *author,
1018   void *baton);
1019
1020
1021 \f
1022 /** A buffer size that may be used when processing a stream of data.
1023  *
1024  * @note We don't use this constant any longer, since it is considered to be
1025  * unnecessarily large.
1026  *
1027  * @deprecated Provided for backwards compatibility with the 1.3 API.
1028  */
1029 #define SVN_STREAM_CHUNK_SIZE 102400
1030
1031 #ifndef DOXYGEN_SHOULD_SKIP_THIS
1032 /*
1033  * The maximum amount we (ideally) hold in memory at a time when
1034  * processing a stream of data.
1035  *
1036  * For example, when copying data from one stream to another, do it in
1037  * blocks of this size.
1038  *
1039  * NOTE: This is an internal macro, put here for convenience.
1040  * No public API may depend on the particular value of this macro.
1041  */
1042 #define SVN__STREAM_CHUNK_SIZE 16384
1043 #endif
1044
1045 /** The maximum amount we can ever hold in memory. */
1046 /* FIXME: Should this be the same as SVN_STREAM_CHUNK_SIZE? */
1047 #define SVN_MAX_OBJECT_SIZE (((apr_size_t) -1) / 2)
1048
1049
1050 \f
1051 /* ### Note: despite being about mime-TYPES, these probably don't
1052  * ### belong in svn_types.h.  However, no other header is more
1053  * ### appropriate, and didn't feel like creating svn_validate.h for
1054  * ### so little.
1055  */
1056
1057 /** Validate @a mime_type.
1058  *
1059  * If @a mime_type does not contain a "/", or ends with non-alphanumeric
1060  * data, return #SVN_ERR_BAD_MIME_TYPE, else return success.
1061  *
1062  * Use @a pool only to find error allocation.
1063  *
1064  * Goal: to match both "foo/bar" and "foo/bar; charset=blah", without
1065  * being too strict about it, but to disallow mime types that have
1066  * quotes, newlines, or other garbage on the end, such as might be
1067  * unsafe in an HTTP header.
1068  */
1069 svn_error_t *
1070 svn_mime_type_validate(const char *mime_type,
1071                        apr_pool_t *pool);
1072
1073 /** Return FALSE iff @a mime_type is a textual type.
1074  *
1075  * All mime types that start with "text/" are textual, plus some special
1076  * cases (for example, "image/x-xbitmap").
1077  */
1078 svn_boolean_t
1079 svn_mime_type_is_binary(const char *mime_type);
1080
1081
1082 \f
1083 /** A user defined callback that subversion will call with a user defined
1084  * baton to see if the current operation should be continued.  If the operation
1085  * should continue, the function should return #SVN_NO_ERROR, if not, it
1086  * should return #SVN_ERR_CANCELLED.
1087  */
1088 typedef svn_error_t *(*svn_cancel_func_t)(void *cancel_baton);
1089
1090
1091 \f
1092 /**
1093  * A lock object, for client & server to share.
1094  *
1095  * A lock represents the exclusive right to add, delete, or modify a
1096  * path.  A lock is created in a repository, wholly controlled by the
1097  * repository.  A "lock-token" is the lock's UUID, and can be used to
1098  * learn more about a lock's fields, and or/make use of the lock.
1099  * Because a lock is immutable, a client is free to not only cache the
1100  * lock-token, but the lock's fields too, for convenience.
1101  *
1102  * Note that the 'is_dav_comment' field is wholly ignored by every
1103  * library except for mod_dav_svn.  The field isn't even marshalled
1104  * over the network to the client.  Assuming lock structures are
1105  * created with apr_pcalloc(), a default value of 0 is universally safe.
1106  *
1107  * @note in the current implementation, only files are lockable.
1108  *
1109  * @since New in 1.2.
1110  */
1111 typedef struct svn_lock_t
1112 {
1113   const char *path;              /**< the path this lock applies to */
1114   const char *token;             /**< unique URI representing lock */
1115   const char *owner;             /**< the username which owns the lock */
1116   const char *comment;           /**< (optional) description of lock  */
1117   svn_boolean_t is_dav_comment;  /**< was comment made by generic DAV client? */
1118   apr_time_t creation_date;      /**< when lock was made */
1119   apr_time_t expiration_date;    /**< (optional) when lock will expire;
1120                                       If value is 0, lock will never expire. */
1121 } svn_lock_t;
1122
1123 /**
1124  * Returns an #svn_lock_t, allocated in @a pool with all fields initialized
1125  * to NULL values.
1126  *
1127  * @note To allow for extending the #svn_lock_t structure in the future
1128  * releases, this function should always be used to allocate the structure.
1129  *
1130  * @since New in 1.2.
1131  */
1132 svn_lock_t *
1133 svn_lock_create(apr_pool_t *pool);
1134
1135 /**
1136  * Return a deep copy of @a lock, allocated in @a pool.
1137  *
1138  * @since New in 1.2.
1139  */
1140 svn_lock_t *
1141 svn_lock_dup(const svn_lock_t *lock, apr_pool_t *pool);
1142
1143
1144 \f
1145 /**
1146  * Return a formatted Universal Unique IDentifier (UUID) string.
1147  *
1148  * @since New in 1.4.
1149  */
1150 const char *
1151 svn_uuid_generate(apr_pool_t *pool);
1152
1153
1154 \f
1155 /**
1156  * Mergeinfo representing a merge of a range of revisions.
1157  *
1158  * @since New in 1.5
1159  */
1160 typedef struct svn_merge_range_t
1161 {
1162   /**
1163    * If the 'start' field is less than the 'end' field then 'start' is
1164    * exclusive and 'end' inclusive of the range described.  This is termed
1165    * a forward merge range.  If 'start' is greater than 'end' then the
1166    * opposite is true.  This is termed a reverse merge range.  If 'start'
1167    * equals 'end' the meaning of the range is not defined.
1168    */
1169   svn_revnum_t start;
1170   svn_revnum_t end;
1171
1172   /**
1173    * Whether this merge range should be inherited by treewise
1174    * descendants of the path to which the range applies. */
1175   svn_boolean_t inheritable;
1176 } svn_merge_range_t;
1177
1178 /**
1179  * Return a copy of @a range, allocated in @a pool.
1180  *
1181  * @since New in 1.5.
1182  */
1183 svn_merge_range_t *
1184 svn_merge_range_dup(const svn_merge_range_t *range, apr_pool_t *pool);
1185
1186 /**
1187  * Returns true if the changeset committed in revision @a rev is one
1188  * of the changesets in the range @a range.
1189  *
1190  * @since New in 1.5.
1191  */
1192 svn_boolean_t
1193 svn_merge_range_contains_rev(const svn_merge_range_t *range, svn_revnum_t rev);
1194
1195
1196 \f
1197 /** @defgroup node_location_seg_reporting Node location segment reporting.
1198  *  @{ */
1199
1200 /**
1201  * A representation of a segment of an object's version history with an
1202  * emphasis on the object's location in the repository as of various
1203  * revisions.
1204  *
1205  * @since New in 1.5.
1206  */
1207 typedef struct svn_location_segment_t
1208 {
1209   /** The beginning (oldest) and ending (youngest) revisions for this
1210       segment, both inclusive. */
1211   svn_revnum_t range_start;
1212   svn_revnum_t range_end;
1213
1214   /** The absolute (sans leading slash) path for this segment.  May be
1215       NULL to indicate gaps in an object's history.  */
1216   const char *path;
1217
1218 } svn_location_segment_t;
1219
1220 /**
1221  * A callback invoked by generators of #svn_location_segment_t
1222  * objects, used to report information about a versioned object's
1223  * history in terms of its location in the repository filesystem over
1224  * time.
1225  */
1226 typedef svn_error_t *(*svn_location_segment_receiver_t)(
1227   svn_location_segment_t *segment,
1228   void *baton,
1229   apr_pool_t *pool);
1230
1231 /**
1232  * Return a deep copy of @a segment, allocated in @a pool.
1233  *
1234  * @since New in 1.5.
1235  */
1236 svn_location_segment_t *
1237 svn_location_segment_dup(const svn_location_segment_t *segment,
1238                          apr_pool_t *pool);
1239
1240 /** @} */
1241
1242
1243 \f
1244 /** A line number, such as in a file or a stream.
1245  *
1246  * @since New in 1.7.
1247  */
1248 typedef unsigned long svn_linenum_t;
1249
1250 /** The maximum value of an svn_linenum_t.
1251  *
1252  * @since New in 1.7.
1253  */
1254 #define SVN_LINENUM_MAX_VALUE ULONG_MAX
1255
1256
1257 \f
1258 #ifdef __cplusplus
1259 }
1260 #endif /* __cplusplus */
1261
1262
1263 /*
1264  * Everybody and their brother needs to deal with svn_error_t, the error
1265  * codes, and whatever else. While they *should* go and include svn_error.h
1266  * in order to do that... bah. Let's just help everybody out and include
1267  * that header whenever somebody grabs svn_types.h.
1268  *
1269  * Note that we do this at the END of this header so that its contents
1270  * are available to svn_error.h (our guards will prevent the circular
1271  * include). We also need to do the include *outside* of the cplusplus
1272  * guard.
1273  */
1274 #include "svn_error.h"
1275
1276
1277 /*
1278  * Subversion developers may want to use some additional debugging facilities
1279  * while working on the code. We'll pull that in here, so individual source
1280  * files don't have to include this header manually.
1281  */
1282 #ifdef SVN_DEBUG
1283 #include "private/svn_debug.h"
1284 #endif
1285
1286
1287 #endif /* SVN_TYPES_H */