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