OSDN Git Service

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