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