Subversion
svn_types.h
Go to the documentation of this file.
00001 /**
00002  * @copyright
00003  * ====================================================================
00004  *    Licensed to the Apache Software Foundation (ASF) under one
00005  *    or more contributor license agreements.  See the NOTICE file
00006  *    distributed with this work for additional information
00007  *    regarding copyright ownership.  The ASF licenses this file
00008  *    to you under the Apache License, Version 2.0 (the
00009  *    "License"); you may not use this file except in compliance
00010  *    with the License.  You may obtain a copy of the License at
00011  *
00012  *      http://www.apache.org/licenses/LICENSE-2.0
00013  *
00014  *    Unless required by applicable law or agreed to in writing,
00015  *    software distributed under the License is distributed on an
00016  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
00017  *    KIND, either express or implied.  See the License for the
00018  *    specific language governing permissions and limitations
00019  *    under the License.
00020  * ====================================================================
00021  * @endcopyright
00022  *
00023  * @file svn_types.h
00024  * @brief Subversion's data types
00025  */
00026 
00027 #ifndef SVN_TYPES_H
00028 #define SVN_TYPES_H
00029 
00030 /* ### this should go away, but it causes too much breakage right now */
00031 #include <stdlib.h>
00032 
00033 #include <apr.h>         /* for apr_size_t, apr_int64_t, ... */
00034 #include <apr_errno.h>   /* for apr_status_t */
00035 #include <apr_pools.h>   /* for apr_pool_t */
00036 #include <apr_hash.h>    /* for apr_hash_t */
00037 #include <apr_tables.h>  /* for apr_array_push() */
00038 #include <apr_time.h>    /* for apr_time_t */
00039 #include <apr_strings.h> /* for apr_atoi64() */
00040 
00041 #ifdef __cplusplus
00042 extern "C" {
00043 #endif /* __cplusplus */
00044 
00045 
00046 
00047 /** Macro used to mark deprecated functions.
00048  *
00049  * @since New in 1.6.
00050  */
00051 #ifndef SVN_DEPRECATED
00052 # if !defined(SWIGPERL) && !defined(SWIGPYTHON) && !defined(SWIGRUBY)
00053 #  if defined(__GNUC__) && (__GNUC__ >= 4 || (__GNUC__==3 && __GNUC_MINOR__>=1))
00054 #   define SVN_DEPRECATED __attribute__((deprecated))
00055 #  elif defined(_MSC_VER) && _MSC_VER >= 1300
00056 #   define SVN_DEPRECATED __declspec(deprecated)
00057 #  else
00058 #   define SVN_DEPRECATED
00059 #  endif
00060 # else
00061 #  define SVN_DEPRECATED
00062 # endif
00063 #endif
00064 
00065 
00066 /** Indicate whether the current platform supports unaligned data access.
00067  *
00068  * On the majority of machines running SVN (x86 / x64), unaligned access
00069  * is much cheaper than repeated aligned access. Define this macro to 1
00070  * on those machines.
00071  * Unaligned access on other machines (e.g. IA64) will trigger memory
00072  * access faults or simply misbehave.
00073  *
00074  * @since New in 1.7.
00075  */
00076 #ifndef SVN_UNALIGNED_ACCESS_IS_OK
00077 # if defined(_M_IX86) || defined(_M_X64) || defined(i386) || defined(__x86_64)
00078 #  define SVN_UNALIGNED_ACCESS_IS_OK 1
00079 # else
00080 #  define SVN_UNALIGNED_ACCESS_IS_OK 0
00081 # endif
00082 #endif
00083 
00084 
00085 /** Subversion error object.
00086  *
00087  * Defined here, rather than in svn_error.h, to avoid a recursive @#include
00088  * situation.
00089  */
00090 typedef struct svn_error_t
00091 {
00092   /** APR error value; possibly an SVN_ custom error code (see
00093    * `svn_error_codes.h' for a full listing).
00094    */
00095   apr_status_t apr_err;
00096 
00097   /** Details from the producer of error.
00098    *
00099    * Note that if this error was generated by Subversion's API, you'll
00100    * probably want to use svn_err_best_message() to get a single
00101    * descriptive string for this error chain (see the @a child member)
00102    * or svn_handle_error2() to print the error chain in full.  This is
00103    * because Subversion's API functions sometimes add many links to
00104    * the error chain that lack details (used only to produce virtual
00105    * stack traces).  (Use svn_error_purge_tracing() to remove those
00106    * trace-only links from the error chain.)
00107    */
00108   const char *message;
00109 
00110   /** Pointer to the error we "wrap" (may be @c NULL).  Via this
00111    * member, individual error object can be strung together into an
00112    * "error chain".
00113    */
00114   struct svn_error_t *child;
00115 
00116   /** The pool in which this error object is allocated.  (If
00117    * Subversion's APIs are used to manage error chains, then this pool
00118    * will contain the whole error chain of which this object is a
00119    * member.) */
00120   apr_pool_t *pool;
00121 
00122   /** Source file where the error originated (iff @c SVN_DEBUG;
00123    * undefined otherwise).
00124    */
00125   const char *file;
00126 
00127   /** Source line where the error originated (iff @c SVN_DEBUG;
00128    * undefined otherwise).
00129    */
00130   long line;
00131 
00132 } svn_error_t;
00133 
00134 /* See svn_version.h.
00135    Defined here to avoid including svn_version.h from all public headers. */
00136 typedef struct svn_version_t svn_version_t;
00137 
00138 /** @defgroup APR_ARRAY_compat_macros APR Array Compatibility Helper Macros
00139  * These macros are provided by APR itself from version 1.3.
00140  * Definitions are provided here for when using older versions of APR.
00141  * @{
00142  */
00143 
00144 /** index into an apr_array_header_t */
00145 #ifndef APR_ARRAY_IDX
00146 #define APR_ARRAY_IDX(ary,i,type) (((type *)(ary)->elts)[i])
00147 #endif
00148 
00149 /** easier array-pushing syntax */
00150 #ifndef APR_ARRAY_PUSH
00151 #define APR_ARRAY_PUSH(ary,type) (*((type *)apr_array_push(ary)))
00152 #endif
00153 
00154 /** @} */
00155 
00156 /** @defgroup apr_hash_utilities APR Hash Table Helpers
00157  * These functions enable the caller to dereference an APR hash table index
00158  * without type casts or temporary variables.
00159  *
00160  * ### These are private, and may go away when APR implements them natively.
00161  * @{
00162  */
00163 
00164 /** Return the key of the hash table entry indexed by @a hi. */
00165 const void *
00166 svn__apr_hash_index_key(const apr_hash_index_t *hi);
00167 
00168 /** Return the key length of the hash table entry indexed by @a hi. */
00169 apr_ssize_t
00170 svn__apr_hash_index_klen(const apr_hash_index_t *hi);
00171 
00172 /** Return the value of the hash table entry indexed by @a hi. */
00173 void *
00174 svn__apr_hash_index_val(const apr_hash_index_t *hi);
00175 
00176 /** On Windows, APR_STATUS_IS_ENOTDIR includes several kinds of
00177  * invalid-pathname error but not ERROR_INVALID_NAME, so we include it.
00178  * We also include ERROR_DIRECTORY as that was not included in apr versions
00179  * before 1.4.0 and this fix is not backported */
00180 /* ### These fixes should go into APR. */
00181 #ifndef WIN32
00182 #define SVN__APR_STATUS_IS_ENOTDIR(s)  APR_STATUS_IS_ENOTDIR(s)
00183 #else
00184 #define SVN__APR_STATUS_IS_ENOTDIR(s)  (APR_STATUS_IS_ENOTDIR(s) \
00185                       || ((s) == APR_OS_START_SYSERR + ERROR_DIRECTORY) \
00186                       || ((s) == APR_OS_START_SYSERR + ERROR_INVALID_NAME))
00187 #endif
00188 
00189 /** @} */
00190 
00191 /** The various types of nodes in the Subversion filesystem. */
00192 typedef enum svn_node_kind_t
00193 {
00194   /** absent */
00195   svn_node_none,
00196 
00197   /** regular file */
00198   svn_node_file,
00199 
00200   /** directory */
00201   svn_node_dir,
00202 
00203   /** something's here, but we don't know what */
00204   svn_node_unknown
00205 } svn_node_kind_t;
00206 
00207 /** Return a constant string expressing @a kind as an English word, e.g.,
00208  * "file", "dir", etc.  The string is not localized, as it may be used for
00209  * client<->server communications.  If the kind is not recognized, return
00210  * "unknown".
00211  *
00212  * @since New in 1.6.
00213  */
00214 const char *
00215 svn_node_kind_to_word(svn_node_kind_t kind);
00216 
00217 /** Return the appropriate node_kind for @a word.  @a word is as
00218  * returned from svn_node_kind_to_word().  If @a word does not
00219  * represent a recognized kind or is @c NULL, return #svn_node_unknown.
00220  *
00221  * @since New in 1.6.
00222  */
00223 svn_node_kind_t
00224 svn_node_kind_from_word(const char *word);
00225 
00226 /** Generic three-state property to represent an unknown value for values
00227  * that are just like booleans.  The values have been set deliberately to
00228  * make tristates disjoint from #svn_boolean_t.
00229  *
00230  * @note It is unsafe to use apr_pcalloc() to allocate these, since '0' is
00231  * not a valid value.
00232  *
00233  * @since New in 1.7. */
00234 typedef enum svn_tristate_t
00235 {
00236   svn_tristate_false = 2,
00237   svn_tristate_true,
00238   svn_tristate_unknown
00239 } svn_tristate_t;
00240 
00241 /** Return a constant string "true", "false" or NULL representing the value of
00242  * @a tristate.
00243  *
00244  * @since New in 1.7.
00245  */
00246 const char *
00247 svn_tristate__to_word(svn_tristate_t tristate);
00248 
00249 /** Return the appropriate tristate for @a word. If @a word is "true", returns
00250  * #svn_tristate_true; if @a word is "false", returns #svn_tristate_false,
00251  * for all other values (including NULL) returns #svn_tristate_unknown.
00252  *
00253  * @since New in 1.7.
00254  */
00255 svn_tristate_t
00256 svn_tristate__from_word(const char * word);
00257 
00258 
00259 /** About Special Files in Subversion
00260  *
00261  * Subversion denotes files that cannot be portably created or
00262  * modified as "special" files (svn_node_special).  It stores these
00263  * files in the repository as a plain text file with the svn:special
00264  * property set.  The file contents contain: a platform-specific type
00265  * string, a space character, then any information necessary to create
00266  * the file on a supported platform.  For example, if a symbolic link
00267  * were being represented, the repository file would have the
00268  * following contents:
00269  *
00270  * "link /path/to/link/target"
00271  *
00272  * Where 'link' is the identifier string showing that this special
00273  * file should be a symbolic link and '/path/to/link/target' is the
00274  * destination of the symbolic link.
00275  *
00276  * Special files are stored in the text-base exactly as they are
00277  * stored in the repository.  The platform specific files are created
00278  * in the working copy at EOL/keyword translation time using
00279  * svn_subst_copy_and_translate2().  If the current platform does not
00280  * support a specific special file type, the file is copied into the
00281  * working copy as it is seen in the repository.  Because of this,
00282  * users of other platforms can still view and modify the special
00283  * files, even if they do not have their unique properties.
00284  *
00285  * New types of special files can be added by:
00286  *  1. Implementing a platform-dependent routine to create a uniquely
00287  *     named special file and one to read the special file in
00288  *     libsvn_subr/io.c.
00289  *  2. Creating a new textual name similar to
00290  *     SVN_SUBST__SPECIAL_LINK_STR in libsvn_subr/subst.c.
00291  *  3. Handling the translation/detranslation case for the new type in
00292  *     create_special_file and detranslate_special_file, using the
00293  *     routines from 1.
00294  */
00295 
00296 /** A revision number. */
00297 typedef long int svn_revnum_t;
00298 
00299 /** Valid revision numbers begin at 0 */
00300 #define SVN_IS_VALID_REVNUM(n) ((n) >= 0)
00301 
00302 /** The 'official' invalid revision num */
00303 #define SVN_INVALID_REVNUM ((svn_revnum_t) -1)
00304 
00305 /** Not really invalid...just unimportant -- one day, this can be its
00306  * own unique value, for now, just make it the same as
00307  * #SVN_INVALID_REVNUM.
00308  */
00309 #define SVN_IGNORED_REVNUM ((svn_revnum_t) -1)
00310 
00311 /** Convert NULL-terminated C string @a str to a revision number. */
00312 #define SVN_STR_TO_REV(str) ((svn_revnum_t) atol(str))
00313 
00314 /**
00315  * Parse NULL-terminated C string @a str as a revision number and
00316  * store its value in @a rev.  If @a endptr is non-NULL, then the
00317  * address of the first non-numeric character in @a str is stored in
00318  * it.  If there are no digits in @a str, then @a endptr is set (if
00319  * non-NULL), and the error #SVN_ERR_REVNUM_PARSE_FAILURE error is
00320  * returned.  Negative numbers parsed from @a str are considered
00321  * invalid, and result in the same error.
00322  *
00323  * @since New in 1.5.
00324  */
00325 svn_error_t *
00326 svn_revnum_parse(svn_revnum_t *rev,
00327                  const char *str,
00328                  const char **endptr);
00329 
00330 /** Originally intended to be used in printf()-style functions to format
00331  * revision numbers.  Deprecated due to incompatibilities with language
00332  * translation tools (e.g. gettext).
00333  *
00334  * New code should use a bare "%ld" format specifier for formatting revision
00335  * numbers.
00336  *
00337  * @deprecated Provided for backward compatibility with the 1.0 API.
00338  */
00339 #define SVN_REVNUM_T_FMT "ld"
00340 
00341 
00342 /** The size of a file in the Subversion FS. */
00343 typedef apr_int64_t svn_filesize_t;
00344 
00345 /** The 'official' invalid file size constant. */
00346 #define SVN_INVALID_FILESIZE ((svn_filesize_t) -1)
00347 
00348 /** In printf()-style functions, format file sizes using this. */
00349 #define SVN_FILESIZE_T_FMT APR_INT64_T_FMT
00350 
00351 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00352 /* Parse a base-10 numeric string into a 64-bit unsigned numeric value. */
00353 /* NOTE: Private. For use by Subversion's own code only. See issue #1644. */
00354 /* FIXME: APR should supply a function to do this, such as "apr_atoui64". */
00355 #define svn__atoui64(X) ((apr_uint64_t) apr_atoi64(X))
00356 #endif
00357 
00358 
00359 /** YABT:  Yet Another Boolean Type */
00360 typedef int svn_boolean_t;
00361 
00362 #ifndef TRUE
00363 /** uhh... true */
00364 #define TRUE 1
00365 #endif /* TRUE */
00366 
00367 #ifndef FALSE
00368 /** uhh... false */
00369 #define FALSE 0
00370 #endif /* FALSE */
00371 
00372 
00373 /** An enum to indicate whether recursion is needed. */
00374 enum svn_recurse_kind
00375 {
00376   svn_nonrecursive = 1,
00377   svn_recursive
00378 };
00379 
00380 /** The concept of depth for directories.
00381  *
00382  * @note This is similar to, but not exactly the same as, the WebDAV
00383  * and LDAP concepts of depth.
00384  *
00385  * @since New in 1.5.
00386  */
00387 typedef enum svn_depth_t
00388 {
00389   /* The order of these depths is important: the higher the number,
00390      the deeper it descends.  This allows us to compare two depths
00391      numerically to decide which should govern. */
00392 
00393   /** Depth undetermined or ignored.  In some contexts, this means the
00394       client should choose an appropriate default depth.  The server
00395       will generally treat it as #svn_depth_infinity. */
00396   svn_depth_unknown    = -2,
00397 
00398   /** Exclude (i.e., don't descend into) directory D.
00399       @note In Subversion 1.5, svn_depth_exclude is *not* supported
00400       anywhere in the client-side (libsvn_wc/libsvn_client/etc) code;
00401       it is only supported as an argument to set_path functions in the
00402       ra and repos reporters.  (This will enable future versions of
00403       Subversion to run updates, etc, against 1.5 servers with proper
00404       svn_depth_exclude behavior, once we get a chance to implement
00405       client-side support for svn_depth_exclude.)
00406   */
00407   svn_depth_exclude    = -1,
00408 
00409   /** Just the named directory D, no entries.  Updates will not pull in
00410       any files or subdirectories not already present. */
00411   svn_depth_empty      =  0,
00412 
00413   /** D + its file children, but not subdirs.  Updates will pull in any
00414       files not already present, but not subdirectories. */
00415   svn_depth_files      =  1,
00416 
00417   /** D + immediate children (D and its entries).  Updates will pull in
00418       any files or subdirectories not already present; those
00419       subdirectories' this_dir entries will have depth-empty. */
00420   svn_depth_immediates =  2,
00421 
00422   /** D + all descendants (full recursion from D).  Updates will pull
00423       in any files or subdirectories not already present; those
00424       subdirectories' this_dir entries will have depth-infinity.
00425       Equivalent to the pre-1.5 default update behavior. */
00426   svn_depth_infinity   =  3
00427 
00428 } svn_depth_t;
00429 
00430 
00431 /** Return a constant string expressing @a depth as an English word,
00432  * e.g., "infinity", "immediates", etc.  The string is not localized,
00433  * as it may be used for client<->server communications.
00434  *
00435  * @since New in 1.5.
00436  */
00437 const char *
00438 svn_depth_to_word(svn_depth_t depth);
00439 
00440 
00441 /** Return the appropriate depth for @a depth_str.  @a word is as
00442  * returned from svn_depth_to_word().  If @a depth_str does not
00443  * represent a recognized depth, return #svn_depth_unknown.
00444  *
00445  * @since New in 1.5.
00446  */
00447 svn_depth_t
00448 svn_depth_from_word(const char *word);
00449 
00450 
00451 /* Return #svn_depth_infinity if boolean @a recurse is TRUE, else
00452  * return #svn_depth_files.
00453  *
00454  * @note New code should never need to use this, it is called only
00455  * from pre-depth APIs, for compatibility.
00456  *
00457  * @since New in 1.5.
00458  */
00459 #define SVN_DEPTH_INFINITY_OR_FILES(recurse) \
00460   ((recurse) ? svn_depth_infinity : svn_depth_files)
00461 
00462 
00463 /* Return #svn_depth_infinity if boolean @a recurse is TRUE, else
00464  * return #svn_depth_immediates.
00465  *
00466  * @note New code should never need to use this, it is called only
00467  * from pre-depth APIs, for compatibility.
00468  *
00469  * @since New in 1.5.
00470  */
00471 #define SVN_DEPTH_INFINITY_OR_IMMEDIATES(recurse) \
00472   ((recurse) ? svn_depth_infinity : svn_depth_immediates)
00473 
00474 
00475 /* Return #svn_depth_infinity if boolean @a recurse is TRUE, else
00476  * return #svn_depth_empty.
00477  *
00478  * @note New code should never need to use this, it is called only
00479  * from pre-depth APIs, for compatibility.
00480  *
00481  * @since New in 1.5.
00482  */
00483 #define SVN_DEPTH_INFINITY_OR_EMPTY(recurse) \
00484   ((recurse) ? svn_depth_infinity : svn_depth_empty)
00485 
00486 
00487 /* Return a recursion boolean based on @a depth.
00488  *
00489  * Although much code has been converted to use depth, some code still
00490  * takes a recurse boolean.  In most cases, it makes sense to treat
00491  * unknown or infinite depth as recursive, and any other depth as
00492  * non-recursive (which in turn usually translates to #svn_depth_files).
00493  */
00494 #define SVN_DEPTH_IS_RECURSIVE(depth)                              \
00495   (((depth) == svn_depth_infinity || (depth) == svn_depth_unknown) \
00496    ? TRUE : FALSE)
00497 
00498 
00499 /**
00500  * It is sometimes convenient to indicate which parts of an #svn_dirent_t
00501  * object you are actually interested in, so that calculating and sending
00502  * the data corresponding to the other fields can be avoided.  These values
00503  * can be used for that purpose.
00504  *
00505  * @defgroup svn_dirent_fields Dirent fields
00506  * @{
00507  */
00508 
00509 /** An indication that you are interested in the @c kind field */
00510 #define SVN_DIRENT_KIND        0x00001
00511 
00512 /** An indication that you are interested in the @c size field */
00513 #define SVN_DIRENT_SIZE        0x00002
00514 
00515 /** An indication that you are interested in the @c has_props field */
00516 #define SVN_DIRENT_HAS_PROPS   0x00004
00517 
00518 /** An indication that you are interested in the @c created_rev field */
00519 #define SVN_DIRENT_CREATED_REV 0x00008
00520 
00521 /** An indication that you are interested in the @c time field */
00522 #define SVN_DIRENT_TIME        0x00010
00523 
00524 /** An indication that you are interested in the @c last_author field */
00525 #define SVN_DIRENT_LAST_AUTHOR 0x00020
00526 
00527 /** A combination of all the dirent fields */
00528 #define SVN_DIRENT_ALL ~((apr_uint32_t ) 0)
00529 
00530 /** @} */
00531 
00532 /** A general subversion directory entry. */
00533 typedef struct svn_dirent_t
00534 {
00535   /** node kind */
00536   svn_node_kind_t kind;
00537 
00538   /** length of file text, or 0 for directories */
00539   svn_filesize_t size;
00540 
00541   /** does the node have props? */
00542   svn_boolean_t has_props;
00543 
00544   /** last rev in which this node changed */
00545   svn_revnum_t created_rev;
00546 
00547   /** time of created_rev (mod-time) */
00548   apr_time_t time;
00549 
00550   /** author of created_rev */
00551   const char *last_author;
00552 
00553   /* IMPORTANT: If you extend this struct, check svn_dirent_dup(). */
00554 } svn_dirent_t;
00555 
00556 
00557 /** Return a deep copy of @a dirent, allocated in @a pool.
00558  *
00559  * @since New in 1.4.
00560  */
00561 svn_dirent_t *
00562 svn_dirent_dup(const svn_dirent_t *dirent,
00563                apr_pool_t *pool);
00564 
00565 
00566 
00567 /** Keyword substitution.
00568  *
00569  * All the keywords Subversion recognizes.
00570  *
00571  * Note that there is a better, more general proposal out there, which
00572  * would take care of both internationalization issues and custom
00573  * keywords (e.g., $NetBSD$).  See
00574  *
00575  * @verbatim
00576       http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=8921
00577       =====
00578       From: "Jonathan M. Manning" <jmanning@alisa-jon.net>
00579       To: dev@subversion.tigris.org
00580       Date: Fri, 14 Dec 2001 11:56:54 -0500
00581       Message-ID: <87970000.1008349014@bdldevel.bl.bdx.com>
00582       Subject: Re: keywords @endverbatim
00583  *
00584  * and Eric Gillespie's support of same:
00585  *
00586  * @verbatim
00587       http://subversion.tigris.org/servlets/ReadMsg?list=dev&msgNo=8757
00588       =====
00589       From: "Eric Gillespie, Jr." <epg@pretzelnet.org>
00590       To: dev@subversion.tigris.org
00591       Date: Wed, 12 Dec 2001 09:48:42 -0500
00592       Message-ID: <87k7vsebp1.fsf@vger.pretzelnet.org>
00593       Subject: Re: Customizable Keywords @endverbatim
00594  *
00595  * However, it is considerably more complex than the scheme below.
00596  * For now we're going with simplicity, hopefully the more general
00597  * solution can be done post-1.0.
00598  *
00599  * @defgroup svn_types_keywords Keyword definitions
00600  * @{
00601  */
00602 
00603 /** The maximum size of an expanded or un-expanded keyword. */
00604 #define SVN_KEYWORD_MAX_LEN    255
00605 
00606 /** The most recent revision in which this file was changed. */
00607 #define SVN_KEYWORD_REVISION_LONG    "LastChangedRevision"
00608 
00609 /** Short version of LastChangedRevision */
00610 #define SVN_KEYWORD_REVISION_SHORT   "Rev"
00611 
00612 /** Medium version of LastChangedRevision, matching the one CVS uses.
00613  * @since New in 1.1. */
00614 #define SVN_KEYWORD_REVISION_MEDIUM  "Revision"
00615 
00616 /** The most recent date (repository time) when this file was changed. */
00617 #define SVN_KEYWORD_DATE_LONG        "LastChangedDate"
00618 
00619 /** Short version of LastChangedDate */
00620 #define SVN_KEYWORD_DATE_SHORT       "Date"
00621 
00622 /** Who most recently committed to this file. */
00623 #define SVN_KEYWORD_AUTHOR_LONG      "LastChangedBy"
00624 
00625 /** Short version of LastChangedBy */
00626 #define SVN_KEYWORD_AUTHOR_SHORT     "Author"
00627 
00628 /** The URL for the head revision of this file. */
00629 #define SVN_KEYWORD_URL_LONG         "HeadURL"
00630 
00631 /** Short version of HeadURL */
00632 #define SVN_KEYWORD_URL_SHORT        "URL"
00633 
00634 /** A compressed combination of the other four keywords. */
00635 #define SVN_KEYWORD_ID               "Id"
00636 
00637 /** A full combination of the first four keywords.
00638  * @since New in 1.6. */
00639 #define SVN_KEYWORD_HEADER           "Header"
00640 
00641 /** @} */
00642 
00643 
00644 /** All information about a commit.
00645  *
00646  * @note Objects of this type should always be created using the
00647  * svn_create_commit_info() function.
00648  *
00649  * @since New in 1.3.
00650  */
00651 typedef struct svn_commit_info_t
00652 {
00653   /** just-committed revision. */
00654   svn_revnum_t revision;
00655 
00656   /** server-side date of the commit. */
00657   const char *date;
00658 
00659   /** author of the commit. */
00660   const char *author;
00661 
00662   /** error message from post-commit hook, or NULL. */
00663   const char *post_commit_err;
00664 
00665   /** repository root, may be @c NULL if unknown.
00666       @since New in 1.7. */
00667   const char *repos_root;
00668 
00669 } svn_commit_info_t;
00670 
00671 
00672 /**
00673  * Allocate an object of type #svn_commit_info_t in @a pool and
00674  * return it.
00675  *
00676  * The @c revision field of the new struct is set to #SVN_INVALID_REVNUM.
00677  * All other fields are initialized to @c NULL.
00678  *
00679  * @note Any object of the type #svn_commit_info_t should
00680  * be created using this function.
00681  * This is to provide for extending the svn_commit_info_t in
00682  * the future.
00683  *
00684  * @since New in 1.3.
00685  */
00686 svn_commit_info_t *
00687 svn_create_commit_info(apr_pool_t *pool);
00688 
00689 
00690 /**
00691  * Return a deep copy @a src_commit_info allocated in @a pool.
00692  *
00693  * @since New in 1.4.
00694  */
00695 svn_commit_info_t *
00696 svn_commit_info_dup(const svn_commit_info_t *src_commit_info,
00697                     apr_pool_t *pool);
00698 
00699 
00700 /**
00701  * A structure to represent a path that changed for a log entry.
00702  *
00703  * @note To allow for extending the #svn_log_changed_path2_t structure in
00704  * future releases, always use svn_log_changed_path2_create() to allocate
00705  * the structure.
00706  *
00707  * @since New in 1.6.
00708  */
00709 typedef struct svn_log_changed_path2_t
00710 {
00711   /** 'A'dd, 'D'elete, 'R'eplace, 'M'odify */
00712   char action;
00713 
00714   /** Source path of copy (if any). */
00715   const char *copyfrom_path;
00716 
00717   /** Source revision of copy (if any). */
00718   svn_revnum_t copyfrom_rev;
00719 
00720   /** The type of the node, may be svn_node_unknown. */
00721   svn_node_kind_t node_kind;
00722 
00723   /** Is the text modified, may be svn_tristate_unknown.
00724    * @since New in 1.7. */
00725   svn_tristate_t text_modified;
00726 
00727   /** Are properties modified, may be svn_tristate_unknown.
00728    * @since New in 1.7. */
00729   svn_tristate_t props_modified;
00730 
00731   /* NOTE: Add new fields at the end to preserve binary compatibility.
00732      Also, if you add fields here, you have to update
00733      svn_log_changed_path2_dup(). */
00734 } svn_log_changed_path2_t;
00735 
00736 /**
00737  * Returns an #svn_log_changed_path2_t, allocated in @a pool with all fields
00738  * initialized to NULL, None or empty values.
00739  *
00740  * @note To allow for extending the #svn_log_changed_path2_t structure in
00741  * future releases, this function should always be used to allocate the
00742  * structure.
00743  *
00744  * @since New in 1.6.
00745  */
00746 svn_log_changed_path2_t *
00747 svn_log_changed_path2_create(apr_pool_t *pool);
00748 
00749 /**
00750  * Return a deep copy of @a changed_path, allocated in @a pool.
00751  *
00752  * @since New in 1.6.
00753  */
00754 svn_log_changed_path2_t *
00755 svn_log_changed_path2_dup(const svn_log_changed_path2_t *changed_path,
00756                           apr_pool_t *pool);
00757 
00758 /**
00759  * A structure to represent a path that changed for a log entry.  Same as
00760  * #svn_log_changed_path2_t, but without the node kind.
00761  *
00762  * @deprecated Provided for backward compatibility with the 1.5 API.
00763  */
00764 typedef struct svn_log_changed_path_t
00765 {
00766   /** 'A'dd, 'D'elete, 'R'eplace, 'M'odify */
00767   char action;
00768 
00769   /** Source path of copy (if any). */
00770   const char *copyfrom_path;
00771 
00772   /** Source revision of copy (if any). */
00773   svn_revnum_t copyfrom_rev;
00774 
00775 } svn_log_changed_path_t;
00776 
00777 
00778 /**
00779  * Return a deep copy of @a changed_path, allocated in @a pool.
00780  *
00781  * @since New in 1.3.
00782  * @deprecated Provided for backward compatibility with the 1.5 API.
00783  */
00784 SVN_DEPRECATED
00785 svn_log_changed_path_t *
00786 svn_log_changed_path_dup(const svn_log_changed_path_t *changed_path,
00787                          apr_pool_t *pool);
00788 
00789 /**
00790  * A structure to represent all the information about a particular log entry.
00791  *
00792  * @note To allow for extending the #svn_log_entry_t structure in future
00793  * releases, always use svn_log_entry_create() to allocate the structure.
00794  *
00795  * @since New in 1.5.
00796  */
00797 typedef struct svn_log_entry_t
00798 {
00799   /** A hash containing as keys every path committed in @a revision; the
00800    * values are (#svn_log_changed_path_t *) structures.
00801    *
00802    * The subversion core libraries will always set this field to the same
00803    * value as changed_paths2 for compatibility reasons.
00804    *
00805    * @deprecated Provided for backward compatibility with the 1.5 API.
00806    */
00807   apr_hash_t *changed_paths;
00808 
00809   /** The revision of the commit. */
00810   svn_revnum_t revision;
00811 
00812   /** The hash of requested revision properties, which may be NULL if it
00813    * would contain no revprops. */
00814   apr_hash_t *revprops;
00815 
00816   /**
00817    * Whether or not this message has children.
00818    *
00819    * When a log operation requests additional merge information, extra log
00820    * entries may be returned as a result of this entry.  The new entries, are
00821    * considered children of the original entry, and will follow it.  When
00822    * the HAS_CHILDREN flag is set, the receiver should increment its stack
00823    * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which
00824    * indicates the end of the children.
00825    *
00826    * For log operations which do not request additional merge information, the
00827    * HAS_CHILDREN flag is always FALSE.
00828    *
00829    * For more information see:
00830    * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting
00831    */
00832   svn_boolean_t has_children;
00833 
00834   /** A hash containing as keys every path committed in @a revision; the
00835    * values are (#svn_log_changed_path2_t *) structures.
00836    *
00837    * If this value is not @c NULL, it MUST have the same value as
00838    * changed_paths or svn_log_entry_dup() will not create an identical copy.
00839    *
00840    * The subversion core libraries will always set this field to the same
00841    * value as changed_paths for compatibility with users assuming an older
00842    * version.
00843    *
00844    * @note See http://svn.haxx.se/dev/archive-2010-08/0362.shtml for
00845    * further explanation.
00846    *
00847    * @since New in 1.6.
00848    */
00849   apr_hash_t *changed_paths2;
00850 
00851   /**
00852    * Whether @a revision should be interpreted as non-inheritable in the
00853    * same sense of #svn_merge_range_t.
00854    *
00855    * @since New in 1.7.
00856    */
00857   svn_boolean_t non_inheritable;
00858 
00859   /**
00860    * Whether @a revision is a merged revision resulting from a reverse merge.
00861    *
00862    * @since New in 1.7.
00863    */
00864   svn_boolean_t subtractive_merge;
00865 
00866   /* NOTE: Add new fields at the end to preserve binary compatibility.
00867      Also, if you add fields here, you have to update
00868      svn_log_entry_dup(). */
00869 } svn_log_entry_t;
00870 
00871 /**
00872  * Returns an #svn_log_entry_t, allocated in @a pool with all fields
00873  * initialized to NULL values.
00874  *
00875  * @note To allow for extending the #svn_log_entry_t structure in future
00876  * releases, this function should always be used to allocate the structure.
00877  *
00878  * @since New in 1.5.
00879  */
00880 svn_log_entry_t *
00881 svn_log_entry_create(apr_pool_t *pool);
00882 
00883 /** Return a deep copy of @a log_entry, allocated in @a pool.
00884  *
00885  * The resulting svn_log_entry_t has @c changed_paths set to the same
00886  * value as @c changed_path2. @c changed_paths will be @c NULL if
00887  * @c changed_paths2 was @c NULL.
00888  *
00889  * @since New in 1.6.
00890  */
00891 svn_log_entry_t *
00892 svn_log_entry_dup(const svn_log_entry_t *log_entry, apr_pool_t *pool);
00893 
00894 /** The callback invoked by log message loopers, such as
00895  * #svn_ra_plugin_t.get_log() and svn_repos_get_logs().
00896  *
00897  * This function is invoked once on each log message, in the order
00898  * determined by the caller (see above-mentioned functions).
00899  *
00900  * @a baton is what you think it is, and @a log_entry contains relevant
00901  * information for the log message.  Any of @a log_entry->author,
00902  * @a log_entry->date, or @a log_entry->message may be @c NULL.
00903  *
00904  * If @a log_entry->date is neither NULL nor the empty string, it was
00905  * generated by svn_time_to_cstring() and can be converted to
00906  * @c apr_time_t with svn_time_from_cstring().
00907  *
00908  * If @a log_entry->changed_paths is non-@c NULL, then it contains as keys
00909  * every path committed in @a log_entry->revision; the values are
00910  * (#svn_log_changed_path_t *) structures.
00911  *
00912  * If @a log_entry->has_children is @c TRUE, the message will be followed
00913  * immediately by any number of merged revisions (child messages), which are
00914  * terminated by an invocation with SVN_INVALID_REVNUM.  This usage may
00915  * be recursive.
00916  *
00917  * Use @a pool for temporary allocation.  If the caller is iterating
00918  * over log messages, invoking this receiver on each, we recommend the
00919  * standard pool loop recipe: create a subpool, pass it as @a pool to
00920  * each call, clear it after each iteration, destroy it after the loop
00921  * is done.  (For allocation that must last beyond the lifetime of a
00922  * given receiver call, use a pool in @a baton.)
00923  *
00924  * @since New in 1.5.
00925  */
00926 
00927 typedef svn_error_t *(*svn_log_entry_receiver_t)(
00928   void *baton,
00929   svn_log_entry_t *log_entry,
00930   apr_pool_t *pool);
00931 
00932 /**
00933  * Similar to #svn_log_entry_receiver_t, except this uses separate
00934  * parameters for each part of the log entry.
00935  *
00936  * @deprecated Provided for backward compatibility with the 1.4 API.
00937  */
00938 typedef svn_error_t *(*svn_log_message_receiver_t)(
00939   void *baton,
00940   apr_hash_t *changed_paths,
00941   svn_revnum_t revision,
00942   const char *author,
00943   const char *date,  /* use svn_time_from_cstring() if need apr_time_t */
00944   const char *message,
00945   apr_pool_t *pool);
00946 
00947 
00948 /** Callback function type for commits.
00949  *
00950  * When a commit succeeds, an instance of this is invoked with the
00951  * @a commit_info, along with the @a baton closure.
00952  * @a pool can be used for temporary allocations.
00953  *
00954  * @since New in 1.4.
00955  */
00956 typedef svn_error_t *(*svn_commit_callback2_t)(
00957   const svn_commit_info_t *commit_info,
00958   void *baton,
00959   apr_pool_t *pool);
00960 
00961 /** Same as #svn_commit_callback2_t, but uses individual
00962  * data elements instead of the #svn_commit_info_t structure
00963  *
00964  * @deprecated Provided for backward compatibility with the 1.3 API.
00965  */
00966 typedef svn_error_t *(*svn_commit_callback_t)(
00967   svn_revnum_t new_revision,
00968   const char *date,
00969   const char *author,
00970   void *baton);
00971 
00972 
00973 /** A buffer size that may be used when processing a stream of data.
00974  *
00975  * @note We don't use this constant any longer, since it is considered to be
00976  * unnecessarily large.
00977  *
00978  * @deprecated Provided for backwards compatibility with the 1.3 API.
00979  */
00980 #define SVN_STREAM_CHUNK_SIZE 102400
00981 
00982 #ifndef DOXYGEN_SHOULD_SKIP_THIS
00983 /*
00984  * The maximum amount we (ideally) hold in memory at a time when
00985  * processing a stream of data.
00986  *
00987  * For example, when copying data from one stream to another, do it in
00988  * blocks of this size.
00989  *
00990  * NOTE: This is an internal macro, put here for convenience.
00991  * No public API may depend on the particular value of this macro.
00992  */
00993 #define SVN__STREAM_CHUNK_SIZE 16384
00994 #endif
00995 
00996 /** The maximum amount we can ever hold in memory. */
00997 /* FIXME: Should this be the same as SVN_STREAM_CHUNK_SIZE? */
00998 #define SVN_MAX_OBJECT_SIZE (((apr_size_t) -1) / 2)
00999 
01000 
01001 
01002 /* ### Note: despite being about mime-TYPES, these probably don't
01003  * ### belong in svn_types.h.  However, no other header is more
01004  * ### appropriate, and didn't feel like creating svn_validate.h for
01005  * ### so little.
01006  */
01007 
01008 /** Validate @a mime_type.
01009  *
01010  * If @a mime_type does not contain a "/", or ends with non-alphanumeric
01011  * data, return #SVN_ERR_BAD_MIME_TYPE, else return success.
01012  *
01013  * Use @a pool only to find error allocation.
01014  *
01015  * Goal: to match both "foo/bar" and "foo/bar; charset=blah", without
01016  * being too strict about it, but to disallow mime types that have
01017  * quotes, newlines, or other garbage on the end, such as might be
01018  * unsafe in an HTTP header.
01019  */
01020 svn_error_t *
01021 svn_mime_type_validate(const char *mime_type,
01022                        apr_pool_t *pool);
01023 
01024 
01025 /** Return FALSE iff @a mime_type is a textual type.
01026  *
01027  * All mime types that start with "text/" are textual, plus some special
01028  * cases (for example, "image/x-xbitmap").
01029  */
01030 svn_boolean_t
01031 svn_mime_type_is_binary(const char *mime_type);
01032 
01033 
01034 
01035 /** A user defined callback that subversion will call with a user defined
01036  * baton to see if the current operation should be continued.  If the operation
01037  * should continue, the function should return #SVN_NO_ERROR, if not, it
01038  * should return #SVN_ERR_CANCELLED.
01039  */
01040 typedef svn_error_t *(*svn_cancel_func_t)(void *cancel_baton);
01041 
01042 
01043 
01044 /**
01045  * A lock object, for client & server to share.
01046  *
01047  * A lock represents the exclusive right to add, delete, or modify a
01048  * path.  A lock is created in a repository, wholly controlled by the
01049  * repository.  A "lock-token" is the lock's UUID, and can be used to
01050  * learn more about a lock's fields, and or/make use of the lock.
01051  * Because a lock is immutable, a client is free to not only cache the
01052  * lock-token, but the lock's fields too, for convenience.
01053  *
01054  * Note that the 'is_dav_comment' field is wholly ignored by every
01055  * library except for mod_dav_svn.  The field isn't even marshalled
01056  * over the network to the client.  Assuming lock structures are
01057  * created with apr_pcalloc(), a default value of 0 is universally safe.
01058  *
01059  * @note in the current implementation, only files are lockable.
01060  *
01061  * @since New in 1.2.
01062  */
01063 typedef struct svn_lock_t
01064 {
01065   const char *path;              /**< the path this lock applies to */
01066   const char *token;             /**< unique URI representing lock */
01067   const char *owner;             /**< the username which owns the lock */
01068   const char *comment;           /**< (optional) description of lock  */
01069   svn_boolean_t is_dav_comment;  /**< was comment made by generic DAV client? */
01070   apr_time_t creation_date;      /**< when lock was made */
01071   apr_time_t expiration_date;    /**< (optional) when lock will expire;
01072                                       If value is 0, lock will never expire. */
01073 } svn_lock_t;
01074 
01075 /**
01076  * Returns an #svn_lock_t, allocated in @a pool with all fields initialized
01077  * to NULL values.
01078  *
01079  * @note To allow for extending the #svn_lock_t structure in the future
01080  * releases, this function should always be used to allocate the structure.
01081  *
01082  * @since New in 1.2.
01083  */
01084 svn_lock_t *
01085 svn_lock_create(apr_pool_t *pool);
01086 
01087 /**
01088  * Return a deep copy of @a lock, allocated in @a pool.
01089  *
01090  * @since New in 1.2.
01091  */
01092 svn_lock_t *
01093 svn_lock_dup(const svn_lock_t *lock, apr_pool_t *pool);
01094 
01095 /**
01096  * Return a formatted Universal Unique IDentifier (UUID) string.
01097  *
01098  * @since New in 1.4.
01099  */
01100 const char *
01101 svn_uuid_generate(apr_pool_t *pool);
01102 
01103 /**
01104  * Mergeinfo representing a merge of a range of revisions.
01105  *
01106  * @since New in 1.5
01107  */
01108 typedef struct svn_merge_range_t
01109 {
01110   /**
01111    * If the 'start' field is less than the 'end' field then 'start' is
01112    * exclusive and 'end' inclusive of the range described.  This is termed
01113    * a forward merge range.  If 'start' is greater than 'end' then the
01114    * opposite is true.  This is termed a reverse merge range.  If 'start'
01115    * equals 'end' the meaning of the range is not defined.
01116    */
01117   svn_revnum_t start;
01118   svn_revnum_t end;
01119 
01120   /**
01121    * Whether this merge range should be inherited by treewise
01122    * descendants of the path to which the range applies. */
01123   svn_boolean_t inheritable;
01124 } svn_merge_range_t;
01125 
01126 /**
01127  * Return a copy of @a range, allocated in @a pool.
01128  *
01129  * @since New in 1.5.
01130  */
01131 svn_merge_range_t *
01132 svn_merge_range_dup(const svn_merge_range_t *range, apr_pool_t *pool);
01133 
01134 /**
01135  * Returns true if the changeset committed in revision @a rev is one
01136  * of the changesets in the range @a range.
01137  *
01138  * @since New in 1.5.
01139  */
01140 svn_boolean_t
01141 svn_merge_range_contains_rev(const svn_merge_range_t *range, svn_revnum_t rev);
01142 
01143 
01144 
01145 /** @defgroup node_location_seg_reporting Node location segment reporting.
01146  *  @{ */
01147 
01148 /**
01149  * A representation of a segment of a object's version history with an
01150  * emphasis on the object's location in the repository as of various
01151  * revisions.
01152  *
01153  * @since New in 1.5.
01154  */
01155 typedef struct svn_location_segment_t
01156 {
01157   /** The beginning (oldest) and ending (youngest) revisions for this
01158       segment. */
01159   svn_revnum_t range_start;
01160   svn_revnum_t range_end;
01161 
01162   /** The absolute (sans leading slash) path for this segment.  May be
01163       NULL to indicate gaps in an object's history.  */
01164   const char *path;
01165 
01166 } svn_location_segment_t;
01167 
01168 
01169 /**
01170  * A callback invoked by generators of #svn_location_segment_t
01171  * objects, used to report information about a versioned object's
01172  * history in terms of its location in the repository filesystem over
01173  * time.
01174  */
01175 typedef svn_error_t *(*svn_location_segment_receiver_t)(
01176   svn_location_segment_t *segment,
01177   void *baton,
01178   apr_pool_t *pool);
01179 
01180 
01181 /**
01182  * Return a deep copy of @a segment, allocated in @a pool.
01183  *
01184  * @since New in 1.5.
01185  */
01186 svn_location_segment_t *
01187 svn_location_segment_dup(const svn_location_segment_t *segment,
01188                          apr_pool_t *pool);
01189 
01190 /** @} */
01191 
01192 /** A line number, such as in a file or a stream.
01193  *
01194  * @since New in 1.7.
01195  */
01196 typedef unsigned long svn_linenum_t;
01197 
01198 /* The maximum value of an svn_linenum_t.
01199  *
01200  * @since New in 1.7.
01201  */
01202 #define SVN_LINENUM_MAX_VALUE ULONG_MAX
01203 
01204 
01205 #ifdef __cplusplus
01206 }
01207 #endif /* __cplusplus */
01208 
01209 
01210 /*
01211  * Everybody and their brother needs to deal with svn_error_t, the error
01212  * codes, and whatever else. While they *should* go and include svn_error.h
01213  * in order to do that... bah. Let's just help everybody out and include
01214  * that header whenever somebody grabs svn_types.h.
01215  *
01216  * Note that we do this at the END of this header so that its contents
01217  * are available to svn_error.h (our guards will prevent the circular
01218  * include). We also need to do the include *outside* of the cplusplus
01219  * guard.
01220  */
01221 #include "svn_error.h"
01222 
01223 
01224 /*
01225  * Subversion developers may want to use some additional debugging facilities
01226  * while working on the code. We'll pull that in here, so individual source
01227  * files don't have to include this header manually.
01228  */
01229 #ifdef SVN_DEBUG
01230 #include "private/svn_debug.h"
01231 #endif
01232 
01233 
01234 #endif /* SVN_TYPES_H */
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines