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. */
302 const char *warning_str;
303 svn_repos_notify_warning_t warning;
305 /** For #svn_repos_notify_pack_shard_start,
306 #svn_repos_notify_pack_shard_end,
307 #svn_repos_notify_pack_shard_start_revprop, and
308 #svn_repos_notify_pack_shard_end_revprop, the shard processed. */
311 /** For #svn_repos_notify_load_node_done, the revision committed. */
312 svn_revnum_t new_revision;
314 /** For #svn_repos_notify_load_node_done, the source revision, if
315 different from @a new_revision, otherwise #SVN_INVALID_REVNUM.
316 For #svn_repos_notify_load_txn_start, the source revision. */
317 svn_revnum_t old_revision;
319 /** For #svn_repos_notify_load_node_start, the action being taken on the
321 enum svn_node_action node_action;
323 /** For #svn_repos_notify_load_node_start, the path of the node. */
326 /* NOTE: Add new fields at the end to preserve binary compatibility.
327 Also, if you add fields here, you have to update
328 svn_repos_notify_create(). */
329 } svn_repos_notify_t;
331 /** Callback for providing notification from the repository.
332 * Returns @c void. Justification: success of an operation is not dependent
333 * upon successful notification of that operation.
335 * @since New in 1.7. */
336 typedef void (*svn_repos_notify_func_t)(void *baton,
337 const svn_repos_notify_t *notify,
338 apr_pool_t *scratch_pool);
341 * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
347 svn_repos_notify_create(svn_repos_notify_action_t action,
348 apr_pool_t *result_pool);
351 /** The repository object. */
352 typedef struct svn_repos_t svn_repos_t;
354 /* Opening and creating repositories. */
357 /** Find the root path of the repository that contains @a path.
359 * If a repository was found, the path to the root of the repository
360 * is returned, else @c NULL. The pointer to the returned path may be
364 svn_repos_find_root_path(const char *path,
367 /** Set @a *repos_p to a repository object for the repository at @a path.
369 * Allocate @a *repos_p in @a pool.
371 * Acquires a shared lock on the repository, and attaches a cleanup
372 * function to @a pool to remove the lock. If no lock can be acquired,
373 * returns error, with undefined effect on @a *repos_p. If an exclusive
374 * lock is present, this blocks until it's gone. @a fs_config will be
375 * passed to the filesystem initialization function and may be @c NULL.
380 svn_repos_open2(svn_repos_t **repos_p,
382 apr_hash_t *fs_config,
385 /** Similar to svn_repos_open2() with @a fs_config set to NULL.
387 * @deprecated Provided for backward compatibility with 1.6 API.
391 svn_repos_open(svn_repos_t **repos_p,
395 /** Create a new Subversion repository at @a path, building the necessary
396 * directory structure, creating the filesystem, and so on.
397 * Return the repository object in @a *repos_p, allocated in @a pool.
399 * @a config is a client configuration hash of #svn_config_t * items
400 * keyed on config category names, and may be NULL.
402 * @a fs_config is passed to the filesystem, and may be NULL.
404 * @a unused_1 and @a unused_2 are not used and should be NULL.
407 svn_repos_create(svn_repos_t **repos_p,
409 const char *unused_1,
410 const char *unused_2,
412 apr_hash_t *fs_config,
416 * Upgrade the Subversion repository (and its underlying versioned
417 * filesystem) located in the directory @a path to the latest version
418 * supported by this library. If the requested upgrade is not
419 * supported due to the current state of the repository or it
420 * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
421 * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
422 * changes to the repository or filesystem.
424 * Acquires an exclusive lock on the repository, upgrades the
425 * repository, and releases the lock. If an exclusive lock can't be
426 * acquired, returns error.
428 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
429 * returned if the lock is not immediately available.
431 * If @a start_callback is not NULL, it will be called with @a
432 * start_callback_baton as argument before the upgrade starts, but
433 * after the exclusive lock has been acquired.
435 * Use @a pool for necessary allocations.
437 * @note This functionality is provided as a convenience for
438 * administrators wishing to make use of new Subversion functionality
439 * without a potentially costly full repository dump/load. As such,
440 * the operation performs only the minimum amount of work needed to
441 * accomplish this while maintaining the integrity of the repository.
442 * It does *not* guarantee the most optimized repository state as a
443 * dump and subsequent load would.
445 * @note On some platforms the exclusive lock does not exclude other
446 * threads in the same process so this function should only be called
447 * by a single threaded process, or by a multi-threaded process when
448 * no other threads are accessing the repository.
453 svn_repos_upgrade2(const char *path,
454 svn_boolean_t nonblocking,
455 svn_repos_notify_func_t notify_func,
460 * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
461 * rather than a notify_callback / baton
464 * @deprecated Provided for backward compatibility with the 1.6 API.
468 svn_repos_upgrade(const char *path,
469 svn_boolean_t nonblocking,
470 svn_error_t *(*start_callback)(void *baton),
471 void *start_callback_baton,
474 /** Destroy the Subversion repository found at @a path, using @a pool for any
475 * necessary allocations.
478 svn_repos_delete(const char *path,
482 * Set @a *has to TRUE if @a repos has @a capability (one of the
483 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
486 * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
487 * with the effect on @a *has undefined.
489 * Use @a pool for all allocation.
494 svn_repos_has_capability(svn_repos_t *repos,
496 const char *capability,
502 * The capability of doing the right thing with merge-tracking
503 * information, both storing it and responding to queries about it.
507 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
508 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
510 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
511 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
512 * colons for their own reasons. While this RA limitation has no
513 * direct impact on repository capabilities, there's no reason to be
514 * gratuitously different either.
516 * If you add a capability, update svn_repos_capabilities().
520 /** Return the filesystem associated with repository object @a repos. */
522 svn_repos_fs(svn_repos_t *repos);
525 /** Make a hot copy of the Subversion repository found at @a src_path
528 * Copy a possibly live Subversion repository from @a src_path to
529 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the
530 * source filesystem as part of the copy operation; currently, this
531 * means deleting copied, unused logfiles for a Berkeley DB source
534 * If @a incremental is TRUE, make an effort to not re-copy information
535 * already present in the destination. If incremental hotcopy is not
536 * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
541 svn_repos_hotcopy2(const char *src_path,
542 const char *dst_path,
543 svn_boolean_t clean_logs,
544 svn_boolean_t incremental,
545 svn_cancel_func_t cancel_func,
550 * Like svn_repos_hotcopy2(), but with @a incremental always passed as
551 * @c FALSE and without cancellation support.
553 * @deprecated Provided for backward compatibility with the 1.6 API.
557 svn_repos_hotcopy(const char *src_path,
558 const char *dst_path,
559 svn_boolean_t clean_logs,
564 * Possibly update the repository, @a repos, to use a more efficient
565 * filesystem representation. Use @a pool for allocations.
570 svn_repos_fs_pack2(svn_repos_t *repos,
571 svn_repos_notify_func_t notify_func,
573 svn_cancel_func_t cancel_func,
578 * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
579 * of a #svn_repos_notify_t.
582 * @deprecated Provided for backward compatibility with the 1.6 API.
586 svn_repos_fs_pack(svn_repos_t *repos,
587 svn_fs_pack_notify_t notify_func,
589 svn_cancel_func_t cancel_func,
594 * Run database recovery procedures on the repository at @a path,
595 * returning the database to a consistent state. Use @a pool for all
598 * Acquires an exclusive lock on the repository, recovers the
599 * database, and releases the lock. If an exclusive lock can't be
600 * acquired, returns error.
602 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
603 * returned if the lock is not immediately available.
605 * If @a notify_func is not NULL, it will be called with @a
606 * notify_baton as argument before the recovery starts, but
607 * after the exclusive lock has been acquired.
609 * If @a cancel_func is not @c NULL, it is called periodically with
610 * @a cancel_baton as argument to see if the client wishes to cancel
613 * @note On some platforms the exclusive lock does not exclude other
614 * threads in the same process so this function should only be called
615 * by a single threaded process, or by a multi-threaded process when
616 * no other threads are accessing the repository.
621 svn_repos_recover4(const char *path,
622 svn_boolean_t nonblocking,
623 svn_repos_notify_func_t notify_func,
625 svn_cancel_func_t cancel_func,
630 * Similar to svn_repos_recover4(), but with @a start callback in place of
631 * the notify_func / baton.
634 * @deprecated Provided for backward compatibility with the 1.6 API.
638 svn_repos_recover3(const char *path,
639 svn_boolean_t nonblocking,
640 svn_error_t *(*start_callback)(void *baton),
641 void *start_callback_baton,
642 svn_cancel_func_t cancel_func,
647 * Similar to svn_repos_recover3(), but without cancellation support.
649 * @deprecated Provided for backward compatibility with the 1.4 API.
653 svn_repos_recover2(const char *path,
654 svn_boolean_t nonblocking,
655 svn_error_t *(*start_callback)(void *baton),
656 void *start_callback_baton,
660 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
661 * with no callbacks provided.
663 * @deprecated Provided for backward compatibility with the 1.0 API.
667 svn_repos_recover(const char *path,
671 * Callback for svn_repos_freeze.
675 typedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
678 * Take an exclusive lock on each of the repositories in @a paths to
679 * prevent commits and then while holding all the locks invoke @a
680 * freeze_func passing @a freeze_baton. Each repository may be readable by
681 * Subversion while frozen, or may be unreadable, depending on which
682 * FS backend the repository uses. Repositories are locked in the
683 * order in which they are specified in the array.
685 * @note On some platforms the exclusive lock does not exclude other
686 * threads in the same process so this function should only be called
687 * by a single threaded process, or by a multi-threaded process when
688 * no other threads are accessing the repositories.
693 svn_repos_freeze(apr_array_header_t *paths,
694 svn_repos_freeze_func_t freeze_func,
698 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
699 * returning log file paths relative to the root of the repository.
701 * @copydoc svn_fs_berkeley_logfiles()
704 svn_repos_db_logfiles(apr_array_header_t **logfiles,
706 svn_boolean_t only_unused,
711 /* Repository Paths */
713 /** Return the top-level repository path allocated in @a pool. */
715 svn_repos_path(svn_repos_t *repos,
718 /** Return the path to @a repos's filesystem directory, allocated in
722 svn_repos_db_env(svn_repos_t *repos,
725 /** Return path to @a repos's config directory, allocated in @a pool. */
727 svn_repos_conf_dir(svn_repos_t *repos,
730 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
732 svn_repos_svnserve_conf(svn_repos_t *repos,
735 /** Return path to @a repos's lock directory, allocated in @a pool. */
737 svn_repos_lock_dir(svn_repos_t *repos,
740 /** Return path to @a repos's db lockfile, allocated in @a pool. */
742 svn_repos_db_lockfile(svn_repos_t *repos,
745 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
747 svn_repos_db_logs_lockfile(svn_repos_t *repos,
750 /** Return the path to @a repos's hook directory, allocated in @a pool. */
752 svn_repos_hook_dir(svn_repos_t *repos,
755 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
757 svn_repos_start_commit_hook(svn_repos_t *repos,
760 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
762 svn_repos_pre_commit_hook(svn_repos_t *repos,
765 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
767 svn_repos_post_commit_hook(svn_repos_t *repos,
770 /** Return the path to @a repos's pre-revprop-change hook, allocated in
774 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
777 /** Return the path to @a repos's post-revprop-change hook, allocated in
781 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
785 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
787 * @since New in 1.2. */
789 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
791 svn_repos_pre_lock_hook(svn_repos_t *repos,
794 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
796 svn_repos_post_lock_hook(svn_repos_t *repos,
799 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
801 svn_repos_pre_unlock_hook(svn_repos_t *repos,
804 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
806 svn_repos_post_unlock_hook(svn_repos_t *repos,
809 /** Specify that Subversion should consult the configuration file
810 * located at @a hooks_env_path to determine how to setup the
811 * environment for hook scripts invoked for the repository @a repos.
812 * As a special case, if @a hooks_env_path is @c NULL, look for the
813 * file in its default location within the repository disk structure.
814 * If @a hooks_env_path is not absolute, it specifies a path relative
815 * to the parent of the file's default location.
817 * Use @a scratch_pool for temporary allocations.
819 * If this function is not called, or if the specified configuration
820 * file does not define any environment variables, hooks will run in
821 * an empty environment.
826 svn_repos_hooks_setenv(svn_repos_t *repos,
827 const char *hooks_env_path,
828 apr_pool_t *scratch_pool);
832 /* ---------------------------------------------------------------*/
834 /* Reporting the state of a working copy, for updates. */
838 * Construct and return a @a report_baton that will be passed to the
839 * other functions in this section to describe the state of a pre-existing
840 * tree (typically, a working copy). When the report is finished,
841 * @a editor/@a edit_baton will be driven in such a way as to transform the
842 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
843 * reported hierarchy to @a tgt_path.
845 * @a fs_base is the absolute path of the node in the filesystem at which
846 * the comparison should be rooted. @a target is a single path component,
847 * used to limit the scope of the report to a single entry of @a fs_base,
848 * or "" if all of @a fs_base itself is the main subject of the report.
850 * @a tgt_path and @a revnum is the fs path/revision pair that is the
851 * "target" of the delta. @a tgt_path should be provided only when
852 * the source and target paths of the report differ. That is, @a tgt_path
853 * should *only* be specified when specifying that the resultant editor
854 * drive be one that transforms the reported hierarchy into a pristine tree
855 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path
856 * will indicate that the editor should be driven in such a way as to
857 * transform the reported hierarchy to revision @a revnum, preserving the
858 * reported hierarchy.
860 * @a text_deltas instructs the driver of the @a editor to enable
861 * the generation of text deltas.
863 * @a ignore_ancestry instructs the driver to ignore node ancestry
864 * when determining how to transmit differences.
866 * @a send_copyfrom_args instructs the driver to send 'copyfrom'
867 * arguments to the editor's add_file() and add_directory() methods,
868 * whenever it deems feasible.
870 * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
871 * avoid sending data through @a editor/@a edit_baton which is not
872 * authorized for transmission.
874 * @a zero_copy_limit controls the maximum size (in bytes) at which
875 * data blocks may be sent using the zero-copy code path. On that
876 * path, a number of in-memory copy operations have been eliminated to
877 * maximize throughput. However, until the whole block has been
878 * pushed to the network stack, other clients block, so be careful
879 * when using larger values here. Pass 0 for @a zero_copy_limit to
880 * disable this optimization altogether.
882 * @a note Never activate this optimization if @a editor might access
883 * any FSFS data structures (and, hence, caches). So, it is basically
884 * safe for networked editors only.
886 * All allocation for the context and collected state will occur in
889 * @a depth is the requested depth of the editor drive.
891 * If @a depth is #svn_depth_unknown, the editor will affect only the
892 * paths reported by the individual calls to svn_repos_set_path3() and
893 * svn_repos_link_path3().
895 * For example, if the reported tree is the @c A subdir of the Greek Tree
896 * (see Subversion's test suite), at depth #svn_depth_empty, but the
897 * @c A/B subdir is reported at depth #svn_depth_infinity, then
898 * repository-side changes to @c A/mu, or underneath @c A/C and @c
899 * A/D, would not be reflected in the editor drive, but changes
900 * underneath @c A/B would be.
902 * Additionally, the editor driver will call @c add_directory and
903 * and @c add_file for directories with an appropriate depth. For
904 * example, a directory reported at #svn_depth_files will receive
905 * file (but not directory) additions. A directory at #svn_depth_empty
906 * will receive neither.
908 * If @a depth is #svn_depth_files, #svn_depth_immediates or
909 * #svn_depth_infinity and @a depth is greater than the reported depth
910 * of the working copy, then the editor driver will emit editor
911 * operations so as to upgrade the working copy to this depth.
913 * If @a depth is #svn_depth_empty, #svn_depth_files,
914 * #svn_depth_immediates and @a depth is lower
915 * than or equal to the depth of the working copy, then the editor
916 * operations will affect only paths at or above @a depth.
921 svn_repos_begin_report3(void **report_baton,
926 const char *tgt_path,
927 svn_boolean_t text_deltas,
929 svn_boolean_t ignore_ancestry,
930 svn_boolean_t send_copyfrom_args,
931 const svn_delta_editor_t *editor,
933 svn_repos_authz_func_t authz_read_func,
934 void *authz_read_baton,
935 apr_size_t zero_copy_limit,
939 * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
940 * always passed as 0.
943 * @deprecated Provided for backward compatibility with the 1.7 API.
947 svn_repos_begin_report2(void **report_baton,
952 const char *tgt_path,
953 svn_boolean_t text_deltas,
955 svn_boolean_t ignore_ancestry,
956 svn_boolean_t send_copyfrom_args,
957 const svn_delta_editor_t *editor,
959 svn_repos_authz_func_t authz_read_func,
960 void *authz_read_baton,
964 * The same as svn_repos_begin_report2(), but taking a boolean
965 * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
967 * If @a recurse is TRUE, the editor driver will drive the editor with
968 * a depth of #svn_depth_infinity; if FALSE, then with a depth of
971 * @note @a username is ignored, and has been removed in a revised
972 * version of this API.
974 * @deprecated Provided for backward compatibility with the 1.4 API.
978 svn_repos_begin_report(void **report_baton,
980 const char *username,
984 const char *tgt_path,
985 svn_boolean_t text_deltas,
986 svn_boolean_t recurse,
987 svn_boolean_t ignore_ancestry,
988 const svn_delta_editor_t *editor,
990 svn_repos_authz_func_t authz_read_func,
991 void *authz_read_baton,
996 * Given a @a report_baton constructed by svn_repos_begin_report3(),
997 * record the presence of @a path, at @a revision with depth @a depth,
998 * in the current tree.
1000 * @a path is relative to the anchor/target used in the creation of the
1003 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
1004 * represents a locally-added path with no revision number, or @a
1005 * depth is #svn_depth_exclude.
1007 * @a path may not be underneath a path on which svn_repos_set_path3()
1008 * was previously called with #svn_depth_exclude in this report.
1010 * The first call of this in a given report usually passes an empty
1011 * @a path; this is used to set up the correct root revision for the editor
1014 * A depth of #svn_depth_unknown is not allowed, and results in an
1017 * If @a start_empty is TRUE and @a path is a directory, then require the
1018 * caller to explicitly provide all the children of @a path - do not assume
1019 * that the tree also contains all the children of @a path at @a revision.
1020 * This is for 'low confidence' client reporting.
1022 * If the caller has a lock token for @a path, then @a lock_token should
1023 * be set to that token. Else, @a lock_token should be NULL.
1025 * All temporary allocations are done in @a pool.
1027 * @since New in 1.5.
1030 svn_repos_set_path3(void *report_baton,
1032 svn_revnum_t revision,
1034 svn_boolean_t start_empty,
1035 const char *lock_token,
1039 * Similar to svn_repos_set_path3(), but with @a depth set to
1040 * #svn_depth_infinity.
1042 * @deprecated Provided for backward compatibility with the 1.4 API.
1046 svn_repos_set_path2(void *report_baton,
1048 svn_revnum_t revision,
1049 svn_boolean_t start_empty,
1050 const char *lock_token,
1054 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
1056 * @deprecated Provided for backward compatibility with the 1.1 API.
1060 svn_repos_set_path(void *report_baton,
1062 svn_revnum_t revision,
1063 svn_boolean_t start_empty,
1067 * Given a @a report_baton constructed by svn_repos_begin_report3(),
1068 * record the presence of @a path in the current tree, containing the contents
1069 * of @a link_path at @a revision with depth @a depth.
1071 * A depth of #svn_depth_unknown is not allowed, and results in an
1074 * @a path may not be underneath a path on which svn_repos_set_path3()
1075 * was previously called with #svn_depth_exclude in this report.
1077 * Note that while @a path is relative to the anchor/target used in the
1078 * creation of the @a report_baton, @a link_path is an absolute filesystem
1081 * If @a start_empty is TRUE and @a path is a directory, then require the
1082 * caller to explicitly provide all the children of @a path - do not assume
1083 * that the tree also contains all the children of @a link_path at
1084 * @a revision. This is for 'low confidence' client reporting.
1086 * If the caller has a lock token for @a link_path, then @a lock_token
1087 * should be set to that token. Else, @a lock_token should be NULL.
1089 * All temporary allocations are done in @a pool.
1091 * @since New in 1.5.
1094 svn_repos_link_path3(void *report_baton,
1096 const char *link_path,
1097 svn_revnum_t revision,
1099 svn_boolean_t start_empty,
1100 const char *lock_token,
1104 * Similar to svn_repos_link_path3(), but with @a depth set to
1105 * #svn_depth_infinity.
1107 * @deprecated Provided for backward compatibility with the 1.4 API.
1111 svn_repos_link_path2(void *report_baton,
1113 const char *link_path,
1114 svn_revnum_t revision,
1115 svn_boolean_t start_empty,
1116 const char *lock_token,
1120 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
1122 * @deprecated Provided for backward compatibility with the 1.1 API.
1126 svn_repos_link_path(void *report_baton,
1128 const char *link_path,
1129 svn_revnum_t revision,
1130 svn_boolean_t start_empty,
1133 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1134 * record the non-existence of @a path in the current tree.
1136 * @a path may not be underneath a path on which svn_repos_set_path3()
1137 * was previously called with #svn_depth_exclude in this report.
1139 * (This allows the reporter's driver to describe missing pieces of a
1140 * working copy, so that 'svn up' can recreate them.)
1142 * All temporary allocations are done in @a pool.
1145 svn_repos_delete_path(void *report_baton,
1149 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1150 * finish the report and drive the editor as specified when the report
1151 * baton was constructed.
1153 * If an error occurs during the driving of the editor, do NOT abort the
1154 * edit; that responsibility belongs to the caller of this function, if
1155 * it happens at all.
1157 * After the call to this function, @a report_baton is no longer valid;
1158 * it should not be passed to any other reporting functions, including
1159 * svn_repos_abort_report(), even if this function returns an error.
1162 svn_repos_finish_report(void *report_baton,
1166 /** Given a @a report_baton constructed by svn_repos_begin_report3(),
1167 * abort the report. This function can be called anytime before
1168 * svn_repos_finish_report() is called.
1170 * After the call to this function, @a report_baton is no longer valid;
1171 * it should not be passed to any other reporting functions.
1174 svn_repos_abort_report(void *report_baton,
1178 /* ---------------------------------------------------------------*/
1180 /* The magical dir_delta update routines. */
1182 /** Use the provided @a editor and @a edit_baton to describe the changes
1183 * necessary for making a given node (and its descendants, if it is a
1184 * directory) under @a src_root look exactly like @a tgt_path under
1185 * @a tgt_root. @a src_entry is the node to update. If @a src_entry
1186 * is empty, then compute the difference between the entire tree
1187 * anchored at @a src_parent_dir under @a src_root and @a tgt_path
1188 * under @a tgt_root. Else, describe the changes needed to update
1189 * only that entry in @a src_parent_dir. Typically, callers of this
1190 * function will use a @a tgt_path that is the concatenation of @a
1191 * src_parent_dir and @a src_entry.
1193 * @a src_root and @a tgt_root can both be either revision or transaction
1194 * roots. If @a tgt_root is a revision, @a editor's set_target_revision()
1195 * will be called with the @a tgt_root's revision number, else it will
1196 * not be called at all.
1198 * If @a authz_read_func is non-NULL, invoke it before any call to
1200 * @a editor->open_root
1201 * @a editor->add_directory
1202 * @a editor->open_directory
1203 * @a editor->add_file
1204 * @a editor->open_file
1206 * passing @a tgt_root, the same path that would be passed to the
1207 * editor function in question, and @a authz_read_baton. If the
1208 * @a *allowed parameter comes back TRUE, then proceed with the planned
1209 * editor call; else if FALSE, then invoke @a editor->absent_file or
1210 * @a editor->absent_directory as appropriate, except if the planned
1211 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
1213 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
1214 * the window handler returned by @a editor->apply_textdelta().
1216 * If @a depth is #svn_depth_empty, invoke @a editor calls only on
1217 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
1218 * If @a depth is #svn_depth_files, also invoke the editor on file
1219 * children, if any; if #svn_depth_immediates, invoke it on
1220 * immediate subdirectories as well as files; if #svn_depth_infinity,
1223 * If @a entry_props is @c TRUE, accompany each opened/added entry with
1224 * propchange editor calls that relay special "entry props" (this
1225 * is typically used only for working copy updates).
1227 * @a ignore_ancestry instructs the function to ignore node ancestry
1228 * when determining how to transmit differences.
1230 * Before completing successfully, this function calls @a editor's
1231 * close_edit(), so the caller should expect its @a edit_baton to be
1232 * invalid after its use with this function.
1234 * Do any allocation necessary for the delta computation in @a pool.
1235 * This function's maximum memory consumption is at most roughly
1236 * proportional to the greatest depth of the tree under @a tgt_root, not
1237 * the total size of the delta.
1239 * ### svn_repos_dir_delta2 is mostly superseded by the reporter
1240 * ### functionality (svn_repos_begin_report3 and friends).
1241 * ### svn_repos_dir_delta2 does allow the roots to be transaction
1242 * ### roots rather than just revision roots, and it has the
1243 * ### entry_props flag. Almost all of Subversion's own code uses the
1244 * ### reporter instead; there are some stray references to the
1245 * ### svn_repos_dir_delta[2] in comments which should probably
1246 * ### actually refer to the reporter.
1248 * @since New in 1.5.
1251 svn_repos_dir_delta2(svn_fs_root_t *src_root,
1252 const char *src_parent_dir,
1253 const char *src_entry,
1254 svn_fs_root_t *tgt_root,
1255 const char *tgt_path,
1256 const svn_delta_editor_t *editor,
1258 svn_repos_authz_func_t authz_read_func,
1259 void *authz_read_baton,
1260 svn_boolean_t text_deltas,
1262 svn_boolean_t entry_props,
1263 svn_boolean_t ignore_ancestry,
1267 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
1268 * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
1269 * pass #svn_depth_files for @a depth.
1271 * @deprecated Provided for backward compatibility with the 1.4 API.
1275 svn_repos_dir_delta(svn_fs_root_t *src_root,
1276 const char *src_parent_dir,
1277 const char *src_entry,
1278 svn_fs_root_t *tgt_root,
1279 const char *tgt_path,
1280 const svn_delta_editor_t *editor,
1282 svn_repos_authz_func_t authz_read_func,
1283 void *authz_read_baton,
1284 svn_boolean_t text_deltas,
1285 svn_boolean_t recurse,
1286 svn_boolean_t entry_props,
1287 svn_boolean_t ignore_ancestry,
1291 /** Use the provided @a editor and @a edit_baton to describe the
1292 * skeletal changes made in a particular filesystem @a root
1293 * (revision or transaction).
1295 * Changes will be limited to those within @a base_dir, and if
1296 * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
1297 * it is assumed that the client has no knowledge of revisions prior to
1298 * @a low_water_mark. Together, these two arguments define the portion of
1299 * the tree that the client is assumed to have knowledge of, and thus any
1300 * copies of data from outside that part of the tree will be sent in their
1301 * entirety, not as simple copies or deltas against a previous version.
1303 * The @a editor passed to this function should be aware of the fact
1304 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
1305 * change_file_prop(), and apply_textdelta() functions will not
1306 * contain meaningful data, and merely serve as indications that
1307 * properties or textual contents were changed.
1309 * If @a send_deltas is @c TRUE, the text and property deltas for changes
1310 * will be sent, otherwise NULL text deltas and empty prop changes will be
1313 * If @a authz_read_func is non-NULL, it will be used to determine if the
1314 * user has read access to the data being accessed. Data that the user
1315 * cannot access will be skipped.
1317 * @note This editor driver passes SVN_INVALID_REVNUM for all
1318 * revision parameters in the editor interface except the copyfrom
1319 * parameter of the add_file() and add_directory() editor functions.
1321 * @since New in 1.4.
1324 svn_repos_replay2(svn_fs_root_t *root,
1325 const char *base_dir,
1326 svn_revnum_t low_water_mark,
1327 svn_boolean_t send_deltas,
1328 const svn_delta_editor_t *editor,
1330 svn_repos_authz_func_t authz_read_func,
1331 void *authz_read_baton,
1335 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
1336 * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
1337 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
1340 * @deprecated Provided for backward compatibility with the 1.3 API.
1344 svn_repos_replay(svn_fs_root_t *root,
1345 const svn_delta_editor_t *editor,
1349 /* ---------------------------------------------------------------*/
1351 /* Making commits. */
1354 * Return an @a editor and @a edit_baton to commit changes to the
1355 * filesystem of @a repos, beginning at location 'rev:@a base_path',
1356 * where "rev" is the argument given to open_root().
1358 * @a repos is a previously opened repository. @a repos_url is the
1359 * decoded URL to the base of the repository, and is used to check
1360 * copyfrom paths. copyfrom paths passed to the editor must be full,
1361 * URI-encoded, URLs. @a txn is a filesystem transaction object to use
1362 * during the commit, or @c NULL to indicate that this function should
1363 * create (and fully manage) a new transaction.
1365 * Store the contents of @a revprop_table, a hash mapping <tt>const
1366 * char *</tt> property names to #svn_string_t values, as properties
1367 * of the commit transaction, including author and log message if
1370 * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
1371 * it will be overwritten when the transaction is committed.
1373 * Iff @a authz_callback is provided, check read/write authorizations
1374 * on paths accessed by editor operations. An operation which fails
1375 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
1376 * SVN_ERR_AUTHZ_UNWRITABLE.
1378 * Calling @a (*editor)->close_edit completes the commit.
1380 * If @a commit_callback is non-NULL, then before @c close_edit returns (but
1381 * after the commit has succeeded) @c close_edit will invoke
1382 * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
1383 * and @a pool or some subpool thereof as arguments. If @a commit_callback
1384 * returns an error, that error will be returned from @c close_edit,
1385 * otherwise if there was a post-commit hook failure, then that error
1386 * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
1387 * (Note that prior to Subversion 1.6, @a commit_callback cannot be NULL; if
1388 * you don't need a callback, pass a dummy function.)
1390 * Calling @a (*editor)->abort_edit aborts the commit, and will also
1391 * abort the commit transaction unless @a txn was supplied (not @c
1392 * NULL). Callers who supply their own transactions are responsible
1393 * for cleaning them up (either by committing them, or aborting them).
1395 * @since New in 1.5.
1397 * @note Yes, @a repos_url is a <em>decoded</em> URL. We realize
1398 * that's sorta wonky. Sorry about that.
1401 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
1405 const char *repos_url,
1406 const char *base_path,
1407 apr_hash_t *revprop_table,
1408 svn_commit_callback2_t commit_callback,
1410 svn_repos_authz_callback_t authz_callback,
1415 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
1416 * set to a hash containing @a user and @a log_msg as the
1417 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
1418 * respectively. @a user and @a log_msg may both be @c NULL.
1420 * @since New in 1.4.
1422 * @deprecated Provided for backward compatibility with the 1.4 API.
1426 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
1430 const char *repos_url,
1431 const char *base_path,
1433 const char *log_msg,
1434 svn_commit_callback2_t commit_callback,
1436 svn_repos_authz_callback_t authz_callback,
1441 * Similar to svn_repos_get_commit_editor4(), but
1442 * uses the svn_commit_callback_t type.
1444 * @since New in 1.3.
1446 * @deprecated Provided for backward compatibility with the 1.3 API.
1450 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1454 const char *repos_url,
1455 const char *base_path,
1457 const char *log_msg,
1458 svn_commit_callback_t callback,
1459 void *callback_baton,
1460 svn_repos_authz_callback_t authz_callback,
1465 * Similar to svn_repos_get_commit_editor3(), but with @a
1466 * authz_callback and @a authz_baton set to @c NULL.
1468 * @deprecated Provided for backward compatibility with the 1.2 API.
1472 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1476 const char *repos_url,
1477 const char *base_path,
1479 const char *log_msg,
1480 svn_commit_callback_t callback,
1481 void *callback_baton,
1486 * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1489 * @deprecated Provided for backward compatibility with the 1.1 API.
1493 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1496 const char *repos_url,
1497 const char *base_path,
1499 const char *log_msg,
1500 svn_commit_callback_t callback,
1501 void *callback_baton,
1504 /* ---------------------------------------------------------------*/
1506 /* Finding particular revisions. */
1508 /** Set @a *revision to the revision number in @a repos's filesystem that was
1509 * youngest at time @a tm.
1512 svn_repos_dated_revision(svn_revnum_t *revision,
1518 /** Given a @a root/@a path within some filesystem, return three pieces of
1519 * information allocated in @a pool:
1521 * - set @a *committed_rev to the revision in which the object was
1522 * last modified. (In fs parlance, this is the revision in which
1523 * the particular node-rev-id was 'created'.)
1525 * - set @a *committed_date to the date of said revision, or @c NULL
1528 * - set @a *last_author to the author of said revision, or @c NULL
1532 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
1533 const char **committed_date,
1534 const char **last_author,
1535 svn_fs_root_t *root,
1541 * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
1542 * root. If @a path does not exist in @a root, set @a *dirent to
1543 * NULL. Use @a pool for memory allocation.
1545 * @since New in 1.2.
1548 svn_repos_stat(svn_dirent_t **dirent,
1549 svn_fs_root_t *root,
1555 * Given @a path which exists at revision @a start in @a fs, set
1556 * @a *deleted to the revision @a path was first deleted, within the
1557 * inclusive revision range bounded by @a start and @a end. If @a path
1558 * does not exist at revision @a start or was not deleted within the
1559 * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1560 * Use @a pool for memory allocation.
1562 * @since New in 1.5.
1565 svn_repos_deleted_rev(svn_fs_t *fs,
1569 svn_revnum_t *deleted,
1573 /** Callback type for use with svn_repos_history(). @a path and @a
1574 * revision represent interesting history locations in the lifetime
1575 * of the path passed to svn_repos_history(). @a baton is the same
1576 * baton given to svn_repos_history(). @a pool is provided for the
1577 * convenience of the implementor, who should not expect it to live
1578 * longer than a single callback call.
1580 * Signal to callback driver to stop processing/invoking this callback
1581 * by returning the #SVN_ERR_CEASE_INVOCATION error code.
1583 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1585 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1587 svn_revnum_t revision,
1591 * Call @a history_func (with @a history_baton) for each interesting
1592 * history location in the lifetime of @a path in @a fs, from the
1593 * youngest of @a end and @a start to the oldest. Stop processing if
1594 * @a history_func returns #SVN_ERR_CEASE_INVOCATION. Only cross
1595 * filesystem copy history if @a cross_copies is @c TRUE. And do all
1596 * of this in @a pool.
1598 * If @a authz_read_func is non-NULL, then use it (and @a
1599 * authz_read_baton) to verify that @a path in @a end is readable; if
1600 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability
1601 * of every ancestral path/revision pair before pushing them at @a
1602 * history_func. If a pair is deemed unreadable, then do not send
1603 * them; instead, immediately stop traversing history and return
1606 * @since New in 1.1.
1608 * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1611 svn_repos_history2(svn_fs_t *fs,
1613 svn_repos_history_func_t history_func,
1614 void *history_baton,
1615 svn_repos_authz_func_t authz_read_func,
1616 void *authz_read_baton,
1619 svn_boolean_t cross_copies,
1623 * Similar to svn_repos_history2(), but with @a authz_read_func
1624 * and @a authz_read_baton always set to NULL.
1626 * @deprecated Provided for backward compatibility with the 1.0 API.
1630 svn_repos_history(svn_fs_t *fs,
1632 svn_repos_history_func_t history_func,
1633 void *history_baton,
1636 svn_boolean_t cross_copies,
1641 * Set @a *locations to be a mapping of the revisions to the paths of
1642 * the file @a fs_path present at the repository in revision
1643 * @a peg_revision, where the revisions are taken out of the array
1644 * @a location_revisions.
1646 * @a location_revisions is an array of svn_revnum_t's and @a *locations
1647 * maps 'svn_revnum_t *' to 'const char *'.
1649 * If optional @a authz_read_func is non-NULL, then use it (and @a
1650 * authz_read_baton) to verify that the peg-object is readable. If not,
1651 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func
1652 * to check that every path returned in the hash is readable. If an
1653 * unreadable path is encountered, stop tracing and return
1656 * @a pool is used for all allocations.
1658 * @since New in 1.1.
1661 svn_repos_trace_node_locations(svn_fs_t *fs,
1662 apr_hash_t **locations,
1663 const char *fs_path,
1664 svn_revnum_t peg_revision,
1665 const apr_array_header_t *location_revisions,
1666 svn_repos_authz_func_t authz_read_func,
1667 void *authz_read_baton,
1672 * Call @a receiver and @a receiver_baton to report successive
1673 * location segments in revisions between @a start_rev and @a end_rev
1674 * (inclusive) for the line of history identified by the peg-object @a
1675 * path in @a peg_revision (and in @a repos).
1677 * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
1678 * to trace the history of the object to its origin.
1680 * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
1681 * revision". Otherwise, @a start_rev must be younger than @a end_rev
1682 * (unless @a end_rev is #SVN_INVALID_REVNUM).
1684 * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
1685 * revision", and must evaluate to be at least as young as @a start_rev.
1687 * If optional @a authz_read_func is not @c NULL, then use it (and @a
1688 * authz_read_baton) to verify that the peg-object is readable. If
1689 * not, return #SVN_ERR_AUTHZ_UNREADABLE. Also use the @a
1690 * authz_read_func to check that every path reported in a location
1691 * segment is readable. If an unreadable path is encountered, report
1692 * a final (possibly truncated) location segment (if any), stop
1693 * tracing history, and return #SVN_NO_ERROR.
1695 * @a pool is used for all allocations.
1697 * @since New in 1.5.
1700 svn_repos_node_location_segments(svn_repos_t *repos,
1702 svn_revnum_t peg_revision,
1703 svn_revnum_t start_rev,
1704 svn_revnum_t end_rev,
1705 svn_location_segment_receiver_t receiver,
1706 void *receiver_baton,
1707 svn_repos_authz_func_t authz_read_func,
1708 void *authz_read_baton,
1712 /* ### other queries we can do someday --
1714 * fetch the last revision created by <user>
1715 (once usernames become revision properties!)
1716 * fetch the last revision where <path> was modified
1722 /* ---------------------------------------------------------------*/
1724 /* Retrieving log messages. */
1728 * Invoke @a receiver with @a receiver_baton on each log message from
1729 * @a start to @a end in @a repos's filesystem. @a start may be greater
1730 * or less than @a end; this just controls whether the log messages are
1731 * processed in descending or ascending revision number order.
1733 * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
1735 * If @a paths is non-NULL and has one or more elements, then only show
1736 * revisions in which at least one of @a paths was changed (i.e., if
1737 * file, text or props changed; if dir, props or entries changed or any node
1738 * changed below it). Each path is a <tt>const char *</tt> representing
1739 * an absolute path in the repository. If @a paths is NULL or empty,
1740 * show all revisions regardless of what paths were changed in those
1743 * If @a limit is non-zero then only invoke @a receiver on the first
1746 * If @a discover_changed_paths, then each call to @a receiver passes a
1747 * hash mapping paths committed in that revision to information about them
1748 * as the receiver's @a changed_paths argument.
1749 * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
1751 * If @a strict_node_history is set, copy history (if any exists) will
1752 * not be traversed while harvesting revision logs for each path.
1754 * If @a include_merged_revisions is set, log information for revisions
1755 * which have been merged to @a paths will also be returned, unless these
1756 * revisions are already part of @a start to @a end in @a repos's
1757 * filesystem, as limited by @a paths. In the latter case those revisions
1758 * are skipped and @a receiver is not invoked.
1760 * If @a revprops is NULL, retrieve all revision properties; else, retrieve
1761 * only the revision properties named by the (const char *) array elements
1762 * (i.e. retrieve none if the array is empty).
1764 * If any invocation of @a receiver returns error, return that error
1765 * immediately and without wrapping it.
1767 * If @a start or @a end is a non-existent revision, return the error
1768 * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
1770 * If optional @a authz_read_func is non-NULL, then use this function
1771 * (along with optional @a authz_read_baton) to check the readability
1772 * of each changed-path in each revision about to be "pushed" at
1773 * @a receiver. If a revision has some changed-paths readable and
1774 * others unreadable, unreadable paths are omitted from the
1775 * changed_paths field and only svn:author and svn:date will be
1776 * available in the revprops field. If a revision has no
1777 * changed-paths readable at all, then all paths are omitted and no
1778 * revprops are available.
1780 * See also the documentation for #svn_log_entry_receiver_t.
1782 * Use @a pool for temporary allocations.
1784 * @since New in 1.5.
1787 svn_repos_get_logs4(svn_repos_t *repos,
1788 const apr_array_header_t *paths,
1792 svn_boolean_t discover_changed_paths,
1793 svn_boolean_t strict_node_history,
1794 svn_boolean_t include_merged_revisions,
1795 const apr_array_header_t *revprops,
1796 svn_repos_authz_func_t authz_read_func,
1797 void *authz_read_baton,
1798 svn_log_entry_receiver_t receiver,
1799 void *receiver_baton,
1803 * Same as svn_repos_get_logs4(), but with @a receiver being
1804 * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
1805 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
1806 * svn:author, svn:date, and svn:log. If @a paths is empty, nothing
1809 * @since New in 1.2.
1810 * @deprecated Provided for backward compatibility with the 1.4 API.
1814 svn_repos_get_logs3(svn_repos_t *repos,
1815 const apr_array_header_t *paths,
1819 svn_boolean_t discover_changed_paths,
1820 svn_boolean_t strict_node_history,
1821 svn_repos_authz_func_t authz_read_func,
1822 void *authz_read_baton,
1823 svn_log_message_receiver_t receiver,
1824 void *receiver_baton,
1829 * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
1831 * @deprecated Provided for backward compatibility with the 1.1 API.
1835 svn_repos_get_logs2(svn_repos_t *repos,
1836 const apr_array_header_t *paths,
1839 svn_boolean_t discover_changed_paths,
1840 svn_boolean_t strict_node_history,
1841 svn_repos_authz_func_t authz_read_func,
1842 void *authz_read_baton,
1843 svn_log_message_receiver_t receiver,
1844 void *receiver_baton,
1848 * Same as svn_repos_get_logs2(), but with @a authz_read_func and
1849 * @a authz_read_baton always set to NULL.
1851 * @deprecated Provided for backward compatibility with the 1.0 API.
1855 svn_repos_get_logs(svn_repos_t *repos,
1856 const apr_array_header_t *paths,
1859 svn_boolean_t discover_changed_paths,
1860 svn_boolean_t strict_node_history,
1861 svn_log_message_receiver_t receiver,
1862 void *receiver_baton,
1867 /* ---------------------------------------------------------------*/
1869 /* Retrieving mergeinfo. */
1872 * Fetch the mergeinfo for @a paths at @a revision in @a repos, and
1873 * set @a *catalog to a catalog of this mergeinfo. @a *catalog will
1874 * never be @c NULL but may be empty.
1876 * The paths in @a paths, and the keys of @a catalog, start with '/'.
1878 * @a inherit indicates whether explicit, explicit or inherited, or
1879 * only inherited mergeinfo for @a paths is fetched.
1881 * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
1883 * If @a include_descendants is TRUE, then additionally return the
1884 * mergeinfo for any descendant of any element of @a paths which has
1885 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note
1886 * that inheritance is only taken into account for the elements in @a
1887 * paths; descendants of the elements in @a paths which get their
1888 * mergeinfo via inheritance are not included in @a *catalog.)
1890 * If optional @a authz_read_func is non-NULL, then use this function
1891 * (along with optional @a authz_read_baton) to check the readability
1892 * of each path which mergeinfo was requested for (from @a paths).
1893 * Silently omit unreadable paths from the request for mergeinfo.
1895 * Use @a pool for all allocations.
1897 * @since New in 1.5.
1900 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1902 const apr_array_header_t *paths,
1903 svn_revnum_t revision,
1904 svn_mergeinfo_inheritance_t inherit,
1905 svn_boolean_t include_descendants,
1906 svn_repos_authz_func_t authz_read_func,
1907 void *authz_read_baton,
1911 /* ---------------------------------------------------------------*/
1913 /* Retrieving multiple revisions of a file. */
1916 * Retrieve a subset of the interesting revisions of a file @a path in
1917 * @a repos as seen in revision @a end. Invoke @a handler with
1918 * @a handler_baton as its first argument for each such revision.
1919 * @a pool is used for all allocations. See svn_fs_history_prev() for
1920 * a discussion of interesting revisions.
1922 * If optional @a authz_read_func is non-NULL, then use this function
1923 * (along with optional @a authz_read_baton) to check the readability
1924 * of the rev-path in each interesting revision encountered.
1926 * Revision discovery happens from @a end to @a start, and if an
1927 * unreadable revision is encountered before @a start is reached, then
1928 * revision discovery stops and only the revisions from @a end to the
1929 * oldest readable revision are returned (So it will appear that @a
1930 * path was added without history in the latter revision).
1932 * If there is an interesting revision of the file that is less than or
1933 * equal to start, the iteration will start at that revision. Else, the
1934 * iteration will start at the first revision of the file in the repository,
1935 * which has to be less than or equal to end. Note that if the function
1936 * succeeds, @a handler will have been called at least once.
1938 * In a series of calls, the file contents for the first interesting revision
1939 * will be provided as a text delta against the empty file. In the following
1940 * calls, the delta will be against the contents for the previous call.
1942 * If @a include_merged_revisions is TRUE, revisions which a included as a
1943 * result of a merge between @a start and @a end will be included.
1945 * Since Subversion 1.8 this function has been enabled to support reversion
1946 * the revision range for @a include_merged_revision @c FALSE reporting by
1947 * switching @a start with @a end.
1949 * @since New in 1.5.
1952 svn_repos_get_file_revs2(svn_repos_t *repos,
1956 svn_boolean_t include_merged_revisions,
1957 svn_repos_authz_func_t authz_read_func,
1958 void *authz_read_baton,
1959 svn_file_rev_handler_t handler,
1960 void *handler_baton,
1964 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
1967 * @deprecated Provided for backward compatibility with the 1.4 API.
1968 * @since New in 1.1.
1972 svn_repos_get_file_revs(svn_repos_t *repos,
1976 svn_repos_authz_func_t authz_read_func,
1977 void *authz_read_baton,
1978 svn_repos_file_rev_handler_t handler,
1979 void *handler_baton,
1983 /* ---------------------------------------------------------------*/
1986 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
1991 /** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
1992 * post-commit hooks around the commit. Use @a pool for any necessary
1995 * If the pre-commit hook fails, do not attempt to commit the
1996 * transaction and throw the original error to the caller.
1998 * A successful commit is indicated by a valid revision value in @a
1999 * *new_rev, not if svn_fs_commit_txn() returns an error, which can
2000 * occur during its post commit FS processing. If the transaction was
2001 * not committed, then return the associated error and do not execute
2002 * the post-commit hook.
2004 * If the commit succeeds the post-commit hook is executed. If the
2005 * post-commit hook returns an error, always wrap it with
2006 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
2007 * find the post-commit hook error in the returned error chain. If
2008 * both svn_fs_commit_txn() and the post-commit hook return errors,
2009 * then svn_fs_commit_txn()'s error is the parent error and the
2010 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
2013 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
2016 svn_repos_fs_commit_txn(const char **conflict_p,
2018 svn_revnum_t *new_rev,
2022 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
2023 * <tt>const char *</tt> property names to #svn_string_t values, to
2024 * set the properties on transaction @a *txn_p. @a repos is the
2025 * repository object which contains the filesystem. @a rev, @a
2026 * *txn_p, and @a pool are as in svn_fs_begin_txn().
2028 * Before a txn is created, the repository's start-commit hooks are
2029 * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
2030 * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
2032 * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
2033 * which will be set on the transaction, but that will be overwritten
2034 * when the transaction is committed.
2036 * @since New in 1.5.
2039 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
2042 apr_hash_t *revprop_table,
2047 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
2048 * set to a hash containing @a author and @a log_msg as the
2049 * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
2050 * respectively. @a author and @a log_msg may both be @c NULL.
2052 * @deprecated Provided for backward compatibility with the 1.4 API.
2056 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
2060 const char *log_msg,
2064 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
2065 * property on transaction @a *txn_p. @a repos is the repository object
2066 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in
2067 * svn_fs_begin_txn().
2069 * ### Someday: before a txn is created, some kind of read-hook could
2072 * @note This function was never fully implemented, nor used. Ignore it.
2073 * @deprecated Provided for backward compatibility with the 1.7 API.
2077 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
2086 /** @defgroup svn_repos_fs_locks Repository lock wrappers
2090 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
2091 * post-lock hooks before and after the locking action. Use @a pool
2092 * for any necessary allocations.
2094 * If the pre-lock hook or svn_fs_lock() fails, throw the original
2095 * error to caller. If an error occurs when running the post-lock
2096 * hook, return the original error wrapped with
2097 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
2098 * error, it knows that the lock succeeded anyway.
2100 * The pre-lock hook may cause a different token to be used for the
2101 * lock, instead of @a token; see the pre-lock-hook documentation for
2104 * @since New in 1.2.
2107 svn_repos_fs_lock(svn_lock_t **lock,
2111 const char *comment,
2112 svn_boolean_t is_dav_comment,
2113 apr_time_t expiration_date,
2114 svn_revnum_t current_rev,
2115 svn_boolean_t steal_lock,
2119 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
2120 * post-unlock hooks before and after the unlocking action. Use @a
2121 * pool for any necessary allocations.
2123 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
2124 * error to caller. If an error occurs when running the post-unlock
2125 * hook, return the original error wrapped with
2126 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this
2127 * error, it knows that the unlock succeeded anyway.
2129 * @since New in 1.2.
2132 svn_repos_fs_unlock(svn_repos_t *repos,
2135 svn_boolean_t break_lock,
2140 /** Look up all the locks in and under @a path in @a repos, setting @a
2141 * *locks to a hash which maps <tt>const char *</tt> paths to the
2142 * #svn_lock_t locks associated with those paths. Use @a
2143 * authz_read_func and @a authz_read_baton to "screen" all returned
2144 * locks. That is: do not return any locks on any paths that are
2145 * unreadable in HEAD, just silently omit them.
2147 * @a depth limits the returned locks to those associated with paths
2148 * within the specified depth of @a path, and must be one of the
2149 * following values: #svn_depth_empty, #svn_depth_files,
2150 * #svn_depth_immediates, or #svn_depth_infinity.
2152 * @since New in 1.7.
2155 svn_repos_fs_get_locks2(apr_hash_t **locks,
2159 svn_repos_authz_func_t authz_read_func,
2160 void *authz_read_baton,
2164 * Similar to svn_repos_fs_get_locks2(), but with @a depth always
2165 * passed as svn_depth_infinity.
2167 * @since New in 1.2.
2168 * @deprecated Provided for backward compatibility with the 1.6 API.
2172 svn_repos_fs_get_locks(apr_hash_t **locks,
2175 svn_repos_authz_func_t authz_read_func,
2176 void *authz_read_baton,
2182 * Like svn_fs_change_rev_prop2(), but validate the name and value of the
2183 * property and invoke the @a repos's pre- and post-revprop-change hooks
2184 * around the change as specified by @a use_pre_revprop_change_hook and
2185 * @a use_post_revprop_change_hook (respectively).
2187 * @a rev is the revision whose property to change, @a name is the
2188 * name of the property, and @a new_value is the new value of the
2189 * property. If @a old_value_p is not @c NULL, then @a *old_value_p
2190 * is the expected current (preexisting) value of the property (or @c NULL
2191 * for "unset"). @a author is the authenticated username of the person
2192 * changing the property value, or NULL if not available.
2194 * If @a authz_read_func is non-NULL, then use it (with @a
2195 * authz_read_baton) to validate the changed-paths associated with @a
2196 * rev. If the revision contains any unreadable changed paths, then
2197 * return #SVN_ERR_AUTHZ_UNREADABLE.
2199 * Validate @a name and @a new_value like the same way
2200 * svn_repos_fs_change_node_prop() does.
2202 * Use @a pool for temporary allocations.
2204 * @since New in 1.7.
2207 svn_repos_fs_change_rev_prop4(svn_repos_t *repos,
2211 const svn_string_t *const *old_value_p,
2212 const svn_string_t *new_value,
2214 use_pre_revprop_change_hook,
2216 use_post_revprop_change_hook,
2217 svn_repos_authz_func_t
2219 void *authz_read_baton,
2223 * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
2224 * set to @c NULL. (In other words, it is similar to
2225 * svn_fs_change_rev_prop().)
2227 * @deprecated Provided for backward compatibility with the 1.6 API.
2228 * @since New in 1.5.
2232 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
2236 const svn_string_t *new_value,
2238 use_pre_revprop_change_hook,
2240 use_post_revprop_change_hook,
2241 svn_repos_authz_func_t
2243 void *authz_read_baton,
2247 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
2248 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
2249 * always set to @c TRUE.
2251 * @deprecated Provided for backward compatibility with the 1.4 API.
2255 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
2259 const svn_string_t *new_value,
2260 svn_repos_authz_func_t
2262 void *authz_read_baton,
2266 * Similar to svn_repos_fs_change_rev_prop2(), but with the
2267 * @a authz_read_func parameter always NULL.
2269 * @deprecated Provided for backward compatibility with the 1.0 API.
2273 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
2277 const svn_string_t *new_value,
2283 * Set @a *value_p to the value of the property named @a propname on
2284 * revision @a rev in the filesystem opened in @a repos. If @a rev
2285 * has no property by that name, set @a *value_p to zero. Allocate
2286 * the result in @a pool.
2288 * If @a authz_read_func is non-NULL, then use it (with @a
2289 * authz_read_baton) to validate the changed-paths associated with @a
2290 * rev. If the changed-paths are all unreadable, then set @a *value_p
2291 * to zero unconditionally. If only some of the changed-paths are
2292 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
2293 * fetched, but return 0 for any other property.
2295 * @since New in 1.1.
2298 svn_repos_fs_revision_prop(svn_string_t **value_p,
2301 const char *propname,
2302 svn_repos_authz_func_t
2304 void *authz_read_baton,
2309 * Set @a *table_p to the entire property list of revision @a rev in
2310 * filesystem opened in @a repos, as a hash table allocated in @a
2311 * pool. The table maps <tt>char *</tt> property names to
2312 * #svn_string_t * values; the names and values are allocated in @a
2315 * If @a authz_read_func is non-NULL, then use it (with @a
2316 * authz_read_baton) to validate the changed-paths associated with @a
2317 * rev. If the changed-paths are all unreadable, then return an empty
2318 * hash. If only some of the changed-paths are unreadable, then return
2319 * an empty hash, except for 'svn:author' and 'svn:date' properties
2320 * (assuming those properties exist).
2322 * @since New in 1.1.
2325 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
2328 svn_repos_authz_func_t
2330 void *authz_read_baton,
2335 /* ---------------------------------------------------------------*/
2337 /* Prop-changing wrappers for libsvn_fs routines. */
2339 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
2340 above with the hook-related functions. */
2343 /** Validating wrapper for svn_fs_change_node_prop() (which see for
2344 * argument descriptions).
2346 * If @a name's kind is not #svn_prop_regular_kind, return
2347 * #SVN_ERR_REPOS_BAD_ARGS. If @a name is an "svn:" property, validate its
2348 * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
2351 * @note Currently, the only properties validated are the "svn:" properties
2352 * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. This may change
2353 * in future releases.
2356 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
2359 const svn_string_t *value,
2362 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
2363 * argument descriptions). See svn_repos_fs_change_txn_props() for more
2367 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
2369 const svn_string_t *value,
2372 /** Validating wrapper for svn_fs_change_txn_props() (which see for
2373 * argument descriptions). Validate properties and their values the
2374 * same way svn_repos_fs_change_node_prop() does.
2376 * @since New in 1.5.
2379 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
2380 const apr_array_header_t *props,
2384 /* ---------------------------------------------------------------*/
2387 * @defgroup svn_repos_inspection Data structures and editor things for \
2388 * repository inspection.
2391 * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
2392 * svn_repos_begin_report3() interfaces can be extremely useful for
2393 * examining the repository, or more exactly, changes to the repository.
2394 * These drivers allows for differences between two trees to be
2395 * described using an editor.
2397 * By using the editor obtained from svn_repos_node_editor() with one of
2398 * the drivers mentioned above, the description of how to transform one
2399 * tree into another can be used to build an in-memory linked-list tree,
2400 * which each node representing a repository node that was changed.
2403 /** A node in the repository. */
2404 typedef struct svn_repos_node_t
2406 /** Node type (file, dir, etc.) */
2407 svn_node_kind_t kind;
2409 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
2412 /** Were there any textual mods? (files only) */
2413 svn_boolean_t text_mod;
2415 /** Where there any property mods? */
2416 svn_boolean_t prop_mod;
2418 /** The name of this node as it appears in its parent's entries list */
2421 /** The filesystem revision where this was copied from (if any) */
2422 svn_revnum_t copyfrom_rev;
2424 /** The filesystem path where this was copied from (if any) */
2425 const char *copyfrom_path;
2427 /** Pointer to the next sibling of this node */
2428 struct svn_repos_node_t *sibling;
2430 /** Pointer to the first child of this node */
2431 struct svn_repos_node_t *child;
2433 /** Pointer to the parent of this node */
2434 struct svn_repos_node_t *parent;
2439 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
2440 * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
2441 * tree representing the delta from @a base_root to @a root in @a
2442 * repos's filesystem.
2444 * The editor can also be driven by svn_repos_dir_delta2() or
2445 * svn_repos_begin_report3(), but unless you have special needs,
2446 * svn_repos_replay2() is preferred.
2448 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
2451 * Note that the delta includes "bubbled-up" directories; that is,
2452 * many of the directory nodes will have no prop_mods.
2454 * Allocate the tree and its contents in @a node_pool; do all other
2455 * allocation in @a pool.
2458 svn_repos_node_editor(const svn_delta_editor_t **editor,
2461 svn_fs_root_t *base_root,
2462 svn_fs_root_t *root,
2463 apr_pool_t *node_pool,
2466 /** Return the root node of the linked-list tree generated by driving the
2467 * editor (associated with @a edit_baton) created by svn_repos_node_editor().
2468 * This is only really useful if used *after* the editor drive is completed.
2471 svn_repos_node_from_baton(void *edit_baton);
2475 /* ---------------------------------------------------------------*/
2478 * @defgroup svn_repos_dump_load Dumping and loading filesystem data
2481 * The filesystem 'dump' format contains nothing but the abstract
2482 * structure of the filesystem -- independent of any internal node-id
2483 * schema or database back-end. All of the data in the dumpfile is
2484 * acquired by public function calls into svn_fs.h. Similarly, the
2485 * parser which reads the dumpfile is able to reconstruct the
2486 * filesystem using only public svn_fs.h routines.
2488 * Thus the dump/load feature's main purpose is for *migrating* data
2489 * from one svn filesystem to another -- presumably two filesystems
2490 * which have different internal implementations.
2492 * If you simply want to backup your filesystem, you're probably
2493 * better off using the built-in facilities of the DB backend (using
2494 * Berkeley DB's hot-backup feature, for example.)
2496 * For a description of the dumpfile format, see
2497 * /trunk/notes/fs_dumprestore.txt.
2500 /* The RFC822-style headers in our dumpfile format. */
2501 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version"
2502 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3
2503 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS 3
2504 #define SVN_REPOS_DUMPFILE_UUID "UUID"
2505 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length"
2507 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number"
2509 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path"
2510 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind"
2511 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action"
2512 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path"
2513 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev"
2514 /** @since New in 1.6. */
2515 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5 "Text-copy-source-md5"
2516 /** @since New in 1.6. */
2517 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1 "Text-copy-source-sha1"
2518 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
2519 SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
2520 /** @since New in 1.6. */
2521 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5 "Text-content-md5"
2522 /** @since New in 1.6. */
2523 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1 "Text-content-sha1"
2524 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM \
2525 SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
2527 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length"
2528 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length"
2530 /** @since New in 1.1. */
2531 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta"
2532 /** @since New in 1.1. */
2533 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta"
2534 /** @since New in 1.6. */
2535 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5 "Text-delta-base-md5"
2536 /** @since New in 1.6. */
2537 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1 "Text-delta-base-sha1"
2538 /** @since New in 1.5. */
2539 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM \
2540 SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
2543 * Verify the contents of the file system in @a repos.
2545 * If @a feedback_stream is not @c NULL, write feedback to it (lines of
2546 * the form "* Verified revision %ld\n").
2548 * If @a start_rev is #SVN_INVALID_REVNUM, then start verifying at
2549 * revision 0. If @a end_rev is #SVN_INVALID_REVNUM, then verify
2550 * through the @c HEAD revision.
2552 * For every verified revision call @a notify_func with @a rev set to
2553 * the verified revision and @a warning_text @c NULL. For warnings call @a
2554 * notify_func with @a warning_text set.
2556 * If @a cancel_func is not @c NULL, call it periodically with @a
2557 * cancel_baton as argument to see if the caller wishes to cancel the
2560 * @since New in 1.7.
2563 svn_repos_verify_fs2(svn_repos_t *repos,
2564 svn_revnum_t start_rev,
2565 svn_revnum_t end_rev,
2566 svn_repos_notify_func_t notify_func,
2568 svn_cancel_func_t cancel,
2570 apr_pool_t *scratch_pool);
2573 * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
2574 * handling feedback via the notify_func handler
2576 * @since New in 1.5.
2577 * @deprecated Provided for backward compatibility with the 1.6 API.
2581 svn_repos_verify_fs(svn_repos_t *repos,
2582 svn_stream_t *feedback_stream,
2583 svn_revnum_t start_rev,
2584 svn_revnum_t end_rev,
2585 svn_cancel_func_t cancel_func,
2590 * Dump the contents of the filesystem within already-open @a repos into
2591 * writable @a dumpstream. Begin at revision @a start_rev, and dump every
2592 * revision up through @a end_rev. Use @a pool for all allocation. If
2593 * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is
2594 * @c NULL, this is effectively a primitive verify. It is not complete,
2595 * however; svn_repos_verify_fs2() and svn_fs_verify().
2597 * If @a start_rev is #SVN_INVALID_REVNUM, then start dumping at revision
2598 * 0. If @a end_rev is #SVN_INVALID_REVNUM, then dump through the @c HEAD
2601 * If @a incremental is @c TRUE, the first revision dumped will be a diff
2602 * against the previous revision (usually it looks like a full dump of
2605 * If @a use_deltas is @c TRUE, output only node properties which have
2606 * changed relative to the previous contents, and output text contents
2607 * as svndiff data against the previous contents. Regardless of how
2608 * this flag is set, the first revision of a non-incremental dump will
2609 * be done with full plain text. A dump with @a use_deltas set cannot
2610 * be loaded by Subversion 1.0.x.
2612 * If @a notify_func is not @c NULL, then for every dumped revision call
2613 * @a notify_func with @a rev set to the dumped revision and @a warning_text
2614 * @c NULL. For warnings call @a notify_func with @a warning_text.
2616 * If @a cancel_func is not @c NULL, it is called periodically with
2617 * @a cancel_baton as argument to see if the client wishes to cancel
2620 * @since New in 1.7.
2623 svn_repos_dump_fs3(svn_repos_t *repos,
2624 svn_stream_t *dumpstream,
2625 svn_revnum_t start_rev,
2626 svn_revnum_t end_rev,
2627 svn_boolean_t incremental,
2628 svn_boolean_t use_deltas,
2629 svn_repos_notify_func_t notify_func,
2631 svn_cancel_func_t cancel_func,
2633 apr_pool_t *scratch_pool);
2636 * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
2637 * handling feedback via the notify_func handler
2639 * @since New in 1.1.
2640 * @deprecated Provided for backward compatibility with the 1.6 API.
2644 svn_repos_dump_fs2(svn_repos_t *repos,
2645 svn_stream_t *dumpstream,
2646 svn_stream_t *feedback_stream,
2647 svn_revnum_t start_rev,
2648 svn_revnum_t end_rev,
2649 svn_boolean_t incremental,
2650 svn_boolean_t use_deltas,
2651 svn_cancel_func_t cancel_func,
2656 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
2657 * parameter always set to @c FALSE.
2659 * @deprecated Provided for backward compatibility with the 1.0 API.
2663 svn_repos_dump_fs(svn_repos_t *repos,
2664 svn_stream_t *dumpstream,
2665 svn_stream_t *feedback_stream,
2666 svn_revnum_t start_rev,
2667 svn_revnum_t end_rev,
2668 svn_boolean_t incremental,
2669 svn_cancel_func_t cancel_func,
2675 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
2676 * filesystem revisions in already-open @a repos, handling uuids in
2677 * accordance with @a uuid_action. Use @a pool for all allocation.
2679 * If the dumpstream contains copy history that is unavailable in the
2680 * repository, an error will be thrown.
2682 * The repository's UUID will be updated iff
2683 * the dumpstream contains a UUID and
2684 * @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
2685 * either the repository contains no revisions or
2686 * @a uuid_action is equal to #svn_repos_load_uuid_force.
2688 * If the dumpstream contains no UUID, then @a uuid_action is
2689 * ignored and the repository UUID is not touched.
2691 * @a start_rev and @a end_rev act as filters, the lower and upper
2692 * (inclusive) range values of revisions in @a dumpstream which will
2693 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
2694 * which case no revision-based filtering occurs at all), or both are
2695 * valid revisions (where @a start_rev is older than or equivalent to
2698 * If @a parent_dir is not NULL, then the parser will reparent all the
2699 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2700 * must be an existing directory in the repository.
2702 * If @a use_pre_commit_hook is set, call the repository's pre-commit
2703 * hook before committing each loaded revision.
2705 * If @a use_post_commit_hook is set, call the repository's
2706 * post-commit hook after committing each loaded revision.
2708 * If @a validate_props is set, then validate Subversion revision and
2709 * node properties (those in the svn: namespace) against established
2710 * rules for those things.
2712 * If non-NULL, use @a notify_func and @a notify_baton to send notification
2713 * of events to the caller.
2715 * If @a cancel_func is not @c NULL, it is called periodically with
2716 * @a cancel_baton as argument to see if the client wishes to cancel
2719 * @since New in 1.8.
2722 svn_repos_load_fs4(svn_repos_t *repos,
2723 svn_stream_t *dumpstream,
2724 svn_revnum_t start_rev,
2725 svn_revnum_t end_rev,
2726 enum svn_repos_load_uuid uuid_action,
2727 const char *parent_dir,
2728 svn_boolean_t use_pre_commit_hook,
2729 svn_boolean_t use_post_commit_hook,
2730 svn_boolean_t validate_props,
2731 svn_repos_notify_func_t notify_func,
2733 svn_cancel_func_t cancel_func,
2737 /** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
2738 * end_rev always passed as #SVN_INVALID_REVNUM.
2740 * @since New in 1.7.
2741 * @deprecated Provided for backward compatibility with the 1.7 API.
2745 svn_repos_load_fs3(svn_repos_t *repos,
2746 svn_stream_t *dumpstream,
2747 enum svn_repos_load_uuid uuid_action,
2748 const char *parent_dir,
2749 svn_boolean_t use_pre_commit_hook,
2750 svn_boolean_t use_post_commit_hook,
2751 svn_boolean_t validate_props,
2752 svn_repos_notify_func_t notify_func,
2754 svn_cancel_func_t cancel_func,
2759 * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
2760 * place of the #svn_repos_notify_func_t and baton and with
2761 * @a validate_props always FALSE.
2763 * @since New in 1.2.
2764 * @deprecated Provided for backward compatibility with the 1.6 API.
2768 svn_repos_load_fs2(svn_repos_t *repos,
2769 svn_stream_t *dumpstream,
2770 svn_stream_t *feedback_stream,
2771 enum svn_repos_load_uuid uuid_action,
2772 const char *parent_dir,
2773 svn_boolean_t use_pre_commit_hook,
2774 svn_boolean_t use_post_commit_hook,
2775 svn_cancel_func_t cancel_func,
2780 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
2781 * @a use_post_commit_hook always @c FALSE.
2783 * @deprecated Provided for backward compatibility with the 1.1 API.
2787 svn_repos_load_fs(svn_repos_t *repos,
2788 svn_stream_t *dumpstream,
2789 svn_stream_t *feedback_stream,
2790 enum svn_repos_load_uuid uuid_action,
2791 const char *parent_dir,
2792 svn_cancel_func_t cancel_func,
2798 * A vtable that is driven by svn_repos_parse_dumpstream3().
2800 * @since New in 1.8.
2802 typedef struct svn_repos_parse_fns3_t
2804 /** The parser has discovered a new "magic header" record within the
2805 * parsing session represented by @a parse_baton. The dump-format
2806 * version number is @a version.
2808 svn_error_t *(*magic_header_record)(int version,
2812 /** The parser has discovered a new uuid record within the parsing
2813 * session represented by @a parse_baton. The uuid's value is
2814 * @a uuid, and it is allocated in @a pool.
2816 svn_error_t *(*uuid_record)(const char *uuid,
2820 /** The parser has discovered a new revision record within the
2821 * parsing session represented by @a parse_baton. All the headers are
2822 * placed in @a headers (allocated in @a pool), which maps <tt>const
2823 * char *</tt> header-name ==> <tt>const char *</tt> header-value.
2824 * The @a revision_baton received back (also allocated in @a pool)
2825 * represents the revision.
2827 svn_error_t *(*new_revision_record)(void **revision_baton,
2828 apr_hash_t *headers,
2832 /** The parser has discovered a new node record within the current
2833 * revision represented by @a revision_baton. All the headers are
2834 * placed in @a headers (as with @c new_revision_record), allocated in
2835 * @a pool. The @a node_baton received back is allocated in @a pool
2836 * and represents the node.
2838 svn_error_t *(*new_node_record)(void **node_baton,
2839 apr_hash_t *headers,
2840 void *revision_baton,
2843 /** For a given @a revision_baton, set a property @a name to @a value. */
2844 svn_error_t *(*set_revision_property)(void *revision_baton,
2846 const svn_string_t *value);
2848 /** For a given @a node_baton, set a property @a name to @a value. */
2849 svn_error_t *(*set_node_property)(void *node_baton,
2851 const svn_string_t *value);
2853 /** For a given @a node_baton, delete property @a name. */
2854 svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
2856 /** For a given @a node_baton, remove all properties. */
2857 svn_error_t *(*remove_node_props)(void *node_baton);
2859 /** For a given @a node_baton, receive a writable @a stream capable of
2860 * receiving the node's fulltext. After writing the fulltext, call
2861 * the stream's close() function.
2863 * If a @c NULL is returned instead of a stream, the vtable is
2864 * indicating that no text is desired, and the parser will not
2865 * attempt to send it.
2867 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2870 /** For a given @a node_baton, set @a handler and @a handler_baton
2871 * to a window handler and baton capable of receiving a delta
2872 * against the node's previous contents. A NULL window will be
2873 * sent to the handler after all the windows are sent.
2875 * If a @c NULL is returned instead of a handler, the vtable is
2876 * indicating that no delta is desired, and the parser will not
2877 * attempt to send it.
2879 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
2880 void **handler_baton,
2883 /** The parser has reached the end of the current node represented by
2884 * @a node_baton, it can be freed.
2886 svn_error_t *(*close_node)(void *node_baton);
2888 /** The parser has reached the end of the current revision
2889 * represented by @a revision_baton. In other words, there are no more
2890 * changed nodes within the revision. The baton can be freed.
2892 svn_error_t *(*close_revision)(void *revision_baton);
2894 } svn_repos_parse_fns3_t;
2898 * Read and parse dumpfile-formatted @a stream, calling callbacks in
2899 * @a parse_fns/@a parse_baton, and using @a pool for allocations.
2901 * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
2902 * set_fulltext callback. This is useful when manipulating a dump
2903 * stream without loading it. Otherwise handle text-deltas with the
2904 * @a apply_textdelta callback.
2906 * If @a cancel_func is not @c NULL, it is called periodically with
2907 * @a cancel_baton as argument to see if the client wishes to cancel
2910 * This parser has built-in knowledge of the dumpfile format, but only
2911 * in a limited sense:
2913 * * it recognizes the "magic" format-version header.
2915 * * it recognizes the UUID header.
2917 * * it recognizes revision and node records by looking for either
2918 * a REVISION_NUMBER or NODE_PATH headers.
2920 * * it recognizes the CONTENT-LENGTH headers, so it knows if and
2921 * how to suck up the content body.
2923 * * it knows how to parse a content body into two parts: props
2924 * and text, and pass the pieces to the vtable.
2926 * This is enough knowledge to make it easy on vtable implementors,
2927 * but still allow expansion of the format: most headers do not have
2928 * to be handled explicitly.
2930 * @since New in 1.8.
2933 svn_repos_parse_dumpstream3(svn_stream_t *stream,
2934 const svn_repos_parse_fns3_t *parse_fns,
2936 svn_boolean_t deltas_are_text,
2937 svn_cancel_func_t cancel_func,
2943 * Set @a *parser and @a *parse_baton to a vtable parser which commits new
2944 * revisions to the fs in @a repos. The constructed parser will treat
2945 * UUID records in a manner consistent with @a uuid_action. Use @a pool
2946 * to operate on the fs.
2948 * @a start_rev and @a end_rev act as filters, the lower and upper
2949 * (inclusive) range values of revisions in @a dumpstream which will
2950 * be loaded. Either both of these values are #SVN_INVALID_REVNUM (in
2951 * which case no revision-based filtering occurs at all), or both are
2952 * valid revisions (where @a start_rev is older than or equivalent to
2955 * If @a use_history is set, then the parser will require relative
2956 * 'copyfrom' history to exist in the repository when it encounters
2957 * nodes that are added-with-history.
2959 * If @a validate_props is set, then validate Subversion revision and
2960 * node properties (those in the svn: namespace) against established
2961 * rules for those things.
2963 * If @a parent_dir is not NULL, then the parser will reparent all the
2964 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2965 * must be an existing directory in the repository.
2967 * @since New in 1.8.
2970 svn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
2973 svn_revnum_t start_rev,
2974 svn_revnum_t end_rev,
2975 svn_boolean_t use_history,
2976 svn_boolean_t validate_props,
2977 enum svn_repos_load_uuid uuid_action,
2978 const char *parent_dir,
2979 svn_repos_notify_func_t notify_func,
2985 * A vtable that is driven by svn_repos_parse_dumpstream2().
2986 * Similar to #svn_repos_parse_fns3_t except that it lacks
2987 * the delete_node_property and apply_textdelta callbacks.
2989 * @deprecated Provided for backward compatibility with the 1.7 API.
2991 typedef struct svn_repos_parse_fns2_t
2993 /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
2994 svn_error_t *(*new_revision_record)(void **revision_baton,
2995 apr_hash_t *headers,
2998 /** Same as #svn_repos_parse_fns3_t.uuid_record. */
2999 svn_error_t *(*uuid_record)(const char *uuid,
3002 /** Same as #svn_repos_parse_fns3_t.new_node_record. */
3003 svn_error_t *(*new_node_record)(void **node_baton,
3004 apr_hash_t *headers,
3005 void *revision_baton,
3007 /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
3008 svn_error_t *(*set_revision_property)(void *revision_baton,
3010 const svn_string_t *value);
3011 /** Same as #svn_repos_parse_fns3_t.set_node_property. */
3012 svn_error_t *(*set_node_property)(void *node_baton,
3014 const svn_string_t *value);
3015 /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
3016 svn_error_t *(*delete_node_property)(void *node_baton,
3018 /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
3019 svn_error_t *(*remove_node_props)(void *node_baton);
3020 /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
3021 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3023 /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
3024 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3025 void **handler_baton,
3027 /** Same as #svn_repos_parse_fns3_t.close_node. */
3028 svn_error_t *(*close_node)(void *node_baton);
3029 /** Same as #svn_repos_parse_fns3_t.close_revision. */
3030 svn_error_t *(*close_revision)(void *revision_baton);
3031 } svn_repos_parse_fns2_t;
3033 /** @deprecated Provided for backward compatibility with the 1.7 API. */
3034 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
3038 * A vtable that is driven by svn_repos_parse_dumpstream().
3039 * Similar to #svn_repos_parse_fns2_t except that it lacks
3040 * the delete_node_property and apply_textdelta callbacks.
3042 * @deprecated Provided for backward compatibility with the 1.0 API.
3044 typedef struct svn_repos_parse_fns_t
3046 /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
3047 svn_error_t *(*new_revision_record)(void **revision_baton,
3048 apr_hash_t *headers,
3051 /** Same as #svn_repos_parse_fns2_t.uuid_record. */
3052 svn_error_t *(*uuid_record)(const char *uuid,
3055 /** Same as #svn_repos_parse_fns2_t.new_node_record. */
3056 svn_error_t *(*new_node_record)(void **node_baton,
3057 apr_hash_t *headers,
3058 void *revision_baton,
3060 /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
3061 svn_error_t *(*set_revision_property)(void *revision_baton,
3063 const svn_string_t *value);
3064 /** Same as #svn_repos_parse_fns2_t.set_node_property. */
3065 svn_error_t *(*set_node_property)(void *node_baton,
3067 const svn_string_t *value);
3068 /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
3069 svn_error_t *(*remove_node_props)(void *node_baton);
3070 /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
3071 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3073 /** Same as #svn_repos_parse_fns2_t.close_node. */
3074 svn_error_t *(*close_node)(void *node_baton);
3075 /** Same as #svn_repos_parse_fns2_t.close_revision. */
3076 svn_error_t *(*close_revision)(void *revision_baton);
3077 } svn_repos_parser_fns_t;
3081 * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
3082 * #svn_repos_parser_fns2_t vtable type.
3084 * @deprecated Provided for backward compatibility with the 1.7 API.
3088 svn_repos_parse_dumpstream2(svn_stream_t *stream,
3089 const svn_repos_parser_fns2_t *parse_fns,
3091 svn_cancel_func_t cancel_func,
3096 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
3097 * #svn_repos_parser_fns_t vtable type.
3099 * @deprecated Provided for backward compatibility with the 1.0 API.
3103 svn_repos_parse_dumpstream(svn_stream_t *stream,
3104 const svn_repos_parser_fns_t *parse_fns,
3106 svn_cancel_func_t cancel_func,
3111 * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
3112 * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
3113 * the more limited svn_repos_parse_fns2_t.
3115 * @since New in 1.7.
3116 * @deprecated Provided for backward compatibility with the 1.7 API.
3120 svn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
3123 svn_boolean_t use_history,
3124 svn_boolean_t validate_props,
3125 enum svn_repos_load_uuid uuid_action,
3126 const char *parent_dir,
3127 svn_repos_notify_func_t notify_func,
3132 * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
3133 * in place if a #svn_repos_notify_func_t and baton and with
3134 * @a validate_props always FALSE.
3136 * @since New in 1.1.
3137 * @deprecated Provided for backward compatibility with the 1.6 API.
3141 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
3144 svn_boolean_t use_history,
3145 enum svn_repos_load_uuid uuid_action,
3146 svn_stream_t *outstream,
3147 const char *parent_dir,
3151 * Similar to svn_repos_get_fs_build_parser2(), but yields the more
3152 * limited svn_repos_parser_fns_t vtable type.
3154 * @deprecated Provided for backward compatibility with the 1.0 API.
3158 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
3161 svn_boolean_t use_history,
3162 enum svn_repos_load_uuid uuid_action,
3163 svn_stream_t *outstream,
3164 const char *parent_dir,
3170 /** A data type which stores the authz information.
3172 * @since New in 1.3.
3174 typedef struct svn_authz_t svn_authz_t;
3177 * Read authz configuration data from @a path (a dirent, an absolute file url
3178 * or a registry path) into @a *authz_p, allocated in @a pool.
3180 * If @a groups_path (a dirent, an absolute file url, or a registry path) is
3181 * set, use the global groups parsed from it.
3183 * If @a path or @a groups_path is not a valid authz rule file, then return
3184 * #SVN_ERR_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then
3185 * undefined. If @a must_exist is TRUE, a missing authz or groups file
3186 * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
3187 * depends on the access type).
3189 * @since New in 1.8.
3192 svn_repos_authz_read2(svn_authz_t **authz_p,
3194 const char *groups_path,
3195 svn_boolean_t must_exist,
3200 * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
3201 * repos_root always passed as @c NULL.
3203 * @since New in 1.3.
3204 * @deprecated Provided for backward compatibility with the 1.7 API.
3208 svn_repos_authz_read(svn_authz_t **authz_p,
3210 svn_boolean_t must_exist,
3214 * Read authz configuration data from @a stream into @a *authz_p,
3215 * allocated in @a pool.
3217 * If @a groups_stream is set, use the global groups parsed from it.
3219 * @since New in 1.8.
3222 svn_repos_authz_parse(svn_authz_t **authz_p,
3223 svn_stream_t *stream,
3224 svn_stream_t *groups_stream,
3228 * Check whether @a user can access @a path in the repository @a
3229 * repos_name with the @a required_access. @a authz lists the ACLs to
3230 * check against. Set @a *access_granted to indicate if the requested
3231 * access is granted.
3233 * If @a path is NULL, then check whether @a user has the @a
3234 * required_access anywhere in the repository. Set @a *access_granted
3235 * to TRUE if at least one path is accessible with the @a
3238 * For compatibility with 1.6, and earlier, @a repos_name can be NULL
3239 * in which case it is equivalent to a @a repos_name of "".
3241 * @note Presently, @a repos_name must byte-for-byte match the repos_name
3242 * specified in the authz file; it is treated as an opaque string, and not
3245 * @since New in 1.3.
3248 svn_repos_authz_check_access(svn_authz_t *authz,
3249 const char *repos_name,
3252 svn_repos_authz_access_t required_access,
3253 svn_boolean_t *access_granted,
3258 /** Revision Access Levels
3260 * Like most version control systems, access to versioned objects in
3261 * Subversion is determined on primarily path-based system. Users either
3262 * do or don't have the ability to read a given path.
3264 * However, unlike many version control systems where versioned objects
3265 * maintain their own distinct version information (revision numbers,
3266 * authors, log messages, change timestamps, etc.), Subversion binds
3267 * multiple paths changed as part of a single commit operation into a
3268 * set, calls the whole thing a revision, and hangs commit metadata
3269 * (author, date, log message, etc.) off of that revision. So, commit
3270 * metadata is shared across all the paths changed as part of a given
3273 * It is common (or, at least, we hope it is) for log messages to give
3274 * detailed information about changes made in the commit to which the log
3275 * message is attached. Such information might include a mention of all
3276 * the files changed, what was changed in them, and so on. But this
3277 * causes a problem when presenting information to readers who aren't
3278 * authorized to read every path in the repository. Simply knowing that
3279 * a given path exists may be a security leak, even if the user can't see
3280 * the contents of the data located at that path.
3282 * So Subversion does what it reasonably can to prevent the leak of this
3283 * information, and does so via a staged revision access policy. A
3284 * reader can be said to have one of three levels of access to a given
3285 * revision's metadata, based solely on the reader's access rights to the
3286 * paths changed or copied in that revision:
3288 * 'full access' -- Granted when the reader has access to all paths
3289 * changed or copied in the revision, or when no paths were
3290 * changed in the revision at all, this access level permits
3291 * full visibility of all revision property names and values,
3292 * and the full changed-paths information.
3294 * 'no access' -- Granted when the reader does not have access to any
3295 * paths changed or copied in the revision, this access level
3296 * denies the reader access to all revision properties and all
3297 * changed-paths information.
3299 * 'partial access' -- Granted when the reader has access to at least
3300 * one, but not all, of the paths changed or copied in the revision,
3301 * this access level permits visibility of the svn:date and
3302 * svn:author revision properties and only the paths of the
3303 * changed-paths information to which the reader has access.
3308 /** An enum defining levels of revision access.
3310 * @since New in 1.5.
3312 typedef enum svn_repos_revision_access_level_t
3314 /** no access allowed to the revision properties and all changed-paths
3316 svn_repos_revision_access_none,
3317 /** access granted to some (svn:date and svn:author) revision properties and
3318 * changed-paths information on paths the read has access to. */
3319 svn_repos_revision_access_partial,
3320 /** access granted to all revision properites and changed-paths
3322 svn_repos_revision_access_full
3324 svn_repos_revision_access_level_t;
3328 * Set @a access to the access level granted for @a revision in @a
3329 * repos, as determined by consulting the @a authz_read_func callback
3330 * function and its associated @a authz_read_baton.
3332 * @a authz_read_func may be @c NULL, in which case @a access will be
3333 * set to #svn_repos_revision_access_full.
3335 * @since New in 1.5.
3338 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
3340 svn_revnum_t revision,
3341 svn_repos_authz_func_t authz_read_func,
3342 void *authz_read_baton,
3346 * Set @a *inherited_values to a depth-first ordered array of
3347 * #svn_prop_inherited_item_t * structures (the path_or_url members of
3348 * which are relative filesystem paths) representing the properties
3349 * inherited by @a path in @a root. If no properties are inherited,
3350 * then set @a *inherited_values to an empty array.
3352 * if @a propname is NULL then retrieve all explicit and/or inherited
3353 * properties. Otherwise retrieve only the properties named @a propname.
3355 * If optional @a authz_read_func is non-NULL, then use this function
3356 * (along with optional @a authz_read_baton) to check the readability
3357 * of each parent path from which properties are inherited. Silently omit
3358 * properties for unreadable parent paths.
3360 * Allocate @a *inherited_props in @a result_pool. Use @a scratch_pool for
3361 * temporary allocations.
3363 * @since New in 1.8.
3366 svn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
3367 svn_fs_root_t *root,
3369 const char *propname,
3370 svn_repos_authz_func_t authz_read_func,
3371 void *authz_read_baton,
3372 apr_pool_t *result_pool,
3373 apr_pool_t *scratch_pool);
3376 /** Capabilities **/
3379 * Store in @a repos the client-reported capabilities @a capabilities,
3380 * which must be allocated in memory at least as long-lived as @a repos.
3382 * The elements of @a capabilities are 'const char *', a subset of
3383 * the constants beginning with @c SVN_RA_CAPABILITY_.
3384 * @a capabilities is not copied, so changing it later will affect
3385 * what is remembered by @a repos.
3387 * @note The capabilities are passed along to the start-commit hook;
3388 * see that hook's template for details.
3390 * @note As of Subversion 1.5, there are no error conditions defined,
3391 * so this always returns SVN_NO_ERROR. In future releases it may
3392 * return error, however, so callers should check.
3394 * @since New in 1.5.
3397 svn_repos_remember_client_capabilities(svn_repos_t *repos,
3398 const apr_array_header_t *capabilities);
3403 #endif /* __cplusplus */
3405 #endif /* SVN_REPOS_H */