]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/blob - contrib/subversion/subversion/include/svn_repos.h
Copy head (r256279) to stable/10 as part of the 10.0-RELEASE cycle.
[FreeBSD/stable/10.git] / contrib / subversion / subversion / include / svn_repos.h
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_repos.h
24  * @brief Tools built on top of the filesystem.
25  */
26
27 #ifndef SVN_REPOS_H
28 #define SVN_REPOS_H
29
30 #include <apr_pools.h>
31 #include <apr_hash.h>
32 #include <apr_tables.h>
33 #include <apr_time.h>
34
35 #include "svn_types.h"
36 #include "svn_string.h"
37 #include "svn_delta.h"
38 #include "svn_fs.h"
39 #include "svn_io.h"
40 #include "svn_mergeinfo.h"
41
42
43 #ifdef __cplusplus
44 extern "C" {
45 #endif /* __cplusplus */
46
47 /* ---------------------------------------------------------------*/
48
49 /**
50  * Get libsvn_repos version information.
51  *
52  * @since New in 1.1.
53  */
54 const svn_version_t *
55 svn_repos_version(void);
56
57
58 /* Some useful enums.  They need to be declared here for the notification
59    system to pick them up. */
60 /** The different "actions" attached to nodes in the dumpfile. */
61 enum svn_node_action
62 {
63   svn_node_action_change,
64   svn_node_action_add,
65   svn_node_action_delete,
66   svn_node_action_replace
67 };
68
69 /** The different policies for processing the UUID in the dumpfile. */
70 enum svn_repos_load_uuid
71 {
72   /** only update uuid if the repos has no revisions. */
73   svn_repos_load_uuid_default,
74   /** never update uuid. */
75   svn_repos_load_uuid_ignore,
76   /** always update uuid. */
77   svn_repos_load_uuid_force
78 };
79
80 \f
81 /** Callback type for checking authorization on paths produced by (at
82  * least) svn_repos_dir_delta2().
83  *
84  * Set @a *allowed to TRUE to indicate that some operation is
85  * authorized for @a path in @a root, or set it to FALSE to indicate
86  * unauthorized (presumably according to state stored in @a baton).
87  *
88  * Do not assume @a pool has any lifetime beyond this call.
89  *
90  * The exact operation being authorized depends on the callback
91  * implementation.  For read authorization, for example, the caller
92  * would implement an instance that does read checking, and pass it as
93  * a parameter named [perhaps] 'authz_read_func'.  The receiver of
94  * that parameter might also take another parameter named
95  * 'authz_write_func', which although sharing this type, would be a
96  * different implementation.
97  *
98  * @note If someday we want more sophisticated authorization states
99  * than just yes/no, @a allowed can become an enum type.
100  */
101 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
102                                                svn_fs_root_t *root,
103                                                const char *path,
104                                                void *baton,
105                                                apr_pool_t *pool);
106
107
108 /** An enum defining the kinds of access authz looks up.
109  *
110  * @since New in 1.3.
111  */
112 typedef enum svn_repos_authz_access_t
113 {
114   /** No access. */
115   svn_authz_none = 0,
116
117   /** Path can be read. */
118   svn_authz_read = 1,
119
120   /** Path can be altered. */
121   svn_authz_write = 2,
122
123   /** The other access credentials are recursive. */
124   svn_authz_recursive = 4
125 } svn_repos_authz_access_t;
126
127
128 /** Callback type for checking authorization on paths produced by
129  * the repository commit editor.
130  *
131  * Set @a *allowed to TRUE to indicate that the @a required access on
132  * @a path in @a root is authorized, or set it to FALSE to indicate
133  * unauthorized (presumable according to state stored in @a baton).
134  *
135  * If @a path is NULL, the callback should perform a global authz
136  * lookup for the @a required access.  That is, the lookup should
137  * check if the @a required access is granted for at least one path of
138  * the repository, and set @a *allowed to TRUE if so.  @a root may
139  * also be NULL if @a path is NULL.
140  *
141  * This callback is very similar to svn_repos_authz_func_t, with the
142  * exception of the addition of the @a required parameter.
143  * This is due to historical reasons: when authz was first implemented
144  * for svn_repos_dir_delta2(), it seemed there would need only checks
145  * for read and write operations, hence the svn_repos_authz_func_t
146  * callback prototype and usage scenario.  But it was then realized
147  * that lookups due to copying needed to be recursive, and that
148  * brute-force recursive lookups didn't square with the O(1)
149  * performances a copy operation should have.
150  *
151  * So a special way to ask for a recursive lookup was introduced.  The
152  * commit editor needs this capability to retain acceptable
153  * performance.  Instead of revving the existing callback, causing
154  * unnecessary revving of functions that don't actually need the
155  * extended functionality, this second, more complete callback was
156  * introduced, for use by the commit editor.
157  *
158  * Some day, it would be nice to reunite these two callbacks and do
159  * the necessary revving anyway, but for the time being, this dual
160  * callback mechanism will do.
161  */
162 typedef svn_error_t *(*svn_repos_authz_callback_t)
163   (svn_repos_authz_access_t required,
164    svn_boolean_t *allowed,
165    svn_fs_root_t *root,
166    const char *path,
167    void *baton,
168    apr_pool_t *pool);
169
170 /**
171  * Similar to #svn_file_rev_handler_t, but without the @a
172  * result_of_merge parameter.
173  *
174  * @deprecated Provided for backward compatibility with 1.4 API.
175  * @since New in 1.1.
176  */
177 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
178   (void *baton,
179    const char *path,
180    svn_revnum_t rev,
181    apr_hash_t *rev_props,
182    svn_txdelta_window_handler_t *delta_handler,
183    void **delta_baton,
184    apr_array_header_t *prop_diffs,
185    apr_pool_t *pool);
186
187 \f
188 /* Notification system. */
189
190 /** The type of action occurring.
191  *
192  * @since New in 1.7.
193  */
194 typedef enum svn_repos_notify_action_t
195 {
196   /** A warning message is waiting. */
197   svn_repos_notify_warning = 0,
198
199   /** A revision has finished being dumped. */
200   svn_repos_notify_dump_rev_end,
201
202   /** A revision has finished being verified. */
203   svn_repos_notify_verify_rev_end,
204
205   /** All revisions have finished being dumped. */
206   svn_repos_notify_dump_end,
207
208   /** All revisions have finished being verified. */
209   svn_repos_notify_verify_end,
210
211   /** packing of an FSFS shard has commenced */
212   svn_repos_notify_pack_shard_start,
213
214   /** packing of an FSFS shard is completed */
215   svn_repos_notify_pack_shard_end,
216
217   /** packing of the shard revprops has commenced */
218   svn_repos_notify_pack_shard_start_revprop,
219
220   /** packing of the shard revprops has completed */
221   svn_repos_notify_pack_shard_end_revprop,
222
223   /** A revision has begun loading */
224   svn_repos_notify_load_txn_start,
225
226   /** A revision has finished loading */
227   svn_repos_notify_load_txn_committed,
228
229   /** A node has begun loading */
230   svn_repos_notify_load_node_start,
231
232   /** A node has finished loading */
233   svn_repos_notify_load_node_done,
234
235   /** A copied node has been encountered */
236   svn_repos_notify_load_copied_node,
237
238   /** Mergeinfo has been normalized */
239   svn_repos_notify_load_normalized_mergeinfo,
240
241   /** The operation has acquired a mutex for the repo. */
242   svn_repos_notify_mutex_acquired,
243
244   /** Recover has started. */
245   svn_repos_notify_recover_start,
246
247   /** Upgrade has started. */
248   svn_repos_notify_upgrade_start,
249
250   /** A revision was skipped during loading. @since New in 1.8. */
251   svn_repos_notify_load_skipped_rev,
252
253   /** The structure of a revision is being verified.  @since New in 1.8. */
254   svn_repos_notify_verify_rev_structure
255
256 } svn_repos_notify_action_t;
257
258 /** The type of error occurring.
259  *
260  * @since New in 1.7.
261  */
262 typedef enum svn_repos_notify_warning_t
263 {
264   /** Referencing copy source data from a revision earlier than the
265    * first revision dumped. */
266   svn_repos_notify_warning_found_old_reference,
267
268   /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a
269    * revision earlier than the first revision dumped. */
270   svn_repos_notify_warning_found_old_mergeinfo,
271
272   /** Found an invalid path in the filesystem.
273    * @see svn_fs.h:"Directory entry names and directory paths" */
274   /* ### TODO(doxygen): make that a proper doxygen link */
275   /* See svn_fs__path_valid(). */
276   svn_repos_notify_warning_invalid_fspath
277
278 } svn_repos_notify_warning_t;
279
280 /**
281  * Structure used by #svn_repos_notify_func_t.
282  *
283  * The only field guaranteed to be populated is @c action.  Other fields are
284  * dependent upon the @c action.  (See individual fields for more information.)
285  *
286  * @note Callers of notification functions should use
287  * svn_repos_notify_create() to create structures of this type to allow for
288  * future extensibility.
289  *
290  * @since New in 1.7.
291  */
292 typedef struct svn_repos_notify_t
293 {
294   /** Action that describes what happened in the repository. */
295   svn_repos_notify_action_t action;
296
297   /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
298    * the revision which just completed. */
299   svn_revnum_t revision;
300
301   /** For #svn_repos_notify_warning, the warning object. Must be cleared
302       by the consumer of the notification. */
303   const char *warning_str;
304   svn_repos_notify_warning_t warning;
305
306   /** For #svn_repos_notify_pack_shard_start,
307       #svn_repos_notify_pack_shard_end,
308       #svn_repos_notify_pack_shard_start_revprop, and
309       #svn_repos_notify_pack_shard_end_revprop, the shard processed. */
310   apr_int64_t shard;
311
312   /** For #svn_repos_notify_load_node_done, the revision committed. */
313   svn_revnum_t new_revision;
314
315   /** For #svn_repos_notify_load_node_done, the source revision, if
316       different from @a new_revision, otherwise #SVN_INVALID_REVNUM.
317       For #svn_repos_notify_load_txn_start, the source revision. */
318   svn_revnum_t old_revision;
319
320   /** For #svn_repos_notify_load_node_start, the action being taken on the
321       node. */
322   enum svn_node_action node_action;
323
324   /** For #svn_repos_notify_load_node_start, the path of the node. */
325   const char *path;
326
327   /* NOTE: Add new fields at the end to preserve binary compatibility.
328      Also, if you add fields here, you have to update
329      svn_repos_notify_create(). */
330 } svn_repos_notify_t;
331
332 /** Callback for providing notification from the repository.
333  * Returns @c void.  Justification: success of an operation is not dependent
334  * upon successful notification of that operation.
335  *
336  * @since New in 1.7. */
337 typedef void (*svn_repos_notify_func_t)(void *baton,
338                                         const svn_repos_notify_t *notify,
339                                         apr_pool_t *scratch_pool);
340
341 /**
342  * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
343  * and return it.
344  *
345  * @since New in 1.7.
346  */
347 svn_repos_notify_t *
348 svn_repos_notify_create(svn_repos_notify_action_t action,
349                         apr_pool_t *result_pool);
350
351 \f
352 /** The repository object. */
353 typedef struct svn_repos_t svn_repos_t;
354
355 /* Opening and creating repositories. */
356
357
358 /** Find the root path of the repository that contains @a path.
359  *
360  * If a repository was found, the path to the root of the repository
361  * is returned, else @c NULL. The pointer to the returned path may be
362  * equal to @a path.
363  */
364 const char *
365 svn_repos_find_root_path(const char *path,
366                          apr_pool_t *pool);
367
368 /** Set @a *repos_p to a repository object for the repository at @a path.
369  *
370  * Allocate @a *repos_p in @a pool.
371  *
372  * Acquires a shared lock on the repository, and attaches a cleanup
373  * function to @a pool to remove the lock.  If no lock can be acquired,
374  * returns error, with undefined effect on @a *repos_p.  If an exclusive
375  * lock is present, this blocks until it's gone.  @a fs_config will be
376  * passed to the filesystem initialization function and may be @c NULL.
377  *
378  * @since New in 1.7.
379  */
380 svn_error_t *
381 svn_repos_open2(svn_repos_t **repos_p,
382                 const char *path,
383                 apr_hash_t *fs_config,
384                 apr_pool_t *pool);
385
386 /** Similar to svn_repos_open2() with @a fs_config set to NULL.
387  *
388  * @deprecated Provided for backward compatibility with 1.6 API.
389  */
390 SVN_DEPRECATED
391 svn_error_t *
392 svn_repos_open(svn_repos_t **repos_p,
393                const char *path,
394                apr_pool_t *pool);
395
396 /** Create a new Subversion repository at @a path, building the necessary
397  * directory structure, creating the filesystem, and so on.
398  * Return the repository object in @a *repos_p, allocated in @a pool.
399  *
400  * @a config is a client configuration hash of #svn_config_t * items
401  * keyed on config category names, and may be NULL.
402  *
403  * @a fs_config is passed to the filesystem, and may be NULL.
404  *
405  * @a unused_1 and @a unused_2 are not used and should be NULL.
406  */
407 svn_error_t *
408 svn_repos_create(svn_repos_t **repos_p,
409                  const char *path,
410                  const char *unused_1,
411                  const char *unused_2,
412                  apr_hash_t *config,
413                  apr_hash_t *fs_config,
414                  apr_pool_t *pool);
415
416 /**
417  * Upgrade the Subversion repository (and its underlying versioned
418  * filesystem) located in the directory @a path to the latest version
419  * supported by this library.  If the requested upgrade is not
420  * supported due to the current state of the repository or it
421  * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
422  * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
423  * changes to the repository or filesystem.
424  *
425  * Acquires an exclusive lock on the repository, upgrades the
426  * repository, and releases the lock.  If an exclusive lock can't be
427  * acquired, returns error.
428  *
429  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
430  * returned if the lock is not immediately available.
431  *
432  * If @a start_callback is not NULL, it will be called with @a
433  * start_callback_baton as argument before the upgrade starts, but
434  * after the exclusive lock has been acquired.
435  *
436  * Use @a pool for necessary allocations.
437  *
438  * @note This functionality is provided as a convenience for
439  * administrators wishing to make use of new Subversion functionality
440  * without a potentially costly full repository dump/load.  As such,
441  * the operation performs only the minimum amount of work needed to
442  * accomplish this while maintaining the integrity of the repository.
443  * It does *not* guarantee the most optimized repository state as a
444  * dump and subsequent load would.
445  *
446  * @note On some platforms the exclusive lock does not exclude other
447  * threads in the same process so this function should only be called
448  * by a single threaded process, or by a multi-threaded process when
449  * no other threads are accessing the repository.
450  *
451  * @since New in 1.7.
452  */
453 svn_error_t *
454 svn_repos_upgrade2(const char *path,
455                    svn_boolean_t nonblocking,
456                    svn_repos_notify_func_t notify_func,
457                    void *notify_baton,
458                    apr_pool_t *pool);
459
460 /**
461  * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
462  * rather than a notify_callback / baton
463  *
464  * @since New in 1.5.
465  * @deprecated Provided for backward compatibility with the 1.6 API.
466  */
467 SVN_DEPRECATED
468 svn_error_t *
469 svn_repos_upgrade(const char *path,
470                   svn_boolean_t nonblocking,
471                   svn_error_t *(*start_callback)(void *baton),
472                   void *start_callback_baton,
473                   apr_pool_t *pool);
474
475 /** Destroy the Subversion repository found at @a path, using @a pool for any
476  * necessary allocations.
477  */
478 svn_error_t *
479 svn_repos_delete(const char *path,
480                  apr_pool_t *pool);
481
482 /**
483  * Set @a *has to TRUE if @a repos has @a capability (one of the
484  * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
485  * @a *has to FALSE.
486  *
487  * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
488  * with the effect on @a *has undefined.
489  *
490  * Use @a pool for all allocation.
491  *
492  * @since New in 1.5.
493  */
494 svn_error_t *
495 svn_repos_has_capability(svn_repos_t *repos,
496                          svn_boolean_t *has,
497                          const char *capability,
498                          apr_pool_t *pool);
499
500 /** @} */
501
502 /**
503  * The capability of doing the right thing with merge-tracking
504  * information, both storing it and responding to queries about it.
505  *
506  * @since New in 1.5.
507  */
508 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
509 /*       *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
510  *
511  * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
512  * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
513  * colons for their own reasons.  While this RA limitation has no
514  * direct impact on repository capabilities, there's no reason to be
515  * gratuitously different either.
516  *
517  * If you add a capability, update svn_repos_capabilities().
518  */
519
520
521 /** Return the filesystem associated with repository object @a repos. */
522 svn_fs_t *
523 svn_repos_fs(svn_repos_t *repos);
524
525
526 /** Make a hot copy of the Subversion repository found at @a src_path
527  * to @a dst_path.
528  *
529  * Copy a possibly live Subversion repository from @a src_path to
530  * @a dst_path.  If @a clean_logs is @c TRUE, perform cleanup on the
531  * source filesystem as part of the copy operation; currently, this
532  * means deleting copied, unused logfiles for a Berkeley DB source
533  * repository.
534  *
535  * If @a incremental is TRUE, make an effort to not re-copy information
536  * already present in the destination. If incremental hotcopy is not
537  * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
538  *
539  * @since New in 1.8.
540  */
541 svn_error_t *
542 svn_repos_hotcopy2(const char *src_path,
543                    const char *dst_path,
544                    svn_boolean_t clean_logs,
545                    svn_boolean_t incremental,
546                    svn_cancel_func_t cancel_func,
547                    void *cancel_baton,
548                    apr_pool_t *pool);
549
550 /**
551  * Like svn_repos_hotcopy2(), but with @a incremental always passed as
552  * @c FALSE and without cancellation support.
553  *
554  * @deprecated Provided for backward compatibility with the 1.6 API.
555  */
556 SVN_DEPRECATED
557 svn_error_t *
558 svn_repos_hotcopy(const char *src_path,
559                   const char *dst_path,
560                   svn_boolean_t clean_logs,
561                   apr_pool_t *pool);
562
563
564 /**
565  * Possibly update the repository, @a repos, to use a more efficient
566  * filesystem representation.  Use @a pool for allocations.
567  *
568  * @since New in 1.7.
569  */
570 svn_error_t *
571 svn_repos_fs_pack2(svn_repos_t *repos,
572                    svn_repos_notify_func_t notify_func,
573                    void *notify_baton,
574                    svn_cancel_func_t cancel_func,
575                    void *cancel_baton,
576                    apr_pool_t *pool);
577
578 /**
579  * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
580  * of a #svn_repos_notify_t.
581  *
582  * @since New in 1.6.
583  * @deprecated Provided for backward compatibility with the 1.6 API.
584  */
585 SVN_DEPRECATED
586 svn_error_t *
587 svn_repos_fs_pack(svn_repos_t *repos,
588                   svn_fs_pack_notify_t notify_func,
589                   void *notify_baton,
590                   svn_cancel_func_t cancel_func,
591                   void *cancel_baton,
592                   apr_pool_t *pool);
593
594 /**
595  * Run database recovery procedures on the repository at @a path,
596  * returning the database to a consistent state.  Use @a pool for all
597  * allocation.
598  *
599  * Acquires an exclusive lock on the repository, recovers the
600  * database, and releases the lock.  If an exclusive lock can't be
601  * acquired, returns error.
602  *
603  * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
604  * returned if the lock is not immediately available.
605  *
606  * If @a notify_func is not NULL, it will be called with @a
607  * notify_baton as argument before the recovery starts, but
608  * after the exclusive lock has been acquired.
609  *
610  * If @a cancel_func is not @c NULL, it is called periodically with
611  * @a cancel_baton as argument to see if the client wishes to cancel
612  * the recovery.
613  *
614  * @note On some platforms the exclusive lock does not exclude other
615  * threads in the same process so this function should only be called
616  * by a single threaded process, or by a multi-threaded process when
617  * no other threads are accessing the repository.
618  *
619  * @since New in 1.7.
620  */
621 svn_error_t *
622 svn_repos_recover4(const char *path,
623                    svn_boolean_t nonblocking,
624                    svn_repos_notify_func_t notify_func,
625                    void *notify_baton,
626                    svn_cancel_func_t cancel_func,
627                    void * cancel_baton,
628                    apr_pool_t *pool);
629
630 /**
631  * Similar to svn_repos_recover4(), but with @a start callback in place of
632  * the notify_func / baton.
633  *
634  * @since New in 1.5.
635  * @deprecated Provided for backward compatibility with the 1.6 API.
636  */
637 SVN_DEPRECATED
638 svn_error_t *
639 svn_repos_recover3(const char *path,
640                    svn_boolean_t nonblocking,
641                    svn_error_t *(*start_callback)(void *baton),
642                    void *start_callback_baton,
643                    svn_cancel_func_t cancel_func,
644                    void * cancel_baton,
645                    apr_pool_t *pool);
646
647 /**
648  * Similar to svn_repos_recover3(), but without cancellation support.
649  *
650  * @deprecated Provided for backward compatibility with the 1.4 API.
651  */
652 SVN_DEPRECATED
653 svn_error_t *
654 svn_repos_recover2(const char *path,
655                    svn_boolean_t nonblocking,
656                    svn_error_t *(*start_callback)(void *baton),
657                    void *start_callback_baton,
658                    apr_pool_t *pool);
659
660 /**
661  * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
662  * with no callbacks provided.
663  *
664  * @deprecated Provided for backward compatibility with the 1.0 API.
665  */
666 SVN_DEPRECATED
667 svn_error_t *
668 svn_repos_recover(const char *path,
669                   apr_pool_t *pool);
670
671 /**
672  * Callback for svn_repos_freeze.
673  *
674  * @since New in 1.8.
675  */
676 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
677
678 /**
679  * Take an exclusive lock on each of the repositories in @a paths to
680  * prevent commits and then while holding all the locks invoke @a
681  * freeze_func passing @a freeze_baton.  Each repository may be readable by
682  * Subversion while frozen, or may be unreadable, depending on which
683  * FS backend the repository uses.  Repositories are locked in the
684  * order in which they are specified in the array.
685  *
686  * @note On some platforms the exclusive lock does not exclude other
687  * threads in the same process so this function should only be called
688  * by a single threaded process, or by a multi-threaded process when
689  * no other threads are accessing the repositories.
690  *
691  * @since New in 1.8.
692  */
693 svn_error_t *
694 svn_repos_freeze(apr_array_header_t *paths,
695                  svn_repos_freeze_func_t freeze_func,
696                  void *freeze_baton,
697                  apr_pool_t *pool);
698
699 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
700  * returning log file paths relative to the root of the repository.
701  *
702  * @copydoc svn_fs_berkeley_logfiles()
703  */
704 svn_error_t *
705 svn_repos_db_logfiles(apr_array_header_t **logfiles,
706                       const char *path,
707                       svn_boolean_t only_unused,
708                       apr_pool_t *pool);
709
710
711 \f
712 /* Repository Paths */
713
714 /** Return the top-level repository path allocated in @a pool. */
715 const char *
716 svn_repos_path(svn_repos_t *repos,
717                apr_pool_t *pool);
718
719 /** Return the path to @a repos's filesystem directory, allocated in
720  * @a pool.
721  */
722 const char *
723 svn_repos_db_env(svn_repos_t *repos,
724                  apr_pool_t *pool);
725
726 /** Return path to @a repos's config directory, allocated in @a pool. */
727 const char *
728 svn_repos_conf_dir(svn_repos_t *repos,
729                    apr_pool_t *pool);
730
731 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
732 const char *
733 svn_repos_svnserve_conf(svn_repos_t *repos,
734                         apr_pool_t *pool);
735
736 /** Return path to @a repos's lock directory, allocated in @a pool. */
737 const char *
738 svn_repos_lock_dir(svn_repos_t *repos,
739                    apr_pool_t *pool);
740
741 /** Return path to @a repos's db lockfile, allocated in @a pool. */
742 const char *
743 svn_repos_db_lockfile(svn_repos_t *repos,
744                       apr_pool_t *pool);
745
746 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
747 const char *
748 svn_repos_db_logs_lockfile(svn_repos_t *repos,
749                            apr_pool_t *pool);
750
751 /** Return the path to @a repos's hook directory, allocated in @a pool. */
752 const char *
753 svn_repos_hook_dir(svn_repos_t *repos,
754                    apr_pool_t *pool);
755
756 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
757 const char *
758 svn_repos_start_commit_hook(svn_repos_t *repos,
759                             apr_pool_t *pool);
760
761 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
762 const char *
763 svn_repos_pre_commit_hook(svn_repos_t *repos,
764                           apr_pool_t *pool);
765
766 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
767 const char *
768 svn_repos_post_commit_hook(svn_repos_t *repos,
769                            apr_pool_t *pool);
770
771 /** Return the path to @a repos's pre-revprop-change hook, allocated in
772  * @a pool.
773  */
774 const char *
775 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
776                                   apr_pool_t *pool);
777
778 /** Return the path to @a repos's post-revprop-change hook, allocated in
779  * @a pool.
780  */
781 const char *
782 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
783                                    apr_pool_t *pool);
784
785
786 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
787  * @{
788  * @since New in 1.2. */
789
790 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
791 const char *
792 svn_repos_pre_lock_hook(svn_repos_t *repos,
793                         apr_pool_t *pool);
794
795 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
796 const char *
797 svn_repos_post_lock_hook(svn_repos_t *repos,
798                          apr_pool_t *pool);
799
800 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
801 const char *
802 svn_repos_pre_unlock_hook(svn_repos_t *repos,
803                           apr_pool_t *pool);
804
805 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
806 const char *
807 svn_repos_post_unlock_hook(svn_repos_t *repos,
808                            apr_pool_t *pool);
809
810 /** Specify that Subversion should consult the configuration file
811  * located at @a hooks_env_path to determine how to setup the
812  * environment for hook scripts invoked for the repository @a repos.
813  * As a special case, if @a hooks_env_path is @c NULL, look for the
814  * file in its default location within the repository disk structure.
815  * If @a hooks_env_path is not absolute, it specifies a path relative
816  * to the parent of the file's default location.
817  *
818  * Use @a scratch_pool for temporary allocations.
819  *
820  * If this function is not called, or if the specified configuration
821  * file does not define any environment variables, hooks will run in
822  * an empty environment.
823  *
824  * @since New in 1.8.
825  */
826 svn_error_t *
827 svn_repos_hooks_setenv(svn_repos_t *repos,
828                        const char *hooks_env_path,
829                        apr_pool_t *scratch_pool);
830
831 /** @} */
832
833 /* ---------------------------------------------------------------*/
834 \f
835 /* Reporting the state of a working copy, for updates. */
836
837
838 /**
839  * Construct and return a @a report_baton that will be passed to the
840  * other functions in this section to describe the state of a pre-existing
841  * tree (typically, a working copy).  When the report is finished,
842  * @a editor/@a edit_baton will be driven in such a way as to transform the
843  * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
844  * reported hierarchy to @a tgt_path.
845  *
846  * @a fs_base is the absolute path of the node in the filesystem at which
847  * the comparison should be rooted.  @a target is a single path component,
848  * used to limit the scope of the report to a single entry of @a fs_base,
849  * or "" if all of @a fs_base itself is the main subject of the report.
850  *
851  * @a tgt_path and @a revnum is the fs path/revision pair that is the
852  * "target" of the delta.  @a tgt_path should be provided only when
853  * the source and target paths of the report differ.  That is, @a tgt_path
854  * should *only* be specified when specifying that the resultant editor
855  * drive be one that transforms the reported hierarchy into a pristine tree
856  * of @a tgt_path at revision @a revnum.  A @c NULL value for @a tgt_path
857  * will indicate that the editor should be driven in such a way as to
858  * transform the reported hierarchy to revision @a revnum, preserving the
859  * reported hierarchy.
860  *
861  * @a text_deltas instructs the driver of the @a editor to enable
862  * the generation of text deltas.
863  *
864  * @a ignore_ancestry instructs the driver to ignore node ancestry
865  * when determining how to transmit differences.
866  *
867  * @a send_copyfrom_args instructs the driver to send 'copyfrom'
868  * arguments to the editor's add_file() and add_directory() methods,
869  * whenever it deems feasible.
870  *
871  * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
872  * avoid sending data through @a editor/@a edit_baton which is not
873  * authorized for transmission.
874  *
875  * @a zero_copy_limit controls the maximum size (in bytes) at which
876  * data blocks may be sent using the zero-copy code path.  On that
877  * path, a number of in-memory copy operations have been eliminated to
878  * maximize throughput.  However, until the whole block has been
879  * pushed to the network stack, other clients block, so be careful
880  * when using larger values here.  Pass 0 for @a zero_copy_limit to
881  * disable this optimization altogether.
882  *
883  * @a note Never activate this optimization if @a editor might access
884  * any FSFS data structures (and, hence, caches).  So, it is basically
885  * safe for networked editors only.
886  *
887  * All allocation for the context and collected state will occur in
888  * @a pool.
889  *
890  * @a depth is the requested depth of the editor drive.
891  *
892  * If @a depth is #svn_depth_unknown, the editor will affect only the
893  * paths reported by the individual calls to svn_repos_set_path3() and
894  * svn_repos_link_path3().
895  *
896  * For example, if the reported tree is the @c A subdir of the Greek Tree
897  * (see Subversion's test suite), at depth #svn_depth_empty, but the
898  * @c A/B subdir is reported at depth #svn_depth_infinity, then
899  * repository-side changes to @c A/mu, or underneath @c A/C and @c
900  * A/D, would not be reflected in the editor drive, but changes
901  * underneath @c A/B would be.
902  *
903  * Additionally, the editor driver will call @c add_directory and
904  * and @c add_file for directories with an appropriate depth.  For
905  * example, a directory reported at #svn_depth_files will receive
906  * file (but not directory) additions.  A directory at #svn_depth_empty
907  * will receive neither.
908  *
909  * If @a depth is #svn_depth_files, #svn_depth_immediates or
910  * #svn_depth_infinity and @a depth is greater than the reported depth
911  * of the working copy, then the editor driver will emit editor
912  * operations so as to upgrade the working copy to this depth.
913  *
914  * If @a depth is #svn_depth_empty, #svn_depth_files,
915  * #svn_depth_immediates and @a depth is lower
916  * than or equal to the depth of the working copy, then the editor
917  * operations will affect only paths at or above @a depth.
918  *
919  * @since New in 1.8.
920  */
921 svn_error_t *
922 svn_repos_begin_report3(void **report_baton,
923                         svn_revnum_t revnum,
924                         svn_repos_t *repos,
925                         const char *fs_base,
926                         const char *target,
927                         const char *tgt_path,
928                         svn_boolean_t text_deltas,
929                         svn_depth_t depth,
930                         svn_boolean_t ignore_ancestry,
931                         svn_boolean_t send_copyfrom_args,
932                         const svn_delta_editor_t *editor,
933                         void *edit_baton,
934                         svn_repos_authz_func_t authz_read_func,
935                         void *authz_read_baton,
936                         apr_size_t zero_copy_limit,
937                         apr_pool_t *pool);
938
939 /**
940  * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
941  * always passed as 0.
942  *
943  * @since New in 1.5.
944  * @deprecated Provided for backward compatibility with the 1.7 API.
945  */
946 SVN_DEPRECATED
947 svn_error_t *
948 svn_repos_begin_report2(void **report_baton,
949                         svn_revnum_t revnum,
950                         svn_repos_t *repos,
951                         const char *fs_base,
952                         const char *target,
953                         const char *tgt_path,
954                         svn_boolean_t text_deltas,
955                         svn_depth_t depth,
956                         svn_boolean_t ignore_ancestry,
957                         svn_boolean_t send_copyfrom_args,
958                         const svn_delta_editor_t *editor,
959                         void *edit_baton,
960                         svn_repos_authz_func_t authz_read_func,
961                         void *authz_read_baton,
962                         apr_pool_t *pool);
963
964 /**
965  * The same as svn_repos_begin_report2(), but taking a boolean
966  * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
967  *
968  * If @a recurse is TRUE, the editor driver will drive the editor with
969  * a depth of #svn_depth_infinity; if FALSE, then with a depth of
970  * #svn_depth_files.
971  *
972  * @note @a username is ignored, and has been removed in a revised
973  * version of this API.
974  *
975  * @deprecated Provided for backward compatibility with the 1.4 API.
976  */
977 SVN_DEPRECATED
978 svn_error_t *
979 svn_repos_begin_report(void **report_baton,
980                        svn_revnum_t revnum,
981                        const char *username,
982                        svn_repos_t *repos,
983                        const char *fs_base,
984                        const char *target,
985                        const char *tgt_path,
986                        svn_boolean_t text_deltas,
987                        svn_boolean_t recurse,
988                        svn_boolean_t ignore_ancestry,
989                        const svn_delta_editor_t *editor,
990                        void *edit_baton,
991                        svn_repos_authz_func_t authz_read_func,
992                        void *authz_read_baton,
993                        apr_pool_t *pool);
994
995
996 /**
997  * Given a @a report_baton constructed by svn_repos_begin_report3(),
998  * record the presence of @a path, at @a revision with depth @a depth,
999  * in the current tree.
1000  *
1001  * @a path is relative to the anchor/target used in the creation of the
1002  * @a report_baton.
1003  *
1004  * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
1005  * represents a locally-added path with no revision number, or @a
1006  * depth is #svn_depth_exclude.
1007  *
1008  * @a path may not be underneath a path on which svn_repos_set_path3()
1009  * was previously called with #svn_depth_exclude in this report.
1010  *
1011  * The first call of this in a given report usually passes an empty
1012  * @a path; this is used to set up the correct root revision for the editor
1013  * drive.
1014  *
1015  * A depth of #svn_depth_unknown is not allowed, and results in an
1016  * error.
1017  *
1018  * If @a start_empty is TRUE and @a path is a directory, then require the
1019  * caller to explicitly provide all the children of @a path - do not assume
1020  * that the tree also contains all the children of @a path at @a revision.
1021  * This is for 'low confidence' client reporting.
1022  *
1023  * If the caller has a lock token for @a path, then @a lock_token should
1024  * be set to that token.  Else, @a lock_token should be NULL.
1025  *
1026  * All temporary allocations are done in @a pool.
1027  *
1028  * @since New in 1.5.
1029  */
1030 svn_error_t *
1031 svn_repos_set_path3(void *report_baton,
1032                     const char *path,
1033                     svn_revnum_t revision,
1034                     svn_depth_t depth,
1035                     svn_boolean_t start_empty,
1036                     const char *lock_token,
1037                     apr_pool_t *pool);
1038
1039 /**
1040  * Similar to svn_repos_set_path3(), but with @a depth set to
1041  * #svn_depth_infinity.
1042  *
1043  * @deprecated Provided for backward compatibility with the 1.4 API.
1044  */
1045 SVN_DEPRECATED
1046 svn_error_t *
1047 svn_repos_set_path2(void *report_baton,
1048                     const char *path,
1049                     svn_revnum_t revision,
1050                     svn_boolean_t start_empty,
1051                     const char *lock_token,
1052                     apr_pool_t *pool);
1053
1054 /**
1055  * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
1056  *
1057  * @deprecated Provided for backward compatibility with the 1.1 API.
1058  */
1059 SVN_DEPRECATED
1060 svn_error_t *
1061 svn_repos_set_path(void *report_baton,
1062                    const char *path,
1063                    svn_revnum_t revision,
1064                    svn_boolean_t start_empty,
1065                    apr_pool_t *pool);
1066
1067 /**
1068  * Given a @a report_baton constructed by svn_repos_begin_report3(),
1069  * record the presence of @a path in the current tree, containing the contents
1070  * of @a link_path at @a revision with depth @a depth.
1071  *
1072  * A depth of #svn_depth_unknown is not allowed, and results in an
1073  * error.
1074  *
1075  * @a path may not be underneath a path on which svn_repos_set_path3()
1076  * was previously called with #svn_depth_exclude in this report.
1077  *
1078  * Note that while @a path is relative to the anchor/target used in the
1079  * creation of the @a report_baton, @a link_path is an absolute filesystem
1080  * path!
1081  *
1082  * If @a start_empty is TRUE and @a path is a directory, then require the
1083  * caller to explicitly provide all the children of @a path - do not assume
1084  * that the tree also contains all the children of @a link_path at
1085  * @a revision.  This is for 'low confidence' client reporting.
1086  *
1087  * If the caller has a lock token for @a link_path, then @a lock_token
1088  * should be set to that token.  Else, @a lock_token should be NULL.
1089  *
1090  * All temporary allocations are done in @a pool.
1091  *
1092  * @since New in 1.5.
1093  */
1094 svn_error_t *
1095 svn_repos_link_path3(void *report_baton,
1096                      const char *path,
1097                      const char *link_path,
1098                      svn_revnum_t revision,
1099                      svn_depth_t depth,
1100                      svn_boolean_t start_empty,
1101                      const char *lock_token,
1102                      apr_pool_t *pool);
1103
1104 /**
1105  * Similar to svn_repos_link_path3(), but with @a depth set to
1106  * #svn_depth_infinity.
1107  *
1108  * @deprecated Provided for backward compatibility with the 1.4 API.
1109  */
1110 SVN_DEPRECATED
1111 svn_error_t *
1112 svn_repos_link_path2(void *report_baton,
1113                      const char *path,
1114                      const char *link_path,
1115                      svn_revnum_t revision,
1116                      svn_boolean_t start_empty,
1117                      const char *lock_token,
1118                      apr_pool_t *pool);
1119
1120 /**
1121  * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
1122  *
1123  * @deprecated Provided for backward compatibility with the 1.1 API.
1124  */
1125 SVN_DEPRECATED
1126 svn_error_t *
1127 svn_repos_link_path(void *report_baton,
1128                     const char *path,
1129                     const char *link_path,
1130                     svn_revnum_t revision,
1131                     svn_boolean_t start_empty,
1132                     apr_pool_t *pool);
1133
1134 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1135  * record the non-existence of @a path in the current tree.
1136  *
1137  * @a path may not be underneath a path on which svn_repos_set_path3()
1138  * was previously called with #svn_depth_exclude in this report.
1139  *
1140  * (This allows the reporter's driver to describe missing pieces of a
1141  * working copy, so that 'svn up' can recreate them.)
1142  *
1143  * All temporary allocations are done in @a pool.
1144  */
1145 svn_error_t *
1146 svn_repos_delete_path(void *report_baton,
1147                       const char *path,
1148                       apr_pool_t *pool);
1149
1150 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1151  * finish the report and drive the editor as specified when the report
1152  * baton was constructed.
1153  *
1154  * If an error occurs during the driving of the editor, do NOT abort the
1155  * edit; that responsibility belongs to the caller of this function, if
1156  * it happens at all.
1157  *
1158  * After the call to this function, @a report_baton is no longer valid;
1159  * it should not be passed to any other reporting functions, including
1160  * svn_repos_abort_report(), even if this function returns an error.
1161  */
1162 svn_error_t *
1163 svn_repos_finish_report(void *report_baton,
1164                         apr_pool_t *pool);
1165
1166
1167 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1168  * abort the report.  This function can be called anytime before
1169  * svn_repos_finish_report() is called.
1170  *
1171  * After the call to this function, @a report_baton is no longer valid;
1172  * it should not be passed to any other reporting functions.
1173  */
1174 svn_error_t *
1175 svn_repos_abort_report(void *report_baton,
1176                        apr_pool_t *pool);
1177
1178
1179 /* ---------------------------------------------------------------*/
1180 \f
1181 /* The magical dir_delta update routines. */
1182
1183 /** Use the provided @a editor and @a edit_baton to describe the changes
1184  * necessary for making a given node (and its descendants, if it is a
1185  * directory) under @a src_root look exactly like @a tgt_path under
1186  * @a tgt_root.  @a src_entry is the node to update.  If @a src_entry
1187  * is empty, then compute the difference between the entire tree
1188  * anchored at @a src_parent_dir under @a src_root and @a tgt_path
1189  * under @a tgt_root.  Else, describe the changes needed to update
1190  * only that entry in @a src_parent_dir.  Typically, callers of this
1191  * function will use a @a tgt_path that is the concatenation of @a
1192  * src_parent_dir and @a src_entry.
1193  *
1194  * @a src_root and @a tgt_root can both be either revision or transaction
1195  * roots.  If @a tgt_root is a revision, @a editor's set_target_revision()
1196  * will be called with the @a tgt_root's revision number, else it will
1197  * not be called at all.
1198  *
1199  * If @a authz_read_func is non-NULL, invoke it before any call to
1200  *
1201  *    @a editor->open_root
1202  *    @a editor->add_directory
1203  *    @a editor->open_directory
1204  *    @a editor->add_file
1205  *    @a editor->open_file
1206  *
1207  * passing @a tgt_root, the same path that would be passed to the
1208  * editor function in question, and @a authz_read_baton.  If the
1209  * @a *allowed parameter comes back TRUE, then proceed with the planned
1210  * editor call; else if FALSE, then invoke @a editor->absent_file or
1211  * @a editor->absent_directory as appropriate, except if the planned
1212  * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
1213  *
1214  * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
1215  * the window handler returned by @a editor->apply_textdelta().
1216  *
1217  * If @a depth is #svn_depth_empty, invoke @a editor calls only on
1218  * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
1219  * If @a depth is #svn_depth_files, also invoke the editor on file
1220  * children, if any; if #svn_depth_immediates, invoke it on
1221  * immediate subdirectories as well as files; if #svn_depth_infinity,
1222  * recurse fully.
1223  *
1224  * If @a entry_props is @c TRUE, accompany each opened/added entry with
1225  * propchange editor calls that relay special "entry props" (this
1226  * is typically used only for working copy updates).
1227  *
1228  * @a ignore_ancestry instructs the function to ignore node ancestry
1229  * when determining how to transmit differences.
1230  *
1231  * Before completing successfully, this function calls @a editor's
1232  * close_edit(), so the caller should expect its @a edit_baton to be
1233  * invalid after its use with this function.
1234  *
1235  * Do any allocation necessary for the delta computation in @a pool.
1236  * This function's maximum memory consumption is at most roughly
1237  * proportional to the greatest depth of the tree under @a tgt_root, not
1238  * the total size of the delta.
1239  *
1240  * ### svn_repos_dir_delta2 is mostly superseded by the reporter
1241  * ### functionality (svn_repos_begin_report3 and friends).
1242  * ### svn_repos_dir_delta2 does allow the roots to be transaction
1243  * ### roots rather than just revision roots, and it has the
1244  * ### entry_props flag.  Almost all of Subversion's own code uses the
1245  * ### reporter instead; there are some stray references to the
1246  * ### svn_repos_dir_delta[2] in comments which should probably
1247  * ### actually refer to the reporter.
1248  *
1249  * @since New in 1.5.
1250  */
1251 svn_error_t *
1252 svn_repos_dir_delta2(svn_fs_root_t *src_root,
1253                      const char *src_parent_dir,
1254                      const char *src_entry,
1255                      svn_fs_root_t *tgt_root,
1256                      const char *tgt_path,
1257                      const svn_delta_editor_t *editor,
1258                      void *edit_baton,
1259                      svn_repos_authz_func_t authz_read_func,
1260                      void *authz_read_baton,
1261                      svn_boolean_t text_deltas,
1262                      svn_depth_t depth,
1263                      svn_boolean_t entry_props,
1264                      svn_boolean_t ignore_ancestry,
1265                      apr_pool_t *pool);
1266
1267 /**
1268  * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
1269  * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
1270  * pass #svn_depth_files for @a depth.
1271  *
1272  * @deprecated Provided for backward compatibility with the 1.4 API.
1273  */
1274 SVN_DEPRECATED
1275 svn_error_t *
1276 svn_repos_dir_delta(svn_fs_root_t *src_root,
1277                     const char *src_parent_dir,
1278                     const char *src_entry,
1279                     svn_fs_root_t *tgt_root,
1280                     const char *tgt_path,
1281                     const svn_delta_editor_t *editor,
1282                     void *edit_baton,
1283                     svn_repos_authz_func_t authz_read_func,
1284                     void *authz_read_baton,
1285                     svn_boolean_t text_deltas,
1286                     svn_boolean_t recurse,
1287                     svn_boolean_t entry_props,
1288                     svn_boolean_t ignore_ancestry,
1289                     apr_pool_t *pool);
1290
1291
1292 /** Use the provided @a editor and @a edit_baton to describe the
1293  * skeletal changes made in a particular filesystem @a root
1294  * (revision or transaction).
1295  *
1296  * Changes will be limited to those within @a base_dir, and if
1297  * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
1298  * it is assumed that the client has no knowledge of revisions prior to
1299  * @a low_water_mark.  Together, these two arguments define the portion of
1300  * the tree that the client is assumed to have knowledge of, and thus any
1301  * copies of data from outside that part of the tree will be sent in their
1302  * entirety, not as simple copies or deltas against a previous version.
1303  *
1304  * The @a editor passed to this function should be aware of the fact
1305  * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
1306  * change_file_prop(), and apply_textdelta() functions will not
1307  * contain meaningful data, and merely serve as indications that
1308  * properties or textual contents were changed.
1309  *
1310  * If @a send_deltas is @c TRUE, the text and property deltas for changes
1311  * will be sent, otherwise NULL text deltas and empty prop changes will be
1312  * used.
1313  *
1314  * If @a authz_read_func is non-NULL, it will be used to determine if the
1315  * user has read access to the data being accessed.  Data that the user
1316  * cannot access will be skipped.
1317  *
1318  * @note This editor driver passes SVN_INVALID_REVNUM for all
1319  * revision parameters in the editor interface except the copyfrom
1320  * parameter of the add_file() and add_directory() editor functions.
1321  *
1322  * @since New in 1.4.
1323  */
1324 svn_error_t *
1325 svn_repos_replay2(svn_fs_root_t *root,
1326                   const char *base_dir,
1327                   svn_revnum_t low_water_mark,
1328                   svn_boolean_t send_deltas,
1329                   const svn_delta_editor_t *editor,
1330                   void *edit_baton,
1331                   svn_repos_authz_func_t authz_read_func,
1332                   void *authz_read_baton,
1333                   apr_pool_t *pool);
1334
1335 /**
1336  * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
1337  * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
1338  * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
1339  * set to @c NULL.
1340  *
1341  * @deprecated Provided for backward compatibility with the 1.3 API.
1342  */
1343 SVN_DEPRECATED
1344 svn_error_t *
1345 svn_repos_replay(svn_fs_root_t *root,
1346                  const svn_delta_editor_t *editor,
1347                  void *edit_baton,
1348                  apr_pool_t *pool);
1349
1350 /* ---------------------------------------------------------------*/
1351 \f
1352 /* Making commits. */
1353
1354 /**
1355  * Return an @a editor and @a edit_baton to commit changes to the
1356  * filesystem of @a repos, beginning at location 'rev:@a base_path',
1357  * where "rev" is the argument given to open_root().
1358  *
1359  * @a repos is a previously opened repository.  @a repos_url is the
1360  * decoded URL to the base of the repository, and is used to check
1361  * copyfrom paths.  copyfrom paths passed to the editor must be full,
1362  * URI-encoded, URLs.  @a txn is a filesystem transaction object to use
1363  * during the commit, or @c NULL to indicate that this function should
1364  * create (and fully manage) a new transaction.
1365  *
1366  * Store the contents of @a revprop_table, a hash mapping <tt>const
1367  * char *</tt> property names to #svn_string_t values, as properties
1368  * of the commit transaction, including author and log message if
1369  * present.
1370  *
1371  * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
1372  * it will be overwritten when the transaction is committed.
1373  *
1374  * Iff @a authz_callback is provided, check read/write authorizations
1375  * on paths accessed by editor operations.  An operation which fails
1376  * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
1377  * SVN_ERR_AUTHZ_UNWRITABLE.
1378  *
1379  * Calling @a (*editor)->close_edit completes the commit.
1380  *
1381  * If @a commit_callback is non-NULL, then before @c close_edit returns (but
1382  * after the commit has succeeded) @c close_edit will invoke
1383  * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
1384  * and @a pool or some subpool thereof as arguments.  If @a commit_callback
1385  * returns an error, that error will be returned from @c close_edit,
1386  * otherwise if there was a post-commit hook failure, then that error
1387  * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
1388  * (Note that prior to Subversion 1.6, @a commit_callback cannot be NULL; if
1389  * you don't need a callback, pass a dummy function.)
1390  *
1391  * Calling @a (*editor)->abort_edit aborts the commit, and will also
1392  * abort the commit transaction unless @a txn was supplied (not @c
1393  * NULL).  Callers who supply their own transactions are responsible
1394  * for cleaning them up (either by committing them, or aborting them).
1395  *
1396  * @since New in 1.5.
1397  *
1398  * @note Yes, @a repos_url is a <em>decoded</em> URL.  We realize
1399  * that's sorta wonky.  Sorry about that.
1400  */
1401 svn_error_t *
1402 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
1403                              void **edit_baton,
1404                              svn_repos_t *repos,
1405                              svn_fs_txn_t *txn,
1406                              const char *repos_url,
1407                              const char *base_path,
1408                              apr_hash_t *revprop_table,
1409                              svn_commit_callback2_t commit_callback,
1410                              void *commit_baton,
1411                              svn_repos_authz_callback_t authz_callback,
1412                              void *authz_baton,
1413                              apr_pool_t *pool);
1414
1415 /**
1416  * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
1417  * set to a hash containing @a user and @a log_msg as the
1418  * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
1419  * respectively.  @a user and @a log_msg may both be @c NULL.
1420  *
1421  * @since New in 1.4.
1422  *
1423  * @deprecated Provided for backward compatibility with the 1.4 API.
1424  */
1425 SVN_DEPRECATED
1426 svn_error_t *
1427 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
1428                              void **edit_baton,
1429                              svn_repos_t *repos,
1430                              svn_fs_txn_t *txn,
1431                              const char *repos_url,
1432                              const char *base_path,
1433                              const char *user,
1434                              const char *log_msg,
1435                              svn_commit_callback2_t commit_callback,
1436                              void *commit_baton,
1437                              svn_repos_authz_callback_t authz_callback,
1438                              void *authz_baton,
1439                              apr_pool_t *pool);
1440
1441 /**
1442  * Similar to svn_repos_get_commit_editor4(), but
1443  * uses the svn_commit_callback_t type.
1444  *
1445  * @since New in 1.3.
1446  *
1447  * @deprecated Provided for backward compatibility with the 1.3 API.
1448  */
1449 SVN_DEPRECATED
1450 svn_error_t *
1451 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1452                              void **edit_baton,
1453                              svn_repos_t *repos,
1454                              svn_fs_txn_t *txn,
1455                              const char *repos_url,
1456                              const char *base_path,
1457                              const char *user,
1458                              const char *log_msg,
1459                              svn_commit_callback_t callback,
1460                              void *callback_baton,
1461                              svn_repos_authz_callback_t authz_callback,
1462                              void *authz_baton,
1463                              apr_pool_t *pool);
1464
1465 /**
1466  * Similar to svn_repos_get_commit_editor3(), but with @a
1467  * authz_callback and @a authz_baton set to @c NULL.
1468  *
1469  * @deprecated Provided for backward compatibility with the 1.2 API.
1470  */
1471 SVN_DEPRECATED
1472 svn_error_t *
1473 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1474                              void **edit_baton,
1475                              svn_repos_t *repos,
1476                              svn_fs_txn_t *txn,
1477                              const char *repos_url,
1478                              const char *base_path,
1479                              const char *user,
1480                              const char *log_msg,
1481                              svn_commit_callback_t callback,
1482                              void *callback_baton,
1483                              apr_pool_t *pool);
1484
1485
1486 /**
1487  * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1488  * set to @c NULL.
1489  *
1490  * @deprecated Provided for backward compatibility with the 1.1 API.
1491  */
1492 SVN_DEPRECATED
1493 svn_error_t *
1494 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1495                             void **edit_baton,
1496                             svn_repos_t *repos,
1497                             const char *repos_url,
1498                             const char *base_path,
1499                             const char *user,
1500                             const char *log_msg,
1501                             svn_commit_callback_t callback,
1502                             void *callback_baton,
1503                             apr_pool_t *pool);
1504
1505 /* ---------------------------------------------------------------*/
1506 \f
1507 /* Finding particular revisions. */
1508
1509 /** Set @a *revision to the revision number in @a repos's filesystem that was
1510  * youngest at time @a tm.
1511  */
1512 svn_error_t *
1513 svn_repos_dated_revision(svn_revnum_t *revision,
1514                          svn_repos_t *repos,
1515                          apr_time_t tm,
1516                          apr_pool_t *pool);
1517
1518
1519 /** Given a @a root/@a path within some filesystem, return three pieces of
1520  * information allocated in @a pool:
1521  *
1522  *    - set @a *committed_rev to the revision in which the object was
1523  *      last modified.  (In fs parlance, this is the revision in which
1524  *      the particular node-rev-id was 'created'.)
1525  *
1526  *    - set @a *committed_date to the date of said revision, or @c NULL
1527  *      if not available.
1528  *
1529  *    - set @a *last_author to the author of said revision, or @c NULL
1530  *      if not available.
1531  */
1532 svn_error_t *
1533 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
1534                              const char **committed_date,
1535                              const char **last_author,
1536                              svn_fs_root_t *root,
1537                              const char *path,
1538                              apr_pool_t *pool);
1539
1540
1541 /**
1542  * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
1543  * root.  If @a path does not exist in @a root, set @a *dirent to
1544  * NULL.  Use @a pool for memory allocation.
1545  *
1546  * @since New in 1.2.
1547  */
1548 svn_error_t *
1549 svn_repos_stat(svn_dirent_t **dirent,
1550                svn_fs_root_t *root,
1551                const char *path,
1552                apr_pool_t *pool);
1553
1554
1555 /**
1556  * Given @a path which exists at revision @a start in @a fs, set
1557  * @a *deleted to the revision @a path was first deleted, within the
1558  * inclusive revision range bounded by @a start and @a end.  If @a path
1559  * does not exist at revision @a start or was not deleted within the
1560  * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1561  * Use @a pool for memory allocation.
1562  *
1563  * @since New in 1.5.
1564  */
1565 svn_error_t *
1566 svn_repos_deleted_rev(svn_fs_t *fs,
1567                       const char *path,
1568                       svn_revnum_t start,
1569                       svn_revnum_t end,
1570                       svn_revnum_t *deleted,
1571                       apr_pool_t *pool);
1572
1573
1574 /** Callback type for use with svn_repos_history().  @a path and @a
1575  * revision represent interesting history locations in the lifetime
1576  * of the path passed to svn_repos_history().  @a baton is the same
1577  * baton given to svn_repos_history().  @a pool is provided for the
1578  * convenience of the implementor, who should not expect it to live
1579  * longer than a single callback call.
1580  *
1581  * Signal to callback driver to stop processing/invoking this callback
1582  * by returning the #SVN_ERR_CEASE_INVOCATION error code.
1583  *
1584  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1585  */
1586 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1587                                                  const char *path,
1588                                                  svn_revnum_t revision,
1589                                                  apr_pool_t *pool);
1590
1591 /**
1592  * Call @a history_func (with @a history_baton) for each interesting
1593  * history location in the lifetime of @a path in @a fs, from the
1594  * youngest of @a end and @a start to the oldest.  Stop processing if
1595  * @a history_func returns #SVN_ERR_CEASE_INVOCATION.  Only cross
1596  * filesystem copy history if @a cross_copies is @c TRUE.  And do all
1597  * of this in @a pool.
1598  *
1599  * If @a authz_read_func is non-NULL, then use it (and @a
1600  * authz_read_baton) to verify that @a path in @a end is readable; if
1601  * not, return SVN_ERR_AUTHZ_UNREADABLE.  Also verify the readability
1602  * of every ancestral path/revision pair before pushing them at @a
1603  * history_func.  If a pair is deemed unreadable, then do not send
1604  * them; instead, immediately stop traversing history and return
1605  * SVN_NO_ERROR.
1606  *
1607  * @since New in 1.1.
1608  *
1609  * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1610  */
1611 svn_error_t *
1612 svn_repos_history2(svn_fs_t *fs,
1613                    const char *path,
1614                    svn_repos_history_func_t history_func,
1615                    void *history_baton,
1616                    svn_repos_authz_func_t authz_read_func,
1617                    void *authz_read_baton,
1618                    svn_revnum_t start,
1619                    svn_revnum_t end,
1620                    svn_boolean_t cross_copies,
1621                    apr_pool_t *pool);
1622
1623 /**
1624  * Similar to svn_repos_history2(), but with @a authz_read_func
1625  * and @a authz_read_baton always set to NULL.
1626  *
1627  * @deprecated Provided for backward compatibility with the 1.0 API.
1628  */
1629 SVN_DEPRECATED
1630 svn_error_t *
1631 svn_repos_history(svn_fs_t *fs,
1632                   const char *path,
1633                   svn_repos_history_func_t history_func,
1634                   void *history_baton,
1635                   svn_revnum_t start,
1636                   svn_revnum_t end,
1637                   svn_boolean_t cross_copies,
1638                   apr_pool_t *pool);
1639
1640
1641 /**
1642  * Set @a *locations to be a mapping of the revisions to the paths of
1643  * the file @a fs_path present at the repository in revision
1644  * @a peg_revision, where the revisions are taken out of the array
1645  * @a location_revisions.
1646  *
1647  * @a location_revisions is an array of svn_revnum_t's and @a *locations
1648  * maps 'svn_revnum_t *' to 'const char *'.
1649  *
1650  * If optional @a authz_read_func is non-NULL, then use it (and @a
1651  * authz_read_baton) to verify that the peg-object is readable.  If not,
1652  * return SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a authz_read_func
1653  * to check that every path returned in the hash is readable.  If an
1654  * unreadable path is encountered, stop tracing and return
1655  * SVN_NO_ERROR.
1656  *
1657  * @a pool is used for all allocations.
1658  *
1659  * @since New in 1.1.
1660  */
1661 svn_error_t *
1662 svn_repos_trace_node_locations(svn_fs_t *fs,
1663                                apr_hash_t **locations,
1664                                const char *fs_path,
1665                                svn_revnum_t peg_revision,
1666                                const apr_array_header_t *location_revisions,
1667                                svn_repos_authz_func_t authz_read_func,
1668                                void *authz_read_baton,
1669                                apr_pool_t *pool);
1670
1671
1672 /**
1673  * Call @a receiver and @a receiver_baton to report successive
1674  * location segments in revisions between @a start_rev and @a end_rev
1675  * (inclusive) for the line of history identified by the peg-object @a
1676  * path in @a peg_revision (and in @a repos).
1677  *
1678  * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
1679  * to trace the history of the object to its origin.
1680  *
1681  * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
1682  * revision".  Otherwise, @a start_rev must be younger than @a end_rev
1683  * (unless @a end_rev is #SVN_INVALID_REVNUM).
1684  *
1685  * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
1686  * revision", and must evaluate to be at least as young as @a start_rev.
1687  *
1688  * If optional @a authz_read_func is not @c NULL, then use it (and @a
1689  * authz_read_baton) to verify that the peg-object is readable.  If
1690  * not, return #SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a
1691  * authz_read_func to check that every path reported in a location
1692  * segment is readable.  If an unreadable path is encountered, report
1693  * a final (possibly truncated) location segment (if any), stop
1694  * tracing history, and return #SVN_NO_ERROR.
1695  *
1696  * @a pool is used for all allocations.
1697  *
1698  * @since New in 1.5.
1699  */
1700 svn_error_t *
1701 svn_repos_node_location_segments(svn_repos_t *repos,
1702                                  const char *path,
1703                                  svn_revnum_t peg_revision,
1704                                  svn_revnum_t start_rev,
1705                                  svn_revnum_t end_rev,
1706                                  svn_location_segment_receiver_t receiver,
1707                                  void *receiver_baton,
1708                                  svn_repos_authz_func_t authz_read_func,
1709                                  void *authz_read_baton,
1710                                  apr_pool_t *pool);
1711
1712
1713 /* ### other queries we can do someday --
1714
1715      * fetch the last revision created by <user>
1716          (once usernames become revision properties!)
1717      * fetch the last revision where <path> was modified
1718
1719 */
1720
1721
1722
1723 /* ---------------------------------------------------------------*/
1724 \f
1725 /* Retrieving log messages. */
1726
1727
1728 /**
1729  * Invoke @a receiver with @a receiver_baton on each log message from
1730  * @a start to @a end in @a repos's filesystem.  @a start may be greater
1731  * or less than @a end; this just controls whether the log messages are
1732  * processed in descending or ascending revision number order.
1733  *
1734  * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
1735  *
1736  * If @a paths is non-NULL and has one or more elements, then only show
1737  * revisions in which at least one of @a paths was changed (i.e., if
1738  * file, text or props changed; if dir, props or entries changed or any node
1739  * changed below it).  Each path is a <tt>const char *</tt> representing
1740  * an absolute path in the repository.  If @a paths is NULL or empty,
1741  * show all revisions regardless of what paths were changed in those
1742  * revisions.
1743  *
1744  * If @a limit is non-zero then only invoke @a receiver on the first
1745  * @a limit logs.
1746  *
1747  * If @a discover_changed_paths, then each call to @a receiver passes a
1748  * hash mapping paths committed in that revision to information about them
1749  * as the receiver's @a changed_paths argument.
1750  * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
1751  *
1752  * If @a strict_node_history is set, copy history (if any exists) will
1753  * not be traversed while harvesting revision logs for each path.
1754  *
1755  * If @a include_merged_revisions is set, log information for revisions
1756  * which have been merged to @a paths will also be returned, unless these
1757  * revisions are already part of @a start to @a end in @a repos's
1758  * filesystem, as limited by @a paths. In the latter case those revisions
1759  * are skipped and @a receiver is not invoked.
1760  *
1761  * If @a revprops is NULL, retrieve all revision properties; else, retrieve
1762  * only the revision properties named by the (const char *) array elements
1763  * (i.e. retrieve none if the array is empty).
1764  *
1765  * If any invocation of @a receiver returns error, return that error
1766  * immediately and without wrapping it.
1767  *
1768  * If @a start or @a end is a non-existent revision, return the error
1769  * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
1770  *
1771  * If optional @a authz_read_func is non-NULL, then use this function
1772  * (along with optional @a authz_read_baton) to check the readability
1773  * of each changed-path in each revision about to be "pushed" at
1774  * @a receiver.  If a revision has some changed-paths readable and
1775  * others unreadable, unreadable paths are omitted from the
1776  * changed_paths field and only svn:author and svn:date will be
1777  * available in the revprops field.  If a revision has no
1778  * changed-paths readable at all, then all paths are omitted and no
1779  * revprops are available.
1780  *
1781  * See also the documentation for #svn_log_entry_receiver_t.
1782  *
1783  * Use @a pool for temporary allocations.
1784  *
1785  * @since New in 1.5.
1786  */
1787 svn_error_t *
1788 svn_repos_get_logs4(svn_repos_t *repos,
1789                     const apr_array_header_t *paths,
1790                     svn_revnum_t start,
1791                     svn_revnum_t end,
1792                     int limit,
1793                     svn_boolean_t discover_changed_paths,
1794                     svn_boolean_t strict_node_history,
1795                     svn_boolean_t include_merged_revisions,
1796                     const apr_array_header_t *revprops,
1797                     svn_repos_authz_func_t authz_read_func,
1798                     void *authz_read_baton,
1799                     svn_log_entry_receiver_t receiver,
1800                     void *receiver_baton,
1801                     apr_pool_t *pool);
1802
1803 /**
1804  * Same as svn_repos_get_logs4(), but with @a receiver being
1805  * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
1806  * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
1807  * svn:author, svn:date, and svn:log.  If @a paths is empty, nothing
1808  * is returned.
1809  *
1810  * @since New in 1.2.
1811  * @deprecated Provided for backward compatibility with the 1.4 API.
1812  */
1813 SVN_DEPRECATED
1814 svn_error_t *
1815 svn_repos_get_logs3(svn_repos_t *repos,
1816                     const apr_array_header_t *paths,
1817                     svn_revnum_t start,
1818                     svn_revnum_t end,
1819                     int limit,
1820                     svn_boolean_t discover_changed_paths,
1821                     svn_boolean_t strict_node_history,
1822                     svn_repos_authz_func_t authz_read_func,
1823                     void *authz_read_baton,
1824                     svn_log_message_receiver_t receiver,
1825                     void *receiver_baton,
1826                     apr_pool_t *pool);
1827
1828
1829 /**
1830  * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
1831  *
1832  * @deprecated Provided for backward compatibility with the 1.1 API.
1833  */
1834 SVN_DEPRECATED
1835 svn_error_t *
1836 svn_repos_get_logs2(svn_repos_t *repos,
1837                     const apr_array_header_t *paths,
1838                     svn_revnum_t start,
1839                     svn_revnum_t end,
1840                     svn_boolean_t discover_changed_paths,
1841                     svn_boolean_t strict_node_history,
1842                     svn_repos_authz_func_t authz_read_func,
1843                     void *authz_read_baton,
1844                     svn_log_message_receiver_t receiver,
1845                     void *receiver_baton,
1846                     apr_pool_t *pool);
1847
1848 /**
1849  * Same as svn_repos_get_logs2(), but with @a authz_read_func and
1850  * @a authz_read_baton always set to NULL.
1851  *
1852  * @deprecated Provided for backward compatibility with the 1.0 API.
1853  */
1854 SVN_DEPRECATED
1855 svn_error_t *
1856 svn_repos_get_logs(svn_repos_t *repos,
1857                    const apr_array_header_t *paths,
1858                    svn_revnum_t start,
1859                    svn_revnum_t end,
1860                    svn_boolean_t discover_changed_paths,
1861                    svn_boolean_t strict_node_history,
1862                    svn_log_message_receiver_t receiver,
1863                    void *receiver_baton,
1864                    apr_pool_t *pool);
1865
1866
1867
1868 /* ---------------------------------------------------------------*/
1869 \f
1870 /* Retrieving mergeinfo. */
1871
1872 /**
1873  * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
1874  * set @a *catalog to a catalog of this mergeinfo.  @a *catalog will
1875  * never be @c NULL but may be empty.
1876  *
1877  * The paths in @a paths, and the keys of @a catalog, start with '/'.
1878  *
1879  * @a inherit indicates whether explicit, explicit or inherited, or
1880  * only inherited mergeinfo for @a paths is fetched.
1881  *
1882  * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
1883  *
1884  * If @a include_descendants is TRUE, then additionally return the
1885  * mergeinfo for any descendant of any element of @a paths which has
1886  * the #SVN_PROP_MERGEINFO property explicitly set on it.  (Note
1887  * that inheritance is only taken into account for the elements in @a
1888  * paths; descendants of the elements in @a paths which get their
1889  * mergeinfo via inheritance are not included in @a *catalog.)
1890  *
1891  * If optional @a authz_read_func is non-NULL, then use this function
1892  * (along with optional @a authz_read_baton) to check the readability
1893  * of each path which mergeinfo was requested for (from @a paths).
1894  * Silently omit unreadable paths from the request for mergeinfo.
1895  *
1896  * Use @a pool for all allocations.
1897  *
1898  * @since New in 1.5.
1899  */
1900 svn_error_t *
1901 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1902                            svn_repos_t *repos,
1903                            const apr_array_header_t *paths,
1904                            svn_revnum_t revision,
1905                            svn_mergeinfo_inheritance_t inherit,
1906                            svn_boolean_t include_descendants,
1907                            svn_repos_authz_func_t authz_read_func,
1908                            void *authz_read_baton,
1909                            apr_pool_t *pool);
1910
1911
1912 /* ---------------------------------------------------------------*/
1913 \f
1914 /* Retrieving multiple revisions of a file. */
1915
1916 /**
1917  * Retrieve a subset of the interesting revisions of a file @a path in
1918  * @a repos as seen in revision @a end.  Invoke @a handler with
1919  * @a handler_baton as its first argument for each such revision.
1920  * @a pool is used for all allocations.  See svn_fs_history_prev() for
1921  * a discussion of interesting revisions.
1922  *
1923  * If optional @a authz_read_func is non-NULL, then use this function
1924  * (along with optional @a authz_read_baton) to check the readability
1925  * of the rev-path in each interesting revision encountered.
1926  *
1927  * Revision discovery happens from @a end to @a start, and if an
1928  * unreadable revision is encountered before @a start is reached, then
1929  * revision discovery stops and only the revisions from @a end to the
1930  * oldest readable revision are returned (So it will appear that @a
1931  * path was added without history in the latter revision).
1932  *
1933  * If there is an interesting revision of the file that is less than or
1934  * equal to start, the iteration will start at that revision.  Else, the
1935  * iteration will start at the first revision of the file in the repository,
1936  * which has to be less than or equal to end.  Note that if the function
1937  * succeeds, @a handler will have been called at least once.
1938  *
1939  * In a series of calls, the file contents for the first interesting revision
1940  * will be provided as a text delta against the empty file.  In the following
1941  * calls, the delta will be against the contents for the previous call.
1942  *
1943  * If @a include_merged_revisions is TRUE, revisions which a included as a
1944  * result of a merge between @a start and @a end will be included.
1945  *
1946  * Since Subversion 1.8 this function has been enabled to support reversion
1947  * the revision range for @a include_merged_revision @c FALSE reporting by
1948  * switching @a start with @a end.
1949  *
1950  * @since New in 1.5.
1951  */
1952 svn_error_t *
1953 svn_repos_get_file_revs2(svn_repos_t *repos,
1954                          const char *path,
1955                          svn_revnum_t start,
1956                          svn_revnum_t end,
1957                          svn_boolean_t include_merged_revisions,
1958                          svn_repos_authz_func_t authz_read_func,
1959                          void *authz_read_baton,
1960                          svn_file_rev_handler_t handler,
1961                          void *handler_baton,
1962                          apr_pool_t *pool);
1963
1964 /**
1965  * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
1966  * set to FALSE.
1967  *
1968  * @deprecated Provided for backward compatibility with the 1.4 API.
1969  * @since New in 1.1.
1970  */
1971 SVN_DEPRECATED
1972 svn_error_t *
1973 svn_repos_get_file_revs(svn_repos_t *repos,
1974                         const char *path,
1975                         svn_revnum_t start,
1976                         svn_revnum_t end,
1977                         svn_repos_authz_func_t authz_read_func,
1978                         void *authz_read_baton,
1979                         svn_repos_file_rev_handler_t handler,
1980                         void *handler_baton,
1981                         apr_pool_t *pool);
1982
1983
1984 /* ---------------------------------------------------------------*/
1985 \f
1986 /**
1987  * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
1988  * routines.
1989  * @{
1990  */
1991
1992 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
1993  * post-commit hooks around the commit.  Use @a pool for any necessary
1994  * allocations.
1995  *
1996  * If the pre-commit hook fails, do not attempt to commit the
1997  * transaction and throw the original error to the caller.
1998  *
1999  * A successful commit is indicated by a valid revision value in @a
2000  * *new_rev, not if svn_fs_commit_txn() returns an error, which can
2001  * occur during its post commit FS processing.  If the transaction was
2002  * not committed, then return the associated error and do not execute
2003  * the post-commit hook.
2004  *
2005  * If the commit succeeds the post-commit hook is executed.  If the
2006  * post-commit hook returns an error, always wrap it with
2007  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
2008  * find the post-commit hook error in the returned error chain.  If
2009  * both svn_fs_commit_txn() and the post-commit hook return errors,
2010  * then svn_fs_commit_txn()'s error is the parent error and the
2011  * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
2012  * error.
2013  *
2014  * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
2015  */
2016 svn_error_t *
2017 svn_repos_fs_commit_txn(const char **conflict_p,
2018                         svn_repos_t *repos,
2019                         svn_revnum_t *new_rev,
2020                         svn_fs_txn_t *txn,
2021                         apr_pool_t *pool);
2022
2023 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
2024  * <tt>const char *</tt> property names to #svn_string_t values, to
2025  * set the properties on transaction @a *txn_p.  @a repos is the
2026  * repository object which contains the filesystem.  @a rev, @a
2027  * *txn_p, and @a pool are as in svn_fs_begin_txn().
2028  *
2029  * Before a txn is created, the repository's start-commit hooks are
2030  * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
2031  * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
2032  *
2033  * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
2034  * which will be set on the transaction, but that will be overwritten
2035  * when the transaction is committed.
2036  *
2037  * @since New in 1.5.
2038  */
2039 svn_error_t *
2040 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
2041                                    svn_repos_t *repos,
2042                                    svn_revnum_t rev,
2043                                    apr_hash_t *revprop_table,
2044                                    apr_pool_t *pool);
2045
2046
2047 /**
2048  * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
2049  * set to a hash containing @a author and @a log_msg as the
2050  * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
2051  * respectively.  @a author and @a log_msg may both be @c NULL.
2052  *
2053  * @deprecated Provided for backward compatibility with the 1.4 API.
2054  */
2055 SVN_DEPRECATED
2056 svn_error_t *
2057 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
2058                                   svn_repos_t *repos,
2059                                   svn_revnum_t rev,
2060                                   const char *author,
2061                                   const char *log_msg,
2062                                   apr_pool_t *pool);
2063
2064
2065 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
2066  * property on transaction @a *txn_p.  @a repos is the repository object
2067  * which contains the filesystem.  @a rev, @a *txn_p, and @a pool are as in
2068  * svn_fs_begin_txn().
2069  *
2070  * ### Someday: before a txn is created, some kind of read-hook could
2071  *              be called here.
2072  *
2073  * @note This function was never fully implemented, nor used. Ignore it.
2074  * @deprecated Provided for backward compatibility with the 1.7 API.
2075  */
2076 SVN_DEPRECATED
2077 svn_error_t *
2078 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
2079                                   svn_repos_t *repos,
2080                                   svn_revnum_t rev,
2081                                   const char *author,
2082                                   apr_pool_t *pool);
2083
2084
2085 /** @} */
2086
2087 /** @defgroup svn_repos_fs_locks Repository lock wrappers
2088  * @{
2089  */
2090
2091 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
2092  * post-lock hooks before and after the locking action.  Use @a pool
2093  * for any necessary allocations.
2094  *
2095  * If the pre-lock hook or svn_fs_lock() fails, throw the original
2096  * error to caller.  If an error occurs when running the post-lock
2097  * hook, return the original error wrapped with
2098  * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED.  If the caller sees this
2099  * error, it knows that the lock succeeded anyway.
2100  *
2101  * The pre-lock hook may cause a different token to be used for the
2102  * lock, instead of @a token; see the pre-lock-hook documentation for
2103  * more.
2104  *
2105  * @since New in 1.2.
2106  */
2107 svn_error_t *
2108 svn_repos_fs_lock(svn_lock_t **lock,
2109                   svn_repos_t *repos,
2110                   const char *path,
2111                   const char *token,
2112                   const char *comment,
2113                   svn_boolean_t is_dav_comment,
2114                   apr_time_t expiration_date,
2115                   svn_revnum_t current_rev,
2116                   svn_boolean_t steal_lock,
2117                   apr_pool_t *pool);
2118
2119
2120 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
2121  * post-unlock hooks before and after the unlocking action.  Use @a
2122  * pool for any necessary allocations.
2123  *
2124  * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
2125  * error to caller.  If an error occurs when running the post-unlock
2126  * hook, return the original error wrapped with
2127  * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.  If the caller sees this
2128  * error, it knows that the unlock succeeded anyway.
2129  *
2130  * @since New in 1.2.
2131  */
2132 svn_error_t *
2133 svn_repos_fs_unlock(svn_repos_t *repos,
2134                     const char *path,
2135                     const char *token,
2136                     svn_boolean_t break_lock,
2137                     apr_pool_t *pool);
2138
2139
2140
2141 /** Look up all the locks in and under @a path in @a repos, setting @a
2142  * *locks to a hash which maps <tt>const char *</tt> paths to the
2143  * #svn_lock_t locks associated with those paths.  Use @a
2144  * authz_read_func and @a authz_read_baton to "screen" all returned
2145  * locks.  That is: do not return any locks on any paths that are
2146  * unreadable in HEAD, just silently omit them.
2147  *
2148  * @a depth limits the returned locks to those associated with paths
2149  * within the specified depth of @a path, and must be one of the
2150  * following values:  #svn_depth_empty, #svn_depth_files,
2151  * #svn_depth_immediates, or #svn_depth_infinity.
2152  *
2153  * @since New in 1.7.
2154  */
2155 svn_error_t *
2156 svn_repos_fs_get_locks2(apr_hash_t **locks,
2157                         svn_repos_t *repos,
2158                         const char *path,
2159                         svn_depth_t depth,
2160                         svn_repos_authz_func_t authz_read_func,
2161                         void *authz_read_baton,
2162                         apr_pool_t *pool);
2163
2164 /**
2165  * Similar to svn_repos_fs_get_locks2(), but with @a depth always
2166  * passed as svn_depth_infinity.
2167  *
2168  * @since New in 1.2.
2169  * @deprecated Provided for backward compatibility with the 1.6 API.
2170  */
2171 SVN_DEPRECATED
2172 svn_error_t *
2173 svn_repos_fs_get_locks(apr_hash_t **locks,
2174                        svn_repos_t *repos,
2175                        const char *path,
2176                        svn_repos_authz_func_t authz_read_func,
2177                        void *authz_read_baton,
2178                        apr_pool_t *pool);
2179
2180 /** @} */
2181
2182 /**
2183  * Like svn_fs_change_rev_prop2(), but validate the name and value of the
2184  * property and invoke the @a repos's pre- and post-revprop-change hooks
2185  * around the change as specified by @a use_pre_revprop_change_hook and
2186  * @a use_post_revprop_change_hook (respectively).
2187  *
2188  * @a rev is the revision whose property to change, @a name is the
2189  * name of the property, and @a new_value is the new value of the
2190  * property.   If @a old_value_p is not @c NULL, then @a *old_value_p
2191  * is the expected current (preexisting) value of the property (or @c NULL
2192  * for "unset").  @a author is the authenticated username of the person
2193  * changing the property value, or NULL if not available.
2194  *
2195  * If @a authz_read_func is non-NULL, then use it (with @a
2196  * authz_read_baton) to validate the changed-paths associated with @a
2197  * rev.  If the revision contains any unreadable changed paths, then
2198  * return #SVN_ERR_AUTHZ_UNREADABLE.
2199  *
2200  * Validate @a name and @a new_value like the same way
2201  * svn_repos_fs_change_node_prop() does.
2202  *
2203  * Use @a pool for temporary allocations.
2204  *
2205  * @since New in 1.7.
2206  */
2207 svn_error_t *
2208 svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
2209                               svn_revnum_t rev,
2210                               const char *author,
2211                               const char *name,
2212                               const svn_string_t *const *old_value_p,
2213                               const svn_string_t *new_value,
2214                               svn_boolean_t
2215                               use_pre_revprop_change_hook,
2216                               svn_boolean_t
2217                               use_post_revprop_change_hook,
2218                               svn_repos_authz_func_t
2219                               authz_read_func,
2220                               void *authz_read_baton,
2221                               apr_pool_t *pool);
2222
2223 /**
2224  * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
2225  * set to @c NULL.  (In other words, it is similar to
2226  * svn_fs_change_rev_prop().)
2227  *
2228  * @deprecated Provided for backward compatibility with the 1.6 API.
2229  * @since New in 1.5.
2230  */
2231 SVN_DEPRECATED
2232 svn_error_t *
2233 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
2234                               svn_revnum_t rev,
2235                               const char *author,
2236                               const char *name,
2237                               const svn_string_t *new_value,
2238                               svn_boolean_t
2239                               use_pre_revprop_change_hook,
2240                               svn_boolean_t
2241                               use_post_revprop_change_hook,
2242                               svn_repos_authz_func_t
2243                               authz_read_func,
2244                               void *authz_read_baton,
2245                               apr_pool_t *pool);
2246
2247 /**
2248  * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
2249  * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
2250  * always set to @c TRUE.
2251  *
2252  * @deprecated Provided for backward compatibility with the 1.4 API.
2253  */
2254 SVN_DEPRECATED
2255 svn_error_t *
2256 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
2257                               svn_revnum_t rev,
2258                               const char *author,
2259                               const char *name,
2260                               const svn_string_t *new_value,
2261                               svn_repos_authz_func_t
2262                               authz_read_func,
2263                               void *authz_read_baton,
2264                               apr_pool_t *pool);
2265
2266 /**
2267  * Similar to svn_repos_fs_change_rev_prop2(), but with the
2268  * @a authz_read_func parameter always NULL.
2269  *
2270  * @deprecated Provided for backward compatibility with the 1.0 API.
2271  */
2272 SVN_DEPRECATED
2273 svn_error_t *
2274 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
2275                              svn_revnum_t rev,
2276                              const char *author,
2277                              const char *name,
2278                              const svn_string_t *new_value,
2279                              apr_pool_t *pool);
2280
2281
2282
2283 /**
2284  * Set @a *value_p to the value of the property named @a propname on
2285  * revision @a rev in the filesystem opened in @a repos.  If @a rev
2286  * has no property by that name, set @a *value_p to zero.  Allocate
2287  * the result in @a pool.
2288  *
2289  * If @a authz_read_func is non-NULL, then use it (with @a
2290  * authz_read_baton) to validate the changed-paths associated with @a
2291  * rev.  If the changed-paths are all unreadable, then set @a *value_p
2292  * to zero unconditionally.  If only some of the changed-paths are
2293  * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
2294  * fetched, but return 0 for any other property.
2295  *
2296  * @since New in 1.1.
2297  */
2298 svn_error_t *
2299 svn_repos_fs_revision_prop(svn_string_t **value_p,
2300                            svn_repos_t *repos,
2301                            svn_revnum_t rev,
2302                            const char *propname,
2303                            svn_repos_authz_func_t
2304                            authz_read_func,
2305                            void *authz_read_baton,
2306                            apr_pool_t *pool);
2307
2308
2309 /**
2310  * Set @a *table_p to the entire property list of revision @a rev in
2311  * filesystem opened in @a repos, as a hash table allocated in @a
2312  * pool.  The table maps <tt>char *</tt> property names to
2313  * #svn_string_t * values; the names and values are allocated in @a
2314  * pool.
2315  *
2316  * If @a authz_read_func is non-NULL, then use it (with @a
2317  * authz_read_baton) to validate the changed-paths associated with @a
2318  * rev.  If the changed-paths are all unreadable, then return an empty
2319  * hash. If only some of the changed-paths are unreadable, then return
2320  * an empty hash, except for 'svn:author' and 'svn:date' properties
2321  * (assuming those properties exist).
2322  *
2323  * @since New in 1.1.
2324  */
2325 svn_error_t *
2326 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
2327                                svn_repos_t *repos,
2328                                svn_revnum_t rev,
2329                                svn_repos_authz_func_t
2330                                authz_read_func,
2331                                void *authz_read_baton,
2332                                apr_pool_t *pool);
2333
2334
2335
2336 /* ---------------------------------------------------------------*/
2337 \f
2338 /* Prop-changing wrappers for libsvn_fs routines. */
2339
2340 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
2341    above with the hook-related functions. */
2342
2343
2344 /** Validating wrapper for svn_fs_change_node_prop() (which see for
2345  * argument descriptions).
2346  *
2347  * If @a name's kind is not #svn_prop_regular_kind, return
2348  * #SVN_ERR_REPOS_BAD_ARGS.  If @a name is an "svn:" property, validate its
2349  * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
2350  * property.
2351  *
2352  * @note Currently, the only properties validated are the "svn:" properties
2353  * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. This may change
2354  * in future releases.
2355  */
2356 svn_error_t *
2357 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
2358                               const char *path,
2359                               const char *name,
2360                               const svn_string_t *value,
2361                               apr_pool_t *pool);
2362
2363 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
2364  * argument descriptions).  See svn_repos_fs_change_txn_props() for more
2365  * information.
2366  */
2367 svn_error_t *
2368 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
2369                              const char *name,
2370                              const svn_string_t *value,
2371                              apr_pool_t *pool);
2372
2373 /** Validating wrapper for svn_fs_change_txn_props() (which see for
2374  * argument descriptions).  Validate properties and their values the
2375  * same way svn_repos_fs_change_node_prop() does.
2376  *
2377  * @since New in 1.5.
2378  */
2379 svn_error_t *
2380 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
2381                               const apr_array_header_t *props,
2382                               apr_pool_t *pool);
2383
2384
2385 /* ---------------------------------------------------------------*/
2386 \f
2387 /**
2388  * @defgroup svn_repos_inspection Data structures and editor things for \
2389  * repository inspection.
2390  * @{
2391  *
2392  * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
2393  * svn_repos_begin_report3() interfaces can be extremely useful for
2394  * examining the repository, or more exactly, changes to the repository.
2395  * These drivers allows for differences between two trees to be
2396  * described using an editor.
2397  *
2398  * By using the editor obtained from svn_repos_node_editor() with one of
2399  * the drivers mentioned above, the description of how to transform one
2400  * tree into another can be used to build an in-memory linked-list tree,
2401  * which each node representing a repository node that was changed.
2402  */
2403
2404 /** A node in the repository. */
2405 typedef struct svn_repos_node_t
2406 {
2407   /** Node type (file, dir, etc.) */
2408   svn_node_kind_t kind;
2409
2410   /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
2411   char action;
2412
2413   /** Were there any textual mods? (files only) */
2414   svn_boolean_t text_mod;
2415
2416   /** Where there any property mods? */
2417   svn_boolean_t prop_mod;
2418
2419   /** The name of this node as it appears in its parent's entries list */
2420   const char *name;
2421
2422   /** The filesystem revision where this was copied from (if any) */
2423   svn_revnum_t copyfrom_rev;
2424
2425   /** The filesystem path where this was copied from (if any) */
2426   const char *copyfrom_path;
2427
2428   /** Pointer to the next sibling of this node */
2429   struct svn_repos_node_t *sibling;
2430
2431   /** Pointer to the first child of this node */
2432   struct svn_repos_node_t *child;
2433
2434   /** Pointer to the parent of this node */
2435   struct svn_repos_node_t *parent;
2436
2437 } svn_repos_node_t;
2438
2439
2440 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
2441  * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
2442  * tree representing the delta from @a base_root to @a root in @a
2443  * repos's filesystem.
2444  *
2445  * The editor can also be driven by svn_repos_dir_delta2() or
2446  * svn_repos_begin_report3(), but unless you have special needs,
2447  * svn_repos_replay2() is preferred.
2448  *
2449  * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
2450  * node afterwards.
2451  *
2452  * Note that the delta includes "bubbled-up" directories; that is,
2453  * many of the directory nodes will have no prop_mods.
2454  *
2455  * Allocate the tree and its contents in @a node_pool; do all other
2456  * allocation in @a pool.
2457  */
2458 svn_error_t *
2459 svn_repos_node_editor(const svn_delta_editor_t **editor,
2460                       void **edit_baton,
2461                       svn_repos_t *repos,
2462                       svn_fs_root_t *base_root,
2463                       svn_fs_root_t *root,
2464                       apr_pool_t *node_pool,
2465                       apr_pool_t *pool);
2466
2467 /** Return the root node of the linked-list tree generated by driving the
2468  * editor (associated with @a edit_baton) created by svn_repos_node_editor().
2469  * This is only really useful if used *after* the editor drive is completed.
2470  */
2471 svn_repos_node_t *
2472 svn_repos_node_from_baton(void *edit_baton);
2473
2474 /** @} */
2475
2476 /* ---------------------------------------------------------------*/
2477 \f
2478 /**
2479  * @defgroup svn_repos_dump_load Dumping and loading filesystem data
2480  * @{
2481  *
2482  * The filesystem 'dump' format contains nothing but the abstract
2483  * structure of the filesystem -- independent of any internal node-id
2484  * schema or database back-end.  All of the data in the dumpfile is
2485  * acquired by public function calls into svn_fs.h.  Similarly, the
2486  * parser which reads the dumpfile is able to reconstruct the
2487  * filesystem using only public svn_fs.h routines.
2488  *
2489  * Thus the dump/load feature's main purpose is for *migrating* data
2490  * from one svn filesystem to another -- presumably two filesystems
2491  * which have different internal implementations.
2492  *
2493  * If you simply want to backup your filesystem, you're probably
2494  * better off using the built-in facilities of the DB backend (using
2495  * Berkeley DB's hot-backup feature, for example.)
2496  *
2497  * For a description of the dumpfile format, see
2498  * /trunk/notes/fs_dumprestore.txt.
2499  */
2500
2501 /* The RFC822-style headers in our dumpfile format. */
2502 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER            "SVN-fs-dump-format-version"
2503 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION           3
2504 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS    3
2505 #define SVN_REPOS_DUMPFILE_UUID                      "UUID"
2506 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH            "Content-length"
2507
2508 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER           "Revision-number"
2509
2510 #define SVN_REPOS_DUMPFILE_NODE_PATH                 "Node-path"
2511 #define SVN_REPOS_DUMPFILE_NODE_KIND                 "Node-kind"
2512 #define SVN_REPOS_DUMPFILE_NODE_ACTION               "Node-action"
2513 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH        "Node-copyfrom-path"
2514 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV         "Node-copyfrom-rev"
2515 /** @since New in 1.6. */
2516 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5      "Text-copy-source-md5"
2517 /** @since New in 1.6. */
2518 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1     "Text-copy-source-sha1"
2519 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
2520                                         SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
2521 /** @since New in 1.6. */
2522 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5          "Text-content-md5"
2523 /** @since New in 1.6. */
2524 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1         "Text-content-sha1"
2525 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM     \
2526                                         SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
2527
2528 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH       "Prop-content-length"
2529 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH       "Text-content-length"
2530
2531 /** @since New in 1.1. */
2532 #define SVN_REPOS_DUMPFILE_PROP_DELTA                "Prop-delta"
2533 /** @since New in 1.1. */
2534 #define SVN_REPOS_DUMPFILE_TEXT_DELTA                "Text-delta"
2535 /** @since New in 1.6. */
2536 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5       "Text-delta-base-md5"
2537 /** @since New in 1.6. */
2538 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1      "Text-delta-base-sha1"
2539 /** @since New in 1.5. */
2540 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM  \
2541                                         SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
2542
2543 /**
2544  * Verify the contents of the file system in @a repos.
2545  *
2546  * If @a feedback_stream is not @c NULL, write feedback to it (lines of
2547  * the form "* Verified revision %ld\n").
2548  *
2549  * If @a start_rev is #SVN_INVALID_REVNUM, then start verifying at
2550  * revision 0.  If @a end_rev is #SVN_INVALID_REVNUM, then verify
2551  * through the @c HEAD revision.
2552  *
2553  * For every verified revision call @a notify_func with @a rev set to
2554  * the verified revision and @a warning_text @c NULL. For warnings call @a
2555  * notify_func with @a warning_text set.
2556  *
2557  * If @a cancel_func is not @c NULL, call it periodically with @a
2558  * cancel_baton as argument to see if the caller wishes to cancel the
2559  * verification.
2560  *
2561  * @since New in 1.7.
2562  */
2563 svn_error_t *
2564 svn_repos_verify_fs2(svn_repos_t *repos,
2565                      svn_revnum_t start_rev,
2566                      svn_revnum_t end_rev,
2567                      svn_repos_notify_func_t notify_func,
2568                      void *notify_baton,
2569                      svn_cancel_func_t cancel,
2570                      void *cancel_baton,
2571                      apr_pool_t *scratch_pool);
2572
2573 /**
2574  * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
2575  * handling feedback via the notify_func handler
2576  *
2577  * @since New in 1.5.
2578  * @deprecated Provided for backward compatibility with the 1.6 API.
2579  */
2580 SVN_DEPRECATED
2581 svn_error_t *
2582 svn_repos_verify_fs(svn_repos_t *repos,
2583                     svn_stream_t *feedback_stream,
2584                     svn_revnum_t start_rev,
2585                     svn_revnum_t end_rev,
2586                     svn_cancel_func_t cancel_func,
2587                     void *cancel_baton,
2588                     apr_pool_t *pool);
2589
2590 /**
2591  * Dump the contents of the filesystem within already-open @a repos into
2592  * writable @a dumpstream.  Begin at revision @a start_rev, and dump every
2593  * revision up through @a end_rev.  Use @a pool for all allocation.  If
2594  * non-@c NULL, send feedback to @a feedback_stream.  If @a dumpstream is
2595  * @c NULL, this is effectively a primitive verify.  It is not complete,
2596  * however; svn_repos_verify_fs2() and svn_fs_verify().
2597  *
2598  * If @a start_rev is #SVN_INVALID_REVNUM, then start dumping at revision
2599  * 0.  If @a end_rev is #SVN_INVALID_REVNUM, then dump through the @c HEAD
2600  * revision.
2601  *
2602  * If @a incremental is @c TRUE, the first revision dumped will be a diff
2603  * against the previous revision (usually it looks like a full dump of
2604  * the tree).
2605  *
2606  * If @a use_deltas is @c TRUE, output only node properties which have
2607  * changed relative to the previous contents, and output text contents
2608  * as svndiff data against the previous contents.  Regardless of how
2609  * this flag is set, the first revision of a non-incremental dump will
2610  * be done with full plain text.  A dump with @a use_deltas set cannot
2611  * be loaded by Subversion 1.0.x.
2612  *
2613  * If @a notify_func is not @c NULL, then for every dumped revision call
2614  * @a notify_func with @a rev set to the dumped revision and @a warning_text
2615  * @c NULL. For warnings call @a notify_func with @a warning_text.
2616  *
2617  * If @a cancel_func is not @c NULL, it is called periodically with
2618  * @a cancel_baton as argument to see if the client wishes to cancel
2619  * the dump.
2620  *
2621  * @since New in 1.7.
2622  */
2623 svn_error_t *
2624 svn_repos_dump_fs3(svn_repos_t *repos,
2625                    svn_stream_t *dumpstream,
2626                    svn_revnum_t start_rev,
2627                    svn_revnum_t end_rev,
2628                    svn_boolean_t incremental,
2629                    svn_boolean_t use_deltas,
2630                    svn_repos_notify_func_t notify_func,
2631                    void *notify_baton,
2632                    svn_cancel_func_t cancel_func,
2633                    void *cancel_baton,
2634                    apr_pool_t *scratch_pool);
2635
2636 /**
2637  * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
2638  * handling feedback via the notify_func handler
2639  *
2640  * @since New in 1.1.
2641  * @deprecated Provided for backward compatibility with the 1.6 API.
2642  */
2643 SVN_DEPRECATED
2644 svn_error_t *
2645 svn_repos_dump_fs2(svn_repos_t *repos,
2646                    svn_stream_t *dumpstream,
2647                    svn_stream_t *feedback_stream,
2648                    svn_revnum_t start_rev,
2649                    svn_revnum_t end_rev,
2650                    svn_boolean_t incremental,
2651                    svn_boolean_t use_deltas,
2652                    svn_cancel_func_t cancel_func,
2653                    void *cancel_baton,
2654                    apr_pool_t *pool);
2655
2656 /**
2657  * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
2658  * parameter always set to @c FALSE.
2659  *
2660  * @deprecated Provided for backward compatibility with the 1.0 API.
2661  */
2662 SVN_DEPRECATED
2663 svn_error_t *
2664 svn_repos_dump_fs(svn_repos_t *repos,
2665                   svn_stream_t *dumpstream,
2666                   svn_stream_t *feedback_stream,
2667                   svn_revnum_t start_rev,
2668                   svn_revnum_t end_rev,
2669                   svn_boolean_t incremental,
2670                   svn_cancel_func_t cancel_func,
2671                   void *cancel_baton,
2672                   apr_pool_t *pool);
2673
2674
2675 /**
2676  * Read and parse dumpfile-formatted @a dumpstream, reconstructing
2677  * filesystem revisions in already-open @a repos, handling uuids in
2678  * accordance with @a uuid_action.  Use @a pool for all allocation.
2679  *
2680  * If the dumpstream contains copy history that is unavailable in the
2681  * repository, an error will be thrown.
2682  *
2683  * The repository's UUID will be updated iff
2684  *   the dumpstream contains a UUID and
2685  *   @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
2686  *   either the repository contains no revisions or
2687  *          @a uuid_action is equal to #svn_repos_load_uuid_force.
2688  *
2689  * If the dumpstream contains no UUID, then @a uuid_action is
2690  * ignored and the repository UUID is not touched.
2691  *
2692  * @a start_rev and @a end_rev act as filters, the lower and upper
2693  * (inclusive) range values of revisions in @a dumpstream which will
2694  * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
2695  * which case no revision-based filtering occurs at all), or both are
2696  * valid revisions (where @a start_rev is older than or equivalent to
2697  * @a end_rev).
2698  *
2699  * If @a parent_dir is not NULL, then the parser will reparent all the
2700  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
2701  * must be an existing directory in the repository.
2702  *
2703  * If @a use_pre_commit_hook is set, call the repository's pre-commit
2704  * hook before committing each loaded revision.
2705  *
2706  * If @a use_post_commit_hook is set, call the repository's
2707  * post-commit hook after committing each loaded revision.
2708  *
2709  * If @a validate_props is set, then validate Subversion revision and
2710  * node properties (those in the svn: namespace) against established
2711  * rules for those things.
2712  *
2713  * If non-NULL, use @a notify_func and @a notify_baton to send notification
2714  * of events to the caller.
2715  *
2716  * If @a cancel_func is not @c NULL, it is called periodically with
2717  * @a cancel_baton as argument to see if the client wishes to cancel
2718  * the load.
2719  *
2720  * @since New in 1.8.
2721  */
2722 svn_error_t *
2723 svn_repos_load_fs4(svn_repos_t *repos,
2724                    svn_stream_t *dumpstream,
2725                    svn_revnum_t start_rev,
2726                    svn_revnum_t end_rev,
2727                    enum svn_repos_load_uuid uuid_action,
2728                    const char *parent_dir,
2729                    svn_boolean_t use_pre_commit_hook,
2730                    svn_boolean_t use_post_commit_hook,
2731                    svn_boolean_t validate_props,
2732                    svn_repos_notify_func_t notify_func,
2733                    void *notify_baton,
2734                    svn_cancel_func_t cancel_func,
2735                    void *cancel_baton,
2736                    apr_pool_t *pool);
2737
2738 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
2739  * end_rev always passed as #SVN_INVALID_REVNUM.
2740  *
2741  * @since New in 1.7.
2742  * @deprecated Provided for backward compatibility with the 1.7 API.
2743  */
2744 SVN_DEPRECATED
2745 svn_error_t *
2746 svn_repos_load_fs3(svn_repos_t *repos,
2747                    svn_stream_t *dumpstream,
2748                    enum svn_repos_load_uuid uuid_action,
2749                    const char *parent_dir,
2750                    svn_boolean_t use_pre_commit_hook,
2751                    svn_boolean_t use_post_commit_hook,
2752                    svn_boolean_t validate_props,
2753                    svn_repos_notify_func_t notify_func,
2754                    void *notify_baton,
2755                    svn_cancel_func_t cancel_func,
2756                    void *cancel_baton,
2757                    apr_pool_t *pool);
2758
2759 /**
2760  * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
2761  * place of the #svn_repos_notify_func_t and baton and with
2762  * @a validate_props always FALSE.
2763  *
2764  * @since New in 1.2.
2765  * @deprecated Provided for backward compatibility with the 1.6 API.
2766  */
2767 SVN_DEPRECATED
2768 svn_error_t *
2769 svn_repos_load_fs2(svn_repos_t *repos,
2770                    svn_stream_t *dumpstream,
2771                    svn_stream_t *feedback_stream,
2772                    enum svn_repos_load_uuid uuid_action,
2773                    const char *parent_dir,
2774                    svn_boolean_t use_pre_commit_hook,
2775                    svn_boolean_t use_post_commit_hook,
2776                    svn_cancel_func_t cancel_func,
2777                    void *cancel_baton,
2778                    apr_pool_t *pool);
2779
2780 /**
2781  * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
2782  * @a use_post_commit_hook always @c FALSE.
2783  *
2784  * @deprecated Provided for backward compatibility with the 1.1 API.
2785  */
2786 SVN_DEPRECATED
2787 svn_error_t *
2788 svn_repos_load_fs(svn_repos_t *repos,
2789                   svn_stream_t *dumpstream,
2790                   svn_stream_t *feedback_stream,
2791                   enum svn_repos_load_uuid uuid_action,
2792                   const char *parent_dir,
2793                   svn_cancel_func_t cancel_func,
2794                   void *cancel_baton,
2795                   apr_pool_t *pool);
2796
2797
2798 /**
2799  * A vtable that is driven by svn_repos_parse_dumpstream3().
2800  *
2801  * @since New in 1.8.
2802  */
2803 typedef struct svn_repos_parse_fns3_t
2804 {
2805   /** The parser has discovered a new "magic header" record within the
2806    * parsing session represented by @a parse_baton.  The dump-format
2807    * version number is @a version.
2808    */
2809   svn_error_t *(*magic_header_record)(int version,
2810                                       void *parse_baton,
2811                                       apr_pool_t *pool);
2812
2813   /** The parser has discovered a new uuid record within the parsing
2814    * session represented by @a parse_baton.  The uuid's value is
2815    * @a uuid, and it is allocated in @a pool.
2816    */
2817   svn_error_t *(*uuid_record)(const char *uuid,
2818                               void *parse_baton,
2819                               apr_pool_t *pool);
2820
2821   /** The parser has discovered a new revision record within the
2822    * parsing session represented by @a parse_baton.  All the headers are
2823    * placed in @a headers (allocated in @a pool), which maps <tt>const
2824    * char *</tt> header-name ==> <tt>const char *</tt> header-value.
2825    * The @a revision_baton received back (also allocated in @a pool)
2826    * represents the revision.
2827    */
2828   svn_error_t *(*new_revision_record)(void **revision_baton,
2829                                       apr_hash_t *headers,
2830                                       void *parse_baton,
2831                                       apr_pool_t *pool);
2832
2833   /** The parser has discovered a new node record within the current
2834    * revision represented by @a revision_baton.  All the headers are
2835    * placed in @a headers (as with @c new_revision_record), allocated in
2836    * @a pool.  The @a node_baton received back is allocated in @a pool
2837    * and represents the node.
2838    */
2839   svn_error_t *(*new_node_record)(void **node_baton,
2840                                   apr_hash_t *headers,
2841                                   void *revision_baton,
2842                                   apr_pool_t *pool);
2843
2844   /** For a given @a revision_baton, set a property @a name to @a value. */
2845   svn_error_t *(*set_revision_property)(void *revision_baton,
2846                                         const char *name,
2847                                         const svn_string_t *value);
2848
2849   /** For a given @a node_baton, set a property @a name to @a value. */
2850   svn_error_t *(*set_node_property)(void *node_baton,
2851                                     const char *name,
2852                                     const svn_string_t *value);
2853
2854   /** For a given @a node_baton, delete property @a name. */
2855   svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
2856
2857   /** For a given @a node_baton, remove all properties. */
2858   svn_error_t *(*remove_node_props)(void *node_baton);
2859
2860   /** For a given @a node_baton, receive a writable @a stream capable of
2861    * receiving the node's fulltext.  After writing the fulltext, call
2862    * the stream's close() function.
2863    *
2864    * If a @c NULL is returned instead of a stream, the vtable is
2865    * indicating that no text is desired, and the parser will not
2866    * attempt to send it.
2867    */
2868   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2869                                void *node_baton);
2870
2871   /** For a given @a node_baton, set @a handler and @a handler_baton
2872    * to a window handler and baton capable of receiving a delta
2873    * against the node's previous contents.  A NULL window will be
2874    * sent to the handler after all the windows are sent.
2875    *
2876    * If a @c NULL is returned instead of a handler, the vtable is
2877    * indicating that no delta is desired, and the parser will not
2878    * attempt to send it.
2879    */
2880   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
2881                                   void **handler_baton,
2882                                   void *node_baton);
2883
2884   /** The parser has reached the end of the current node represented by
2885    * @a node_baton, it can be freed.
2886    */
2887   svn_error_t *(*close_node)(void *node_baton);
2888
2889   /** The parser has reached the end of the current revision
2890    * represented by @a revision_baton.  In other words, there are no more
2891    * changed nodes within the revision.  The baton can be freed.
2892    */
2893   svn_error_t *(*close_revision)(void *revision_baton);
2894
2895 } svn_repos_parse_fns3_t;
2896
2897
2898 /**
2899  * Read and parse dumpfile-formatted @a stream, calling callbacks in
2900  * @a parse_fns/@a parse_baton, and using @a pool for allocations.
2901  *
2902  * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
2903  * set_fulltext callback.  This is useful when manipulating a dump
2904  * stream without loading it.  Otherwise handle text-deltas with the
2905  * @a apply_textdelta callback.
2906  *
2907  * If @a cancel_func is not @c NULL, it is called periodically with
2908  * @a cancel_baton as argument to see if the client wishes to cancel
2909  * the dump.
2910  *
2911  * This parser has built-in knowledge of the dumpfile format, but only
2912  * in a limited sense:
2913  *
2914  *    * it recognizes the "magic" format-version header.
2915  *
2916  *    * it recognizes the UUID header.
2917  *
2918  *    * it recognizes revision and node records by looking for either
2919  *      a REVISION_NUMBER or NODE_PATH headers.
2920  *
2921  *    * it recognizes the CONTENT-LENGTH headers, so it knows if and
2922  *      how to suck up the content body.
2923  *
2924  *    * it knows how to parse a content body into two parts:  props
2925  *      and text, and pass the pieces to the vtable.
2926  *
2927  * This is enough knowledge to make it easy on vtable implementors,
2928  * but still allow expansion of the format: most headers do not have
2929  * to be handled explicitly.
2930  *
2931  * @since New in 1.8.
2932  */
2933 svn_error_t *
2934 svn_repos_parse_dumpstream3(svn_stream_t *stream,
2935                             const svn_repos_parse_fns3_t *parse_fns,
2936                             void *parse_baton,
2937                             svn_boolean_t deltas_are_text,
2938                             svn_cancel_func_t cancel_func,
2939                             void *cancel_baton,
2940                             apr_pool_t *pool);
2941
2942
2943 /**
2944  * Set @a *parser and @a *parse_baton to a vtable parser which commits new
2945  * revisions to the fs in @a repos.  The constructed parser will treat
2946  * UUID records in a manner consistent with @a uuid_action.  Use @a pool
2947  * to operate on the fs.
2948  *
2949  * @a start_rev and @a end_rev act as filters, the lower and upper
2950  * (inclusive) range values of revisions in @a dumpstream which will
2951  * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
2952  * which case no revision-based filtering occurs at all), or both are
2953  * valid revisions (where @a start_rev is older than or equivalent to
2954  * @a end_rev).
2955  *
2956  * If @a use_history is set, then the parser will require relative
2957  * 'copyfrom' history to exist in the repository when it encounters
2958  * nodes that are added-with-history.
2959  *
2960  * If @a validate_props is set, then validate Subversion revision and
2961  * node properties (those in the svn: namespace) against established
2962  * rules for those things.
2963  *
2964  * If @a parent_dir is not NULL, then the parser will reparent all the
2965  * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
2966  * must be an existing directory in the repository.
2967  *
2968  * @since New in 1.8.
2969  */
2970 svn_error_t *
2971 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
2972                                void **parse_baton,
2973                                svn_repos_t *repos,
2974                                svn_revnum_t start_rev,
2975                                svn_revnum_t end_rev,
2976                                svn_boolean_t use_history,
2977                                svn_boolean_t validate_props,
2978                                enum svn_repos_load_uuid uuid_action,
2979                                const char *parent_dir,
2980                                svn_repos_notify_func_t notify_func,
2981                                void *notify_baton,
2982                                apr_pool_t *pool);
2983
2984
2985 /**
2986  * A vtable that is driven by svn_repos_parse_dumpstream2().
2987  * Similar to #svn_repos_parse_fns3_t except that it lacks
2988  * the delete_node_property and apply_textdelta callbacks.
2989  *
2990  * @deprecated Provided for backward compatibility with the 1.7 API.
2991  */
2992 typedef struct svn_repos_parse_fns2_t
2993 {
2994   /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
2995   svn_error_t *(*new_revision_record)(void **revision_baton,
2996                                       apr_hash_t *headers,
2997                                       void *parse_baton,
2998                                       apr_pool_t *pool);
2999   /** Same as #svn_repos_parse_fns3_t.uuid_record. */
3000   svn_error_t *(*uuid_record)(const char *uuid,
3001                               void *parse_baton,
3002                               apr_pool_t *pool);
3003   /** Same as #svn_repos_parse_fns3_t.new_node_record. */
3004   svn_error_t *(*new_node_record)(void **node_baton,
3005                                   apr_hash_t *headers,
3006                                   void *revision_baton,
3007                                   apr_pool_t *pool);
3008   /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
3009   svn_error_t *(*set_revision_property)(void *revision_baton,
3010                                         const char *name,
3011                                         const svn_string_t *value);
3012   /** Same as #svn_repos_parse_fns3_t.set_node_property. */
3013   svn_error_t *(*set_node_property)(void *node_baton,
3014                                     const char *name,
3015                                     const svn_string_t *value);
3016   /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
3017   svn_error_t *(*delete_node_property)(void *node_baton,
3018                                        const char *name);
3019   /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
3020   svn_error_t *(*remove_node_props)(void *node_baton);
3021   /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
3022   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3023                                void *node_baton);
3024   /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
3025   svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3026                                   void **handler_baton,
3027                                   void *node_baton);
3028   /** Same as #svn_repos_parse_fns3_t.close_node. */
3029   svn_error_t *(*close_node)(void *node_baton);
3030   /** Same as #svn_repos_parse_fns3_t.close_revision. */
3031   svn_error_t *(*close_revision)(void *revision_baton);
3032 } svn_repos_parse_fns2_t;
3033
3034 /** @deprecated Provided for backward compatibility with the 1.7 API. */
3035 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
3036
3037
3038 /**
3039  * A vtable that is driven by svn_repos_parse_dumpstream().
3040  * Similar to #svn_repos_parse_fns2_t except that it lacks
3041  * the delete_node_property and apply_textdelta callbacks.
3042  *
3043  * @deprecated Provided for backward compatibility with the 1.0 API.
3044  */
3045 typedef struct svn_repos_parse_fns_t
3046 {
3047   /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
3048   svn_error_t *(*new_revision_record)(void **revision_baton,
3049                                       apr_hash_t *headers,
3050                                       void *parse_baton,
3051                                       apr_pool_t *pool);
3052   /** Same as #svn_repos_parse_fns2_t.uuid_record. */
3053   svn_error_t *(*uuid_record)(const char *uuid,
3054                               void *parse_baton,
3055                               apr_pool_t *pool);
3056   /** Same as #svn_repos_parse_fns2_t.new_node_record. */
3057   svn_error_t *(*new_node_record)(void **node_baton,
3058                                   apr_hash_t *headers,
3059                                   void *revision_baton,
3060                                   apr_pool_t *pool);
3061   /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
3062   svn_error_t *(*set_revision_property)(void *revision_baton,
3063                                         const char *name,
3064                                         const svn_string_t *value);
3065   /** Same as #svn_repos_parse_fns2_t.set_node_property. */
3066   svn_error_t *(*set_node_property)(void *node_baton,
3067                                     const char *name,
3068                                     const svn_string_t *value);
3069   /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
3070   svn_error_t *(*remove_node_props)(void *node_baton);
3071   /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
3072   svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3073                                void *node_baton);
3074   /** Same as #svn_repos_parse_fns2_t.close_node. */
3075   svn_error_t *(*close_node)(void *node_baton);
3076   /** Same as #svn_repos_parse_fns2_t.close_revision. */
3077   svn_error_t *(*close_revision)(void *revision_baton);
3078 } svn_repos_parser_fns_t;
3079
3080
3081 /**
3082  * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
3083  * #svn_repos_parser_fns2_t vtable type.
3084  *
3085  * @deprecated Provided for backward compatibility with the 1.7 API.
3086  */
3087 SVN_DEPRECATED
3088 svn_error_t *
3089 svn_repos_parse_dumpstream2(svn_stream_t *stream,
3090                             const svn_repos_parser_fns2_t *parse_fns,
3091                             void *parse_baton,
3092                             svn_cancel_func_t cancel_func,
3093                             void *cancel_baton,
3094                             apr_pool_t *pool);
3095
3096 /**
3097  * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
3098  * #svn_repos_parser_fns_t vtable type.
3099  *
3100  * @deprecated Provided for backward compatibility with the 1.0 API.
3101  */
3102 SVN_DEPRECATED
3103 svn_error_t *
3104 svn_repos_parse_dumpstream(svn_stream_t *stream,
3105                            const svn_repos_parser_fns_t *parse_fns,
3106                            void *parse_baton,
3107                            svn_cancel_func_t cancel_func,
3108                            void *cancel_baton,
3109                            apr_pool_t *pool);
3110
3111 /**
3112  * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
3113  * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
3114  * the more limited svn_repos_parse_fns2_t.
3115  *
3116  * @since New in 1.7.
3117  * @deprecated Provided for backward compatibility with the 1.7 API.
3118  */
3119 SVN_DEPRECATED
3120 svn_error_t *
3121 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
3122                                void **parse_baton,
3123                                svn_repos_t *repos,
3124                                svn_boolean_t use_history,
3125                                svn_boolean_t validate_props,
3126                                enum svn_repos_load_uuid uuid_action,
3127                                const char *parent_dir,
3128                                svn_repos_notify_func_t notify_func,
3129                                void *notify_baton,
3130                                apr_pool_t *pool);
3131
3132 /**
3133  * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
3134  * in place if a #svn_repos_notify_func_t and baton and with
3135  * @a validate_props always FALSE.
3136  *
3137  * @since New in 1.1.
3138  * @deprecated Provided for backward compatibility with the 1.6 API.
3139  */
3140 SVN_DEPRECATED
3141 svn_error_t *
3142 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
3143                                void **parse_baton,
3144                                svn_repos_t *repos,
3145                                svn_boolean_t use_history,
3146                                enum svn_repos_load_uuid uuid_action,
3147                                svn_stream_t *outstream,
3148                                const char *parent_dir,
3149                                apr_pool_t *pool);
3150
3151 /**
3152  * Similar to svn_repos_get_fs_build_parser2(), but yields the more
3153  * limited svn_repos_parser_fns_t vtable type.
3154  *
3155  * @deprecated Provided for backward compatibility with the 1.0 API.
3156  */
3157 SVN_DEPRECATED
3158 svn_error_t *
3159 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
3160                               void **parse_baton,
3161                               svn_repos_t *repos,
3162                               svn_boolean_t use_history,
3163                               enum svn_repos_load_uuid uuid_action,
3164                               svn_stream_t *outstream,
3165                               const char *parent_dir,
3166                               apr_pool_t *pool);
3167
3168
3169 /** @} */
3170
3171 /** A data type which stores the authz information.
3172  *
3173  * @since New in 1.3.
3174  */
3175 typedef struct svn_authz_t svn_authz_t;
3176
3177 /**
3178  * Read authz configuration data from @a path (a dirent, an absolute file url
3179  * or a registry path) into @a *authz_p, allocated in @a pool.
3180  *
3181  * If @a groups_path (a dirent, an absolute file url, or a registry path) is
3182  * set, use the global groups parsed from it.
3183  *
3184  * If @a path or @a groups_path is not a valid authz rule file, then return
3185  * #SVN_ERR_AUTHZ_INVALID_CONFIG.  The contents of @a *authz_p is then
3186  * undefined.  If @a must_exist is TRUE, a missing authz or groups file
3187  * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
3188  * depends on the access type).
3189  *
3190  * @since New in 1.8.
3191  */
3192 svn_error_t *
3193 svn_repos_authz_read2(svn_authz_t **authz_p,
3194                       const char *path,
3195                       const char *groups_path,
3196                       svn_boolean_t must_exist,
3197                       apr_pool_t *pool);
3198
3199
3200 /**
3201  * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
3202  * repos_root always passed as @c NULL.
3203  *
3204  * @since New in 1.3.
3205  * @deprecated Provided for backward compatibility with the 1.7 API.
3206  */
3207 SVN_DEPRECATED
3208 svn_error_t *
3209 svn_repos_authz_read(svn_authz_t **authz_p,
3210                      const char *file,
3211                      svn_boolean_t must_exist,
3212                      apr_pool_t *pool);
3213
3214 /**
3215  * Read authz configuration data from @a stream into @a *authz_p,
3216  * allocated in @a pool.
3217  *
3218  * If @a groups_stream is set, use the global groups parsed from it.
3219  *
3220  * @since New in 1.8.
3221  */
3222 svn_error_t *
3223 svn_repos_authz_parse(svn_authz_t **authz_p,
3224                       svn_stream_t *stream,
3225                       svn_stream_t *groups_stream,
3226                       apr_pool_t *pool);
3227
3228 /**
3229  * Check whether @a user can access @a path in the repository @a
3230  * repos_name with the @a required_access.  @a authz lists the ACLs to
3231  * check against.  Set @a *access_granted to indicate if the requested
3232  * access is granted.
3233  *
3234  * If @a path is NULL, then check whether @a user has the @a
3235  * required_access anywhere in the repository.  Set @a *access_granted
3236  * to TRUE if at least one path is accessible with the @a
3237  * required_access.
3238  *
3239  * For compatibility with 1.6, and earlier, @a repos_name can be NULL
3240  * in which case it is equivalent to a @a repos_name of "".
3241  *
3242  * @note Presently, @a repos_name must byte-for-byte match the repos_name
3243  * specified in the authz file; it is treated as an opaque string, and not
3244  * as a dirent.
3245  *
3246  * @since New in 1.3.
3247  */
3248 svn_error_t *
3249 svn_repos_authz_check_access(svn_authz_t *authz,
3250                              const char *repos_name,
3251                              const char *path,
3252                              const char *user,
3253                              svn_repos_authz_access_t required_access,
3254                              svn_boolean_t *access_granted,
3255                              apr_pool_t *pool);
3256
3257
3258 \f
3259 /** Revision Access Levels
3260  *
3261  * Like most version control systems, access to versioned objects in
3262  * Subversion is determined on primarily path-based system.  Users either
3263  * do or don't have the ability to read a given path.
3264  *
3265  * However, unlike many version control systems where versioned objects
3266  * maintain their own distinct version information (revision numbers,
3267  * authors, log messages, change timestamps, etc.), Subversion binds
3268  * multiple paths changed as part of a single commit operation into a
3269  * set, calls the whole thing a revision, and hangs commit metadata
3270  * (author, date, log message, etc.) off of that revision.  So, commit
3271  * metadata is shared across all the paths changed as part of a given
3272  * commit operation.
3273  *
3274  * It is common (or, at least, we hope it is) for log messages to give
3275  * detailed information about changes made in the commit to which the log
3276  * message is attached.  Such information might include a mention of all
3277  * the files changed, what was changed in them, and so on.  But this
3278  * causes a problem when presenting information to readers who aren't
3279  * authorized to read every path in the repository.  Simply knowing that
3280  * a given path exists may be a security leak, even if the user can't see
3281  * the contents of the data located at that path.
3282  *
3283  * So Subversion does what it reasonably can to prevent the leak of this
3284  * information, and does so via a staged revision access policy.  A
3285  * reader can be said to have one of three levels of access to a given
3286  * revision's metadata, based solely on the reader's access rights to the
3287  * paths changed or copied in that revision:
3288  *
3289  *   'full access' -- Granted when the reader has access to all paths
3290  *      changed or copied in the revision, or when no paths were
3291  *      changed in the revision at all, this access level permits
3292  *      full visibility of all revision property names and values,
3293  *      and the full changed-paths information.
3294  *
3295  *   'no access' -- Granted when the reader does not have access to any
3296  *      paths changed or copied in the revision, this access level
3297  *      denies the reader access to all revision properties and all
3298  *      changed-paths information.
3299  *
3300  *   'partial access' -- Granted when the reader has access to at least
3301  *      one, but not all, of the paths changed or copied in the revision,
3302  *      this access level permits visibility of the svn:date and
3303  *      svn:author revision properties and only the paths of the
3304  *      changed-paths information to which the reader has access.
3305  *
3306  */
3307
3308
3309 /** An enum defining levels of revision access.
3310  *
3311  * @since New in 1.5.
3312  */
3313 typedef enum svn_repos_revision_access_level_t
3314 {
3315   /** no access allowed to the revision properties and all changed-paths
3316    * information. */ 
3317   svn_repos_revision_access_none,
3318   /** access granted to some (svn:date and svn:author) revision properties and
3319    * changed-paths information on paths the read has access to. */
3320   svn_repos_revision_access_partial,
3321   /** access granted to all revision properites and changed-paths
3322    * information. */
3323   svn_repos_revision_access_full
3324 }
3325 svn_repos_revision_access_level_t;
3326
3327
3328 /**
3329  * Set @a access to the access level granted for @a revision in @a
3330  * repos, as determined by consulting the @a authz_read_func callback
3331  * function and its associated @a authz_read_baton.
3332  *
3333  * @a authz_read_func may be @c NULL, in which case @a access will be
3334  * set to #svn_repos_revision_access_full.
3335  *
3336  * @since New in 1.5.
3337  */
3338 svn_error_t *
3339 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
3340                                 svn_repos_t *repos,
3341                                 svn_revnum_t revision,
3342                                 svn_repos_authz_func_t authz_read_func,
3343                                 void *authz_read_baton,
3344                                 apr_pool_t *pool);
3345
3346 /**
3347  * Set @a *inherited_values to a depth-first ordered array of
3348  * #svn_prop_inherited_item_t * structures (the path_or_url members of
3349  * which are relative filesystem paths) representing the properties
3350  * inherited by @a path in @a root.  If no properties are inherited,
3351  * then set @a *inherited_values to an empty array.
3352  *
3353  * if @a propname is NULL then retrieve all explicit and/or inherited
3354  * properties.  Otherwise retrieve only the properties named @a propname.
3355  *
3356  * If optional @a authz_read_func is non-NULL, then use this function
3357  * (along with optional @a authz_read_baton) to check the readability
3358  * of each parent path from which properties are inherited. Silently omit
3359  * properties for unreadable parent paths.
3360  *
3361  * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool for
3362  * temporary allocations.
3363  *
3364  * @since New in 1.8.
3365  */
3366 svn_error_t *
3367 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
3368                                  svn_fs_root_t *root,
3369                                  const char *path,
3370                                  const char *propname,
3371                                  svn_repos_authz_func_t authz_read_func,
3372                                  void *authz_read_baton,
3373                                  apr_pool_t *result_pool,
3374                                  apr_pool_t *scratch_pool);
3375
3376 \f
3377 /** Capabilities **/
3378
3379 /**
3380  * Store in @a repos the client-reported capabilities @a capabilities,
3381  * which must be allocated in memory at least as long-lived as @a repos.
3382  *
3383  * The elements of @a capabilities are 'const char *', a subset of
3384  * the constants beginning with @c SVN_RA_CAPABILITY_.
3385  * @a capabilities is not copied, so changing it later will affect
3386  * what is remembered by @a repos.
3387  *
3388  * @note The capabilities are passed along to the start-commit hook;
3389  * see that hook's template for details.
3390  *
3391  * @note As of Subversion 1.5, there are no error conditions defined,
3392  * so this always returns SVN_NO_ERROR.  In future releases it may
3393  * return error, however, so callers should check.
3394  *
3395  * @since New in 1.5.
3396  */
3397 svn_error_t *
3398 svn_repos_remember_client_capabilities(svn_repos_t *repos,
3399                                        const apr_array_header_t *capabilities);
3400
3401
3402 #ifdef __cplusplus
3403 }
3404 #endif /* __cplusplus */
3405
3406 #endif /* SVN_REPOS_H */