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