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