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