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
12 * http://www.apache.org/licenses/LICENSE-2.0
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
20 * ====================================================================
24 * @brief Tools built on top of the filesystem.
30 #include <apr_pools.h>
32 #include <apr_tables.h>
35 #include "svn_types.h"
36 #include "svn_string.h"
37 #include "svn_delta.h"
40 #include "svn_mergeinfo.h"
45 #endif /* __cplusplus */
47 /* ---------------------------------------------------------------*/
50 * Get libsvn_repos version information.
55 svn_repos_version(void);
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. */
63 svn_node_action_change,
65 svn_node_action_delete,
66 svn_node_action_replace
70 /** @defgroup svn_repos_authz_callbacks Repository authorization callbacks
74 /** Callback type for checking authorization on a path.
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).
80 * Do not assume @a pool has any lifetime beyond this call.
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.
90 * @note If someday we want more sophisticated authorization states
91 * than just yes/no, @a allowed can become an enum type.
93 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
100 /** An enum defining the kinds of access authz looks up.
104 typedef enum svn_repos_authz_access_t
109 /** Path can be read. */
112 /** Path can be altered. */
115 /** The other access credentials are recursive. */
116 svn_authz_recursive = 4
117 } svn_repos_authz_access_t;
120 /** Callback type for checking authorization on paths produced by
121 * the repository commit editor.
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).
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.
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.
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.
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.
154 typedef svn_error_t *(*svn_repos_authz_callback_t)
155 (svn_repos_authz_access_t required,
156 svn_boolean_t *allowed,
165 /** @defgroup svn_repos_notifications Repository notifications
169 /* Notification system. */
171 /** The type of action occurring.
175 typedef enum svn_repos_notify_action_t
177 /** A warning message is waiting. */
178 svn_repos_notify_warning = 0,
180 /** A revision has finished being dumped. */
181 svn_repos_notify_dump_rev_end,
183 /** A revision has finished being verified. */
184 svn_repos_notify_verify_rev_end,
186 /** All revisions have finished being dumped. */
187 svn_repos_notify_dump_end,
189 /** All revisions have finished being verified. */
190 svn_repos_notify_verify_end,
192 /** packing of an FSFS shard has commenced */
193 svn_repos_notify_pack_shard_start,
195 /** packing of an FSFS shard is completed */
196 svn_repos_notify_pack_shard_end,
198 /** packing of the shard revprops has commenced */
199 svn_repos_notify_pack_shard_start_revprop,
201 /** packing of the shard revprops has completed */
202 svn_repos_notify_pack_shard_end_revprop,
204 /** A revision has begun loading */
205 svn_repos_notify_load_txn_start,
207 /** A revision has finished loading */
208 svn_repos_notify_load_txn_committed,
210 /** A node has begun loading */
211 svn_repos_notify_load_node_start,
213 /** A node has finished loading */
214 svn_repos_notify_load_node_done,
216 /** A copied node has been encountered */
217 svn_repos_notify_load_copied_node,
219 /** Mergeinfo has been normalized */
220 svn_repos_notify_load_normalized_mergeinfo,
222 /** The operation has acquired a mutex for the repo. */
223 svn_repos_notify_mutex_acquired,
225 /** Recover has started. */
226 svn_repos_notify_recover_start,
228 /** Upgrade has started. */
229 svn_repos_notify_upgrade_start,
231 /** A revision was skipped during loading. @since New in 1.8. */
232 svn_repos_notify_load_skipped_rev,
234 /** The structure of a revision is being verified. @since New in 1.8. */
235 svn_repos_notify_verify_rev_structure,
237 /** A revprop shard got packed. @since New in 1.9. */
238 svn_repos_notify_pack_revprops,
240 /** A non-packed revprop shard got removed. @since New in 1.9. */
241 svn_repos_notify_cleanup_revprops,
243 /** The repository format got bumped. @since New in 1.9. */
244 svn_repos_notify_format_bumped,
246 /** A revision range was copied. @since New in 1.9. */
247 svn_repos_notify_hotcopy_rev_range,
249 /** The repository pack did not do anything. @since New in 1.10. */
250 svn_repos_notify_pack_noop,
252 /** The revision properties got set. @since New in 1.10. */
253 svn_repos_notify_load_revprop_set
254 } svn_repos_notify_action_t;
256 /** The type of warning occurring.
260 typedef enum svn_repos_notify_warning_t
262 /** Referencing copy source data from a revision earlier than the
263 * first revision dumped. */
264 svn_repos_notify_warning_found_old_reference,
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,
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,
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.
283 svn_repos_notify_warning_name_collision,
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.
293 svn_repos_notify_warning_mergeinfo_collision,
296 * Detected invalid mergeinfo.
300 svn_repos_notify_warning_invalid_mergeinfo
301 } svn_repos_notify_warning_t;
304 * Structure used by #svn_repos_notify_func_t.
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.)
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.
315 typedef struct svn_repos_notify_t
317 /** Action that describes what happened in the repository. */
318 svn_repos_notify_action_t action;
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;
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;
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. */
338 /** For #svn_repos_notify_load_txn_committed, the revision committed. */
339 svn_revnum_t new_revision;
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;
347 /** For #svn_repos_notify_load_node_start, the action being taken on the
349 enum svn_node_action node_action;
351 /** For #svn_repos_notify_load_node_start, the path of the node. */
354 /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied
356 @since New in 1.9. */
357 svn_revnum_t start_revision;
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;
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;
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.
373 * @since New in 1.7. */
374 typedef void (*svn_repos_notify_func_t)(void *baton,
375 const svn_repos_notify_t *notify,
376 apr_pool_t *scratch_pool);
378 /** Callback for filtering repository contents during dump.
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).
385 * Do not assume @a scratch_pool has any lifetime beyond this call.
387 * @since New in 1.10.
389 typedef svn_error_t * (*svn_repos_dump_filter_func_t)(
390 svn_boolean_t *include,
394 apr_pool_t *scratch_pool);
397 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
403 svn_repos_notify_create(svn_repos_notify_action_t action,
404 apr_pool_t *result_pool);
409 /** The repository object. */
410 typedef struct svn_repos_t svn_repos_t;
412 /* Opening and creating repositories. */
415 /** Find the root path of the repository that contains @a path.
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
422 svn_repos_find_root_path(const char *path,
425 /** Set @a *repos_p to a repository object for the repository at @a path.
427 * Allocate @a *repos_p in @a result_pool.
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.
435 * Use @a scratch_pool for temporary allocations.
440 svn_repos_open3(svn_repos_t **repos_p,
442 apr_hash_t *fs_config,
443 apr_pool_t *result_pool,
444 apr_pool_t *scratch_pool);
446 /** Similar to svn_repos_open3() but without @a scratch_pool.
448 * @deprecated Provided for backward compatibility with 1.8 API.
453 svn_repos_open2(svn_repos_t **repos_p,
455 apr_hash_t *fs_config,
458 /** Similar to svn_repos_open2() with @a fs_config set to NULL.
460 * @deprecated Provided for backward compatibility with 1.6 API.
464 svn_repos_open(svn_repos_t **repos_p,
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.
472 * @a config is a client configuration hash of #svn_config_t * items
473 * keyed on config category names, and may be NULL.
475 * @a fs_config is passed to the filesystem, and may be NULL.
477 * @a unused_1 and @a unused_2 are not used and should be NULL.
480 svn_repos_create(svn_repos_t **repos_p,
482 const char *unused_1,
483 const char *unused_2,
485 apr_hash_t *fs_config,
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.
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.
501 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
502 * returned if the lock is not immediately available.
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.
508 * Use @a pool for necessary allocations.
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.
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.
526 svn_repos_upgrade2(const char *path,
527 svn_boolean_t nonblocking,
528 svn_repos_notify_func_t notify_func,
533 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
534 * rather than a notify_callback / baton
537 * @deprecated Provided for backward compatibility with the 1.6 API.
541 svn_repos_upgrade(const char *path,
542 svn_boolean_t nonblocking,
543 svn_error_t *(*start_callback)(void *baton),
544 void *start_callback_baton,
547 /** Destroy the Subversion repository found at @a path, using @a pool for any
548 * necessary allocations.
551 svn_repos_delete(const char *path,
555 /** @defgroup svn_repos_capabilities Repository capabilities
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
564 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
565 * with the effect on @a *has undefined.
567 * Use @a pool for all allocation.
572 svn_repos_has_capability(svn_repos_t *repos,
574 const char *capability,
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.)
583 * The set is represented as a hash whose const char * keys are the set
584 * members. The values are not defined.
586 * Allocate @a capabilities in @a result_pool and use @a scratch_pool for
587 * temporary allocations.
589 * @see svn_repos_info_format
594 svn_repos_capabilities(apr_hash_t **capabilities,
596 apr_pool_t *result_pool,
597 apr_pool_t *scratch_pool);
600 * The capability of doing the right thing with merge-tracking
601 * information, both storing it and responding to queries about it.
605 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
606 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
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.
614 * If you add a capability, update svn_repos_capabilities().
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.
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.
629 * @note The capabilities are passed along to the start-commit hook;
630 * see that hook's template for details.
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.
639 svn_repos_remember_client_capabilities(svn_repos_t *repos,
640 const apr_array_header_t *capabilities);
643 /** Return the filesystem associated with repository object @a repos. */
645 svn_repos_fs(svn_repos_t *repos);
647 /** Return the type of filesystem associated with repository object
648 * @a repos allocated in @a result_pool.
650 * @see #svn_fs_backend_names
655 svn_repos_fs_type(svn_repos_t *repos,
656 apr_pool_t *result_pool);
658 /** Make a hot copy of the Subversion repository found at @a src_path
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
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.
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.
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
683 * Use @a scratch_pool for temporary allocations.
688 svn_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,
694 svn_cancel_func_t cancel_func,
696 apr_pool_t *scratch_pool);
699 * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton
700 * always passed as @c NULL.
703 * @deprecated Provided for backward compatibility with the 1.8 API.
707 svn_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,
716 * Like svn_repos_hotcopy2(), but with @a incremental always passed as
717 * @c FALSE and without cancellation support.
719 * @deprecated Provided for backward compatibility with the 1.6 API.
723 svn_repos_hotcopy(const char *src_path,
724 const char *dst_path,
725 svn_boolean_t clean_logs,
730 * Possibly update the repository, @a repos, to use a more efficient
731 * filesystem representation. Use @a pool for allocations.
736 svn_repos_fs_pack2(svn_repos_t *repos,
737 svn_repos_notify_func_t notify_func,
739 svn_cancel_func_t cancel_func,
744 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
745 * of a #svn_repos_notify_t.
748 * @deprecated Provided for backward compatibility with the 1.6 API.
752 svn_repos_fs_pack(svn_repos_t *repos,
753 svn_fs_pack_notify_t notify_func,
755 svn_cancel_func_t cancel_func,
760 * Run database recovery procedures on the repository at @a path,
761 * returning the database to a consistent state. Use @a pool for all
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.
768 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
769 * returned if the lock is not immediately available.
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.
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
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.
787 svn_repos_recover4(const char *path,
788 svn_boolean_t nonblocking,
789 svn_repos_notify_func_t notify_func,
791 svn_cancel_func_t cancel_func,
796 * Similar to svn_repos_recover4(), but with @a start callback in place of
797 * the notify_func / baton.
800 * @deprecated Provided for backward compatibility with the 1.6 API.
804 svn_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,
813 * Similar to svn_repos_recover3(), but without cancellation support.
815 * @deprecated Provided for backward compatibility with the 1.4 API.
819 svn_repos_recover2(const char *path,
820 svn_boolean_t nonblocking,
821 svn_error_t *(*start_callback)(void *baton),
822 void *start_callback_baton,
826 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
827 * with no callbacks provided.
829 * @deprecated Provided for backward compatibility with the 1.0 API.
833 svn_repos_recover(const char *path,
837 * Callback for svn_repos_freeze.
841 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
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.
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.
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.
864 svn_repos_freeze(apr_array_header_t *paths,
865 svn_repos_freeze_func_t freeze_func,
869 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
870 * returning log file paths relative to the root of the repository.
872 * @copydoc svn_fs_berkeley_logfiles()
875 svn_repos_db_logfiles(apr_array_header_t **logfiles,
877 svn_boolean_t only_unused,
882 /* Repository Paths */
884 /** Return the top-level repository path allocated in @a pool. */
886 svn_repos_path(svn_repos_t *repos,
889 /** Return the path to @a repos's filesystem directory, allocated in
893 svn_repos_db_env(svn_repos_t *repos,
896 /** Return path to @a repos's config directory, allocated in @a pool. */
898 svn_repos_conf_dir(svn_repos_t *repos,
901 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
903 svn_repos_svnserve_conf(svn_repos_t *repos,
906 /** Return path to @a repos's lock directory, allocated in @a pool. */
908 svn_repos_lock_dir(svn_repos_t *repos,
911 /** Return path to @a repos's db lockfile, allocated in @a pool. */
913 svn_repos_db_lockfile(svn_repos_t *repos,
916 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
918 svn_repos_db_logs_lockfile(svn_repos_t *repos,
921 /** Return the path to @a repos's hook directory, allocated in @a pool. */
923 svn_repos_hook_dir(svn_repos_t *repos,
926 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
928 svn_repos_start_commit_hook(svn_repos_t *repos,
931 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
933 svn_repos_pre_commit_hook(svn_repos_t *repos,
936 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
938 svn_repos_post_commit_hook(svn_repos_t *repos,
941 /** Return the path to @a repos's pre-revprop-change hook, allocated in
945 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
948 /** Return the path to @a repos's post-revprop-change hook, allocated in
952 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
956 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
958 * @since New in 1.2. */
960 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
962 svn_repos_pre_lock_hook(svn_repos_t *repos,
965 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
967 svn_repos_post_lock_hook(svn_repos_t *repos,
970 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
972 svn_repos_pre_unlock_hook(svn_repos_t *repos,
975 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
977 svn_repos_post_unlock_hook(svn_repos_t *repos,
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.
988 * Use @a scratch_pool for temporary allocations.
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.
997 svn_repos_hooks_setenv(svn_repos_t *repos,
998 const char *hooks_env_path,
999 apr_pool_t *scratch_pool);
1003 /* ---------------------------------------------------------------*/
1005 /* Reporting the state of a working copy, for updates. */
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.
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.
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.
1031 * @a text_deltas instructs the driver of the @a editor to enable
1032 * the generation of text deltas.
1034 * @a ignore_ancestry instructs the driver to ignore node ancestry
1035 * when determining how to transmit differences.
1037 * @a send_copyfrom_args instructs the driver to send 'copyfrom'
1038 * arguments to the editor's add_file() and add_directory() methods,
1039 * whenever it deems feasible.
1041 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
1042 * avoid sending data through @a editor/@a edit_baton which is not
1043 * authorized for transmission.
1045 * @a zero_copy_limit controls the maximum size (in bytes) at which
1046 * data blocks may be sent using the zero-copy code path. On that
1047 * path, a number of in-memory copy operations have been eliminated to
1048 * maximize throughput. However, until the whole block has been
1049 * pushed to the network stack, other clients block, so be careful
1050 * when using larger values here. Pass 0 for @a zero_copy_limit to
1051 * disable this optimization altogether.
1053 * @note Never activate this optimization if @a editor might access
1054 * any FSFS data structures (and, hence, caches). So, it is basically
1055 * safe for networked editors only.
1057 * All allocation for the context and collected state will occur in
1060 * @a depth is the requested depth of the editor drive.
1062 * If @a depth is #svn_depth_unknown, the editor will affect only the
1063 * paths reported by the individual calls to svn_repos_set_path3() and
1064 * svn_repos_link_path3().
1066 * For example, if the reported tree is the @c A subdir of the Greek Tree
1067 * (see Subversion's test suite), at depth #svn_depth_empty, but the
1068 * @c A/B subdir is reported at depth #svn_depth_infinity, then
1069 * repository-side changes to @c A/mu, or underneath @c A/C and @c
1070 * A/D, would not be reflected in the editor drive, but changes
1071 * underneath @c A/B would be.
1073 * Additionally, the editor driver will call @c add_directory and
1074 * and @c add_file for directories with an appropriate depth. For
1075 * example, a directory reported at #svn_depth_files will receive
1076 * file (but not directory) additions. A directory at #svn_depth_empty
1077 * will receive neither.
1079 * If @a depth is #svn_depth_files, #svn_depth_immediates or
1080 * #svn_depth_infinity and @a depth is greater than the reported depth
1081 * of the working copy, then the editor driver will emit editor
1082 * operations so as to upgrade the working copy to this depth.
1084 * If @a depth is #svn_depth_empty, #svn_depth_files,
1085 * #svn_depth_immediates and @a depth is lower
1086 * than or equal to the depth of the working copy, then the editor
1087 * operations will affect only paths at or above @a depth.
1089 * @since New in 1.8.
1092 svn_repos_begin_report3(void **report_baton,
1093 svn_revnum_t revnum,
1095 const char *fs_base,
1097 const char *tgt_path,
1098 svn_boolean_t text_deltas,
1100 svn_boolean_t ignore_ancestry,
1101 svn_boolean_t send_copyfrom_args,
1102 const svn_delta_editor_t *editor,
1104 svn_repos_authz_func_t authz_read_func,
1105 void *authz_read_baton,
1106 apr_size_t zero_copy_limit,
1110 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
1111 * always passed as 0.
1113 * @since New in 1.5.
1114 * @deprecated Provided for backward compatibility with the 1.7 API.
1118 svn_repos_begin_report2(void **report_baton,
1119 svn_revnum_t revnum,
1121 const char *fs_base,
1123 const char *tgt_path,
1124 svn_boolean_t text_deltas,
1126 svn_boolean_t ignore_ancestry,
1127 svn_boolean_t send_copyfrom_args,
1128 const svn_delta_editor_t *editor,
1130 svn_repos_authz_func_t authz_read_func,
1131 void *authz_read_baton,
1135 * The same as svn_repos_begin_report2(), but taking a boolean
1136 * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
1138 * If @a recurse is TRUE, the editor driver will drive the editor with
1139 * a depth of #svn_depth_infinity; if FALSE, then with a depth of
1142 * @note @a username is ignored, and has been removed in a revised
1143 * version of this API.
1145 * @deprecated Provided for backward compatibility with the 1.4 API.
1149 svn_repos_begin_report(void **report_baton,
1150 svn_revnum_t revnum,
1151 const char *username,
1153 const char *fs_base,
1155 const char *tgt_path,
1156 svn_boolean_t text_deltas,
1157 svn_boolean_t recurse,
1158 svn_boolean_t ignore_ancestry,
1159 const svn_delta_editor_t *editor,
1161 svn_repos_authz_func_t authz_read_func,
1162 void *authz_read_baton,
1167 * Given a @a report_baton constructed by svn_repos_begin_report3(),
1168 * record the presence of @a path, at @a revision with depth @a depth,
1169 * in the current tree.
1171 * @a path is relative to the anchor/target used in the creation of the
1174 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
1175 * represents a locally-added path with no revision number, or @a
1176 * depth is #svn_depth_exclude.
1178 * @a path may not be underneath a path on which svn_repos_set_path3()
1179 * was previously called with #svn_depth_exclude in this report.
1181 * The first call of this in a given report usually passes an empty
1182 * @a path; this is used to set up the correct root revision for the editor
1185 * A depth of #svn_depth_unknown is not allowed, and results in an
1188 * If @a start_empty is TRUE and @a path is a directory, then require the
1189 * caller to explicitly provide all the children of @a path - do not assume
1190 * that the tree also contains all the children of @a path at @a revision.
1191 * This is for 'low confidence' client reporting.
1193 * If the caller has a lock token for @a path, then @a lock_token should
1194 * be set to that token. Else, @a lock_token should be NULL.
1196 * All temporary allocations are done in @a pool.
1198 * @since New in 1.5.
1201 svn_repos_set_path3(void *report_baton,
1203 svn_revnum_t revision,
1205 svn_boolean_t start_empty,
1206 const char *lock_token,
1210 * Similar to svn_repos_set_path3(), but with @a depth set to
1211 * #svn_depth_infinity.
1213 * @deprecated Provided for backward compatibility with the 1.4 API.
1217 svn_repos_set_path2(void *report_baton,
1219 svn_revnum_t revision,
1220 svn_boolean_t start_empty,
1221 const char *lock_token,
1225 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
1227 * @deprecated Provided for backward compatibility with the 1.1 API.
1231 svn_repos_set_path(void *report_baton,
1233 svn_revnum_t revision,
1234 svn_boolean_t start_empty,
1238 * Given a @a report_baton constructed by svn_repos_begin_report3(),
1239 * record the presence of @a path in the current tree, containing the contents
1240 * of @a link_path at @a revision with depth @a depth.
1242 * A depth of #svn_depth_unknown is not allowed, and results in an
1245 * @a path may not be underneath a path on which svn_repos_set_path3()
1246 * was previously called with #svn_depth_exclude in this report.
1248 * Note that while @a path is relative to the anchor/target used in the
1249 * creation of the @a report_baton, @a link_path is an absolute filesystem
1252 * If @a start_empty is TRUE and @a path is a directory, then require the
1253 * caller to explicitly provide all the children of @a path - do not assume
1254 * that the tree also contains all the children of @a link_path at
1255 * @a revision. This is for 'low confidence' client reporting.
1257 * If the caller has a lock token for @a link_path, then @a lock_token
1258 * should be set to that token. Else, @a lock_token should be NULL.
1260 * All temporary allocations are done in @a pool.
1262 * @since New in 1.5.
1265 svn_repos_link_path3(void *report_baton,
1267 const char *link_path,
1268 svn_revnum_t revision,
1270 svn_boolean_t start_empty,
1271 const char *lock_token,
1275 * Similar to svn_repos_link_path3(), but with @a depth set to
1276 * #svn_depth_infinity.
1278 * @deprecated Provided for backward compatibility with the 1.4 API.
1282 svn_repos_link_path2(void *report_baton,
1284 const char *link_path,
1285 svn_revnum_t revision,
1286 svn_boolean_t start_empty,
1287 const char *lock_token,
1291 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
1293 * @deprecated Provided for backward compatibility with the 1.1 API.
1297 svn_repos_link_path(void *report_baton,
1299 const char *link_path,
1300 svn_revnum_t revision,
1301 svn_boolean_t start_empty,
1304 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1305 * record the non-existence of @a path in the current tree.
1307 * @a path may not be underneath a path on which svn_repos_set_path3()
1308 * was previously called with #svn_depth_exclude in this report.
1310 * (This allows the reporter's driver to describe missing pieces of a
1311 * working copy, so that 'svn up' can recreate them.)
1313 * All temporary allocations are done in @a pool.
1316 svn_repos_delete_path(void *report_baton,
1320 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1321 * finish the report and drive the editor as specified when the report
1322 * baton was constructed.
1324 * If an error occurs during the driving of the editor, do NOT abort the
1325 * edit; that responsibility belongs to the caller of this function, if
1326 * it happens at all.
1328 * After the call to this function, @a report_baton is no longer valid;
1329 * it should not be passed to any other reporting functions, including
1330 * svn_repos_abort_report(), even if this function returns an error.
1333 svn_repos_finish_report(void *report_baton,
1337 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1338 * abort the report. This function can be called anytime before
1339 * svn_repos_finish_report() is called.
1341 * After the call to this function, @a report_baton is no longer valid;
1342 * it should not be passed to any other reporting functions.
1345 svn_repos_abort_report(void *report_baton,
1349 /* ---------------------------------------------------------------*/
1351 /* The magical dir_delta update routines. */
1353 /** Use the provided @a editor and @a edit_baton to describe the changes
1354 * necessary for making a given node (and its descendants, if it is a
1355 * directory) under @a src_root look exactly like @a tgt_path under
1356 * @a tgt_root. @a src_entry is the node to update. If @a src_entry
1357 * is empty, then compute the difference between the entire tree
1358 * anchored at @a src_parent_dir under @a src_root and @a tgt_path
1359 * under @a tgt_root. Else, describe the changes needed to update
1360 * only that entry in @a src_parent_dir. Typically, callers of this
1361 * function will use a @a tgt_path that is the concatenation of @a
1362 * src_parent_dir and @a src_entry.
1364 * @a src_root and @a tgt_root can both be either revision or transaction
1365 * roots. If @a tgt_root is a revision, @a editor's set_target_revision()
1366 * will be called with the @a tgt_root's revision number, else it will
1367 * not be called at all.
1369 * If @a authz_read_func is non-NULL, invoke it before any call to
1371 * @a editor->open_root
1372 * @a editor->add_directory
1373 * @a editor->open_directory
1374 * @a editor->add_file
1375 * @a editor->open_file
1377 * passing @a tgt_root, the same path that would be passed to the
1378 * editor function in question, and @a authz_read_baton. If the
1379 * @a *allowed parameter comes back TRUE, then proceed with the planned
1380 * editor call; else if FALSE, then invoke @a editor->absent_file or
1381 * @a editor->absent_directory as appropriate, except if the planned
1382 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
1384 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
1385 * the window handler returned by @a editor->apply_textdelta().
1387 * If @a depth is #svn_depth_empty, invoke @a editor calls only on
1388 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
1389 * If @a depth is #svn_depth_files, also invoke the editor on file
1390 * children, if any; if #svn_depth_immediates, invoke it on
1391 * immediate subdirectories as well as files; if #svn_depth_infinity,
1394 * If @a entry_props is @c TRUE, accompany each opened/added entry with
1395 * propchange editor calls that relay special "entry props" (this
1396 * is typically used only for working copy updates).
1398 * @a ignore_ancestry instructs the function to ignore node ancestry
1399 * when determining how to transmit differences.
1401 * Before completing successfully, this function calls @a editor's
1402 * close_edit(), so the caller should expect its @a edit_baton to be
1403 * invalid after its use with this function.
1405 * Do any allocation necessary for the delta computation in @a pool.
1406 * This function's maximum memory consumption is at most roughly
1407 * proportional to the greatest depth of the tree under @a tgt_root, not
1408 * the total size of the delta.
1410 * ### svn_repos_dir_delta2 is mostly superseded by the reporter
1411 * ### functionality (svn_repos_begin_report3 and friends).
1412 * ### svn_repos_dir_delta2 does allow the roots to be transaction
1413 * ### roots rather than just revision roots, and it has the
1414 * ### entry_props flag. Almost all of Subversion's own code uses the
1415 * ### reporter instead; there are some stray references to the
1416 * ### svn_repos_dir_delta[2] in comments which should probably
1417 * ### actually refer to the reporter.
1419 * @since New in 1.5.
1422 svn_repos_dir_delta2(svn_fs_root_t *src_root,
1423 const char *src_parent_dir,
1424 const char *src_entry,
1425 svn_fs_root_t *tgt_root,
1426 const char *tgt_path,
1427 const svn_delta_editor_t *editor,
1429 svn_repos_authz_func_t authz_read_func,
1430 void *authz_read_baton,
1431 svn_boolean_t text_deltas,
1433 svn_boolean_t entry_props,
1434 svn_boolean_t ignore_ancestry,
1438 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
1439 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
1440 * pass #svn_depth_files for @a depth.
1442 * @deprecated Provided for backward compatibility with the 1.4 API.
1446 svn_repos_dir_delta(svn_fs_root_t *src_root,
1447 const char *src_parent_dir,
1448 const char *src_entry,
1449 svn_fs_root_t *tgt_root,
1450 const char *tgt_path,
1451 const svn_delta_editor_t *editor,
1453 svn_repos_authz_func_t authz_read_func,
1454 void *authz_read_baton,
1455 svn_boolean_t text_deltas,
1456 svn_boolean_t recurse,
1457 svn_boolean_t entry_props,
1458 svn_boolean_t ignore_ancestry,
1462 /** Use the provided @a editor and @a edit_baton to describe the
1463 * skeletal changes made in a particular filesystem @a root
1464 * (revision or transaction).
1466 * Changes will be limited to those within @a base_dir, and if
1467 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
1468 * it is assumed that the client has no knowledge of revisions prior to
1469 * @a low_water_mark. Together, these two arguments define the portion of
1470 * the tree that the client is assumed to have knowledge of, and thus any
1471 * copies of data from outside that part of the tree will be sent in their
1472 * entirety, not as simple copies or deltas against a previous version.
1474 * The @a editor passed to this function should be aware of the fact
1475 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
1476 * change_file_prop(), and apply_textdelta() functions will not
1477 * contain meaningful data, and merely serve as indications that
1478 * properties or textual contents were changed.
1480 * If @a send_deltas is @c TRUE, the text and property deltas for changes
1481 * will be sent, otherwise NULL text deltas and empty prop changes will be
1484 * If @a authz_read_func is non-NULL, it will be used to determine if the
1485 * user has read access to the data being accessed. Data that the user
1486 * cannot access will be skipped.
1488 * @note This editor driver passes SVN_INVALID_REVNUM for all
1489 * revision parameters in the editor interface except the copyfrom
1490 * parameter of the add_file() and add_directory() editor functions.
1492 * @since New in 1.4.
1495 svn_repos_replay2(svn_fs_root_t *root,
1496 const char *base_dir,
1497 svn_revnum_t low_water_mark,
1498 svn_boolean_t send_deltas,
1499 const svn_delta_editor_t *editor,
1501 svn_repos_authz_func_t authz_read_func,
1502 void *authz_read_baton,
1506 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
1507 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
1508 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
1511 * @deprecated Provided for backward compatibility with the 1.3 API.
1515 svn_repos_replay(svn_fs_root_t *root,
1516 const svn_delta_editor_t *editor,
1520 /* ---------------------------------------------------------------*/
1522 /* Making commits. */
1525 * Return an @a editor and @a edit_baton to commit changes to the
1526 * filesystem of @a repos, beginning at location 'rev:@a base_path',
1527 * where "rev" is the argument given to open_root().
1529 * @a repos is a previously opened repository. @a repos_url_decoded is the
1530 * decoded URL to the base of the repository, and is used to check
1531 * copyfrom paths. @a txn is a filesystem transaction object to use
1532 * during the commit, or @c NULL to indicate that this function should
1533 * create (and fully manage) a new transaction.
1535 * Store the contents of @a revprop_table, a hash mapping <tt>const
1536 * char *</tt> property names to #svn_string_t values, as properties
1537 * of the commit transaction, including author and log message if
1540 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
1541 * it will be overwritten when the transaction is committed.
1543 * Iff @a authz_callback is provided, check read/write authorizations
1544 * on paths accessed by editor operations. An operation which fails
1545 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
1546 * SVN_ERR_AUTHZ_UNWRITABLE.
1548 * Calling @a (*editor)->close_edit completes the commit.
1550 * If @a commit_callback is non-NULL, then before @c close_edit returns (but
1551 * after the commit has succeeded) @c close_edit will invoke
1552 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
1553 * and @a pool or some subpool thereof as arguments. The @c repos_root field
1554 * of the #svn_commit_info_t is @c NULL. If @a commit_callback
1555 * returns an error, that error will be returned from @c close_edit,
1556 * otherwise if there was a post-commit hook failure, then that error
1557 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
1558 * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL;
1559 * if you don't need a callback, pass a dummy function.)
1561 * Calling @a (*editor)->abort_edit aborts the commit, and will also
1562 * abort the commit transaction unless @a txn was supplied (not @c
1563 * NULL). Callers who supply their own transactions are responsible
1564 * for cleaning them up (either by committing them, or aborting them).
1566 * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL.
1568 * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL. We realize
1569 * that's sorta wonky. Sorry about that.
1571 * @note Like most commit editors, the returned editor requires that the
1572 * @c copyfrom_path parameter passed to its @c add_file and @c add_directory
1573 * methods is a full, URI-encoded URL, not a relative path.
1576 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
1580 const char *repos_url_decoded,
1581 const char *base_path,
1582 apr_hash_t *revprop_table,
1583 svn_commit_callback2_t commit_callback,
1585 svn_repos_authz_callback_t authz_callback,
1590 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
1591 * set to a hash containing @a user and @a log_msg as the
1592 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
1593 * respectively. @a user and @a log_msg may both be @c NULL.
1595 * @since New in 1.4.
1597 * @deprecated Provided for backward compatibility with the 1.4 API.
1601 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
1605 const char *repos_url,
1606 const char *base_path,
1608 const char *log_msg,
1609 svn_commit_callback2_t commit_callback,
1611 svn_repos_authz_callback_t authz_callback,
1616 * Similar to svn_repos_get_commit_editor4(), but
1617 * uses the svn_commit_callback_t type.
1619 * @since New in 1.3.
1621 * @deprecated Provided for backward compatibility with the 1.3 API.
1625 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1629 const char *repos_url,
1630 const char *base_path,
1632 const char *log_msg,
1633 svn_commit_callback_t callback,
1634 void *callback_baton,
1635 svn_repos_authz_callback_t authz_callback,
1640 * Similar to svn_repos_get_commit_editor3(), but with @a
1641 * authz_callback and @a authz_baton set to @c NULL.
1643 * @deprecated Provided for backward compatibility with the 1.2 API.
1647 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1651 const char *repos_url,
1652 const char *base_path,
1654 const char *log_msg,
1655 svn_commit_callback_t callback,
1656 void *callback_baton,
1661 * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1664 * @deprecated Provided for backward compatibility with the 1.1 API.
1668 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1671 const char *repos_url,
1672 const char *base_path,
1674 const char *log_msg,
1675 svn_commit_callback_t callback,
1676 void *callback_baton,
1679 /* ---------------------------------------------------------------*/
1681 /* Finding particular revisions. */
1683 /** Set @a *revision to the revision number in @a repos's filesystem that was
1684 * youngest at time @a tm.
1687 svn_repos_dated_revision(svn_revnum_t *revision,
1693 /** Given a @a root/@a path within some filesystem, return three pieces of
1694 * information allocated in @a pool:
1696 * - set @a *committed_rev to the revision in which the object was
1697 * last modified. (In fs parlance, this is the revision in which
1698 * the particular node-rev-id was 'created'.)
1700 * - set @a *committed_date to the date of said revision, or @c NULL
1703 * - set @a *last_author to the author of said revision, or @c NULL
1707 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
1708 const char **committed_date,
1709 const char **last_author,
1710 svn_fs_root_t *root,
1716 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
1717 * root. If @a path does not exist in @a root, set @a *dirent to
1718 * NULL. Use @a pool for memory allocation.
1720 * @since New in 1.2.
1723 svn_repos_stat(svn_dirent_t **dirent,
1724 svn_fs_root_t *root,
1729 * Callback type to be used with svn_repos_list(). It will be invoked for
1730 * every directory entry found.
1732 * The full path of the entry is given in @a path and @a dirent contains
1733 * various additional information. If svn_repos_list() has been called
1734 * with @a path_info_only set, only the @a kind element of this struct
1737 * @a baton is the user-provided receiver baton. @a scratch_pool may be
1738 * used for temporary allocations.
1740 * @since New in 1.10.
1742 typedef svn_error_t *(* svn_repos_dirent_receiver_t)(const char *path,
1743 svn_dirent_t *dirent,
1745 apr_pool_t *scratch_pool);
1748 * Efficiently list everything within a sub-tree. Specify glob patterns
1749 * to search for specific files and folders.
1751 * Walk the sub-tree starting at @a path under @a root up to the given
1752 * @a depth. For each directory entry found, @a receiver will be called
1753 * with @a receiver_baton. The starting @a path will be reported as well.
1754 * Because retrieving all elements of a #svn_dirent_t can be expensive,
1755 * you may set @a path_info_only to receive only the path name and the node
1756 * kind. The entries will be reported ordered by their path.
1758 * @a patterns is an optional array of <tt>const char *</tt>. If it is
1759 * not @c NULL, only those directory entries will be reported whose last
1760 * path segment matches at least one of these patterns. This feature uses
1761 * apr_fnmatch() for glob matching and requiring '.' to matched by dots
1764 * If @a authz_read_func is not @c NULL, this function will neither report
1765 * entries nor recurse into directories that the user has no access to.
1767 * Cancellation support is provided in the usual way through the optional
1768 * @a cancel_func and @a cancel_baton.
1770 * @a path must point to a directory and @a depth must be at least
1773 * Use @a scratch_pool for temporary memory allocation.
1775 * @since New in 1.10.
1778 svn_repos_list(svn_fs_root_t *root,
1780 const apr_array_header_t *patterns,
1782 svn_boolean_t path_info_only,
1783 svn_repos_authz_func_t authz_read_func,
1784 void *authz_read_baton,
1785 svn_repos_dirent_receiver_t receiver,
1786 void *receiver_baton,
1787 svn_cancel_func_t cancel_func,
1789 apr_pool_t *scratch_pool);
1792 * Given @a path which exists at revision @a start in @a fs, set
1793 * @a *deleted to the revision @a path was first deleted, within the
1794 * inclusive revision range bounded by @a start and @a end. If @a path
1795 * does not exist at revision @a start or was not deleted within the
1796 * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1797 * Use @a pool for memory allocation.
1799 * @since New in 1.5.
1802 svn_repos_deleted_rev(svn_fs_t *fs,
1806 svn_revnum_t *deleted,
1810 /** Callback type for use with svn_repos_history(). @a path and @a
1811 * revision represent interesting history locations in the lifetime
1812 * of the path passed to svn_repos_history(). @a baton is the same
1813 * baton given to svn_repos_history(). @a pool is provided for the
1814 * convenience of the implementor, who should not expect it to live
1815 * longer than a single callback call.
1817 * Signal to callback driver to stop processing/invoking this callback
1818 * by returning the #SVN_ERR_CEASE_INVOCATION error code.
1820 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1822 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1824 svn_revnum_t revision,
1828 * Call @a history_func (with @a history_baton) for each interesting
1829 * history location in the lifetime of @a path in @a fs, from the
1830 * youngest of @a end and @a start to the oldest. Stop processing if
1831 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross
1832 * filesystem copy history if @a cross_copies is @c TRUE. And do all
1833 * of this in @a pool.
1835 * If @a authz_read_func is non-NULL, then use it (and @a
1836 * authz_read_baton) to verify that @a path in @a end is readable; if
1837 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability
1838 * of every ancestral path/revision pair before pushing them at @a
1839 * history_func. If a pair is deemed unreadable, then do not send
1840 * them; instead, immediately stop traversing history and return
1843 * @since New in 1.1.
1845 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1848 svn_repos_history2(svn_fs_t *fs,
1850 svn_repos_history_func_t history_func,
1851 void *history_baton,
1852 svn_repos_authz_func_t authz_read_func,
1853 void *authz_read_baton,
1856 svn_boolean_t cross_copies,
1860 * Similar to svn_repos_history2(), but with @a authz_read_func
1861 * and @a authz_read_baton always set to NULL.
1863 * @deprecated Provided for backward compatibility with the 1.0 API.
1867 svn_repos_history(svn_fs_t *fs,
1869 svn_repos_history_func_t history_func,
1870 void *history_baton,
1873 svn_boolean_t cross_copies,
1878 * Set @a *locations to be a mapping of the revisions to the paths of
1879 * the file @a fs_path present at the repository in revision
1880 * @a peg_revision, where the revisions are taken out of the array
1881 * @a location_revisions.
1883 * @a location_revisions is an array of svn_revnum_t's and @a *locations
1884 * maps 'svn_revnum_t *' to 'const char *'.
1886 * If optional @a authz_read_func is non-NULL, then use it (and @a
1887 * authz_read_baton) to verify that the peg-object is readable. If not,
1888 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func
1889 * to check that every path returned in the hash is readable. If an
1890 * unreadable path is encountered, stop tracing and return
1893 * @a pool is used for all allocations.
1895 * @since New in 1.1.
1898 svn_repos_trace_node_locations(svn_fs_t *fs,
1899 apr_hash_t **locations,
1900 const char *fs_path,
1901 svn_revnum_t peg_revision,
1902 const apr_array_header_t *location_revisions,
1903 svn_repos_authz_func_t authz_read_func,
1904 void *authz_read_baton,
1909 * Call @a receiver and @a receiver_baton to report successive
1910 * location segments in revisions between @a start_rev and @a end_rev
1911 * (inclusive) for the line of history identified by the peg-object @a
1912 * path in @a peg_revision (and in @a repos).
1914 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
1915 * to trace the history of the object to its origin.
1917 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
1918 * revision". Otherwise, @a start_rev must be younger than @a end_rev
1919 * (unless @a end_rev is #SVN_INVALID_REVNUM).
1921 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
1922 * revision", and must evaluate to be at least as young as @a start_rev.
1924 * If optional @a authz_read_func is not @c NULL, then use it (and @a
1925 * authz_read_baton) to verify that the peg-object is readable. If
1926 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a
1927 * authz_read_func to check that every path reported in a location
1928 * segment is readable. If an unreadable path is encountered, report
1929 * a final (possibly truncated) location segment (if any), stop
1930 * tracing history, and return #SVN_NO_ERROR.
1932 * @a pool is used for all allocations.
1934 * @since New in 1.5.
1937 svn_repos_node_location_segments(svn_repos_t *repos,
1939 svn_revnum_t peg_revision,
1940 svn_revnum_t start_rev,
1941 svn_revnum_t end_rev,
1942 svn_location_segment_receiver_t receiver,
1943 void *receiver_baton,
1944 svn_repos_authz_func_t authz_read_func,
1945 void *authz_read_baton,
1949 /* ---------------------------------------------------------------*/
1951 /* Retrieving log messages. */
1953 /** Path change descriptor.
1955 * @note Identical to #svn_fs_path_change3_t but with all information
1956 * known, i.e. @a node_kind is never #svn_node_unknown and
1957 * @a copyfrom_known is always @c TRUE.
1959 * @note To allow for extending this structure in future releases,
1960 * always use svn_repos_path_change_create() to allocate the stucture.
1962 * @see svn_fs_path_change3_t
1964 * @since New in 1.10.
1966 typedef svn_fs_path_change3_t svn_repos_path_change_t;
1969 * Return an #svn_repos_path_change_t structure, allocated in @a result_pool,
1970 * with all fields initialized to their respective null/none/empty/invalid
1973 * @note To allow for extending the #svn_repos_path_change_t structure in
1974 * future releases, this function should always be used to allocate it.
1976 * @since New in 1.10.
1978 svn_repos_path_change_t *
1979 svn_repos_path_change_create(apr_pool_t *result_pool);
1982 * Return a deep copy of @a change, allocated in @a result_pool.
1984 * @since New in 1.10.
1986 svn_repos_path_change_t *
1987 svn_repos_path_change_dup(svn_repos_path_change_t *change,
1988 apr_pool_t *result_pool);
1990 /** The callback invoked by log message loopers, such as
1991 * svn_repos_get_logs5().
1993 * This function is invoked once on each changed path, in a potentially
1994 * random order that may even change between invocations for the same
1997 * @a baton is what you think it is, and @a change contains relevant
1998 * information for the changed path. Please note that @a change may be
1999 * modified within this callback but it will become invalid as soon as
2000 * the callback returns.
2002 * Use @a scratch_pool for temporary allocation. The caller may clear it
2003 * between or after invocations.
2005 * @since New in 1.10.
2007 typedef svn_error_t *(*svn_repos_path_change_receiver_t)(
2009 svn_repos_path_change_t *change,
2010 apr_pool_t *scratch_pool);
2014 * A structure to represent all the information about a particular log entry.
2016 * @note To allow for extending this structure in future releases,
2017 * always use svn_repos_log_entry_create() to allocate the stucture.
2019 * @since New in 1.10.
2021 typedef struct svn_repos_log_entry_t
2023 /** The revision of the commit. */
2024 svn_revnum_t revision;
2026 /** The hash of requested revision properties, which may be NULL if it
2027 * would contain no revprops. Maps (const char *) property name to
2028 * (svn_string_t *) property value. */
2029 apr_hash_t *revprops;
2032 * Whether or not this message has children.
2034 * When a log operation requests additional merge information, extra log
2035 * entries may be returned as a result of this entry. The new entries, are
2036 * considered children of the original entry, and will follow it. When
2037 * the HAS_CHILDREN flag is set, the receiver should increment its stack
2038 * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which
2039 * indicates the end of the children.
2041 * For log operations which do not request additional merge information, the
2042 * HAS_CHILDREN flag is always FALSE.
2044 * For more information see:
2045 * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting
2047 svn_boolean_t has_children;
2050 * Whether @a revision should be interpreted as non-inheritable in the
2051 * same sense of #svn_merge_range_t.
2053 * Currently always FALSE.
2055 svn_boolean_t non_inheritable;
2058 * Whether @a revision is a merged revision resulting from a reverse merge.
2060 svn_boolean_t subtractive_merge;
2062 /* NOTE: Add new fields at the end to preserve binary compatibility. */
2063 } svn_repos_log_entry_t;
2066 * Return an #svn_repos_log_entry_t, allocated in @a result_pool,
2067 * with all fields initialized to their respective null/none/empty/invalid
2070 * @note To allow for extending the #svn_repos_log_entry_t structure in
2071 * future releases, this function should always be used to allocate it.
2073 * @since New in 1.10.
2075 svn_repos_log_entry_t *
2076 svn_repos_log_entry_create(apr_pool_t *result_pool);
2078 /** Return a deep copy of @a log_entry, allocated in @a result_pool.
2080 * @since New in 1.10.
2082 svn_repos_log_entry_t *
2083 svn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry,
2084 apr_pool_t *result_pool);
2087 /** The callback invoked by log message loopers, such as
2088 * svn_repos_get_logs5().
2090 * This function is invoked once on each log message, in the order
2091 * determined by the caller (see above-mentioned functions).
2093 * @a baton is what you think it is, and @a log_entry contains relevant
2094 * information for the log message.
2096 * If @a log_entry->has_children is @c TRUE, the message will be followed
2097 * immediately by any number of merged revisions (child messages), which are
2098 * terminated by an invocation with SVN_INVALID_REVNUM. This usage may
2101 * Use @a scratch_pool for temporary allocation. The caller may clear it
2102 * between or after invocations.
2104 * @since New in 1.10.
2106 typedef svn_error_t *(*svn_repos_log_entry_receiver_t)(
2108 svn_repos_log_entry_t *log_entry,
2109 apr_pool_t *scratch_pool);
2113 * Invoke @a revision_receiver with @a revision_receiver_baton on each
2114 * revision from @a start to @a end in @a repos's filesystem. @a start may
2115 * be greater or less than @a end; this just controls whether the log is
2116 * processed in descending or ascending revision number order.
2118 * If not @c NULL, @a path_change_receiver will be invoked with
2119 * @a path_change_receiver_baton for each changed path in the respective
2120 * revision. These changes will be reported before the @a revision_receiver
2121 * is invoked for that revision. So, for each revision in the log, there
2122 * is a number of calls to @a path_change_receiver followed by a single
2123 * invocation of @a revision_receiver, implicitly marking the end of the
2124 * changes list for that revision. If a revision does not contain any
2125 * changes (or if none are visible due to @a authz_read_func),
2126 * @a path_change_receiver will not be called for that revision.
2128 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
2130 * If @a paths is non-NULL and has one or more elements, then only show
2131 * revisions in which at least one of @a paths was changed (i.e., if
2132 * file, text or props changed; if dir, props or entries changed or any node
2133 * changed below it). Each path is a <tt>const char *</tt> representing
2134 * an absolute path in the repository. If @a paths is NULL or empty,
2135 * show all revisions regardless of what paths were changed in those
2138 * If @a limit is greater than zero then only invoke @a revision_receiver
2139 * on the first @a limit logs.
2141 * If @a strict_node_history is set, copy history (if any exists) will
2142 * not be traversed while harvesting revision logs for each path.
2144 * If @a include_merged_revisions is set, log information for revisions
2145 * which have been merged to @a paths will also be returned, unless these
2146 * revisions are already part of @a start to @a end in @a repos's
2147 * filesystem, as limited by @a paths. In the latter case those revisions
2148 * are skipped and @a receiver is not invoked.
2150 * If @a revprops is NULL, retrieve all revision properties; else, retrieve
2151 * only the revision properties named by the (const char *) array elements
2152 * (i.e. retrieve none if the array is empty).
2154 * If any invocation of @a revision_receiver or @a path_change_receiver
2155 * returnn an error, return that error immediately and without wrapping it.
2157 * If @a start or @a end is a non-existent revision, return the error
2158 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a revision_receiver.
2160 * If optional @a authz_read_func is non-NULL, then use this function
2161 * (along with optional @a authz_read_baton) to check the readability
2162 * of each changed-path in each revision about to be "pushed" at
2163 * @a path_change_receiver. If a revision has some changed-paths readable
2164 * and others unreadable, unreadable paths are omitted from the
2165 * @a path_change_receiver invocations and only svn:author and svn:date
2166 * will be available in the revprops field in the @a revision_receiver
2167 * callback. If a revision has no changed-paths readable at all, then all
2168 * paths are omitted and no revprops are available. If
2169 * @a path_change_receiver is @c NULL, the same filtering is performed
2170 * just without reporting any path changes.
2172 * Use @a scratch_pool for temporary allocations.
2174 * @see svn_repos_path_change_receiver_t, svn_repos_log_entry_receiver_t
2176 * @since New in 1.10.
2179 svn_repos_get_logs5(svn_repos_t *repos,
2180 const apr_array_header_t *paths,
2184 svn_boolean_t strict_node_history,
2185 svn_boolean_t include_merged_revisions,
2186 const apr_array_header_t *revprops,
2187 svn_repos_authz_func_t authz_read_func,
2188 void *authz_read_baton,
2189 svn_repos_path_change_receiver_t path_change_receiver,
2190 void *path_change_receiver_baton,
2191 svn_repos_log_entry_receiver_t revision_receiver,
2192 void *revision_receiver_baton,
2193 apr_pool_t *scratch_pool);
2196 * Similar to svn_repos_get_logs5 but using a #svn_log_entry_receiver_t
2197 * @a receiver to receive revision properties and changed paths through a
2198 * single callback and the @a discover_changed_paths flag to control it.
2200 * If @a discover_changed_paths, then each call to @a receiver passes a
2201 * hash mapping paths committed in that revision to information about them
2202 * as the receiver's @a changed_paths argument.
2203 * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
2205 * @see svn_log_entry_receiver_t
2207 * @since New in 1.5.
2209 * @deprecated Provided for backward compatibility with the 1.9 API.
2213 svn_repos_get_logs4(svn_repos_t *repos,
2214 const apr_array_header_t *paths,
2218 svn_boolean_t discover_changed_paths,
2219 svn_boolean_t strict_node_history,
2220 svn_boolean_t include_merged_revisions,
2221 const apr_array_header_t *revprops,
2222 svn_repos_authz_func_t authz_read_func,
2223 void *authz_read_baton,
2224 svn_log_entry_receiver_t receiver,
2225 void *receiver_baton,
2229 * Same as svn_repos_get_logs4(), but with @a receiver being
2230 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
2231 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
2232 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing
2235 * @since New in 1.2.
2236 * @deprecated Provided for backward compatibility with the 1.4 API.
2240 svn_repos_get_logs3(svn_repos_t *repos,
2241 const apr_array_header_t *paths,
2245 svn_boolean_t discover_changed_paths,
2246 svn_boolean_t strict_node_history,
2247 svn_repos_authz_func_t authz_read_func,
2248 void *authz_read_baton,
2249 svn_log_message_receiver_t receiver,
2250 void *receiver_baton,
2255 * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
2257 * @deprecated Provided for backward compatibility with the 1.1 API.
2261 svn_repos_get_logs2(svn_repos_t *repos,
2262 const apr_array_header_t *paths,
2265 svn_boolean_t discover_changed_paths,
2266 svn_boolean_t strict_node_history,
2267 svn_repos_authz_func_t authz_read_func,
2268 void *authz_read_baton,
2269 svn_log_message_receiver_t receiver,
2270 void *receiver_baton,
2274 * Same as svn_repos_get_logs2(), but with @a authz_read_func and
2275 * @a authz_read_baton always set to NULL.
2277 * @deprecated Provided for backward compatibility with the 1.0 API.
2281 svn_repos_get_logs(svn_repos_t *repos,
2282 const apr_array_header_t *paths,
2285 svn_boolean_t discover_changed_paths,
2286 svn_boolean_t strict_node_history,
2287 svn_log_message_receiver_t receiver,
2288 void *receiver_baton,
2293 /* ---------------------------------------------------------------*/
2295 /* Retrieving mergeinfo. */
2297 /** Receives parsed @a mergeinfo for the file system path @a path.
2299 * The user-provided @a baton is being passed through by the retrieval
2300 * function and @a scratch_pool will be cleared between invocations.
2302 * @since New in 1.10.
2304 typedef svn_fs_mergeinfo_receiver_t svn_repos_mergeinfo_receiver_t;
2307 * For each node found with mergeinfo on it, invoke @a receiver with
2308 * the provided @a receiver_baton.
2310 * The paths in @a paths start with '/'.
2312 * @a inherit indicates whether explicit, explicit or inherited, or
2313 * only inherited mergeinfo for @a paths is fetched.
2315 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
2317 * If @a include_descendants is TRUE, then additionally return the
2318 * mergeinfo for any descendant of any element of @a paths which has
2319 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note
2320 * that inheritance is only taken into account for the elements in @a
2321 * paths; descendants of the elements in @a paths which get their
2322 * mergeinfo via inheritance are not reported to @a receiver.)
2324 * If optional @a authz_read_func is non-NULL, then use this function
2325 * (along with optional @a authz_read_baton) to check the readability
2326 * of each path which mergeinfo was requested for (from @a paths).
2327 * Silently omit unreadable paths from the request for mergeinfo.
2329 * Use @a scratch_pool for temporary allocations.
2331 * @since New in 1.10.
2334 svn_repos_fs_get_mergeinfo2(svn_repos_t *repos,
2335 const apr_array_header_t *paths,
2336 svn_revnum_t revision,
2337 svn_mergeinfo_inheritance_t inherit,
2338 svn_boolean_t include_descendants,
2339 svn_repos_authz_func_t authz_read_func,
2340 void *authz_read_baton,
2341 svn_repos_mergeinfo_receiver_t receiver,
2342 void *receiver_baton,
2343 apr_pool_t *scratch_pool);
2346 * Same as svn_repos_fs_get_mergeinfo2(), but all mergeinfo is being collected
2347 * and returned in @a *catalog. It will never be @c NULL, but may be empty.
2349 * @since New in 1.5.
2351 * @deprecated Provided for backward compatibility with the 1.9 API.
2355 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
2357 const apr_array_header_t *paths,
2358 svn_revnum_t revision,
2359 svn_mergeinfo_inheritance_t inherit,
2360 svn_boolean_t include_descendants,
2361 svn_repos_authz_func_t authz_read_func,
2362 void *authz_read_baton,
2366 /* ---------------------------------------------------------------*/
2368 /* Retrieving multiple revisions of a file. */
2371 * Retrieve a subset of the interesting revisions of a file @a path in
2372 * @a repos as seen in revision @a end. Invoke @a handler with
2373 * @a handler_baton as its first argument for each such revision.
2374 * @a pool is used for all allocations. See svn_fs_history_prev() for
2375 * a discussion of interesting revisions.
2377 * If optional @a authz_read_func is non-NULL, then use this function
2378 * (along with optional @a authz_read_baton) to check the readability
2379 * of the rev-path in each interesting revision encountered.
2381 * Revision discovery happens from @a end to @a start, and if an
2382 * unreadable revision is encountered before @a start is reached, then
2383 * revision discovery stops and only the revisions from @a end to the
2384 * oldest readable revision are returned (So it will appear that @a
2385 * path was added without history in the latter revision).
2387 * If there is an interesting revision of the file that is less than or
2388 * equal to start, the iteration will start at that revision. Else, the
2389 * iteration will start at the first revision of the file in the repository,
2390 * which has to be less than or equal to end. Note that if the function
2391 * succeeds, @a handler will have been called at least once.
2393 * In a series of calls, the file contents for the first interesting revision
2394 * will be provided as a text delta against the empty file. In the following
2395 * calls, the delta will be against the contents for the previous call.
2397 * If @a include_merged_revisions is TRUE, revisions which a included as a
2398 * result of a merge between @a start and @a end will be included.
2400 * Since Subversion 1.8 this function has been enabled to support reversion
2401 * the revision range for @a include_merged_revision @c FALSE reporting by
2402 * switching @a start with @a end.
2404 * @note Prior to Subversion 1.9, this function may request delta handlers
2405 * from @a handler even for empty text deltas. Starting with 1.9, the
2406 * delta handler / baton return arguments passed to @a handler will be
2407 * #NULL unless there is an actual difference in the file contents between
2408 * the current and the previous call.
2410 * @since New in 1.5.
2413 svn_repos_get_file_revs2(svn_repos_t *repos,
2417 svn_boolean_t include_merged_revisions,
2418 svn_repos_authz_func_t authz_read_func,
2419 void *authz_read_baton,
2420 svn_file_rev_handler_t handler,
2421 void *handler_baton,
2425 * Similar to #svn_file_rev_handler_t, but without the @a
2426 * result_of_merge parameter.
2428 * @deprecated Provided for backward compatibility with 1.4 API.
2429 * @since New in 1.1.
2431 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
2435 apr_hash_t *rev_props,
2436 svn_txdelta_window_handler_t *delta_handler,
2438 apr_array_header_t *prop_diffs,
2442 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
2445 * @deprecated Provided for backward compatibility with the 1.4 API.
2446 * @since New in 1.1.
2450 svn_repos_get_file_revs(svn_repos_t *repos,
2454 svn_repos_authz_func_t authz_read_func,
2455 void *authz_read_baton,
2456 svn_repos_file_rev_handler_t handler,
2457 void *handler_baton,
2461 /* ---------------------------------------------------------------*/
2464 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
2469 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
2470 * post-commit hooks around the commit. Use @a pool for any necessary
2473 * If the pre-commit hook fails, do not attempt to commit the
2474 * transaction and throw the original error to the caller.
2476 * A successful commit is indicated by a valid revision value in @a
2477 * *new_rev, not if svn_fs_commit_txn() returns an error, which can
2478 * occur during its post commit FS processing. If the transaction was
2479 * not committed, then return the associated error and do not execute
2480 * the post-commit hook.
2482 * If the commit succeeds the post-commit hook is executed. If the
2483 * post-commit hook returns an error, always wrap it with
2484 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
2485 * find the post-commit hook error in the returned error chain. If
2486 * both svn_fs_commit_txn() and the post-commit hook return errors,
2487 * then svn_fs_commit_txn()'s error is the parent error and the
2488 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
2491 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
2494 svn_repos_fs_commit_txn(const char **conflict_p,
2496 svn_revnum_t *new_rev,
2500 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
2501 * <tt>const char *</tt> property names to #svn_string_t values, to
2502 * set the properties on transaction @a *txn_p. @a repos is the
2503 * repository object which contains the filesystem. @a rev, @a
2504 * *txn_p, and @a pool are as in svn_fs_begin_txn().
2506 * Before a txn is created, the repository's start-commit hooks are
2507 * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
2508 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
2510 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
2511 * which will be set on the transaction, but that will be overwritten
2512 * when the transaction is committed.
2514 * @since New in 1.5.
2517 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
2520 apr_hash_t *revprop_table,
2525 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
2526 * set to a hash containing @a author and @a log_msg as the
2527 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
2528 * respectively. @a author and @a log_msg may both be @c NULL.
2530 * @deprecated Provided for backward compatibility with the 1.4 API.
2534 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
2538 const char *log_msg,
2542 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
2543 * property on transaction @a *txn_p. @a repos is the repository object
2544 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in
2545 * svn_fs_begin_txn().
2547 * ### Someday: before a txn is created, some kind of read-hook could
2550 * @note This function was never fully implemented, nor used. Ignore it.
2551 * @deprecated Provided for backward compatibility with the 1.7 API.
2555 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
2564 /** @defgroup svn_repos_fs_locks Repository lock wrappers
2568 /** Like svn_fs_lock_many(), but invoke the @a repos's pre- and
2569 * post-lock hooks before and after the locking action.
2571 * The pre-lock is run for every path in @a targets. Those targets for
2572 * which the pre-lock is successful are passed to svn_fs_lock_many and
2573 * the post-lock is run for those that are successfully locked.
2574 * Pre-lock hook errors are passed to @a lock_callback.
2576 * For each path in @a targets @a lock_callback will be invoked
2577 * passing @a lock_baton and the lock and error that apply to path.
2578 * @a lock_callback can be NULL in which case it is not called and any
2579 * errors that would have been passed to the callback are not reported.
2581 * If an error occurs when running the post-lock hook the error is
2582 * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the
2583 * caller sees this error, it knows that some locks succeeded.
2585 * The pre-lock hook may cause a different token to be used for the
2586 * lock, instead of the token supplied; see the pre-lock-hook
2587 * documentation for more.
2589 * The lock and path passed to @a lock_callback will be allocated in
2590 * @a result_pool. Use @a scratch_pool for temporary allocations.
2592 * @note This function is not atomic. If it returns an error, some targets
2593 * may remain unlocked while others may have been locked.
2595 * @see svn_fs_lock_many
2597 * @since New in 1.9.
2600 svn_repos_fs_lock_many(svn_repos_t *repos,
2601 apr_hash_t *lock_targets,
2602 const char *comment,
2603 svn_boolean_t is_dav_comment,
2604 apr_time_t expiration_date,
2605 svn_boolean_t steal_lock,
2606 svn_fs_lock_callback_t lock_callback,
2608 apr_pool_t *result_pool,
2609 apr_pool_t *scratch_pool);
2611 /** Similar to svn_repos_fs_lock_many() but locks only a single path.
2613 * @since New in 1.2.
2616 svn_repos_fs_lock(svn_lock_t **lock,
2620 const char *comment,
2621 svn_boolean_t is_dav_comment,
2622 apr_time_t expiration_date,
2623 svn_revnum_t current_rev,
2624 svn_boolean_t steal_lock,
2628 /** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and
2629 * post-unlock hooks before and after the unlocking action.
2631 * The pre-unlock hook is run for every path in @a targets. Those
2632 * targets for which the pre-unlock is successful are passed to
2633 * svn_fs_unlock_many and the post-unlock is run for those that are
2634 * successfully unlocked. Pre-unlock hook errors are passed to @a
2637 * For each path in @a targets @a lock_callback will be invoked
2638 * passing @a lock_baton and error that apply to path. The lock
2639 * passed to the callback will be NULL. @a lock_callback can be NULL
2640 * in which case it is not called and any errors that would have been
2641 * passed to the callback are not reported.
2643 * If an error occurs when running the post-unlock hook, return the
2644 * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.
2645 * If the caller sees this error, it knows that some unlocks
2648 * The path passed to @a lock_callback will be allocated in @a result_pool.
2649 * Use @a scratch_pool for temporary allocations.
2651 * @note This function is not atomic. If it returns an error, some targets
2652 * may remain locked while others may have been unlocked.
2654 * @see svn_fs_unlock_many
2656 * @since New in 1.9.
2659 svn_repos_fs_unlock_many(svn_repos_t *repos,
2660 apr_hash_t *unlock_targets,
2661 svn_boolean_t break_lock,
2662 svn_fs_lock_callback_t lock_callback,
2664 apr_pool_t *result_pool,
2665 apr_pool_t *scratch_pool);
2667 /** Similar to svn_repos_fs_unlock_many() but only unlocks a single path.
2669 * @since New in 1.2.
2672 svn_repos_fs_unlock(svn_repos_t *repos,
2675 svn_boolean_t break_lock,
2680 /** Look up all the locks in and under @a path in @a repos, setting @a
2681 * *locks to a hash which maps <tt>const char *</tt> paths to the
2682 * #svn_lock_t locks associated with those paths. Use @a
2683 * authz_read_func and @a authz_read_baton to "screen" all returned
2684 * locks. That is: do not return any locks on any paths that are
2685 * unreadable in HEAD, just silently omit them.
2687 * @a depth limits the returned locks to those associated with paths
2688 * within the specified depth of @a path, and must be one of the
2689 * following values: #svn_depth_empty, #svn_depth_files,
2690 * #svn_depth_immediates, or #svn_depth_infinity.
2692 * @since New in 1.7.
2695 svn_repos_fs_get_locks2(apr_hash_t **locks,
2699 svn_repos_authz_func_t authz_read_func,
2700 void *authz_read_baton,
2704 * Similar to svn_repos_fs_get_locks2(), but with @a depth always
2705 * passed as svn_depth_infinity.
2707 * @since New in 1.2.
2708 * @deprecated Provided for backward compatibility with the 1.6 API.
2712 svn_repos_fs_get_locks(apr_hash_t **locks,
2715 svn_repos_authz_func_t authz_read_func,
2716 void *authz_read_baton,
2721 /** @defgroup svn_repos_properties Versioned and Unversioned Properties
2723 * Prop-changing and prop-reading wrappers for libsvn_fs routines.
2728 * Like svn_fs_change_rev_prop2(), but validate the name and value of the
2729 * property and invoke the @a repos's pre- and post-revprop-change hooks
2730 * around the change as specified by @a use_pre_revprop_change_hook and
2731 * @a use_post_revprop_change_hook (respectively).
2733 * @a rev is the revision whose property to change, @a name is the
2734 * name of the property, and @a new_value is the new value of the
2735 * property. If @a old_value_p is not @c NULL, then @a *old_value_p
2736 * is the expected current (preexisting) value of the property (or @c NULL
2737 * for "unset"). @a author is the authenticated username of the person
2738 * changing the property value, or NULL if not available.
2740 * If @a authz_read_func is non-NULL, then use it (with @a
2741 * authz_read_baton) to validate the changed-paths associated with @a
2742 * rev. If the revision contains any unreadable changed paths, then
2743 * return #SVN_ERR_AUTHZ_UNREADABLE.
2745 * Validate @a name and @a new_value like the same way
2746 * svn_repos_fs_change_node_prop() does.
2748 * Use @a pool for temporary allocations.
2750 * @since New in 1.7.
2753 svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
2757 const svn_string_t *const *old_value_p,
2758 const svn_string_t *new_value,
2759 svn_boolean_t use_pre_revprop_change_hook,
2760 svn_boolean_t use_post_revprop_change_hook,
2761 svn_repos_authz_func_t authz_read_func,
2762 void *authz_read_baton,
2766 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
2767 * set to @c NULL. (In other words, it is similar to
2768 * svn_fs_change_rev_prop().)
2770 * @deprecated Provided for backward compatibility with the 1.6 API.
2771 * @since New in 1.5.
2775 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
2779 const svn_string_t *new_value,
2780 svn_boolean_t use_pre_revprop_change_hook,
2781 svn_boolean_t use_post_revprop_change_hook,
2782 svn_repos_authz_func_t authz_read_func,
2783 void *authz_read_baton,
2787 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
2788 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
2789 * always set to @c TRUE.
2791 * @deprecated Provided for backward compatibility with the 1.4 API.
2795 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
2799 const svn_string_t *new_value,
2800 svn_repos_authz_func_t authz_read_func,
2801 void *authz_read_baton,
2805 * Similar to svn_repos_fs_change_rev_prop2(), but with the
2806 * @a authz_read_func parameter always NULL.
2808 * @deprecated Provided for backward compatibility with the 1.0 API.
2812 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
2816 const svn_string_t *new_value,
2822 * Set @a *value_p to the value of the property named @a propname on
2823 * revision @a rev in the filesystem opened in @a repos. If @a rev
2824 * has no property by that name, set @a *value_p to zero. Allocate
2825 * the result in @a pool.
2827 * If @a authz_read_func is non-NULL, then use it (with @a
2828 * authz_read_baton) to validate the changed-paths associated with @a
2829 * rev. If the changed-paths are all unreadable, then set @a *value_p
2830 * to zero unconditionally. If only some of the changed-paths are
2831 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
2832 * fetched, but return 0 for any other property.
2834 * @since New in 1.1.
2837 svn_repos_fs_revision_prop(svn_string_t **value_p,
2840 const char *propname,
2841 svn_repos_authz_func_t authz_read_func,
2842 void *authz_read_baton,
2847 * Set @a *table_p to the entire property list of revision @a rev in
2848 * filesystem opened in @a repos, as a hash table allocated in @a
2849 * pool. The table maps <tt>char *</tt> property names to
2850 * #svn_string_t * values; the names and values are allocated in @a
2853 * If @a authz_read_func is non-NULL, then use it (with @a
2854 * authz_read_baton) to validate the changed-paths associated with @a
2855 * rev. If the changed-paths are all unreadable, then return an empty
2856 * hash. If only some of the changed-paths are unreadable, then return
2857 * an empty hash, except for 'svn:author' and 'svn:date' properties
2858 * (assuming those properties exist).
2860 * @since New in 1.1.
2863 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
2866 svn_repos_authz_func_t authz_read_func,
2867 void *authz_read_baton,
2870 /** Validating wrapper for svn_fs_change_node_prop() (which see for
2871 * argument descriptions).
2873 * If @a name's kind is not #svn_prop_regular_kind, return
2874 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its
2875 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
2878 * @note Originally, the only properties validated were the "svn:" properties
2879 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current
2880 * validation rules see the private function svn_repos__validate_prop().
2883 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
2886 const svn_string_t *value,
2890 * Set @a *inherited_values to a depth-first ordered array of
2891 * #svn_prop_inherited_item_t * structures (the path_or_url members of
2892 * which are relative filesystem paths) representing the properties
2893 * inherited by @a path in @a root. If no properties are inherited,
2894 * then set @a *inherited_values to an empty array.
2896 * if @a propname is NULL then retrieve all explicit and/or inherited
2897 * properties. Otherwise retrieve only the properties named @a propname.
2899 * If optional @a authz_read_func is non-NULL, then use this function
2900 * (along with optional @a authz_read_baton) to check the readability
2901 * of each parent path from which properties are inherited. Silently omit
2902 * properties for unreadable parent paths.
2904 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for
2905 * temporary allocations.
2907 * @since New in 1.8.
2910 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
2911 svn_fs_root_t *root,
2913 const char *propname,
2914 svn_repos_authz_func_t authz_read_func,
2915 void *authz_read_baton,
2916 apr_pool_t *result_pool,
2917 apr_pool_t *scratch_pool);
2919 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
2920 * argument descriptions). See svn_repos_fs_change_txn_props() for more
2924 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
2926 const svn_string_t *value,
2929 /** Validating wrapper for svn_fs_change_txn_props() (which see for
2930 * argument descriptions). Validate properties and their values the
2931 * same way svn_repos_fs_change_node_prop() does.
2933 * @since New in 1.5.
2936 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
2937 const apr_array_header_t *props,
2943 /* ---------------------------------------------------------------*/
2946 * @defgroup svn_repos_inspection Data structures and editor things for \
2947 * repository inspection.
2950 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
2951 * svn_repos_begin_report3() interfaces can be extremely useful for
2952 * examining the repository, or more exactly, changes to the repository.
2953 * These drivers allows for differences between two trees to be
2954 * described using an editor.
2956 * By using the editor obtained from svn_repos_node_editor() with one of
2957 * the drivers mentioned above, the description of how to transform one
2958 * tree into another can be used to build an in-memory linked-list tree,
2959 * which each node representing a repository node that was changed.
2962 /** A node in the repository. */
2963 typedef struct svn_repos_node_t
2965 /** Node type (file, dir, etc.) */
2966 svn_node_kind_t kind;
2968 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
2971 /** Were there any textual mods? (files only) */
2972 svn_boolean_t text_mod;
2974 /** Where there any property mods? */
2975 svn_boolean_t prop_mod;
2977 /** The name of this node as it appears in its parent's entries list */
2980 /** The filesystem revision where this was copied from (if any) */
2981 svn_revnum_t copyfrom_rev;
2983 /** The filesystem path where this was copied from (if any) */
2984 const char *copyfrom_path;
2986 /** Pointer to the next sibling of this node */
2987 struct svn_repos_node_t *sibling;
2989 /** Pointer to the first child of this node */
2990 struct svn_repos_node_t *child;
2992 /** Pointer to the parent of this node */
2993 struct svn_repos_node_t *parent;
2998 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
2999 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
3000 * tree representing the delta from @a base_root to @a root in @a
3001 * repos's filesystem.
3003 * The editor can also be driven by svn_repos_dir_delta2() or
3004 * svn_repos_begin_report3(), but unless you have special needs,
3005 * svn_repos_replay2() is preferred.
3007 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
3010 * Note that the delta includes "bubbled-up" directories; that is,
3011 * many of the directory nodes will have no prop_mods.
3013 * Allocate the tree and its contents in @a node_pool; do all other
3014 * allocation in @a pool.
3017 svn_repos_node_editor(const svn_delta_editor_t **editor,
3020 svn_fs_root_t *base_root,
3021 svn_fs_root_t *root,
3022 apr_pool_t *node_pool,
3025 /** Return the root node of the linked-list tree generated by driving the
3026 * editor (associated with @a edit_baton) created by svn_repos_node_editor().
3027 * This is only really useful if used *after* the editor drive is completed.
3030 svn_repos_node_from_baton(void *edit_baton);
3033 * Return repository format information for @a repos.
3035 * Set @a *repos_format to the repository format number of @a repos, which is
3036 * an integer that increases when incompatible changes are made (such as
3037 * by #svn_repos_upgrade2).
3039 * Set @a *supports_version to the version number of the minimum Subversion
3040 * GA release that can read and write @a repos; allocate it in
3041 * @a result_pool. Use @a scratch_pool for temporary allocations.
3043 * @see svn_fs_info_format, svn_repos_capabilities
3045 * @since New in 1.9.
3048 svn_repos_info_format(int *repos_format,
3049 svn_version_t **supports_version,
3051 apr_pool_t *result_pool,
3052 apr_pool_t *scratch_pool);
3056 /* ---------------------------------------------------------------*/
3059 * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data
3062 * The filesystem 'dump' format contains nothing but the abstract
3063 * structure of the filesystem -- independent of any internal node-id
3064 * schema or database back-end. All of the data in the dumpfile is
3065 * acquired by public function calls into svn_fs.h. Similarly, the
3066 * parser which reads the dumpfile is able to reconstruct the
3067 * filesystem using only public svn_fs.h routines.
3069 * Thus the dump/load feature's main purpose is for *migrating* data
3070 * from one svn filesystem to another -- presumably two filesystems
3071 * which have different internal implementations.
3073 * If you simply want to backup your filesystem, you're probably
3074 * better off using the built-in facilities of the DB backend (using
3075 * Berkeley DB's hot-backup feature, for example.)
3077 * For a description of the dumpfile format, see
3078 * /trunk/notes/fs_dumprestore.txt.
3081 /* The RFC822-style headers in our dumpfile format. */
3082 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version"
3083 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3
3084 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3
3085 #define SVN_REPOS_DUMPFILE_UUID "UUID"
3086 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length"
3088 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number"
3090 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path"
3091 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind"
3092 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action"
3093 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path"
3094 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev"
3095 /** @since New in 1.6. */
3096 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5"
3097 /** @since New in 1.6. */
3098 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1"
3099 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
3100 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
3101 /** @since New in 1.6. */
3102 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5"
3103 /** @since New in 1.6. */
3104 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1"
3105 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \
3106 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
3108 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length"
3109 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length"
3111 /** @since New in 1.1. */
3112 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta"
3113 /** @since New in 1.1. */
3114 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta"
3115 /** @since New in 1.6. */
3116 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5"
3117 /** @since New in 1.6. */
3118 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1"
3119 /** @since New in 1.5. */
3120 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \
3121 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
3123 /** The different policies for processing the UUID in the dumpfile. */
3124 enum svn_repos_load_uuid
3126 /** only update uuid if the repos has no revisions. */
3127 svn_repos_load_uuid_default,
3128 /** never update uuid. */
3129 svn_repos_load_uuid_ignore,
3130 /** always update uuid. */
3131 svn_repos_load_uuid_force
3134 /** Callback type for use with svn_repos_verify_fs3(). @a revision
3135 * and @a verify_err are the details of a single verification failure
3136 * that occurred during the svn_repos_verify_fs3() call. @a baton is
3137 * the same baton given to svn_repos_verify_fs3(). @a scratch_pool is
3138 * provided for the convenience of the implementor, who should not
3139 * expect it to live longer than a single callback call.
3141 * @a verify_err will be cleared and becomes invalid after the callback
3142 * returns, use svn_error_dup() to preserve the error. If a callback uses
3143 * @a verify_err as the return value or as a part of the return value, it
3144 * should also call svn_error_dup() for @a verify_err. Implementors of this
3145 * callback are forbidden to call svn_error_clear() for @a verify_err.
3147 * @see svn_repos_verify_fs3
3149 * @since New in 1.9.
3151 typedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton,
3152 svn_revnum_t revision,
3153 svn_error_t *verify_err,
3154 apr_pool_t *scratch_pool);
3157 * Verify the contents of the file system in @a repos.
3159 * Verify the revisions from @a start_rev to @a end_rev inclusive. If
3160 * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev
3161 * is #SVN_INVALID_REVNUM, end at the head revision. @a start_rev must be
3162 * older than or equal to @a end_rev. If revision 0 is included in the
3163 * range, then also verify "global invariants" of the repository, as
3164 * described in svn_fs_verify().
3166 * If @a check_normalization is @c TRUE, report any name collisions
3167 * within the same directory or svn:mergeinfo property where the names
3168 * differ only in character representation, but are otherwise
3171 * If @a metadata_only is @c TRUE, backends that have a concept of separate
3172 * metadata verification will only perform that and skip the more expensive
3173 * file context reconstruction and verification. For FSFS format 7+ and
3174 * FSX, this allows for a very fast check against external corruption.
3176 * If @a verify_callback is not @c NULL, call it with @a verify_baton upon
3177 * receiving an FS-specific structure failure or a revision verification
3178 * failure. Set @c revision callback argument to #SVN_INVALID_REVNUM or
3179 * to the revision number respectively. Set @c verify_err to svn_error_t
3180 * describing the reason of the failure. @c verify_err will be cleared
3181 * after the callback returns, use svn_error_dup() to preserve the error.
3182 * If @a verify_callback returns an error different from #SVN_NO_ERROR,
3183 * stop verifying the repository and immediately return the error from
3184 * @a verify_callback.
3186 * If @a verify_callback is @c NULL, this function returns the first
3187 * encountered verification error or #SVN_NO_ERROR if there were no failures
3188 * during the verification. Errors that prevent the verification process
3189 * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately
3190 * and do not trigger an invocation of @a verify_callback.
3192 * If @a notify_func is not null, then call it with @a notify_baton and
3193 * with a notification structure in which the fields are set as follows.
3194 * (For a warning that does not apply to a specific revision, the revision
3195 * number is #SVN_INVALID_REVNUM.)
3197 * For each FS-specific structure warning:
3198 * @c action = svn_repos_notify_verify_rev_structure
3199 * @c revision = the revision or #SVN_INVALID_REVNUM
3201 * For each revision verification warning:
3202 * @c action = #svn_repos_notify_warning
3203 * @c warning and @c warning_str fields set accordingly
3204 * ### TODO: Set @c revision = the revision?
3206 * For each successfully verified revision:
3207 * @c action = #svn_repos_notify_verify_rev_end
3208 * @c revision = the revision
3211 * @c action = svn_repos_notify_verify_end
3212 * ### Do we really need a callback to tell us the function we
3213 * called has reached its end and is about to return?
3214 * ### Not sent, currently, if a FS structure error is found.
3216 * If @a cancel_func is not @c NULL, call it periodically with @a
3217 * cancel_baton as argument to see if the caller wishes to cancel the
3220 * Use @a scratch_pool for temporary allocation.
3222 * @see svn_repos_verify_callback_t
3224 * @since New in 1.9.
3227 svn_repos_verify_fs3(svn_repos_t *repos,
3228 svn_revnum_t start_rev,
3229 svn_revnum_t end_rev,
3230 svn_boolean_t check_normalization,
3231 svn_boolean_t metadata_only,
3232 svn_repos_notify_func_t notify_func,
3234 svn_repos_verify_callback_t verify_callback,
3236 svn_cancel_func_t cancel,
3238 apr_pool_t *scratch_pool);
3241 * Like svn_repos_verify_fs3(), but with @a verify_callback and
3242 * @a verify_baton set to @c NULL and with @a check_normalization
3243 * and @a metadata_only set to @c FALSE.
3245 * @since New in 1.7.
3246 * @deprecated Provided for backward compatibility with the 1.8 API.
3250 svn_repos_verify_fs2(svn_repos_t *repos,
3251 svn_revnum_t start_rev,
3252 svn_revnum_t end_rev,
3253 svn_repos_notify_func_t notify_func,
3255 svn_cancel_func_t cancel,
3257 apr_pool_t *scratch_pool);
3260 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
3261 * handling feedback via the notify_func handler.
3263 * If @a feedback_stream is not @c NULL, write feedback to it (lines of
3264 * the form "* Verified revision %ld\n").
3266 * @since New in 1.5.
3267 * @deprecated Provided for backward compatibility with the 1.6 API.
3271 svn_repos_verify_fs(svn_repos_t *repos,
3272 svn_stream_t *feedback_stream,
3273 svn_revnum_t start_rev,
3274 svn_revnum_t end_rev,
3275 svn_cancel_func_t cancel_func,
3280 * Dump the contents of the filesystem within already-open @a repos into
3281 * writable @a dumpstream. If @a dumpstream is
3282 * @c NULL, this is effectively a primitive verify. It is not complete,
3283 * however; see instead svn_repos_verify_fs3().
3285 * Begin at revision @a start_rev, and dump every revision up through
3286 * @a end_rev. If @a start_rev is #SVN_INVALID_REVNUM, start at revision
3287 * 0. If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision.
3289 * If @a incremental is @c TRUE, the first revision dumped will be a diff
3290 * against the previous revision (usually it looks like a full dump of
3293 * If @a use_deltas is @c TRUE, output only node properties which have
3294 * changed relative to the previous contents, and output text contents
3295 * as svndiff data against the previous contents. Regardless of how
3296 * this flag is set, the first revision of a non-incremental dump will
3297 * be done with full plain text. A dump with @a use_deltas set cannot
3298 * be loaded by Subversion 1.0.x.
3300 * If @a include_revprops is @c TRUE, output the revision properties as
3301 * well, otherwise omit them.
3303 * If @a include_changes is @c TRUE, output the revision contents, i.e.
3304 * tree and node changes.
3306 * If @a notify_func is not null, then call it with @a notify_baton and
3307 * with a notification structure in which the fields are set as follows.
3308 * (For a warning or error notification that does not apply to a specific
3309 * revision, the revision number is #SVN_INVALID_REVNUM.)
3312 * @c action = #svn_repos_notify_warning
3313 * @c warning and @c warning_str fields set accordingly
3314 * ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM?
3316 * For each successfully dumped revision:
3317 * @c action = #svn_repos_notify_dump_rev_end
3318 * @c revision = the revision
3321 * @c action = svn_repos_notify_verify_end
3322 * ### Do we really need a callback to tell us the function we
3323 * called has reached its end and is about to return?
3325 * At the end, if there were certain warnings previously:
3326 * @c action = #svn_repos_notify_warning
3327 * @c warning and @c warning_str fields set accordingly,
3328 * reiterating the existence of previous warnings
3329 * ### This is a presentation issue. Caller could do this itself.
3331 * If @a filter_func is not @c NULL, it is called for each node being
3332 * dumped, allowing the caller to exclude it from dump.
3334 * If @a cancel_func is not @c NULL, it is called periodically with
3335 * @a cancel_baton as argument to see if the client wishes to cancel
3338 * Use @a scratch_pool for temporary allocation.
3340 * @since New in 1.10.
3343 svn_repos_dump_fs4(svn_repos_t *repos,
3344 svn_stream_t *stream,
3345 svn_revnum_t start_rev,
3346 svn_revnum_t end_rev,
3347 svn_boolean_t incremental,
3348 svn_boolean_t use_deltas,
3349 svn_boolean_t include_revprops,
3350 svn_boolean_t include_changes,
3351 svn_repos_notify_func_t notify_func,
3353 svn_repos_dump_filter_func_t filter_func,
3355 svn_cancel_func_t cancel_func,
3360 * Similar to svn_repos_dump_fs4(), but with @a include_revprops and
3361 * @a include_changes both set to @c TRUE and @a filter_func and
3362 * @a filter_baton set to @c NULL.
3364 * @since New in 1.7.
3365 * @deprecated Provided for backward compatibility with the 1.9 API.
3369 svn_repos_dump_fs3(svn_repos_t *repos,
3370 svn_stream_t *dumpstream,
3371 svn_revnum_t start_rev,
3372 svn_revnum_t end_rev,
3373 svn_boolean_t incremental,
3374 svn_boolean_t use_deltas,
3375 svn_repos_notify_func_t notify_func,
3377 svn_cancel_func_t cancel_func,
3379 apr_pool_t *scratch_pool);
3382 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
3383 * handling feedback via the notify_func handler
3385 * @since New in 1.1.
3386 * @deprecated Provided for backward compatibility with the 1.6 API.
3390 svn_repos_dump_fs2(svn_repos_t *repos,
3391 svn_stream_t *dumpstream,
3392 svn_stream_t *feedback_stream,
3393 svn_revnum_t start_rev,
3394 svn_revnum_t end_rev,
3395 svn_boolean_t incremental,
3396 svn_boolean_t use_deltas,
3397 svn_cancel_func_t cancel_func,
3402 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
3403 * parameter always set to @c FALSE.
3405 * @deprecated Provided for backward compatibility with the 1.0 API.
3409 svn_repos_dump_fs(svn_repos_t *repos,
3410 svn_stream_t *dumpstream,
3411 svn_stream_t *feedback_stream,
3412 svn_revnum_t start_rev,
3413 svn_revnum_t end_rev,
3414 svn_boolean_t incremental,
3415 svn_cancel_func_t cancel_func,
3421 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
3422 * filesystem revisions in already-open @a repos, handling uuids in
3423 * accordance with @a uuid_action. Use @a pool for all allocation.
3425 * If the dumpstream contains copy history that is unavailable in the
3426 * repository, an error will be thrown.
3428 * The repository's UUID will be updated iff
3429 * the dumpstream contains a UUID and
3430 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
3431 * either the repository contains no revisions or
3432 * @a uuid_action is equal to #svn_repos_load_uuid_force.
3434 * If the dumpstream contains no UUID, then @a uuid_action is
3435 * ignored and the repository UUID is not touched.
3437 * @a start_rev and @a end_rev act as filters, the lower and upper
3438 * (inclusive) range values of revisions in @a dumpstream which will
3439 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
3440 * which case no revision-based filtering occurs at all), or both are
3441 * valid revisions (where @a start_rev is older than or equivalent to
3444 * If @a parent_dir is not NULL, then the parser will reparent all the
3445 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
3446 * must be an existing directory in the repository.
3448 * If @a use_pre_commit_hook is set, call the repository's pre-commit
3449 * hook before committing each loaded revision.
3451 * If @a use_post_commit_hook is set, call the repository's
3452 * post-commit hook after committing each loaded revision.
3454 * If @a validate_props is set, then validate Subversion revision and
3455 * node properties (those in the svn: namespace) against established
3456 * rules for those things.
3458 * If @a ignore_dates is set, ignore any revision datestamps found in
3459 * @a dumpstream, allowing the revisions created by the load process
3460 * to be stamped as if they were newly created via the normal commit
3463 * If @a normalize_props is set, attempt to normalize invalid Subversion
3464 * revision and node properties (those in the svn: namespace) so that
3465 * their values would follow the established rules for them. For example,
3466 * for such properties, typically the value must be in UTF-8 with LF
3469 * @note The details or the performed normalizations are deliberately
3470 * left unspecified and may change in the future.
3472 * If non-NULL, use @a notify_func and @a notify_baton to send notification
3473 * of events to the caller.
3475 * If @a cancel_func is not @c NULL, it is called periodically with
3476 * @a cancel_baton as argument to see if the client wishes to cancel
3479 * @since New in 1.10.
3482 svn_repos_load_fs6(svn_repos_t *repos,
3483 svn_stream_t *dumpstream,
3484 svn_revnum_t start_rev,
3485 svn_revnum_t end_rev,
3486 enum svn_repos_load_uuid uuid_action,
3487 const char *parent_dir,
3488 svn_boolean_t use_pre_commit_hook,
3489 svn_boolean_t use_post_commit_hook,
3490 svn_boolean_t validate_props,
3491 svn_boolean_t ignore_dates,
3492 svn_boolean_t normalize_props,
3493 svn_repos_notify_func_t notify_func,
3495 svn_cancel_func_t cancel_func,
3500 * Similar to svn_repos_load_fs6(), but with the @a normalize_props
3501 * parameter always set to @c FALSE.
3503 * @since New in 1.9.
3504 * @deprecated Provided for backward compatibility with the 1.9 API.
3508 svn_repos_load_fs5(svn_repos_t *repos,
3509 svn_stream_t *dumpstream,
3510 svn_revnum_t start_rev,
3511 svn_revnum_t end_rev,
3512 enum svn_repos_load_uuid uuid_action,
3513 const char *parent_dir,
3514 svn_boolean_t use_pre_commit_hook,
3515 svn_boolean_t use_post_commit_hook,
3516 svn_boolean_t validate_props,
3517 svn_boolean_t ignore_dates,
3518 svn_repos_notify_func_t notify_func,
3520 svn_cancel_func_t cancel_func,
3524 /** Similar to svn_repos_load_fs5(), but with @a ignore_dates
3525 * always passed as FALSE.
3527 * @since New in 1.8.
3528 * @deprecated Provided for backward compatibility with the 1.8 API.
3532 svn_repos_load_fs4(svn_repos_t *repos,
3533 svn_stream_t *dumpstream,
3534 svn_revnum_t start_rev,
3535 svn_revnum_t end_rev,
3536 enum svn_repos_load_uuid uuid_action,
3537 const char *parent_dir,
3538 svn_boolean_t use_pre_commit_hook,
3539 svn_boolean_t use_post_commit_hook,
3540 svn_boolean_t validate_props,
3541 svn_repos_notify_func_t notify_func,
3543 svn_cancel_func_t cancel_func,
3547 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
3548 * end_rev always passed as #SVN_INVALID_REVNUM.
3550 * @since New in 1.7.
3551 * @deprecated Provided for backward compatibility with the 1.7 API.
3555 svn_repos_load_fs3(svn_repos_t *repos,
3556 svn_stream_t *dumpstream,
3557 enum svn_repos_load_uuid uuid_action,
3558 const char *parent_dir,
3559 svn_boolean_t use_pre_commit_hook,
3560 svn_boolean_t use_post_commit_hook,
3561 svn_boolean_t validate_props,
3562 svn_repos_notify_func_t notify_func,
3564 svn_cancel_func_t cancel_func,
3569 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
3570 * place of the #svn_repos_notify_func_t and baton and with
3571 * @a validate_props always FALSE.
3573 * @since New in 1.2.
3574 * @deprecated Provided for backward compatibility with the 1.6 API.
3578 svn_repos_load_fs2(svn_repos_t *repos,
3579 svn_stream_t *dumpstream,
3580 svn_stream_t *feedback_stream,
3581 enum svn_repos_load_uuid uuid_action,
3582 const char *parent_dir,
3583 svn_boolean_t use_pre_commit_hook,
3584 svn_boolean_t use_post_commit_hook,
3585 svn_cancel_func_t cancel_func,
3590 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
3591 * @a use_post_commit_hook always @c FALSE.
3593 * @deprecated Provided for backward compatibility with the 1.1 API.
3597 svn_repos_load_fs(svn_repos_t *repos,
3598 svn_stream_t *dumpstream,
3599 svn_stream_t *feedback_stream,
3600 enum svn_repos_load_uuid uuid_action,
3601 const char *parent_dir,
3602 svn_cancel_func_t cancel_func,
3607 * Read and parse dumpfile-formatted @a dumpstream, extracting the
3608 * revision properties from it and apply them to the already-open
3609 * @a repos. Use @a scratch_pool for temporary allocations.
3611 * If, after filtering by the @a start_rev and @a end_rev, the dumpstream
3612 * contains revisions missing in @a repos, an error will be thrown.
3614 * @a start_rev and @a end_rev act as filters, the lower and upper
3615 * (inclusive) range values of revisions in @a dumpstream which will
3616 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
3617 * which case no revision-based filtering occurs at all), or both are
3618 * valid revisions (where @a start_rev is older than or equivalent to
3621 * If @a validate_props is set, then validate Subversion revision
3622 * properties (those in the svn: namespace) against established
3623 * rules for those things.
3625 * If @a ignore_dates is set, ignore any revision datestamps found in
3626 * @a dumpstream, keeping whatever timestamps the revisions currently
3629 * If @a normalize_props is set, attempt to normalize invalid Subversion
3630 * revision and node properties (those in the svn: namespace) so that
3631 * their values would follow the established rules for them. For example,
3632 * for such properties, typically the value must be in UTF-8 with LF
3635 * @note The details or the performed normalizations are deliberately
3636 * left unspecified and may change in the future.
3638 * If non-NULL, use @a notify_func and @a notify_baton to send notification
3639 * of events to the caller.
3641 * If @a cancel_func is not @c NULL, it is called periodically with
3642 * @a cancel_baton as argument to see if the client wishes to cancel
3645 * @remark No repository hooks will be triggered.
3647 * @since New in 1.10.
3650 svn_repos_load_fs_revprops(svn_repos_t *repos,
3651 svn_stream_t *dumpstream,
3652 svn_revnum_t start_rev,
3653 svn_revnum_t end_rev,
3654 svn_boolean_t validate_props,
3655 svn_boolean_t ignore_dates,
3656 svn_boolean_t normalize_props,
3657 svn_repos_notify_func_t notify_func,
3659 svn_cancel_func_t cancel_func,
3661 apr_pool_t *scratch_pool);
3664 * A vtable that is driven by svn_repos_parse_dumpstream3().
3666 * @since New in 1.8.
3668 typedef struct svn_repos_parse_fns3_t
3670 /** The parser has discovered a new "magic header" record within the
3671 * parsing session represented by @a parse_baton. The dump-format
3672 * version number is @a version.
3674 svn_error_t *(*magic_header_record)(int version,
3678 /** The parser has discovered a new uuid record within the parsing
3679 * session represented by @a parse_baton. The uuid's value is
3680 * @a uuid, and it is allocated in @a pool.
3682 svn_error_t *(*uuid_record)(const char *uuid,
3686 /** The parser has discovered a new revision record within the
3687 * parsing session represented by @a parse_baton. All the headers are
3688 * placed in @a headers (allocated in @a pool), which maps <tt>const
3689 * char *</tt> header-name ==> <tt>const char *</tt> header-value.
3690 * The @a revision_baton received back (also allocated in @a pool)
3691 * represents the revision.
3693 svn_error_t *(*new_revision_record)(void **revision_baton,
3694 apr_hash_t *headers,
3698 /** The parser has discovered a new node record within the current
3699 * revision represented by @a revision_baton. All the headers are
3700 * placed in @a headers (as with @c new_revision_record), allocated in
3701 * @a pool. The @a node_baton received back is allocated in @a pool
3702 * and represents the node.
3704 svn_error_t *(*new_node_record)(void **node_baton,
3705 apr_hash_t *headers,
3706 void *revision_baton,
3709 /** For a given @a revision_baton, set a property @a name to @a value. */
3710 svn_error_t *(*set_revision_property)(void *revision_baton,
3712 const svn_string_t *value);
3714 /** For a given @a node_baton, set a property @a name to @a value. */
3715 svn_error_t *(*set_node_property)(void *node_baton,
3717 const svn_string_t *value);
3719 /** For a given @a node_baton, delete property @a name. */
3720 svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
3722 /** For a given @a node_baton, remove all properties. */
3723 svn_error_t *(*remove_node_props)(void *node_baton);
3725 /** For a given @a node_baton, set @a stream to a writable stream
3726 * capable of receiving the node's fulltext. The parser will write
3727 * the fulltext to the stream and then close the stream to signal
3730 * If a @c NULL is returned instead of a stream, the vtable is
3731 * indicating that no text is desired, and the parser will not
3732 * attempt to send it.
3734 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3737 /** For a given @a node_baton, set @a handler and @a handler_baton
3738 * to a window handler and baton capable of receiving a delta
3739 * against the node's previous contents. The parser will send all
3740 * the windows of data to this handler, and will then send a NULL
3741 * window to signal completion.
3743 * If a @c NULL is returned instead of a handler, the vtable is
3744 * indicating that no delta is desired, and the parser will not
3745 * attempt to send it.
3747 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3748 void **handler_baton,
3751 /** The parser has reached the end of the current node represented by
3752 * @a node_baton, it can be freed.
3754 svn_error_t *(*close_node)(void *node_baton);
3756 /** The parser has reached the end of the current revision
3757 * represented by @a revision_baton. In other words, there are no more
3758 * changed nodes within the revision. The baton can be freed.
3760 svn_error_t *(*close_revision)(void *revision_baton);
3762 } svn_repos_parse_fns3_t;
3766 * Read and parse dumpfile-formatted @a stream, calling callbacks in
3767 * @a parse_fns/@a parse_baton, and using @a pool for allocations.
3769 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
3770 * set_fulltext callback. This is useful when manipulating a dump
3771 * stream without loading it. Otherwise handle text-deltas with the
3772 * @a apply_textdelta callback.
3774 * If @a cancel_func is not @c NULL, it is called periodically with
3775 * @a cancel_baton as argument to see if the client wishes to cancel
3778 * This parser has built-in knowledge of the dumpfile format, but only
3779 * in a limited sense:
3781 * * it recognizes the "magic" format-version header.
3783 * * it recognizes the UUID header.
3785 * * it recognizes revision and node records by looking for either
3786 * a REVISION_NUMBER or NODE_PATH headers.
3788 * * it recognizes the CONTENT-LENGTH headers, so it knows if and
3789 * how to suck up the content body.
3791 * * it knows how to parse a content body into two parts: props
3792 * and text, and pass the pieces to the vtable.
3794 * This is enough knowledge to make it easy on vtable implementors,
3795 * but still allow expansion of the format: most headers do not have
3796 * to be handled explicitly.
3798 * ### [JAF] Wouldn't it be more efficient to support a start/end rev
3799 * range here than only supporting it in receivers such as
3800 * svn_repos_get_fs_build_parser4()? This parser could then skip over
3801 * chunks of the input stream before the oldest required rev, and
3802 * could stop reading entirely after the youngest required rev.
3804 * @since New in 1.8.
3806 * @since Starting in 1.10, @a parse_fns may contain #NULL pointers for
3807 * those callbacks that the caller is not interested in.
3810 svn_repos_parse_dumpstream3(svn_stream_t *stream,
3811 const svn_repos_parse_fns3_t *parse_fns,
3813 svn_boolean_t deltas_are_text,
3814 svn_cancel_func_t cancel_func,
3820 * Set @a *parser and @a *parse_baton to a vtable parser which commits new
3821 * revisions to the fs in @a repos. The constructed parser will treat
3822 * UUID records in a manner consistent with @a uuid_action. Use @a pool
3823 * to operate on the fs.
3825 * @a start_rev and @a end_rev act as filters, the lower and upper
3826 * (inclusive) range values of revisions which will
3827 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
3828 * which case no revision-based filtering occurs at all), or both are
3829 * valid revisions (where @a start_rev is older than or equivalent to
3830 * @a end_rev). They refer to dump stream revision numbers rather than
3831 * committed revision numbers.
3833 * If @a use_history is true, then when the parser encounters a node that
3834 * is added-with-history, it will require 'copy-from' history to exist in
3835 * the repository at the relative (adjusted) copy-from revision and path.
3836 * It will perform a copy from that source location, and will fail if no
3837 * suitable source exists there. If @a use_history is false, then it will
3838 * instead convert every copy to a plain add.
3840 * ### The 'use_history=FALSE' case is unused and untested in Subversion.
3841 * It seems to me it would not work with a deltas dumpfile (a driver
3842 * that calls the @c apply_textdelta method), as it would not have
3843 * access to the delta base text.
3845 * If @a use_pre_commit_hook is set, call the repository's pre-commit
3846 * hook before committing each loaded revision.
3848 * If @a use_post_commit_hook is set, call the repository's
3849 * post-commit hook after committing each loaded revision.
3851 * If @a validate_props is set, then validate Subversion revision and
3852 * node properties (those in the svn: namespace) against established
3853 * rules for those things.
3855 * If @a ignore_dates is set, ignore any revision datestamps found in
3856 * @a dumpstream, allowing the revisions created by the load process
3857 * to be stamped as if they were newly created via the normal commit
3860 * If @a normalize_props is set, attempt to normalize invalid Subversion
3861 * revision and node properties (those in the svn: namespace) so that
3862 * their values would follow the established rules for them. For example,
3863 * for such properties, typically the value must be in UTF-8 with LF
3866 * @note The details or the performed normalizations are deliberately
3867 * left unspecified and may change in the future.
3869 * If @a parent_dir is not NULL, then the parser will reparent all the
3870 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
3871 * must be an existing directory in the repository.
3873 * @since New in 1.10.
3876 svn_repos_get_fs_build_parser6(const svn_repos_parse_fns3_t **parser,
3879 svn_revnum_t start_rev,
3880 svn_revnum_t end_rev,
3881 svn_boolean_t use_history,
3882 svn_boolean_t validate_props,
3883 enum svn_repos_load_uuid uuid_action,
3884 const char *parent_dir,
3885 svn_boolean_t use_pre_commit_hook,
3886 svn_boolean_t use_post_commit_hook,
3887 svn_boolean_t ignore_dates,
3888 svn_boolean_t normalize_props,
3889 svn_repos_notify_func_t notify_func,
3894 * Similar to svn_repos_get_fs_build_parser6(), but with the
3895 * @a normalize_props parameter always set to @c FALSE.
3897 * @since New in 1.9.
3898 * @deprecated Provided for backward compatibility with the 1.9 API.
3902 svn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser,
3905 svn_revnum_t start_rev,
3906 svn_revnum_t end_rev,
3907 svn_boolean_t use_history,
3908 svn_boolean_t validate_props,
3909 enum svn_repos_load_uuid uuid_action,
3910 const char *parent_dir,
3911 svn_boolean_t use_pre_commit_hook,
3912 svn_boolean_t use_post_commit_hook,
3913 svn_boolean_t ignore_dates,
3914 svn_repos_notify_func_t notify_func,
3919 * Similar to svn_repos_get_fs_build_parser5(), but with the
3920 * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates
3921 * arguments all false.
3923 * @since New in 1.8.
3924 * @deprecated Provided for backward compatibility with the 1.8 API.
3928 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
3931 svn_revnum_t start_rev,
3932 svn_revnum_t end_rev,
3933 svn_boolean_t use_history,
3934 svn_boolean_t validate_props,
3935 enum svn_repos_load_uuid uuid_action,
3936 const char *parent_dir,
3937 svn_repos_notify_func_t notify_func,
3944 * A vtable that is driven by svn_repos_parse_dumpstream2().
3945 * Similar to #svn_repos_parse_fns3_t except that it lacks
3946 * the magic_header_record callback.
3948 * @deprecated Provided for backward compatibility with the 1.7 API.
3950 typedef struct svn_repos_parse_fns2_t
3952 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
3953 svn_error_t *(*new_revision_record)(void **revision_baton,
3954 apr_hash_t *headers,
3957 /** Same as #svn_repos_parse_fns3_t.uuid_record. */
3958 svn_error_t *(*uuid_record)(const char *uuid,
3961 /** Same as #svn_repos_parse_fns3_t.new_node_record. */
3962 svn_error_t *(*new_node_record)(void **node_baton,
3963 apr_hash_t *headers,
3964 void *revision_baton,
3966 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
3967 svn_error_t *(*set_revision_property)(void *revision_baton,
3969 const svn_string_t *value);
3970 /** Same as #svn_repos_parse_fns3_t.set_node_property. */
3971 svn_error_t *(*set_node_property)(void *node_baton,
3973 const svn_string_t *value);
3974 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
3975 svn_error_t *(*delete_node_property)(void *node_baton,
3977 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
3978 svn_error_t *(*remove_node_props)(void *node_baton);
3979 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
3980 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3982 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
3983 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3984 void **handler_baton,
3986 /** Same as #svn_repos_parse_fns3_t.close_node. */
3987 svn_error_t *(*close_node)(void *node_baton);
3988 /** Same as #svn_repos_parse_fns3_t.close_revision. */
3989 svn_error_t *(*close_revision)(void *revision_baton);
3990 } svn_repos_parse_fns2_t;
3992 /** @deprecated Provided for backward compatibility with the 1.7 API. */
3993 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
3997 * A vtable that is driven by svn_repos_parse_dumpstream().
3998 * Similar to #svn_repos_parse_fns2_t except that it lacks
3999 * the delete_node_property and apply_textdelta callbacks.
4001 * @deprecated Provided for backward compatibility with the 1.0 API.
4003 typedef struct svn_repos_parse_fns_t
4005 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
4006 svn_error_t *(*new_revision_record)(void **revision_baton,
4007 apr_hash_t *headers,
4010 /** Same as #svn_repos_parse_fns2_t.uuid_record. */
4011 svn_error_t *(*uuid_record)(const char *uuid,
4014 /** Same as #svn_repos_parse_fns2_t.new_node_record. */
4015 svn_error_t *(*new_node_record)(void **node_baton,
4016 apr_hash_t *headers,
4017 void *revision_baton,
4019 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
4020 svn_error_t *(*set_revision_property)(void *revision_baton,
4022 const svn_string_t *value);
4023 /** Same as #svn_repos_parse_fns2_t.set_node_property. */
4024 svn_error_t *(*set_node_property)(void *node_baton,
4026 const svn_string_t *value);
4027 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
4028 svn_error_t *(*remove_node_props)(void *node_baton);
4029 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
4030 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
4032 /** Same as #svn_repos_parse_fns2_t.close_node. */
4033 svn_error_t *(*close_node)(void *node_baton);
4034 /** Same as #svn_repos_parse_fns2_t.close_revision. */
4035 svn_error_t *(*close_revision)(void *revision_baton);
4036 } svn_repos_parser_fns_t;
4040 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
4041 * #svn_repos_parser_fns2_t vtable type.
4043 * @deprecated Provided for backward compatibility with the 1.7 API.
4047 svn_repos_parse_dumpstream2(svn_stream_t *stream,
4048 const svn_repos_parser_fns2_t *parse_fns,
4050 svn_cancel_func_t cancel_func,
4055 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
4056 * #svn_repos_parser_fns_t vtable type.
4058 * @deprecated Provided for backward compatibility with the 1.0 API.
4062 svn_repos_parse_dumpstream(svn_stream_t *stream,
4063 const svn_repos_parser_fns_t *parse_fns,
4065 svn_cancel_func_t cancel_func,
4070 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
4071 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
4072 * the more limited svn_repos_parse_fns2_t.
4074 * @since New in 1.7.
4075 * @deprecated Provided for backward compatibility with the 1.7 API.
4079 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
4082 svn_boolean_t use_history,
4083 svn_boolean_t validate_props,
4084 enum svn_repos_load_uuid uuid_action,
4085 const char *parent_dir,
4086 svn_repos_notify_func_t notify_func,
4091 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
4092 * in place if a #svn_repos_notify_func_t and baton and with
4093 * @a validate_props always FALSE.
4095 * @since New in 1.1.
4096 * @deprecated Provided for backward compatibility with the 1.6 API.
4100 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
4103 svn_boolean_t use_history,
4104 enum svn_repos_load_uuid uuid_action,
4105 svn_stream_t *outstream,
4106 const char *parent_dir,
4110 * Similar to svn_repos_get_fs_build_parser2(), but yields the more
4111 * limited svn_repos_parser_fns_t vtable type.
4113 * @deprecated Provided for backward compatibility with the 1.0 API.
4117 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
4120 svn_boolean_t use_history,
4121 enum svn_repos_load_uuid uuid_action,
4122 svn_stream_t *outstream,
4123 const char *parent_dir,
4129 /** A data type which stores the authz information.
4131 * @since New in 1.3.
4133 typedef struct svn_authz_t svn_authz_t;
4136 * This should be called before any other authz function.
4138 * @a pool must support multi-threaded access if the application will use
4139 * authz from multiple threads.
4141 * @since New in 1.10.
4144 svn_repos_authz_initialize(apr_pool_t *pool);
4147 * Read authz configuration data from @a path (a dirent, an absolute file url
4148 * or a registry path) into @a *authz_p, allocated in @a pool.
4150 * If @a groups_path (a dirent, an absolute file url, or a registry path) is
4151 * set, use the global groups parsed from it.
4153 * If @a path or @a groups_path is not a valid authz rule file, then return
4154 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then
4155 * undefined. If @a must_exist is TRUE, a missing authz or groups file
4156 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
4157 * depends on the access type).
4159 * For efficient access of in-repository authz, you may provide @a repos_hint
4160 * which will be tried first and may remove the need to open a temporary
4161 * repository instance. Otherwise, set it to NULL and the repositories will
4162 * be opened as needed.
4164 * @since New in 1.10.
4167 svn_repos_authz_read3(svn_authz_t **authz_p,
4169 const char *groups_path,
4170 svn_boolean_t must_exist,
4171 svn_repos_t *repos_hint,
4172 apr_pool_t *result_pool,
4173 apr_pool_t *scratch_pool);
4176 * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL.
4178 * @since New in 1.8.
4179 * @deprecated Provided for backward compatibility with the 1.9 API.
4183 svn_repos_authz_read2(svn_authz_t **authz_p,
4185 const char *groups_path,
4186 svn_boolean_t must_exist,
4191 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
4192 * repos_root always passed as @c NULL.
4194 * @since New in 1.3.
4195 * @deprecated Provided for backward compatibility with the 1.7 API.
4199 svn_repos_authz_read(svn_authz_t **authz_p,
4201 svn_boolean_t must_exist,
4205 * Read authz configuration data from @a stream into @a *authz_p,
4206 * allocated in @a pool.
4208 * If @a groups_stream is set, use the global groups parsed from it.
4210 * @since New in 1.8.
4213 svn_repos_authz_parse(svn_authz_t **authz_p,
4214 svn_stream_t *stream,
4215 svn_stream_t *groups_stream,
4219 * Check whether @a user can access @a path in the repository @a
4220 * repos_name with the @a required_access. @a authz lists the ACLs to
4221 * check against. Set @a *access_granted to indicate if the requested
4222 * access is granted.
4224 * If @a path is NULL, then check whether @a user has the @a
4225 * required_access anywhere in the repository. Set @a *access_granted
4226 * to TRUE if at least one path is accessible with the @a
4229 * For compatibility with 1.6, and earlier, @a repos_name can be NULL
4230 * in which case it is equivalent to a @a repos_name of "".
4232 * @note Presently, @a repos_name must byte-for-byte match the repos_name
4233 * specified in the authz file; it is treated as an opaque string, and not
4236 * @since New in 1.3.
4239 svn_repos_authz_check_access(svn_authz_t *authz,
4240 const char *repos_name,
4243 svn_repos_authz_access_t required_access,
4244 svn_boolean_t *access_granted,
4249 /** Revision Access Levels
4251 * Like most version control systems, access to versioned objects in
4252 * Subversion is determined on primarily path-based system. Users either
4253 * do or don't have the ability to read a given path.
4255 * However, unlike many version control systems where versioned objects
4256 * maintain their own distinct version information (revision numbers,
4257 * authors, log messages, change timestamps, etc.), Subversion binds
4258 * multiple paths changed as part of a single commit operation into a
4259 * set, calls the whole thing a revision, and hangs commit metadata
4260 * (author, date, log message, etc.) off of that revision. So, commit
4261 * metadata is shared across all the paths changed as part of a given
4264 * It is common (or, at least, we hope it is) for log messages to give
4265 * detailed information about changes made in the commit to which the log
4266 * message is attached. Such information might include a mention of all
4267 * the files changed, what was changed in them, and so on. But this
4268 * causes a problem when presenting information to readers who aren't
4269 * authorized to read every path in the repository. Simply knowing that
4270 * a given path exists may be a security leak, even if the user can't see
4271 * the contents of the data located at that path.
4273 * So Subversion does what it reasonably can to prevent the leak of this
4274 * information, and does so via a staged revision access policy. A
4275 * reader can be said to have one of three levels of access to a given
4276 * revision's metadata, based solely on the reader's access rights to the
4277 * paths changed or copied in that revision:
4279 * 'full access' -- Granted when the reader has access to all paths
4280 * changed or copied in the revision, or when no paths were
4281 * changed in the revision at all, this access level permits
4282 * full visibility of all revision property names and values,
4283 * and the full changed-paths information.
4285 * 'no access' -- Granted when the reader does not have access to any
4286 * paths changed or copied in the revision, this access level
4287 * denies the reader access to all revision properties and all
4288 * changed-paths information.
4290 * 'partial access' -- Granted when the reader has access to at least
4291 * one, but not all, of the paths changed or copied in the revision,
4292 * this access level permits visibility of the svn:date and
4293 * svn:author revision properties and only the paths of the
4294 * changed-paths information to which the reader has access.
4299 /** An enum defining levels of revision access.
4301 * @since New in 1.5.
4303 typedef enum svn_repos_revision_access_level_t
4305 /** no access allowed to the revision properties and all changed-paths
4307 svn_repos_revision_access_none,
4308 /** access granted to some (svn:date and svn:author) revision properties and
4309 * changed-paths information on paths the read has access to. */
4310 svn_repos_revision_access_partial,
4311 /** access granted to all revision properites and changed-paths
4313 svn_repos_revision_access_full
4315 svn_repos_revision_access_level_t;
4319 * Set @a access to the access level granted for @a revision in @a
4320 * repos, as determined by consulting the @a authz_read_func callback
4321 * function and its associated @a authz_read_baton.
4323 * @a authz_read_func may be @c NULL, in which case @a access will be
4324 * set to #svn_repos_revision_access_full.
4326 * @since New in 1.5.
4329 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
4331 svn_revnum_t revision,
4332 svn_repos_authz_func_t authz_read_func,
4333 void *authz_read_baton,
4339 #endif /* __cplusplus */
4341 #endif /* SVN_REPOS_H */