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