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
69 /** The different policies for processing the UUID in the dumpfile. */
70 enum svn_repos_load_uuid
72 /** only update uuid if the repos has no revisions. */
73 svn_repos_load_uuid_default,
74 /** never update uuid. */
75 svn_repos_load_uuid_ignore,
76 /** always update uuid. */
77 svn_repos_load_uuid_force
81 /** Callback type for checking authorization on paths produced by (at
82 * least) svn_repos_dir_delta2().
84 * Set @a *allowed to TRUE to indicate that some operation is
85 * authorized for @a path in @a root, or set it to FALSE to indicate
86 * unauthorized (presumably according to state stored in @a baton).
88 * Do not assume @a pool has any lifetime beyond this call.
90 * The exact operation being authorized depends on the callback
91 * implementation. For read authorization, for example, the caller
92 * would implement an instance that does read checking, and pass it as
93 * a parameter named [perhaps] 'authz_read_func'. The receiver of
94 * that parameter might also take another parameter named
95 * 'authz_write_func', which although sharing this type, would be a
96 * different implementation.
98 * @note If someday we want more sophisticated authorization states
99 * than just yes/no, @a allowed can become an enum type.
101 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
108 /** An enum defining the kinds of access authz looks up.
112 typedef enum svn_repos_authz_access_t
117 /** Path can be read. */
120 /** Path can be altered. */
123 /** The other access credentials are recursive. */
124 svn_authz_recursive = 4
125 } svn_repos_authz_access_t;
128 /** Callback type for checking authorization on paths produced by
129 * the repository commit editor.
131 * Set @a *allowed to TRUE to indicate that the @a required access on
132 * @a path in @a root is authorized, or set it to FALSE to indicate
133 * unauthorized (presumable according to state stored in @a baton).
135 * If @a path is NULL, the callback should perform a global authz
136 * lookup for the @a required access. That is, the lookup should
137 * check if the @a required access is granted for at least one path of
138 * the repository, and set @a *allowed to TRUE if so. @a root may
139 * also be NULL if @a path is NULL.
141 * This callback is very similar to svn_repos_authz_func_t, with the
142 * exception of the addition of the @a required parameter.
143 * This is due to historical reasons: when authz was first implemented
144 * for svn_repos_dir_delta2(), it seemed there would need only checks
145 * for read and write operations, hence the svn_repos_authz_func_t
146 * callback prototype and usage scenario. But it was then realized
147 * that lookups due to copying needed to be recursive, and that
148 * brute-force recursive lookups didn't square with the O(1)
149 * performances a copy operation should have.
151 * So a special way to ask for a recursive lookup was introduced. The
152 * commit editor needs this capability to retain acceptable
153 * performance. Instead of revving the existing callback, causing
154 * unnecessary revving of functions that don't actually need the
155 * extended functionality, this second, more complete callback was
156 * introduced, for use by the commit editor.
158 * Some day, it would be nice to reunite these two callbacks and do
159 * the necessary revving anyway, but for the time being, this dual
160 * callback mechanism will do.
162 typedef svn_error_t *(*svn_repos_authz_callback_t)
163 (svn_repos_authz_access_t required,
164 svn_boolean_t *allowed,
171 * Similar to #svn_file_rev_handler_t, but without the @a
172 * result_of_merge parameter.
174 * @deprecated Provided for backward compatibility with 1.4 API.
177 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
181 apr_hash_t *rev_props,
182 svn_txdelta_window_handler_t *delta_handler,
184 apr_array_header_t *prop_diffs,
188 /* Notification system. */
190 /** The type of action occurring.
194 typedef enum svn_repos_notify_action_t
196 /** A warning message is waiting. */
197 svn_repos_notify_warning = 0,
199 /** A revision has finished being dumped. */
200 svn_repos_notify_dump_rev_end,
202 /** A revision has finished being verified. */
203 svn_repos_notify_verify_rev_end,
205 /** All revisions have finished being dumped. */
206 svn_repos_notify_dump_end,
208 /** All revisions have finished being verified. */
209 svn_repos_notify_verify_end,
211 /** packing of an FSFS shard has commenced */
212 svn_repos_notify_pack_shard_start,
214 /** packing of an FSFS shard is completed */
215 svn_repos_notify_pack_shard_end,
217 /** packing of the shard revprops has commenced */
218 svn_repos_notify_pack_shard_start_revprop,
220 /** packing of the shard revprops has completed */
221 svn_repos_notify_pack_shard_end_revprop,
223 /** A revision has begun loading */
224 svn_repos_notify_load_txn_start,
226 /** A revision has finished loading */
227 svn_repos_notify_load_txn_committed,
229 /** A node has begun loading */
230 svn_repos_notify_load_node_start,
232 /** A node has finished loading */
233 svn_repos_notify_load_node_done,
235 /** A copied node has been encountered */
236 svn_repos_notify_load_copied_node,
238 /** Mergeinfo has been normalized */
239 svn_repos_notify_load_normalized_mergeinfo,
241 /** The operation has acquired a mutex for the repo. */
242 svn_repos_notify_mutex_acquired,
244 /** Recover has started. */
245 svn_repos_notify_recover_start,
247 /** Upgrade has started. */
248 svn_repos_notify_upgrade_start,
250 /** A revision was skipped during loading. @since New in 1.8. */
251 svn_repos_notify_load_skipped_rev,
253 /** The structure of a revision is being verified. @since New in 1.8. */
254 svn_repos_notify_verify_rev_structure
256 } svn_repos_notify_action_t;
258 /** The type of error occurring.
262 typedef enum svn_repos_notify_warning_t
264 /** Referencing copy source data from a revision earlier than the
265 * first revision dumped. */
266 svn_repos_notify_warning_found_old_reference,
268 /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a
269 * revision earlier than the first revision dumped. */
270 svn_repos_notify_warning_found_old_mergeinfo,
272 /** Found an invalid path in the filesystem.
273 * @see svn_fs.h:"Directory entry names and directory paths" */
274 /* ### TODO(doxygen): make that a proper doxygen link */
275 /* See svn_fs__path_valid(). */
276 svn_repos_notify_warning_invalid_fspath
278 } svn_repos_notify_warning_t;
281 * Structure used by #svn_repos_notify_func_t.
283 * The only field guaranteed to be populated is @c action. Other fields are
284 * dependent upon the @c action. (See individual fields for more information.)
286 * @note Callers of notification functions should use
287 * svn_repos_notify_create() to create structures of this type to allow for
288 * future extensibility.
292 typedef struct svn_repos_notify_t
294 /** Action that describes what happened in the repository. */
295 svn_repos_notify_action_t action;
297 /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
298 * the revision which just completed. */
299 svn_revnum_t revision;
301 /** For #svn_repos_notify_warning, the warning object. Must be cleared
302 by the consumer of the notification. */
303 const char *warning_str;
304 svn_repos_notify_warning_t warning;
306 /** For #svn_repos_notify_pack_shard_start,
307 #svn_repos_notify_pack_shard_end,
308 #svn_repos_notify_pack_shard_start_revprop, and
309 #svn_repos_notify_pack_shard_end_revprop, the shard processed. */
312 /** For #svn_repos_notify_load_node_done, the revision committed. */
313 svn_revnum_t new_revision;
315 /** For #svn_repos_notify_load_node_done, the source revision, if
316 different from @a new_revision, otherwise #SVN_INVALID_REVNUM.
317 For #svn_repos_notify_load_txn_start, the source revision. */
318 svn_revnum_t old_revision;
320 /** For #svn_repos_notify_load_node_start, the action being taken on the
322 enum svn_node_action node_action;
324 /** For #svn_repos_notify_load_node_start, the path of the node. */
327 /* NOTE: Add new fields at the end to preserve binary compatibility.
328 Also, if you add fields here, you have to update
329 svn_repos_notify_create(). */
330 } svn_repos_notify_t;
332 /** Callback for providing notification from the repository.
333 * Returns @c void. Justification: success of an operation is not dependent
334 * upon successful notification of that operation.
336 * @since New in 1.7. */
337 typedef void (*svn_repos_notify_func_t)(void *baton,
338 const svn_repos_notify_t *notify,
339 apr_pool_t *scratch_pool);
342 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
348 svn_repos_notify_create(svn_repos_notify_action_t action,
349 apr_pool_t *result_pool);
352 /** The repository object. */
353 typedef struct svn_repos_t svn_repos_t;
355 /* Opening and creating repositories. */
358 /** Find the root path of the repository that contains @a path.
360 * If a repository was found, the path to the root of the repository
361 * is returned, else @c NULL. The pointer to the returned path may be
365 svn_repos_find_root_path(const char *path,
368 /** Set @a *repos_p to a repository object for the repository at @a path.
370 * Allocate @a *repos_p in @a pool.
372 * Acquires a shared lock on the repository, and attaches a cleanup
373 * function to @a pool to remove the lock. If no lock can be acquired,
374 * returns error, with undefined effect on @a *repos_p. If an exclusive
375 * lock is present, this blocks until it's gone. @a fs_config will be
376 * passed to the filesystem initialization function and may be @c NULL.
381 svn_repos_open2(svn_repos_t **repos_p,
383 apr_hash_t *fs_config,
386 /** Similar to svn_repos_open2() with @a fs_config set to NULL.
388 * @deprecated Provided for backward compatibility with 1.6 API.
392 svn_repos_open(svn_repos_t **repos_p,
396 /** Create a new Subversion repository at @a path, building the necessary
397 * directory structure, creating the filesystem, and so on.
398 * Return the repository object in @a *repos_p, allocated in @a pool.
400 * @a config is a client configuration hash of #svn_config_t * items
401 * keyed on config category names, and may be NULL.
403 * @a fs_config is passed to the filesystem, and may be NULL.
405 * @a unused_1 and @a unused_2 are not used and should be NULL.
408 svn_repos_create(svn_repos_t **repos_p,
410 const char *unused_1,
411 const char *unused_2,
413 apr_hash_t *fs_config,
417 * Upgrade the Subversion repository (and its underlying versioned
418 * filesystem) located in the directory @a path to the latest version
419 * supported by this library. If the requested upgrade is not
420 * supported due to the current state of the repository or it
421 * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
422 * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
423 * changes to the repository or filesystem.
425 * Acquires an exclusive lock on the repository, upgrades the
426 * repository, and releases the lock. If an exclusive lock can't be
427 * acquired, returns error.
429 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
430 * returned if the lock is not immediately available.
432 * If @a start_callback is not NULL, it will be called with @a
433 * start_callback_baton as argument before the upgrade starts, but
434 * after the exclusive lock has been acquired.
436 * Use @a pool for necessary allocations.
438 * @note This functionality is provided as a convenience for
439 * administrators wishing to make use of new Subversion functionality
440 * without a potentially costly full repository dump/load. As such,
441 * the operation performs only the minimum amount of work needed to
442 * accomplish this while maintaining the integrity of the repository.
443 * It does *not* guarantee the most optimized repository state as a
444 * dump and subsequent load would.
446 * @note On some platforms the exclusive lock does not exclude other
447 * threads in the same process so this function should only be called
448 * by a single threaded process, or by a multi-threaded process when
449 * no other threads are accessing the repository.
454 svn_repos_upgrade2(const char *path,
455 svn_boolean_t nonblocking,
456 svn_repos_notify_func_t notify_func,
461 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
462 * rather than a notify_callback / baton
465 * @deprecated Provided for backward compatibility with the 1.6 API.
469 svn_repos_upgrade(const char *path,
470 svn_boolean_t nonblocking,
471 svn_error_t *(*start_callback)(void *baton),
472 void *start_callback_baton,
475 /** Destroy the Subversion repository found at @a path, using @a pool for any
476 * necessary allocations.
479 svn_repos_delete(const char *path,
483 * Set @a *has to TRUE if @a repos has @a capability (one of the
484 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
487 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
488 * with the effect on @a *has undefined.
490 * Use @a pool for all allocation.
495 svn_repos_has_capability(svn_repos_t *repos,
497 const char *capability,
503 * The capability of doing the right thing with merge-tracking
504 * information, both storing it and responding to queries about it.
508 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
509 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
511 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
512 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
513 * colons for their own reasons. While this RA limitation has no
514 * direct impact on repository capabilities, there's no reason to be
515 * gratuitously different either.
517 * If you add a capability, update svn_repos_capabilities().
521 /** Return the filesystem associated with repository object @a repos. */
523 svn_repos_fs(svn_repos_t *repos);
526 /** Make a hot copy of the Subversion repository found at @a src_path
529 * Copy a possibly live Subversion repository from @a src_path to
530 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the
531 * source filesystem as part of the copy operation; currently, this
532 * means deleting copied, unused logfiles for a Berkeley DB source
535 * If @a incremental is TRUE, make an effort to not re-copy information
536 * already present in the destination. If incremental hotcopy is not
537 * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
542 svn_repos_hotcopy2(const char *src_path,
543 const char *dst_path,
544 svn_boolean_t clean_logs,
545 svn_boolean_t incremental,
546 svn_cancel_func_t cancel_func,
551 * Like svn_repos_hotcopy2(), but with @a incremental always passed as
552 * @c FALSE and without cancellation support.
554 * @deprecated Provided for backward compatibility with the 1.6 API.
558 svn_repos_hotcopy(const char *src_path,
559 const char *dst_path,
560 svn_boolean_t clean_logs,
565 * Possibly update the repository, @a repos, to use a more efficient
566 * filesystem representation. Use @a pool for allocations.
571 svn_repos_fs_pack2(svn_repos_t *repos,
572 svn_repos_notify_func_t notify_func,
574 svn_cancel_func_t cancel_func,
579 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
580 * of a #svn_repos_notify_t.
583 * @deprecated Provided for backward compatibility with the 1.6 API.
587 svn_repos_fs_pack(svn_repos_t *repos,
588 svn_fs_pack_notify_t notify_func,
590 svn_cancel_func_t cancel_func,
595 * Run database recovery procedures on the repository at @a path,
596 * returning the database to a consistent state. Use @a pool for all
599 * Acquires an exclusive lock on the repository, recovers the
600 * database, and releases the lock. If an exclusive lock can't be
601 * acquired, returns error.
603 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
604 * returned if the lock is not immediately available.
606 * If @a notify_func is not NULL, it will be called with @a
607 * notify_baton as argument before the recovery starts, but
608 * after the exclusive lock has been acquired.
610 * If @a cancel_func is not @c NULL, it is called periodically with
611 * @a cancel_baton as argument to see if the client wishes to cancel
614 * @note On some platforms the exclusive lock does not exclude other
615 * threads in the same process so this function should only be called
616 * by a single threaded process, or by a multi-threaded process when
617 * no other threads are accessing the repository.
622 svn_repos_recover4(const char *path,
623 svn_boolean_t nonblocking,
624 svn_repos_notify_func_t notify_func,
626 svn_cancel_func_t cancel_func,
631 * Similar to svn_repos_recover4(), but with @a start callback in place of
632 * the notify_func / baton.
635 * @deprecated Provided for backward compatibility with the 1.6 API.
639 svn_repos_recover3(const char *path,
640 svn_boolean_t nonblocking,
641 svn_error_t *(*start_callback)(void *baton),
642 void *start_callback_baton,
643 svn_cancel_func_t cancel_func,
648 * Similar to svn_repos_recover3(), but without cancellation support.
650 * @deprecated Provided for backward compatibility with the 1.4 API.
654 svn_repos_recover2(const char *path,
655 svn_boolean_t nonblocking,
656 svn_error_t *(*start_callback)(void *baton),
657 void *start_callback_baton,
661 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
662 * with no callbacks provided.
664 * @deprecated Provided for backward compatibility with the 1.0 API.
668 svn_repos_recover(const char *path,
672 * Callback for svn_repos_freeze.
676 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
679 * Take an exclusive lock on each of the repositories in @a paths to
680 * prevent commits and then while holding all the locks invoke @a
681 * freeze_func passing @a freeze_baton. Each repository may be readable by
682 * Subversion while frozen, or may be unreadable, depending on which
683 * FS backend the repository uses. Repositories are locked in the
684 * order in which they are specified in the array.
686 * @note On some platforms the exclusive lock does not exclude other
687 * threads in the same process so this function should only be called
688 * by a single threaded process, or by a multi-threaded process when
689 * no other threads are accessing the repositories.
694 svn_repos_freeze(apr_array_header_t *paths,
695 svn_repos_freeze_func_t freeze_func,
699 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
700 * returning log file paths relative to the root of the repository.
702 * @copydoc svn_fs_berkeley_logfiles()
705 svn_repos_db_logfiles(apr_array_header_t **logfiles,
707 svn_boolean_t only_unused,
712 /* Repository Paths */
714 /** Return the top-level repository path allocated in @a pool. */
716 svn_repos_path(svn_repos_t *repos,
719 /** Return the path to @a repos's filesystem directory, allocated in
723 svn_repos_db_env(svn_repos_t *repos,
726 /** Return path to @a repos's config directory, allocated in @a pool. */
728 svn_repos_conf_dir(svn_repos_t *repos,
731 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
733 svn_repos_svnserve_conf(svn_repos_t *repos,
736 /** Return path to @a repos's lock directory, allocated in @a pool. */
738 svn_repos_lock_dir(svn_repos_t *repos,
741 /** Return path to @a repos's db lockfile, allocated in @a pool. */
743 svn_repos_db_lockfile(svn_repos_t *repos,
746 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
748 svn_repos_db_logs_lockfile(svn_repos_t *repos,
751 /** Return the path to @a repos's hook directory, allocated in @a pool. */
753 svn_repos_hook_dir(svn_repos_t *repos,
756 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
758 svn_repos_start_commit_hook(svn_repos_t *repos,
761 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
763 svn_repos_pre_commit_hook(svn_repos_t *repos,
766 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
768 svn_repos_post_commit_hook(svn_repos_t *repos,
771 /** Return the path to @a repos's pre-revprop-change hook, allocated in
775 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
778 /** Return the path to @a repos's post-revprop-change hook, allocated in
782 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
786 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
788 * @since New in 1.2. */
790 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
792 svn_repos_pre_lock_hook(svn_repos_t *repos,
795 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
797 svn_repos_post_lock_hook(svn_repos_t *repos,
800 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
802 svn_repos_pre_unlock_hook(svn_repos_t *repos,
805 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
807 svn_repos_post_unlock_hook(svn_repos_t *repos,
810 /** Specify that Subversion should consult the configuration file
811 * located at @a hooks_env_path to determine how to setup the
812 * environment for hook scripts invoked for the repository @a repos.
813 * As a special case, if @a hooks_env_path is @c NULL, look for the
814 * file in its default location within the repository disk structure.
815 * If @a hooks_env_path is not absolute, it specifies a path relative
816 * to the parent of the file's default location.
818 * Use @a scratch_pool for temporary allocations.
820 * If this function is not called, or if the specified configuration
821 * file does not define any environment variables, hooks will run in
822 * an empty environment.
827 svn_repos_hooks_setenv(svn_repos_t *repos,
828 const char *hooks_env_path,
829 apr_pool_t *scratch_pool);
833 /* ---------------------------------------------------------------*/
835 /* Reporting the state of a working copy, for updates. */
839 * Construct and return a @a report_baton that will be passed to the
840 * other functions in this section to describe the state of a pre-existing
841 * tree (typically, a working copy). When the report is finished,
842 * @a editor/@a edit_baton will be driven in such a way as to transform the
843 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
844 * reported hierarchy to @a tgt_path.
846 * @a fs_base is the absolute path of the node in the filesystem at which
847 * the comparison should be rooted. @a target is a single path component,
848 * used to limit the scope of the report to a single entry of @a fs_base,
849 * or "" if all of @a fs_base itself is the main subject of the report.
851 * @a tgt_path and @a revnum is the fs path/revision pair that is the
852 * "target" of the delta. @a tgt_path should be provided only when
853 * the source and target paths of the report differ. That is, @a tgt_path
854 * should *only* be specified when specifying that the resultant editor
855 * drive be one that transforms the reported hierarchy into a pristine tree
856 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path
857 * will indicate that the editor should be driven in such a way as to
858 * transform the reported hierarchy to revision @a revnum, preserving the
859 * reported hierarchy.
861 * @a text_deltas instructs the driver of the @a editor to enable
862 * the generation of text deltas.
864 * @a ignore_ancestry instructs the driver to ignore node ancestry
865 * when determining how to transmit differences.
867 * @a send_copyfrom_args instructs the driver to send 'copyfrom'
868 * arguments to the editor's add_file() and add_directory() methods,
869 * whenever it deems feasible.
871 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
872 * avoid sending data through @a editor/@a edit_baton which is not
873 * authorized for transmission.
875 * @a zero_copy_limit controls the maximum size (in bytes) at which
876 * data blocks may be sent using the zero-copy code path. On that
877 * path, a number of in-memory copy operations have been eliminated to
878 * maximize throughput. However, until the whole block has been
879 * pushed to the network stack, other clients block, so be careful
880 * when using larger values here. Pass 0 for @a zero_copy_limit to
881 * disable this optimization altogether.
883 * @a note Never activate this optimization if @a editor might access
884 * any FSFS data structures (and, hence, caches). So, it is basically
885 * safe for networked editors only.
887 * All allocation for the context and collected state will occur in
890 * @a depth is the requested depth of the editor drive.
892 * If @a depth is #svn_depth_unknown, the editor will affect only the
893 * paths reported by the individual calls to svn_repos_set_path3() and
894 * svn_repos_link_path3().
896 * For example, if the reported tree is the @c A subdir of the Greek Tree
897 * (see Subversion's test suite), at depth #svn_depth_empty, but the
898 * @c A/B subdir is reported at depth #svn_depth_infinity, then
899 * repository-side changes to @c A/mu, or underneath @c A/C and @c
900 * A/D, would not be reflected in the editor drive, but changes
901 * underneath @c A/B would be.
903 * Additionally, the editor driver will call @c add_directory and
904 * and @c add_file for directories with an appropriate depth. For
905 * example, a directory reported at #svn_depth_files will receive
906 * file (but not directory) additions. A directory at #svn_depth_empty
907 * will receive neither.
909 * If @a depth is #svn_depth_files, #svn_depth_immediates or
910 * #svn_depth_infinity and @a depth is greater than the reported depth
911 * of the working copy, then the editor driver will emit editor
912 * operations so as to upgrade the working copy to this depth.
914 * If @a depth is #svn_depth_empty, #svn_depth_files,
915 * #svn_depth_immediates and @a depth is lower
916 * than or equal to the depth of the working copy, then the editor
917 * operations will affect only paths at or above @a depth.
922 svn_repos_begin_report3(void **report_baton,
927 const char *tgt_path,
928 svn_boolean_t text_deltas,
930 svn_boolean_t ignore_ancestry,
931 svn_boolean_t send_copyfrom_args,
932 const svn_delta_editor_t *editor,
934 svn_repos_authz_func_t authz_read_func,
935 void *authz_read_baton,
936 apr_size_t zero_copy_limit,
940 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
941 * always passed as 0.
944 * @deprecated Provided for backward compatibility with the 1.7 API.
948 svn_repos_begin_report2(void **report_baton,
953 const char *tgt_path,
954 svn_boolean_t text_deltas,
956 svn_boolean_t ignore_ancestry,
957 svn_boolean_t send_copyfrom_args,
958 const svn_delta_editor_t *editor,
960 svn_repos_authz_func_t authz_read_func,
961 void *authz_read_baton,
965 * The same as svn_repos_begin_report2(), but taking a boolean
966 * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
968 * If @a recurse is TRUE, the editor driver will drive the editor with
969 * a depth of #svn_depth_infinity; if FALSE, then with a depth of
972 * @note @a username is ignored, and has been removed in a revised
973 * version of this API.
975 * @deprecated Provided for backward compatibility with the 1.4 API.
979 svn_repos_begin_report(void **report_baton,
981 const char *username,
985 const char *tgt_path,
986 svn_boolean_t text_deltas,
987 svn_boolean_t recurse,
988 svn_boolean_t ignore_ancestry,
989 const svn_delta_editor_t *editor,
991 svn_repos_authz_func_t authz_read_func,
992 void *authz_read_baton,
997 * Given a @a report_baton constructed by svn_repos_begin_report3(),
998 * record the presence of @a path, at @a revision with depth @a depth,
999 * in the current tree.
1001 * @a path is relative to the anchor/target used in the creation of the
1004 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
1005 * represents a locally-added path with no revision number, or @a
1006 * depth is #svn_depth_exclude.
1008 * @a path may not be underneath a path on which svn_repos_set_path3()
1009 * was previously called with #svn_depth_exclude in this report.
1011 * The first call of this in a given report usually passes an empty
1012 * @a path; this is used to set up the correct root revision for the editor
1015 * A depth of #svn_depth_unknown is not allowed, and results in an
1018 * If @a start_empty is TRUE and @a path is a directory, then require the
1019 * caller to explicitly provide all the children of @a path - do not assume
1020 * that the tree also contains all the children of @a path at @a revision.
1021 * This is for 'low confidence' client reporting.
1023 * If the caller has a lock token for @a path, then @a lock_token should
1024 * be set to that token. Else, @a lock_token should be NULL.
1026 * All temporary allocations are done in @a pool.
1028 * @since New in 1.5.
1031 svn_repos_set_path3(void *report_baton,
1033 svn_revnum_t revision,
1035 svn_boolean_t start_empty,
1036 const char *lock_token,
1040 * Similar to svn_repos_set_path3(), but with @a depth set to
1041 * #svn_depth_infinity.
1043 * @deprecated Provided for backward compatibility with the 1.4 API.
1047 svn_repos_set_path2(void *report_baton,
1049 svn_revnum_t revision,
1050 svn_boolean_t start_empty,
1051 const char *lock_token,
1055 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
1057 * @deprecated Provided for backward compatibility with the 1.1 API.
1061 svn_repos_set_path(void *report_baton,
1063 svn_revnum_t revision,
1064 svn_boolean_t start_empty,
1068 * Given a @a report_baton constructed by svn_repos_begin_report3(),
1069 * record the presence of @a path in the current tree, containing the contents
1070 * of @a link_path at @a revision with depth @a depth.
1072 * A depth of #svn_depth_unknown is not allowed, and results in an
1075 * @a path may not be underneath a path on which svn_repos_set_path3()
1076 * was previously called with #svn_depth_exclude in this report.
1078 * Note that while @a path is relative to the anchor/target used in the
1079 * creation of the @a report_baton, @a link_path is an absolute filesystem
1082 * If @a start_empty is TRUE and @a path is a directory, then require the
1083 * caller to explicitly provide all the children of @a path - do not assume
1084 * that the tree also contains all the children of @a link_path at
1085 * @a revision. This is for 'low confidence' client reporting.
1087 * If the caller has a lock token for @a link_path, then @a lock_token
1088 * should be set to that token. Else, @a lock_token should be NULL.
1090 * All temporary allocations are done in @a pool.
1092 * @since New in 1.5.
1095 svn_repos_link_path3(void *report_baton,
1097 const char *link_path,
1098 svn_revnum_t revision,
1100 svn_boolean_t start_empty,
1101 const char *lock_token,
1105 * Similar to svn_repos_link_path3(), but with @a depth set to
1106 * #svn_depth_infinity.
1108 * @deprecated Provided for backward compatibility with the 1.4 API.
1112 svn_repos_link_path2(void *report_baton,
1114 const char *link_path,
1115 svn_revnum_t revision,
1116 svn_boolean_t start_empty,
1117 const char *lock_token,
1121 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
1123 * @deprecated Provided for backward compatibility with the 1.1 API.
1127 svn_repos_link_path(void *report_baton,
1129 const char *link_path,
1130 svn_revnum_t revision,
1131 svn_boolean_t start_empty,
1134 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1135 * record the non-existence of @a path in the current tree.
1137 * @a path may not be underneath a path on which svn_repos_set_path3()
1138 * was previously called with #svn_depth_exclude in this report.
1140 * (This allows the reporter's driver to describe missing pieces of a
1141 * working copy, so that 'svn up' can recreate them.)
1143 * All temporary allocations are done in @a pool.
1146 svn_repos_delete_path(void *report_baton,
1150 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1151 * finish the report and drive the editor as specified when the report
1152 * baton was constructed.
1154 * If an error occurs during the driving of the editor, do NOT abort the
1155 * edit; that responsibility belongs to the caller of this function, if
1156 * it happens at all.
1158 * After the call to this function, @a report_baton is no longer valid;
1159 * it should not be passed to any other reporting functions, including
1160 * svn_repos_abort_report(), even if this function returns an error.
1163 svn_repos_finish_report(void *report_baton,
1167 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1168 * abort the report. This function can be called anytime before
1169 * svn_repos_finish_report() is called.
1171 * After the call to this function, @a report_baton is no longer valid;
1172 * it should not be passed to any other reporting functions.
1175 svn_repos_abort_report(void *report_baton,
1179 /* ---------------------------------------------------------------*/
1181 /* The magical dir_delta update routines. */
1183 /** Use the provided @a editor and @a edit_baton to describe the changes
1184 * necessary for making a given node (and its descendants, if it is a
1185 * directory) under @a src_root look exactly like @a tgt_path under
1186 * @a tgt_root. @a src_entry is the node to update. If @a src_entry
1187 * is empty, then compute the difference between the entire tree
1188 * anchored at @a src_parent_dir under @a src_root and @a tgt_path
1189 * under @a tgt_root. Else, describe the changes needed to update
1190 * only that entry in @a src_parent_dir. Typically, callers of this
1191 * function will use a @a tgt_path that is the concatenation of @a
1192 * src_parent_dir and @a src_entry.
1194 * @a src_root and @a tgt_root can both be either revision or transaction
1195 * roots. If @a tgt_root is a revision, @a editor's set_target_revision()
1196 * will be called with the @a tgt_root's revision number, else it will
1197 * not be called at all.
1199 * If @a authz_read_func is non-NULL, invoke it before any call to
1201 * @a editor->open_root
1202 * @a editor->add_directory
1203 * @a editor->open_directory
1204 * @a editor->add_file
1205 * @a editor->open_file
1207 * passing @a tgt_root, the same path that would be passed to the
1208 * editor function in question, and @a authz_read_baton. If the
1209 * @a *allowed parameter comes back TRUE, then proceed with the planned
1210 * editor call; else if FALSE, then invoke @a editor->absent_file or
1211 * @a editor->absent_directory as appropriate, except if the planned
1212 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
1214 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
1215 * the window handler returned by @a editor->apply_textdelta().
1217 * If @a depth is #svn_depth_empty, invoke @a editor calls only on
1218 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
1219 * If @a depth is #svn_depth_files, also invoke the editor on file
1220 * children, if any; if #svn_depth_immediates, invoke it on
1221 * immediate subdirectories as well as files; if #svn_depth_infinity,
1224 * If @a entry_props is @c TRUE, accompany each opened/added entry with
1225 * propchange editor calls that relay special "entry props" (this
1226 * is typically used only for working copy updates).
1228 * @a ignore_ancestry instructs the function to ignore node ancestry
1229 * when determining how to transmit differences.
1231 * Before completing successfully, this function calls @a editor's
1232 * close_edit(), so the caller should expect its @a edit_baton to be
1233 * invalid after its use with this function.
1235 * Do any allocation necessary for the delta computation in @a pool.
1236 * This function's maximum memory consumption is at most roughly
1237 * proportional to the greatest depth of the tree under @a tgt_root, not
1238 * the total size of the delta.
1240 * ### svn_repos_dir_delta2 is mostly superseded by the reporter
1241 * ### functionality (svn_repos_begin_report3 and friends).
1242 * ### svn_repos_dir_delta2 does allow the roots to be transaction
1243 * ### roots rather than just revision roots, and it has the
1244 * ### entry_props flag. Almost all of Subversion's own code uses the
1245 * ### reporter instead; there are some stray references to the
1246 * ### svn_repos_dir_delta[2] in comments which should probably
1247 * ### actually refer to the reporter.
1249 * @since New in 1.5.
1252 svn_repos_dir_delta2(svn_fs_root_t *src_root,
1253 const char *src_parent_dir,
1254 const char *src_entry,
1255 svn_fs_root_t *tgt_root,
1256 const char *tgt_path,
1257 const svn_delta_editor_t *editor,
1259 svn_repos_authz_func_t authz_read_func,
1260 void *authz_read_baton,
1261 svn_boolean_t text_deltas,
1263 svn_boolean_t entry_props,
1264 svn_boolean_t ignore_ancestry,
1268 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
1269 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
1270 * pass #svn_depth_files for @a depth.
1272 * @deprecated Provided for backward compatibility with the 1.4 API.
1276 svn_repos_dir_delta(svn_fs_root_t *src_root,
1277 const char *src_parent_dir,
1278 const char *src_entry,
1279 svn_fs_root_t *tgt_root,
1280 const char *tgt_path,
1281 const svn_delta_editor_t *editor,
1283 svn_repos_authz_func_t authz_read_func,
1284 void *authz_read_baton,
1285 svn_boolean_t text_deltas,
1286 svn_boolean_t recurse,
1287 svn_boolean_t entry_props,
1288 svn_boolean_t ignore_ancestry,
1292 /** Use the provided @a editor and @a edit_baton to describe the
1293 * skeletal changes made in a particular filesystem @a root
1294 * (revision or transaction).
1296 * Changes will be limited to those within @a base_dir, and if
1297 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
1298 * it is assumed that the client has no knowledge of revisions prior to
1299 * @a low_water_mark. Together, these two arguments define the portion of
1300 * the tree that the client is assumed to have knowledge of, and thus any
1301 * copies of data from outside that part of the tree will be sent in their
1302 * entirety, not as simple copies or deltas against a previous version.
1304 * The @a editor passed to this function should be aware of the fact
1305 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
1306 * change_file_prop(), and apply_textdelta() functions will not
1307 * contain meaningful data, and merely serve as indications that
1308 * properties or textual contents were changed.
1310 * If @a send_deltas is @c TRUE, the text and property deltas for changes
1311 * will be sent, otherwise NULL text deltas and empty prop changes will be
1314 * If @a authz_read_func is non-NULL, it will be used to determine if the
1315 * user has read access to the data being accessed. Data that the user
1316 * cannot access will be skipped.
1318 * @note This editor driver passes SVN_INVALID_REVNUM for all
1319 * revision parameters in the editor interface except the copyfrom
1320 * parameter of the add_file() and add_directory() editor functions.
1322 * @since New in 1.4.
1325 svn_repos_replay2(svn_fs_root_t *root,
1326 const char *base_dir,
1327 svn_revnum_t low_water_mark,
1328 svn_boolean_t send_deltas,
1329 const svn_delta_editor_t *editor,
1331 svn_repos_authz_func_t authz_read_func,
1332 void *authz_read_baton,
1336 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
1337 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
1338 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
1341 * @deprecated Provided for backward compatibility with the 1.3 API.
1345 svn_repos_replay(svn_fs_root_t *root,
1346 const svn_delta_editor_t *editor,
1350 /* ---------------------------------------------------------------*/
1352 /* Making commits. */
1355 * Return an @a editor and @a edit_baton to commit changes to the
1356 * filesystem of @a repos, beginning at location 'rev:@a base_path',
1357 * where "rev" is the argument given to open_root().
1359 * @a repos is a previously opened repository. @a repos_url is the
1360 * decoded URL to the base of the repository, and is used to check
1361 * copyfrom paths. copyfrom paths passed to the editor must be full,
1362 * URI-encoded, URLs. @a txn is a filesystem transaction object to use
1363 * during the commit, or @c NULL to indicate that this function should
1364 * create (and fully manage) a new transaction.
1366 * Store the contents of @a revprop_table, a hash mapping <tt>const
1367 * char *</tt> property names to #svn_string_t values, as properties
1368 * of the commit transaction, including author and log message if
1371 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
1372 * it will be overwritten when the transaction is committed.
1374 * Iff @a authz_callback is provided, check read/write authorizations
1375 * on paths accessed by editor operations. An operation which fails
1376 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
1377 * SVN_ERR_AUTHZ_UNWRITABLE.
1379 * Calling @a (*editor)->close_edit completes the commit.
1381 * If @a commit_callback is non-NULL, then before @c close_edit returns (but
1382 * after the commit has succeeded) @c close_edit will invoke
1383 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
1384 * and @a pool or some subpool thereof as arguments. If @a commit_callback
1385 * returns an error, that error will be returned from @c close_edit,
1386 * otherwise if there was a post-commit hook failure, then that error
1387 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
1388 * (Note that prior to Subversion 1.6, @a commit_callback cannot be NULL; if
1389 * you don't need a callback, pass a dummy function.)
1391 * Calling @a (*editor)->abort_edit aborts the commit, and will also
1392 * abort the commit transaction unless @a txn was supplied (not @c
1393 * NULL). Callers who supply their own transactions are responsible
1394 * for cleaning them up (either by committing them, or aborting them).
1396 * @since New in 1.5.
1398 * @note Yes, @a repos_url is a <em>decoded</em> URL. We realize
1399 * that's sorta wonky. Sorry about that.
1402 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
1406 const char *repos_url,
1407 const char *base_path,
1408 apr_hash_t *revprop_table,
1409 svn_commit_callback2_t commit_callback,
1411 svn_repos_authz_callback_t authz_callback,
1416 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
1417 * set to a hash containing @a user and @a log_msg as the
1418 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
1419 * respectively. @a user and @a log_msg may both be @c NULL.
1421 * @since New in 1.4.
1423 * @deprecated Provided for backward compatibility with the 1.4 API.
1427 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
1431 const char *repos_url,
1432 const char *base_path,
1434 const char *log_msg,
1435 svn_commit_callback2_t commit_callback,
1437 svn_repos_authz_callback_t authz_callback,
1442 * Similar to svn_repos_get_commit_editor4(), but
1443 * uses the svn_commit_callback_t type.
1445 * @since New in 1.3.
1447 * @deprecated Provided for backward compatibility with the 1.3 API.
1451 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1455 const char *repos_url,
1456 const char *base_path,
1458 const char *log_msg,
1459 svn_commit_callback_t callback,
1460 void *callback_baton,
1461 svn_repos_authz_callback_t authz_callback,
1466 * Similar to svn_repos_get_commit_editor3(), but with @a
1467 * authz_callback and @a authz_baton set to @c NULL.
1469 * @deprecated Provided for backward compatibility with the 1.2 API.
1473 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1477 const char *repos_url,
1478 const char *base_path,
1480 const char *log_msg,
1481 svn_commit_callback_t callback,
1482 void *callback_baton,
1487 * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1490 * @deprecated Provided for backward compatibility with the 1.1 API.
1494 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1497 const char *repos_url,
1498 const char *base_path,
1500 const char *log_msg,
1501 svn_commit_callback_t callback,
1502 void *callback_baton,
1505 /* ---------------------------------------------------------------*/
1507 /* Finding particular revisions. */
1509 /** Set @a *revision to the revision number in @a repos's filesystem that was
1510 * youngest at time @a tm.
1513 svn_repos_dated_revision(svn_revnum_t *revision,
1519 /** Given a @a root/@a path within some filesystem, return three pieces of
1520 * information allocated in @a pool:
1522 * - set @a *committed_rev to the revision in which the object was
1523 * last modified. (In fs parlance, this is the revision in which
1524 * the particular node-rev-id was 'created'.)
1526 * - set @a *committed_date to the date of said revision, or @c NULL
1529 * - set @a *last_author to the author of said revision, or @c NULL
1533 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
1534 const char **committed_date,
1535 const char **last_author,
1536 svn_fs_root_t *root,
1542 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
1543 * root. If @a path does not exist in @a root, set @a *dirent to
1544 * NULL. Use @a pool for memory allocation.
1546 * @since New in 1.2.
1549 svn_repos_stat(svn_dirent_t **dirent,
1550 svn_fs_root_t *root,
1556 * Given @a path which exists at revision @a start in @a fs, set
1557 * @a *deleted to the revision @a path was first deleted, within the
1558 * inclusive revision range bounded by @a start and @a end. If @a path
1559 * does not exist at revision @a start or was not deleted within the
1560 * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1561 * Use @a pool for memory allocation.
1563 * @since New in 1.5.
1566 svn_repos_deleted_rev(svn_fs_t *fs,
1570 svn_revnum_t *deleted,
1574 /** Callback type for use with svn_repos_history(). @a path and @a
1575 * revision represent interesting history locations in the lifetime
1576 * of the path passed to svn_repos_history(). @a baton is the same
1577 * baton given to svn_repos_history(). @a pool is provided for the
1578 * convenience of the implementor, who should not expect it to live
1579 * longer than a single callback call.
1581 * Signal to callback driver to stop processing/invoking this callback
1582 * by returning the #SVN_ERR_CEASE_INVOCATION error code.
1584 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1586 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1588 svn_revnum_t revision,
1592 * Call @a history_func (with @a history_baton) for each interesting
1593 * history location in the lifetime of @a path in @a fs, from the
1594 * youngest of @a end and @a start to the oldest. Stop processing if
1595 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross
1596 * filesystem copy history if @a cross_copies is @c TRUE. And do all
1597 * of this in @a pool.
1599 * If @a authz_read_func is non-NULL, then use it (and @a
1600 * authz_read_baton) to verify that @a path in @a end is readable; if
1601 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability
1602 * of every ancestral path/revision pair before pushing them at @a
1603 * history_func. If a pair is deemed unreadable, then do not send
1604 * them; instead, immediately stop traversing history and return
1607 * @since New in 1.1.
1609 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1612 svn_repos_history2(svn_fs_t *fs,
1614 svn_repos_history_func_t history_func,
1615 void *history_baton,
1616 svn_repos_authz_func_t authz_read_func,
1617 void *authz_read_baton,
1620 svn_boolean_t cross_copies,
1624 * Similar to svn_repos_history2(), but with @a authz_read_func
1625 * and @a authz_read_baton always set to NULL.
1627 * @deprecated Provided for backward compatibility with the 1.0 API.
1631 svn_repos_history(svn_fs_t *fs,
1633 svn_repos_history_func_t history_func,
1634 void *history_baton,
1637 svn_boolean_t cross_copies,
1642 * Set @a *locations to be a mapping of the revisions to the paths of
1643 * the file @a fs_path present at the repository in revision
1644 * @a peg_revision, where the revisions are taken out of the array
1645 * @a location_revisions.
1647 * @a location_revisions is an array of svn_revnum_t's and @a *locations
1648 * maps 'svn_revnum_t *' to 'const char *'.
1650 * If optional @a authz_read_func is non-NULL, then use it (and @a
1651 * authz_read_baton) to verify that the peg-object is readable. If not,
1652 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func
1653 * to check that every path returned in the hash is readable. If an
1654 * unreadable path is encountered, stop tracing and return
1657 * @a pool is used for all allocations.
1659 * @since New in 1.1.
1662 svn_repos_trace_node_locations(svn_fs_t *fs,
1663 apr_hash_t **locations,
1664 const char *fs_path,
1665 svn_revnum_t peg_revision,
1666 const apr_array_header_t *location_revisions,
1667 svn_repos_authz_func_t authz_read_func,
1668 void *authz_read_baton,
1673 * Call @a receiver and @a receiver_baton to report successive
1674 * location segments in revisions between @a start_rev and @a end_rev
1675 * (inclusive) for the line of history identified by the peg-object @a
1676 * path in @a peg_revision (and in @a repos).
1678 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
1679 * to trace the history of the object to its origin.
1681 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
1682 * revision". Otherwise, @a start_rev must be younger than @a end_rev
1683 * (unless @a end_rev is #SVN_INVALID_REVNUM).
1685 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
1686 * revision", and must evaluate to be at least as young as @a start_rev.
1688 * If optional @a authz_read_func is not @c NULL, then use it (and @a
1689 * authz_read_baton) to verify that the peg-object is readable. If
1690 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a
1691 * authz_read_func to check that every path reported in a location
1692 * segment is readable. If an unreadable path is encountered, report
1693 * a final (possibly truncated) location segment (if any), stop
1694 * tracing history, and return #SVN_NO_ERROR.
1696 * @a pool is used for all allocations.
1698 * @since New in 1.5.
1701 svn_repos_node_location_segments(svn_repos_t *repos,
1703 svn_revnum_t peg_revision,
1704 svn_revnum_t start_rev,
1705 svn_revnum_t end_rev,
1706 svn_location_segment_receiver_t receiver,
1707 void *receiver_baton,
1708 svn_repos_authz_func_t authz_read_func,
1709 void *authz_read_baton,
1713 /* ### other queries we can do someday --
1715 * fetch the last revision created by <user>
1716 (once usernames become revision properties!)
1717 * fetch the last revision where <path> was modified
1723 /* ---------------------------------------------------------------*/
1725 /* Retrieving log messages. */
1729 * Invoke @a receiver with @a receiver_baton on each log message from
1730 * @a start to @a end in @a repos's filesystem. @a start may be greater
1731 * or less than @a end; this just controls whether the log messages are
1732 * processed in descending or ascending revision number order.
1734 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
1736 * If @a paths is non-NULL and has one or more elements, then only show
1737 * revisions in which at least one of @a paths was changed (i.e., if
1738 * file, text or props changed; if dir, props or entries changed or any node
1739 * changed below it). Each path is a <tt>const char *</tt> representing
1740 * an absolute path in the repository. If @a paths is NULL or empty,
1741 * show all revisions regardless of what paths were changed in those
1744 * If @a limit is non-zero then only invoke @a receiver on the first
1747 * If @a discover_changed_paths, then each call to @a receiver passes a
1748 * hash mapping paths committed in that revision to information about them
1749 * as the receiver's @a changed_paths argument.
1750 * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
1752 * If @a strict_node_history is set, copy history (if any exists) will
1753 * not be traversed while harvesting revision logs for each path.
1755 * If @a include_merged_revisions is set, log information for revisions
1756 * which have been merged to @a paths will also be returned, unless these
1757 * revisions are already part of @a start to @a end in @a repos's
1758 * filesystem, as limited by @a paths. In the latter case those revisions
1759 * are skipped and @a receiver is not invoked.
1761 * If @a revprops is NULL, retrieve all revision properties; else, retrieve
1762 * only the revision properties named by the (const char *) array elements
1763 * (i.e. retrieve none if the array is empty).
1765 * If any invocation of @a receiver returns error, return that error
1766 * immediately and without wrapping it.
1768 * If @a start or @a end is a non-existent revision, return the error
1769 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
1771 * If optional @a authz_read_func is non-NULL, then use this function
1772 * (along with optional @a authz_read_baton) to check the readability
1773 * of each changed-path in each revision about to be "pushed" at
1774 * @a receiver. If a revision has some changed-paths readable and
1775 * others unreadable, unreadable paths are omitted from the
1776 * changed_paths field and only svn:author and svn:date will be
1777 * available in the revprops field. If a revision has no
1778 * changed-paths readable at all, then all paths are omitted and no
1779 * revprops are available.
1781 * See also the documentation for #svn_log_entry_receiver_t.
1783 * Use @a pool for temporary allocations.
1785 * @since New in 1.5.
1788 svn_repos_get_logs4(svn_repos_t *repos,
1789 const apr_array_header_t *paths,
1793 svn_boolean_t discover_changed_paths,
1794 svn_boolean_t strict_node_history,
1795 svn_boolean_t include_merged_revisions,
1796 const apr_array_header_t *revprops,
1797 svn_repos_authz_func_t authz_read_func,
1798 void *authz_read_baton,
1799 svn_log_entry_receiver_t receiver,
1800 void *receiver_baton,
1804 * Same as svn_repos_get_logs4(), but with @a receiver being
1805 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
1806 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
1807 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing
1810 * @since New in 1.2.
1811 * @deprecated Provided for backward compatibility with the 1.4 API.
1815 svn_repos_get_logs3(svn_repos_t *repos,
1816 const apr_array_header_t *paths,
1820 svn_boolean_t discover_changed_paths,
1821 svn_boolean_t strict_node_history,
1822 svn_repos_authz_func_t authz_read_func,
1823 void *authz_read_baton,
1824 svn_log_message_receiver_t receiver,
1825 void *receiver_baton,
1830 * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
1832 * @deprecated Provided for backward compatibility with the 1.1 API.
1836 svn_repos_get_logs2(svn_repos_t *repos,
1837 const apr_array_header_t *paths,
1840 svn_boolean_t discover_changed_paths,
1841 svn_boolean_t strict_node_history,
1842 svn_repos_authz_func_t authz_read_func,
1843 void *authz_read_baton,
1844 svn_log_message_receiver_t receiver,
1845 void *receiver_baton,
1849 * Same as svn_repos_get_logs2(), but with @a authz_read_func and
1850 * @a authz_read_baton always set to NULL.
1852 * @deprecated Provided for backward compatibility with the 1.0 API.
1856 svn_repos_get_logs(svn_repos_t *repos,
1857 const apr_array_header_t *paths,
1860 svn_boolean_t discover_changed_paths,
1861 svn_boolean_t strict_node_history,
1862 svn_log_message_receiver_t receiver,
1863 void *receiver_baton,
1868 /* ---------------------------------------------------------------*/
1870 /* Retrieving mergeinfo. */
1873 * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
1874 * set @a *catalog to a catalog of this mergeinfo. @a *catalog will
1875 * never be @c NULL but may be empty.
1877 * The paths in @a paths, and the keys of @a catalog, start with '/'.
1879 * @a inherit indicates whether explicit, explicit or inherited, or
1880 * only inherited mergeinfo for @a paths is fetched.
1882 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
1884 * If @a include_descendants is TRUE, then additionally return the
1885 * mergeinfo for any descendant of any element of @a paths which has
1886 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note
1887 * that inheritance is only taken into account for the elements in @a
1888 * paths; descendants of the elements in @a paths which get their
1889 * mergeinfo via inheritance are not included in @a *catalog.)
1891 * If optional @a authz_read_func is non-NULL, then use this function
1892 * (along with optional @a authz_read_baton) to check the readability
1893 * of each path which mergeinfo was requested for (from @a paths).
1894 * Silently omit unreadable paths from the request for mergeinfo.
1896 * Use @a pool for all allocations.
1898 * @since New in 1.5.
1901 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1903 const apr_array_header_t *paths,
1904 svn_revnum_t revision,
1905 svn_mergeinfo_inheritance_t inherit,
1906 svn_boolean_t include_descendants,
1907 svn_repos_authz_func_t authz_read_func,
1908 void *authz_read_baton,
1912 /* ---------------------------------------------------------------*/
1914 /* Retrieving multiple revisions of a file. */
1917 * Retrieve a subset of the interesting revisions of a file @a path in
1918 * @a repos as seen in revision @a end. Invoke @a handler with
1919 * @a handler_baton as its first argument for each such revision.
1920 * @a pool is used for all allocations. See svn_fs_history_prev() for
1921 * a discussion of interesting revisions.
1923 * If optional @a authz_read_func is non-NULL, then use this function
1924 * (along with optional @a authz_read_baton) to check the readability
1925 * of the rev-path in each interesting revision encountered.
1927 * Revision discovery happens from @a end to @a start, and if an
1928 * unreadable revision is encountered before @a start is reached, then
1929 * revision discovery stops and only the revisions from @a end to the
1930 * oldest readable revision are returned (So it will appear that @a
1931 * path was added without history in the latter revision).
1933 * If there is an interesting revision of the file that is less than or
1934 * equal to start, the iteration will start at that revision. Else, the
1935 * iteration will start at the first revision of the file in the repository,
1936 * which has to be less than or equal to end. Note that if the function
1937 * succeeds, @a handler will have been called at least once.
1939 * In a series of calls, the file contents for the first interesting revision
1940 * will be provided as a text delta against the empty file. In the following
1941 * calls, the delta will be against the contents for the previous call.
1943 * If @a include_merged_revisions is TRUE, revisions which a included as a
1944 * result of a merge between @a start and @a end will be included.
1946 * Since Subversion 1.8 this function has been enabled to support reversion
1947 * the revision range for @a include_merged_revision @c FALSE reporting by
1948 * switching @a start with @a end.
1950 * @since New in 1.5.
1953 svn_repos_get_file_revs2(svn_repos_t *repos,
1957 svn_boolean_t include_merged_revisions,
1958 svn_repos_authz_func_t authz_read_func,
1959 void *authz_read_baton,
1960 svn_file_rev_handler_t handler,
1961 void *handler_baton,
1965 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
1968 * @deprecated Provided for backward compatibility with the 1.4 API.
1969 * @since New in 1.1.
1973 svn_repos_get_file_revs(svn_repos_t *repos,
1977 svn_repos_authz_func_t authz_read_func,
1978 void *authz_read_baton,
1979 svn_repos_file_rev_handler_t handler,
1980 void *handler_baton,
1984 /* ---------------------------------------------------------------*/
1987 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
1992 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
1993 * post-commit hooks around the commit. Use @a pool for any necessary
1996 * If the pre-commit hook fails, do not attempt to commit the
1997 * transaction and throw the original error to the caller.
1999 * A successful commit is indicated by a valid revision value in @a
2000 * *new_rev, not if svn_fs_commit_txn() returns an error, which can
2001 * occur during its post commit FS processing. If the transaction was
2002 * not committed, then return the associated error and do not execute
2003 * the post-commit hook.
2005 * If the commit succeeds the post-commit hook is executed. If the
2006 * post-commit hook returns an error, always wrap it with
2007 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
2008 * find the post-commit hook error in the returned error chain. If
2009 * both svn_fs_commit_txn() and the post-commit hook return errors,
2010 * then svn_fs_commit_txn()'s error is the parent error and the
2011 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
2014 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
2017 svn_repos_fs_commit_txn(const char **conflict_p,
2019 svn_revnum_t *new_rev,
2023 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
2024 * <tt>const char *</tt> property names to #svn_string_t values, to
2025 * set the properties on transaction @a *txn_p. @a repos is the
2026 * repository object which contains the filesystem. @a rev, @a
2027 * *txn_p, and @a pool are as in svn_fs_begin_txn().
2029 * Before a txn is created, the repository's start-commit hooks are
2030 * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
2031 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
2033 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
2034 * which will be set on the transaction, but that will be overwritten
2035 * when the transaction is committed.
2037 * @since New in 1.5.
2040 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
2043 apr_hash_t *revprop_table,
2048 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
2049 * set to a hash containing @a author and @a log_msg as the
2050 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
2051 * respectively. @a author and @a log_msg may both be @c NULL.
2053 * @deprecated Provided for backward compatibility with the 1.4 API.
2057 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
2061 const char *log_msg,
2065 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
2066 * property on transaction @a *txn_p. @a repos is the repository object
2067 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in
2068 * svn_fs_begin_txn().
2070 * ### Someday: before a txn is created, some kind of read-hook could
2073 * @note This function was never fully implemented, nor used. Ignore it.
2074 * @deprecated Provided for backward compatibility with the 1.7 API.
2078 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
2087 /** @defgroup svn_repos_fs_locks Repository lock wrappers
2091 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
2092 * post-lock hooks before and after the locking action. Use @a pool
2093 * for any necessary allocations.
2095 * If the pre-lock hook or svn_fs_lock() fails, throw the original
2096 * error to caller. If an error occurs when running the post-lock
2097 * hook, return the original error wrapped with
2098 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
2099 * error, it knows that the lock succeeded anyway.
2101 * The pre-lock hook may cause a different token to be used for the
2102 * lock, instead of @a token; see the pre-lock-hook documentation for
2105 * @since New in 1.2.
2108 svn_repos_fs_lock(svn_lock_t **lock,
2112 const char *comment,
2113 svn_boolean_t is_dav_comment,
2114 apr_time_t expiration_date,
2115 svn_revnum_t current_rev,
2116 svn_boolean_t steal_lock,
2120 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
2121 * post-unlock hooks before and after the unlocking action. Use @a
2122 * pool for any necessary allocations.
2124 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
2125 * error to caller. If an error occurs when running the post-unlock
2126 * hook, return the original error wrapped with
2127 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this
2128 * error, it knows that the unlock succeeded anyway.
2130 * @since New in 1.2.
2133 svn_repos_fs_unlock(svn_repos_t *repos,
2136 svn_boolean_t break_lock,
2141 /** Look up all the locks in and under @a path in @a repos, setting @a
2142 * *locks to a hash which maps <tt>const char *</tt> paths to the
2143 * #svn_lock_t locks associated with those paths. Use @a
2144 * authz_read_func and @a authz_read_baton to "screen" all returned
2145 * locks. That is: do not return any locks on any paths that are
2146 * unreadable in HEAD, just silently omit them.
2148 * @a depth limits the returned locks to those associated with paths
2149 * within the specified depth of @a path, and must be one of the
2150 * following values: #svn_depth_empty, #svn_depth_files,
2151 * #svn_depth_immediates, or #svn_depth_infinity.
2153 * @since New in 1.7.
2156 svn_repos_fs_get_locks2(apr_hash_t **locks,
2160 svn_repos_authz_func_t authz_read_func,
2161 void *authz_read_baton,
2165 * Similar to svn_repos_fs_get_locks2(), but with @a depth always
2166 * passed as svn_depth_infinity.
2168 * @since New in 1.2.
2169 * @deprecated Provided for backward compatibility with the 1.6 API.
2173 svn_repos_fs_get_locks(apr_hash_t **locks,
2176 svn_repos_authz_func_t authz_read_func,
2177 void *authz_read_baton,
2183 * Like svn_fs_change_rev_prop2(), but validate the name and value of the
2184 * property and invoke the @a repos's pre- and post-revprop-change hooks
2185 * around the change as specified by @a use_pre_revprop_change_hook and
2186 * @a use_post_revprop_change_hook (respectively).
2188 * @a rev is the revision whose property to change, @a name is the
2189 * name of the property, and @a new_value is the new value of the
2190 * property. If @a old_value_p is not @c NULL, then @a *old_value_p
2191 * is the expected current (preexisting) value of the property (or @c NULL
2192 * for "unset"). @a author is the authenticated username of the person
2193 * changing the property value, or NULL if not available.
2195 * If @a authz_read_func is non-NULL, then use it (with @a
2196 * authz_read_baton) to validate the changed-paths associated with @a
2197 * rev. If the revision contains any unreadable changed paths, then
2198 * return #SVN_ERR_AUTHZ_UNREADABLE.
2200 * Validate @a name and @a new_value like the same way
2201 * svn_repos_fs_change_node_prop() does.
2203 * Use @a pool for temporary allocations.
2205 * @since New in 1.7.
2208 svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
2212 const svn_string_t *const *old_value_p,
2213 const svn_string_t *new_value,
2215 use_pre_revprop_change_hook,
2217 use_post_revprop_change_hook,
2218 svn_repos_authz_func_t
2220 void *authz_read_baton,
2224 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
2225 * set to @c NULL. (In other words, it is similar to
2226 * svn_fs_change_rev_prop().)
2228 * @deprecated Provided for backward compatibility with the 1.6 API.
2229 * @since New in 1.5.
2233 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
2237 const svn_string_t *new_value,
2239 use_pre_revprop_change_hook,
2241 use_post_revprop_change_hook,
2242 svn_repos_authz_func_t
2244 void *authz_read_baton,
2248 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
2249 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
2250 * always set to @c TRUE.
2252 * @deprecated Provided for backward compatibility with the 1.4 API.
2256 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
2260 const svn_string_t *new_value,
2261 svn_repos_authz_func_t
2263 void *authz_read_baton,
2267 * Similar to svn_repos_fs_change_rev_prop2(), but with the
2268 * @a authz_read_func parameter always NULL.
2270 * @deprecated Provided for backward compatibility with the 1.0 API.
2274 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
2278 const svn_string_t *new_value,
2284 * Set @a *value_p to the value of the property named @a propname on
2285 * revision @a rev in the filesystem opened in @a repos. If @a rev
2286 * has no property by that name, set @a *value_p to zero. Allocate
2287 * the result in @a pool.
2289 * If @a authz_read_func is non-NULL, then use it (with @a
2290 * authz_read_baton) to validate the changed-paths associated with @a
2291 * rev. If the changed-paths are all unreadable, then set @a *value_p
2292 * to zero unconditionally. If only some of the changed-paths are
2293 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
2294 * fetched, but return 0 for any other property.
2296 * @since New in 1.1.
2299 svn_repos_fs_revision_prop(svn_string_t **value_p,
2302 const char *propname,
2303 svn_repos_authz_func_t
2305 void *authz_read_baton,
2310 * Set @a *table_p to the entire property list of revision @a rev in
2311 * filesystem opened in @a repos, as a hash table allocated in @a
2312 * pool. The table maps <tt>char *</tt> property names to
2313 * #svn_string_t * values; the names and values are allocated in @a
2316 * If @a authz_read_func is non-NULL, then use it (with @a
2317 * authz_read_baton) to validate the changed-paths associated with @a
2318 * rev. If the changed-paths are all unreadable, then return an empty
2319 * hash. If only some of the changed-paths are unreadable, then return
2320 * an empty hash, except for 'svn:author' and 'svn:date' properties
2321 * (assuming those properties exist).
2323 * @since New in 1.1.
2326 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
2329 svn_repos_authz_func_t
2331 void *authz_read_baton,
2336 /* ---------------------------------------------------------------*/
2338 /* Prop-changing wrappers for libsvn_fs routines. */
2340 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
2341 above with the hook-related functions. */
2344 /** Validating wrapper for svn_fs_change_node_prop() (which see for
2345 * argument descriptions).
2347 * If @a name's kind is not #svn_prop_regular_kind, return
2348 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its
2349 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
2352 * @note Currently, the only properties validated are the "svn:" properties
2353 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. This may change
2354 * in future releases.
2357 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
2360 const svn_string_t *value,
2363 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
2364 * argument descriptions). See svn_repos_fs_change_txn_props() for more
2368 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
2370 const svn_string_t *value,
2373 /** Validating wrapper for svn_fs_change_txn_props() (which see for
2374 * argument descriptions). Validate properties and their values the
2375 * same way svn_repos_fs_change_node_prop() does.
2377 * @since New in 1.5.
2380 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
2381 const apr_array_header_t *props,
2385 /* ---------------------------------------------------------------*/
2388 * @defgroup svn_repos_inspection Data structures and editor things for \
2389 * repository inspection.
2392 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
2393 * svn_repos_begin_report3() interfaces can be extremely useful for
2394 * examining the repository, or more exactly, changes to the repository.
2395 * These drivers allows for differences between two trees to be
2396 * described using an editor.
2398 * By using the editor obtained from svn_repos_node_editor() with one of
2399 * the drivers mentioned above, the description of how to transform one
2400 * tree into another can be used to build an in-memory linked-list tree,
2401 * which each node representing a repository node that was changed.
2404 /** A node in the repository. */
2405 typedef struct svn_repos_node_t
2407 /** Node type (file, dir, etc.) */
2408 svn_node_kind_t kind;
2410 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
2413 /** Were there any textual mods? (files only) */
2414 svn_boolean_t text_mod;
2416 /** Where there any property mods? */
2417 svn_boolean_t prop_mod;
2419 /** The name of this node as it appears in its parent's entries list */
2422 /** The filesystem revision where this was copied from (if any) */
2423 svn_revnum_t copyfrom_rev;
2425 /** The filesystem path where this was copied from (if any) */
2426 const char *copyfrom_path;
2428 /** Pointer to the next sibling of this node */
2429 struct svn_repos_node_t *sibling;
2431 /** Pointer to the first child of this node */
2432 struct svn_repos_node_t *child;
2434 /** Pointer to the parent of this node */
2435 struct svn_repos_node_t *parent;
2440 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
2441 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
2442 * tree representing the delta from @a base_root to @a root in @a
2443 * repos's filesystem.
2445 * The editor can also be driven by svn_repos_dir_delta2() or
2446 * svn_repos_begin_report3(), but unless you have special needs,
2447 * svn_repos_replay2() is preferred.
2449 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
2452 * Note that the delta includes "bubbled-up" directories; that is,
2453 * many of the directory nodes will have no prop_mods.
2455 * Allocate the tree and its contents in @a node_pool; do all other
2456 * allocation in @a pool.
2459 svn_repos_node_editor(const svn_delta_editor_t **editor,
2462 svn_fs_root_t *base_root,
2463 svn_fs_root_t *root,
2464 apr_pool_t *node_pool,
2467 /** Return the root node of the linked-list tree generated by driving the
2468 * editor (associated with @a edit_baton) created by svn_repos_node_editor().
2469 * This is only really useful if used *after* the editor drive is completed.
2472 svn_repos_node_from_baton(void *edit_baton);
2476 /* ---------------------------------------------------------------*/
2479 * @defgroup svn_repos_dump_load Dumping and loading filesystem data
2482 * The filesystem 'dump' format contains nothing but the abstract
2483 * structure of the filesystem -- independent of any internal node-id
2484 * schema or database back-end. All of the data in the dumpfile is
2485 * acquired by public function calls into svn_fs.h. Similarly, the
2486 * parser which reads the dumpfile is able to reconstruct the
2487 * filesystem using only public svn_fs.h routines.
2489 * Thus the dump/load feature's main purpose is for *migrating* data
2490 * from one svn filesystem to another -- presumably two filesystems
2491 * which have different internal implementations.
2493 * If you simply want to backup your filesystem, you're probably
2494 * better off using the built-in facilities of the DB backend (using
2495 * Berkeley DB's hot-backup feature, for example.)
2497 * For a description of the dumpfile format, see
2498 * /trunk/notes/fs_dumprestore.txt.
2501 /* The RFC822-style headers in our dumpfile format. */
2502 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version"
2503 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3
2504 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3
2505 #define SVN_REPOS_DUMPFILE_UUID "UUID"
2506 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length"
2508 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number"
2510 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path"
2511 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind"
2512 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action"
2513 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path"
2514 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev"
2515 /** @since New in 1.6. */
2516 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5"
2517 /** @since New in 1.6. */
2518 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1"
2519 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
2520 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
2521 /** @since New in 1.6. */
2522 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5"
2523 /** @since New in 1.6. */
2524 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1"
2525 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \
2526 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
2528 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length"
2529 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length"
2531 /** @since New in 1.1. */
2532 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta"
2533 /** @since New in 1.1. */
2534 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta"
2535 /** @since New in 1.6. */
2536 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5"
2537 /** @since New in 1.6. */
2538 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1"
2539 /** @since New in 1.5. */
2540 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \
2541 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
2544 * Verify the contents of the file system in @a repos.
2546 * If @a feedback_stream is not @c NULL, write feedback to it (lines of
2547 * the form "* Verified revision %ld\n").
2549 * If @a start_rev is #SVN_INVALID_REVNUM, then start verifying at
2550 * revision 0. If @a end_rev is #SVN_INVALID_REVNUM, then verify
2551 * through the @c HEAD revision.
2553 * For every verified revision call @a notify_func with @a rev set to
2554 * the verified revision and @a warning_text @c NULL. For warnings call @a
2555 * notify_func with @a warning_text set.
2557 * If @a cancel_func is not @c NULL, call it periodically with @a
2558 * cancel_baton as argument to see if the caller wishes to cancel the
2561 * @since New in 1.7.
2564 svn_repos_verify_fs2(svn_repos_t *repos,
2565 svn_revnum_t start_rev,
2566 svn_revnum_t end_rev,
2567 svn_repos_notify_func_t notify_func,
2569 svn_cancel_func_t cancel,
2571 apr_pool_t *scratch_pool);
2574 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
2575 * handling feedback via the notify_func handler
2577 * @since New in 1.5.
2578 * @deprecated Provided for backward compatibility with the 1.6 API.
2582 svn_repos_verify_fs(svn_repos_t *repos,
2583 svn_stream_t *feedback_stream,
2584 svn_revnum_t start_rev,
2585 svn_revnum_t end_rev,
2586 svn_cancel_func_t cancel_func,
2591 * Dump the contents of the filesystem within already-open @a repos into
2592 * writable @a dumpstream. Begin at revision @a start_rev, and dump every
2593 * revision up through @a end_rev. Use @a pool for all allocation. If
2594 * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is
2595 * @c NULL, this is effectively a primitive verify. It is not complete,
2596 * however; svn_repos_verify_fs2() and svn_fs_verify().
2598 * If @a start_rev is #SVN_INVALID_REVNUM, then start dumping at revision
2599 * 0. If @a end_rev is #SVN_INVALID_REVNUM, then dump through the @c HEAD
2602 * If @a incremental is @c TRUE, the first revision dumped will be a diff
2603 * against the previous revision (usually it looks like a full dump of
2606 * If @a use_deltas is @c TRUE, output only node properties which have
2607 * changed relative to the previous contents, and output text contents
2608 * as svndiff data against the previous contents. Regardless of how
2609 * this flag is set, the first revision of a non-incremental dump will
2610 * be done with full plain text. A dump with @a use_deltas set cannot
2611 * be loaded by Subversion 1.0.x.
2613 * If @a notify_func is not @c NULL, then for every dumped revision call
2614 * @a notify_func with @a rev set to the dumped revision and @a warning_text
2615 * @c NULL. For warnings call @a notify_func with @a warning_text.
2617 * If @a cancel_func is not @c NULL, it is called periodically with
2618 * @a cancel_baton as argument to see if the client wishes to cancel
2621 * @since New in 1.7.
2624 svn_repos_dump_fs3(svn_repos_t *repos,
2625 svn_stream_t *dumpstream,
2626 svn_revnum_t start_rev,
2627 svn_revnum_t end_rev,
2628 svn_boolean_t incremental,
2629 svn_boolean_t use_deltas,
2630 svn_repos_notify_func_t notify_func,
2632 svn_cancel_func_t cancel_func,
2634 apr_pool_t *scratch_pool);
2637 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
2638 * handling feedback via the notify_func handler
2640 * @since New in 1.1.
2641 * @deprecated Provided for backward compatibility with the 1.6 API.
2645 svn_repos_dump_fs2(svn_repos_t *repos,
2646 svn_stream_t *dumpstream,
2647 svn_stream_t *feedback_stream,
2648 svn_revnum_t start_rev,
2649 svn_revnum_t end_rev,
2650 svn_boolean_t incremental,
2651 svn_boolean_t use_deltas,
2652 svn_cancel_func_t cancel_func,
2657 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
2658 * parameter always set to @c FALSE.
2660 * @deprecated Provided for backward compatibility with the 1.0 API.
2664 svn_repos_dump_fs(svn_repos_t *repos,
2665 svn_stream_t *dumpstream,
2666 svn_stream_t *feedback_stream,
2667 svn_revnum_t start_rev,
2668 svn_revnum_t end_rev,
2669 svn_boolean_t incremental,
2670 svn_cancel_func_t cancel_func,
2676 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
2677 * filesystem revisions in already-open @a repos, handling uuids in
2678 * accordance with @a uuid_action. Use @a pool for all allocation.
2680 * If the dumpstream contains copy history that is unavailable in the
2681 * repository, an error will be thrown.
2683 * The repository's UUID will be updated iff
2684 * the dumpstream contains a UUID and
2685 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
2686 * either the repository contains no revisions or
2687 * @a uuid_action is equal to #svn_repos_load_uuid_force.
2689 * If the dumpstream contains no UUID, then @a uuid_action is
2690 * ignored and the repository UUID is not touched.
2692 * @a start_rev and @a end_rev act as filters, the lower and upper
2693 * (inclusive) range values of revisions in @a dumpstream which will
2694 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
2695 * which case no revision-based filtering occurs at all), or both are
2696 * valid revisions (where @a start_rev is older than or equivalent to
2699 * If @a parent_dir is not NULL, then the parser will reparent all the
2700 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2701 * must be an existing directory in the repository.
2703 * If @a use_pre_commit_hook is set, call the repository's pre-commit
2704 * hook before committing each loaded revision.
2706 * If @a use_post_commit_hook is set, call the repository's
2707 * post-commit hook after committing each loaded revision.
2709 * If @a validate_props is set, then validate Subversion revision and
2710 * node properties (those in the svn: namespace) against established
2711 * rules for those things.
2713 * If non-NULL, use @a notify_func and @a notify_baton to send notification
2714 * of events to the caller.
2716 * If @a cancel_func is not @c NULL, it is called periodically with
2717 * @a cancel_baton as argument to see if the client wishes to cancel
2720 * @since New in 1.8.
2723 svn_repos_load_fs4(svn_repos_t *repos,
2724 svn_stream_t *dumpstream,
2725 svn_revnum_t start_rev,
2726 svn_revnum_t end_rev,
2727 enum svn_repos_load_uuid uuid_action,
2728 const char *parent_dir,
2729 svn_boolean_t use_pre_commit_hook,
2730 svn_boolean_t use_post_commit_hook,
2731 svn_boolean_t validate_props,
2732 svn_repos_notify_func_t notify_func,
2734 svn_cancel_func_t cancel_func,
2738 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
2739 * end_rev always passed as #SVN_INVALID_REVNUM.
2741 * @since New in 1.7.
2742 * @deprecated Provided for backward compatibility with the 1.7 API.
2746 svn_repos_load_fs3(svn_repos_t *repos,
2747 svn_stream_t *dumpstream,
2748 enum svn_repos_load_uuid uuid_action,
2749 const char *parent_dir,
2750 svn_boolean_t use_pre_commit_hook,
2751 svn_boolean_t use_post_commit_hook,
2752 svn_boolean_t validate_props,
2753 svn_repos_notify_func_t notify_func,
2755 svn_cancel_func_t cancel_func,
2760 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
2761 * place of the #svn_repos_notify_func_t and baton and with
2762 * @a validate_props always FALSE.
2764 * @since New in 1.2.
2765 * @deprecated Provided for backward compatibility with the 1.6 API.
2769 svn_repos_load_fs2(svn_repos_t *repos,
2770 svn_stream_t *dumpstream,
2771 svn_stream_t *feedback_stream,
2772 enum svn_repos_load_uuid uuid_action,
2773 const char *parent_dir,
2774 svn_boolean_t use_pre_commit_hook,
2775 svn_boolean_t use_post_commit_hook,
2776 svn_cancel_func_t cancel_func,
2781 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
2782 * @a use_post_commit_hook always @c FALSE.
2784 * @deprecated Provided for backward compatibility with the 1.1 API.
2788 svn_repos_load_fs(svn_repos_t *repos,
2789 svn_stream_t *dumpstream,
2790 svn_stream_t *feedback_stream,
2791 enum svn_repos_load_uuid uuid_action,
2792 const char *parent_dir,
2793 svn_cancel_func_t cancel_func,
2799 * A vtable that is driven by svn_repos_parse_dumpstream3().
2801 * @since New in 1.8.
2803 typedef struct svn_repos_parse_fns3_t
2805 /** The parser has discovered a new "magic header" record within the
2806 * parsing session represented by @a parse_baton. The dump-format
2807 * version number is @a version.
2809 svn_error_t *(*magic_header_record)(int version,
2813 /** The parser has discovered a new uuid record within the parsing
2814 * session represented by @a parse_baton. The uuid's value is
2815 * @a uuid, and it is allocated in @a pool.
2817 svn_error_t *(*uuid_record)(const char *uuid,
2821 /** The parser has discovered a new revision record within the
2822 * parsing session represented by @a parse_baton. All the headers are
2823 * placed in @a headers (allocated in @a pool), which maps <tt>const
2824 * char *</tt> header-name ==> <tt>const char *</tt> header-value.
2825 * The @a revision_baton received back (also allocated in @a pool)
2826 * represents the revision.
2828 svn_error_t *(*new_revision_record)(void **revision_baton,
2829 apr_hash_t *headers,
2833 /** The parser has discovered a new node record within the current
2834 * revision represented by @a revision_baton. All the headers are
2835 * placed in @a headers (as with @c new_revision_record), allocated in
2836 * @a pool. The @a node_baton received back is allocated in @a pool
2837 * and represents the node.
2839 svn_error_t *(*new_node_record)(void **node_baton,
2840 apr_hash_t *headers,
2841 void *revision_baton,
2844 /** For a given @a revision_baton, set a property @a name to @a value. */
2845 svn_error_t *(*set_revision_property)(void *revision_baton,
2847 const svn_string_t *value);
2849 /** For a given @a node_baton, set a property @a name to @a value. */
2850 svn_error_t *(*set_node_property)(void *node_baton,
2852 const svn_string_t *value);
2854 /** For a given @a node_baton, delete property @a name. */
2855 svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
2857 /** For a given @a node_baton, remove all properties. */
2858 svn_error_t *(*remove_node_props)(void *node_baton);
2860 /** For a given @a node_baton, receive a writable @a stream capable of
2861 * receiving the node's fulltext. After writing the fulltext, call
2862 * the stream's close() function.
2864 * If a @c NULL is returned instead of a stream, the vtable is
2865 * indicating that no text is desired, and the parser will not
2866 * attempt to send it.
2868 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2871 /** For a given @a node_baton, set @a handler and @a handler_baton
2872 * to a window handler and baton capable of receiving a delta
2873 * against the node's previous contents. A NULL window will be
2874 * sent to the handler after all the windows are sent.
2876 * If a @c NULL is returned instead of a handler, the vtable is
2877 * indicating that no delta is desired, and the parser will not
2878 * attempt to send it.
2880 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
2881 void **handler_baton,
2884 /** The parser has reached the end of the current node represented by
2885 * @a node_baton, it can be freed.
2887 svn_error_t *(*close_node)(void *node_baton);
2889 /** The parser has reached the end of the current revision
2890 * represented by @a revision_baton. In other words, there are no more
2891 * changed nodes within the revision. The baton can be freed.
2893 svn_error_t *(*close_revision)(void *revision_baton);
2895 } svn_repos_parse_fns3_t;
2899 * Read and parse dumpfile-formatted @a stream, calling callbacks in
2900 * @a parse_fns/@a parse_baton, and using @a pool for allocations.
2902 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
2903 * set_fulltext callback. This is useful when manipulating a dump
2904 * stream without loading it. Otherwise handle text-deltas with the
2905 * @a apply_textdelta callback.
2907 * If @a cancel_func is not @c NULL, it is called periodically with
2908 * @a cancel_baton as argument to see if the client wishes to cancel
2911 * This parser has built-in knowledge of the dumpfile format, but only
2912 * in a limited sense:
2914 * * it recognizes the "magic" format-version header.
2916 * * it recognizes the UUID header.
2918 * * it recognizes revision and node records by looking for either
2919 * a REVISION_NUMBER or NODE_PATH headers.
2921 * * it recognizes the CONTENT-LENGTH headers, so it knows if and
2922 * how to suck up the content body.
2924 * * it knows how to parse a content body into two parts: props
2925 * and text, and pass the pieces to the vtable.
2927 * This is enough knowledge to make it easy on vtable implementors,
2928 * but still allow expansion of the format: most headers do not have
2929 * to be handled explicitly.
2931 * @since New in 1.8.
2934 svn_repos_parse_dumpstream3(svn_stream_t *stream,
2935 const svn_repos_parse_fns3_t *parse_fns,
2937 svn_boolean_t deltas_are_text,
2938 svn_cancel_func_t cancel_func,
2944 * Set @a *parser and @a *parse_baton to a vtable parser which commits new
2945 * revisions to the fs in @a repos. The constructed parser will treat
2946 * UUID records in a manner consistent with @a uuid_action. Use @a pool
2947 * to operate on the fs.
2949 * @a start_rev and @a end_rev act as filters, the lower and upper
2950 * (inclusive) range values of revisions in @a dumpstream which will
2951 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
2952 * which case no revision-based filtering occurs at all), or both are
2953 * valid revisions (where @a start_rev is older than or equivalent to
2956 * If @a use_history is set, then the parser will require relative
2957 * 'copyfrom' history to exist in the repository when it encounters
2958 * nodes that are added-with-history.
2960 * If @a validate_props is set, then validate Subversion revision and
2961 * node properties (those in the svn: namespace) against established
2962 * rules for those things.
2964 * If @a parent_dir is not NULL, then the parser will reparent all the
2965 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2966 * must be an existing directory in the repository.
2968 * @since New in 1.8.
2971 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
2974 svn_revnum_t start_rev,
2975 svn_revnum_t end_rev,
2976 svn_boolean_t use_history,
2977 svn_boolean_t validate_props,
2978 enum svn_repos_load_uuid uuid_action,
2979 const char *parent_dir,
2980 svn_repos_notify_func_t notify_func,
2986 * A vtable that is driven by svn_repos_parse_dumpstream2().
2987 * Similar to #svn_repos_parse_fns3_t except that it lacks
2988 * the delete_node_property and apply_textdelta callbacks.
2990 * @deprecated Provided for backward compatibility with the 1.7 API.
2992 typedef struct svn_repos_parse_fns2_t
2994 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
2995 svn_error_t *(*new_revision_record)(void **revision_baton,
2996 apr_hash_t *headers,
2999 /** Same as #svn_repos_parse_fns3_t.uuid_record. */
3000 svn_error_t *(*uuid_record)(const char *uuid,
3003 /** Same as #svn_repos_parse_fns3_t.new_node_record. */
3004 svn_error_t *(*new_node_record)(void **node_baton,
3005 apr_hash_t *headers,
3006 void *revision_baton,
3008 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
3009 svn_error_t *(*set_revision_property)(void *revision_baton,
3011 const svn_string_t *value);
3012 /** Same as #svn_repos_parse_fns3_t.set_node_property. */
3013 svn_error_t *(*set_node_property)(void *node_baton,
3015 const svn_string_t *value);
3016 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
3017 svn_error_t *(*delete_node_property)(void *node_baton,
3019 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
3020 svn_error_t *(*remove_node_props)(void *node_baton);
3021 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
3022 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3024 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
3025 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3026 void **handler_baton,
3028 /** Same as #svn_repos_parse_fns3_t.close_node. */
3029 svn_error_t *(*close_node)(void *node_baton);
3030 /** Same as #svn_repos_parse_fns3_t.close_revision. */
3031 svn_error_t *(*close_revision)(void *revision_baton);
3032 } svn_repos_parse_fns2_t;
3034 /** @deprecated Provided for backward compatibility with the 1.7 API. */
3035 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
3039 * A vtable that is driven by svn_repos_parse_dumpstream().
3040 * Similar to #svn_repos_parse_fns2_t except that it lacks
3041 * the delete_node_property and apply_textdelta callbacks.
3043 * @deprecated Provided for backward compatibility with the 1.0 API.
3045 typedef struct svn_repos_parse_fns_t
3047 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
3048 svn_error_t *(*new_revision_record)(void **revision_baton,
3049 apr_hash_t *headers,
3052 /** Same as #svn_repos_parse_fns2_t.uuid_record. */
3053 svn_error_t *(*uuid_record)(const char *uuid,
3056 /** Same as #svn_repos_parse_fns2_t.new_node_record. */
3057 svn_error_t *(*new_node_record)(void **node_baton,
3058 apr_hash_t *headers,
3059 void *revision_baton,
3061 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
3062 svn_error_t *(*set_revision_property)(void *revision_baton,
3064 const svn_string_t *value);
3065 /** Same as #svn_repos_parse_fns2_t.set_node_property. */
3066 svn_error_t *(*set_node_property)(void *node_baton,
3068 const svn_string_t *value);
3069 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
3070 svn_error_t *(*remove_node_props)(void *node_baton);
3071 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
3072 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3074 /** Same as #svn_repos_parse_fns2_t.close_node. */
3075 svn_error_t *(*close_node)(void *node_baton);
3076 /** Same as #svn_repos_parse_fns2_t.close_revision. */
3077 svn_error_t *(*close_revision)(void *revision_baton);
3078 } svn_repos_parser_fns_t;
3082 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
3083 * #svn_repos_parser_fns2_t vtable type.
3085 * @deprecated Provided for backward compatibility with the 1.7 API.
3089 svn_repos_parse_dumpstream2(svn_stream_t *stream,
3090 const svn_repos_parser_fns2_t *parse_fns,
3092 svn_cancel_func_t cancel_func,
3097 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
3098 * #svn_repos_parser_fns_t vtable type.
3100 * @deprecated Provided for backward compatibility with the 1.0 API.
3104 svn_repos_parse_dumpstream(svn_stream_t *stream,
3105 const svn_repos_parser_fns_t *parse_fns,
3107 svn_cancel_func_t cancel_func,
3112 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
3113 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
3114 * the more limited svn_repos_parse_fns2_t.
3116 * @since New in 1.7.
3117 * @deprecated Provided for backward compatibility with the 1.7 API.
3121 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
3124 svn_boolean_t use_history,
3125 svn_boolean_t validate_props,
3126 enum svn_repos_load_uuid uuid_action,
3127 const char *parent_dir,
3128 svn_repos_notify_func_t notify_func,
3133 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
3134 * in place if a #svn_repos_notify_func_t and baton and with
3135 * @a validate_props always FALSE.
3137 * @since New in 1.1.
3138 * @deprecated Provided for backward compatibility with the 1.6 API.
3142 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
3145 svn_boolean_t use_history,
3146 enum svn_repos_load_uuid uuid_action,
3147 svn_stream_t *outstream,
3148 const char *parent_dir,
3152 * Similar to svn_repos_get_fs_build_parser2(), but yields the more
3153 * limited svn_repos_parser_fns_t vtable type.
3155 * @deprecated Provided for backward compatibility with the 1.0 API.
3159 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
3162 svn_boolean_t use_history,
3163 enum svn_repos_load_uuid uuid_action,
3164 svn_stream_t *outstream,
3165 const char *parent_dir,
3171 /** A data type which stores the authz information.
3173 * @since New in 1.3.
3175 typedef struct svn_authz_t svn_authz_t;
3178 * Read authz configuration data from @a path (a dirent, an absolute file url
3179 * or a registry path) into @a *authz_p, allocated in @a pool.
3181 * If @a groups_path (a dirent, an absolute file url, or a registry path) is
3182 * set, use the global groups parsed from it.
3184 * If @a path or @a groups_path is not a valid authz rule file, then return
3185 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then
3186 * undefined. If @a must_exist is TRUE, a missing authz or groups file
3187 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
3188 * depends on the access type).
3190 * @since New in 1.8.
3193 svn_repos_authz_read2(svn_authz_t **authz_p,
3195 const char *groups_path,
3196 svn_boolean_t must_exist,
3201 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
3202 * repos_root always passed as @c NULL.
3204 * @since New in 1.3.
3205 * @deprecated Provided for backward compatibility with the 1.7 API.
3209 svn_repos_authz_read(svn_authz_t **authz_p,
3211 svn_boolean_t must_exist,
3215 * Read authz configuration data from @a stream into @a *authz_p,
3216 * allocated in @a pool.
3218 * If @a groups_stream is set, use the global groups parsed from it.
3220 * @since New in 1.8.
3223 svn_repos_authz_parse(svn_authz_t **authz_p,
3224 svn_stream_t *stream,
3225 svn_stream_t *groups_stream,
3229 * Check whether @a user can access @a path in the repository @a
3230 * repos_name with the @a required_access. @a authz lists the ACLs to
3231 * check against. Set @a *access_granted to indicate if the requested
3232 * access is granted.
3234 * If @a path is NULL, then check whether @a user has the @a
3235 * required_access anywhere in the repository. Set @a *access_granted
3236 * to TRUE if at least one path is accessible with the @a
3239 * For compatibility with 1.6, and earlier, @a repos_name can be NULL
3240 * in which case it is equivalent to a @a repos_name of "".
3242 * @note Presently, @a repos_name must byte-for-byte match the repos_name
3243 * specified in the authz file; it is treated as an opaque string, and not
3246 * @since New in 1.3.
3249 svn_repos_authz_check_access(svn_authz_t *authz,
3250 const char *repos_name,
3253 svn_repos_authz_access_t required_access,
3254 svn_boolean_t *access_granted,
3259 /** Revision Access Levels
3261 * Like most version control systems, access to versioned objects in
3262 * Subversion is determined on primarily path-based system. Users either
3263 * do or don't have the ability to read a given path.
3265 * However, unlike many version control systems where versioned objects
3266 * maintain their own distinct version information (revision numbers,
3267 * authors, log messages, change timestamps, etc.), Subversion binds
3268 * multiple paths changed as part of a single commit operation into a
3269 * set, calls the whole thing a revision, and hangs commit metadata
3270 * (author, date, log message, etc.) off of that revision. So, commit
3271 * metadata is shared across all the paths changed as part of a given
3274 * It is common (or, at least, we hope it is) for log messages to give
3275 * detailed information about changes made in the commit to which the log
3276 * message is attached. Such information might include a mention of all
3277 * the files changed, what was changed in them, and so on. But this
3278 * causes a problem when presenting information to readers who aren't
3279 * authorized to read every path in the repository. Simply knowing that
3280 * a given path exists may be a security leak, even if the user can't see
3281 * the contents of the data located at that path.
3283 * So Subversion does what it reasonably can to prevent the leak of this
3284 * information, and does so via a staged revision access policy. A
3285 * reader can be said to have one of three levels of access to a given
3286 * revision's metadata, based solely on the reader's access rights to the
3287 * paths changed or copied in that revision:
3289 * 'full access' -- Granted when the reader has access to all paths
3290 * changed or copied in the revision, or when no paths were
3291 * changed in the revision at all, this access level permits
3292 * full visibility of all revision property names and values,
3293 * and the full changed-paths information.
3295 * 'no access' -- Granted when the reader does not have access to any
3296 * paths changed or copied in the revision, this access level
3297 * denies the reader access to all revision properties and all
3298 * changed-paths information.
3300 * 'partial access' -- Granted when the reader has access to at least
3301 * one, but not all, of the paths changed or copied in the revision,
3302 * this access level permits visibility of the svn:date and
3303 * svn:author revision properties and only the paths of the
3304 * changed-paths information to which the reader has access.
3309 /** An enum defining levels of revision access.
3311 * @since New in 1.5.
3313 typedef enum svn_repos_revision_access_level_t
3315 /** no access allowed to the revision properties and all changed-paths
3317 svn_repos_revision_access_none,
3318 /** access granted to some (svn:date and svn:author) revision properties and
3319 * changed-paths information on paths the read has access to. */
3320 svn_repos_revision_access_partial,
3321 /** access granted to all revision properites and changed-paths
3323 svn_repos_revision_access_full
3325 svn_repos_revision_access_level_t;
3329 * Set @a access to the access level granted for @a revision in @a
3330 * repos, as determined by consulting the @a authz_read_func callback
3331 * function and its associated @a authz_read_baton.
3333 * @a authz_read_func may be @c NULL, in which case @a access will be
3334 * set to #svn_repos_revision_access_full.
3336 * @since New in 1.5.
3339 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
3341 svn_revnum_t revision,
3342 svn_repos_authz_func_t authz_read_func,
3343 void *authz_read_baton,
3347 * Set @a *inherited_values to a depth-first ordered array of
3348 * #svn_prop_inherited_item_t * structures (the path_or_url members of
3349 * which are relative filesystem paths) representing the properties
3350 * inherited by @a path in @a root. If no properties are inherited,
3351 * then set @a *inherited_values to an empty array.
3353 * if @a propname is NULL then retrieve all explicit and/or inherited
3354 * properties. Otherwise retrieve only the properties named @a propname.
3356 * If optional @a authz_read_func is non-NULL, then use this function
3357 * (along with optional @a authz_read_baton) to check the readability
3358 * of each parent path from which properties are inherited. Silently omit
3359 * properties for unreadable parent paths.
3361 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for
3362 * temporary allocations.
3364 * @since New in 1.8.
3367 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
3368 svn_fs_root_t *root,
3370 const char *propname,
3371 svn_repos_authz_func_t authz_read_func,
3372 void *authz_read_baton,
3373 apr_pool_t *result_pool,
3374 apr_pool_t *scratch_pool);
3377 /** Capabilities **/
3380 * Store in @a repos the client-reported capabilities @a capabilities,
3381 * which must be allocated in memory at least as long-lived as @a repos.
3383 * The elements of @a capabilities are 'const char *', a subset of
3384 * the constants beginning with @c SVN_RA_CAPABILITY_.
3385 * @a capabilities is not copied, so changing it later will affect
3386 * what is remembered by @a repos.
3388 * @note The capabilities are passed along to the start-commit hook;
3389 * see that hook's template for details.
3391 * @note As of Subversion 1.5, there are no error conditions defined,
3392 * so this always returns SVN_NO_ERROR. In future releases it may
3393 * return error, however, so callers should check.
3395 * @since New in 1.5.
3398 svn_repos_remember_client_capabilities(svn_repos_t *repos,
3399 const apr_array_header_t *capabilities);
3404 #endif /* __cplusplus */
3406 #endif /* SVN_REPOS_H */