- Main Page
- Related Pages
- Modules
- Data Structures
- Files

- File List
- Globals

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

All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Defines