Fix compiler warning due to missing function prototype.
[svn.git] / subversion / include / svn_repos.h
blobe613292f90b1d6a1321442e7d364aac36d12315b
1 /**
2 * @copyright
3 * ====================================================================
4 * Copyright (c) 2000-2008 CollabNet. All rights reserved.
6 * This software is licensed as described in the file COPYING, which
7 * you should have received as part of this distribution. The terms
8 * are also available at http://subversion.tigris.org/license-1.html.
9 * If newer versions of this license are posted there, you may use a
10 * newer version instead, at your option.
12 * This software consists of voluntary contributions made by many
13 * individuals. For exact contribution history, see the revision
14 * history and logs, available at http://subversion.tigris.org/.
15 * ====================================================================
16 * @endcopyright
18 * @file svn_repos.h
19 * @brief tools built on top of the filesystem.
23 #ifndef SVN_REPOS_H
24 #define SVN_REPOS_H
26 #include <apr_pools.h>
27 #include <apr_hash.h>
28 #include "svn_fs.h"
29 #include "svn_delta.h"
30 #include "svn_types.h"
31 #include "svn_error.h"
32 #include "svn_version.h"
35 #ifdef __cplusplus
36 extern "C" {
37 #endif /* __cplusplus */
39 /* ---------------------------------------------------------------*/
41 /**
42 * Get libsvn_repos version information.
44 * @since New in 1.1.
46 const svn_version_t *svn_repos_version(void);
50 /** Callback type for checking authorization on paths produced by (at
51 * least) svn_repos_dir_delta2().
53 * Set @a *allowed to TRUE to indicate that some operation is
54 * authorized for @a path in @a root, or set it to FALSE to indicate
55 * unauthorized (presumably according to state stored in @a baton).
57 * Do not assume @a pool has any lifetime beyond this call.
59 * The exact operation being authorized depends on the callback
60 * implementation. For read authorization, for example, the caller
61 * would implement an instance that does read checking, and pass it as
62 * a parameter named [perhaps] 'authz_read_func'. The receiver of
63 * that parameter might also take another parameter named
64 * 'authz_write_func', which although sharing this type, would be a
65 * different implementation.
67 * @note If someday we want more sophisticated authorization states
68 * than just yes/no, @a allowed can become an enum type.
70 typedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
71 svn_fs_root_t *root,
72 const char *path,
73 void *baton,
74 apr_pool_t *pool);
77 /** An enum defining the kinds of access authz looks up.
79 * @since New in 1.3.
81 typedef enum
83 /** No access. */
84 svn_authz_none = 0,
86 /** Path can be read. */
87 svn_authz_read = 1,
89 /** Path can be altered. */
90 svn_authz_write = 2,
92 /** The other access credentials are recursive. */
93 svn_authz_recursive = 4
94 } svn_repos_authz_access_t;
97 /** Callback type for checking authorization on paths produced by
98 * the repository commit editor.
100 * Set @a *allowed to TRUE to indicate that the @a required access on
101 * @a path in @a root is authorized, or set it to FALSE to indicate
102 * unauthorized (presumable according to state stored in @a baton).
104 * If @a path is NULL, the callback should perform a global authz
105 * lookup for the @a required access. That is, the lookup should
106 * check if the @a required access is granted for at least one path of
107 * the repository, and set @a *allowed to TRUE if so. @a root may
108 * also be NULL if @a path is NULL.
110 * This callback is very similar to svn_repos_authz_func_t, with the
111 * exception of the addition of the @a required parameter.
112 * This is due to historical reasons: when authz was first implemented
113 * for svn_repos_dir_delta2(), it seemed there would need only checks
114 * for read and write operations, hence the svn_repos_authz_func_t
115 * callback prototype and usage scenario. But it was then realized
116 * that lookups due to copying needed to be recursive, and that
117 * brute-force recursive lookups didn't square with the O(1)
118 * performances a copy operation should have.
120 * So a special way to ask for a recursive lookup was introduced. The
121 * commit editor needs this capability to retain acceptable
122 * performance. Instead of revving the existing callback, causing
123 * unnecessary revving of functions that don't actually need the
124 * extended functionality, this second, more complete callback was
125 * introduced, for use by the commit editor.
127 * Some day, it would be nice to reunite these two callbacks and do
128 * the necessary revving anyway, but for the time being, this dual
129 * callback mechanism will do.
131 typedef svn_error_t *(*svn_repos_authz_callback_t)
132 (svn_repos_authz_access_t required,
133 svn_boolean_t *allowed,
134 svn_fs_root_t *root,
135 const char *path,
136 void *baton,
137 apr_pool_t *pool);
140 * Similar to @c svn_file_rev_handler_t, but without the @a
141 * result_of_merge parameter.
143 * @deprecated Provided for backward compatibility with 1.4 API.
144 * @since New in 1.1.
146 typedef svn_error_t *(*svn_repos_file_rev_handler_t)
147 (void *baton,
148 const char *path,
149 svn_revnum_t rev,
150 apr_hash_t *rev_props,
151 svn_txdelta_window_handler_t *delta_handler,
152 void **delta_baton,
153 apr_array_header_t *prop_diffs,
154 apr_pool_t *pool);
157 /** The repository object. */
158 typedef struct svn_repos_t svn_repos_t;
160 /* Opening and creating repositories. */
163 /** Find the root path of the repository that contains @a path.
165 * If a repository was found, the path to the root of the repository
166 * is returned, else @c NULL. The pointer to the returned path may be
167 * equal to @a path.
169 const char *
170 svn_repos_find_root_path(const char *path,
171 apr_pool_t *pool);
173 /** Set @a *repos_p to a repository object for the repository at @a path.
175 * Allocate @a *repos_p in @a pool.
177 * Acquires a shared lock on the repository, and attaches a cleanup
178 * function to @a pool to remove the lock. If no lock can be acquired,
179 * returns error, with undefined effect on @a *repos_p. If an exclusive
180 * lock is present, this blocks until it's gone.
182 svn_error_t *
183 svn_repos_open(svn_repos_t **repos_p,
184 const char *path,
185 apr_pool_t *pool);
187 /** Create a new Subversion repository at @a path, building the necessary
188 * directory structure, creating the filesystem, and so on.
189 * Return the repository object in @a *repos_p, allocated in @a pool.
191 * @a config is a client configuration hash of @c svn_config_t * items
192 * keyed on config category names, and may be NULL.
194 * @a fs_config is passed to the filesystem, and may be NULL.
196 * @a unused_1 and @a unused_2 are not used and should be NULL.
198 svn_error_t *
199 svn_repos_create(svn_repos_t **repos_p,
200 const char *path,
201 const char *unused_1,
202 const char *unused_2,
203 apr_hash_t *config,
204 apr_hash_t *fs_config,
205 apr_pool_t *pool);
208 * Upgrade the Subversion repository (and its underlying versioned
209 * filesystem) located in the directory @a path to the latest version
210 * supported by this library. If the requested upgrade is not
211 * supported due to the current state of the repository or it
212 * underlying filesystem, return @c SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
213 * or @c SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
214 * changes to the repository or filesystem.
216 * Acquires an exclusive lock on the repository, upgrades the
217 * repository, and releases the lock. If an exclusive lock can't be
218 * acquired, returns error.
220 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
221 * returned if the lock is not immediately available.
223 * If @a start_callback is not NULL, it will be called with @a
224 * start_callback_baton as argument before the upgrade starts, but
225 * after the exclusive lock has been acquired.
227 * Use @a pool for necessary allocations.
229 * @note This functionality is provided as a convenience for
230 * administrators wishing to make use of new Subversion functionality
231 * without a potentially costly full repository dump/load. As such,
232 * the operation performs only the minimum amount of work needed to
233 * accomplish this while maintaining the integrity of the repository.
234 * It does *not* guarantee the most optimized repository state as a
235 * dump and subsequent load would.
237 * @since New in 1.5.
239 svn_error_t *
240 svn_repos_upgrade(const char *path,
241 svn_boolean_t nonblocking,
242 svn_error_t *(*start_callback)(void *baton),
243 void *start_callback_baton,
244 apr_pool_t *pool);
246 /** Destroy the Subversion repository found at @a path, using @a pool for any
247 * necessary allocations.
249 svn_error_t *svn_repos_delete(const char *path, apr_pool_t *pool);
252 * Set @a *has to TRUE if @a repos has @a capability (one of the
253 * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
254 * @a *has to FALSE.
256 * If @a capability isn't recognized, throw @c SVN_ERR_UNKNOWN_CAPABILITY,
257 * with the effect on @a *has undefined.
259 * Use @a pool for all allocation.
261 * @since New in 1.5.
263 svn_error_t *
264 svn_repos_has_capability(svn_repos_t *repos,
265 svn_boolean_t *has,
266 const char *capability,
267 apr_pool_t *pool);
270 * The capability of doing the right thing with merge-tracking
271 * information, both storing it and responding to queries about it.
273 * @since New in 1.5.
275 #define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
276 /* *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
278 * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
279 * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
280 * colons for their own reasons. While this RA limitation has no
281 * direct impact on repository capabilities, there's no reason to be
282 * gratuitously different either.
286 /** Return the filesystem associated with repository object @a repos. */
287 svn_fs_t *svn_repos_fs(svn_repos_t *repos);
290 /** Make a hot copy of the Subversion repository found at @a src_path
291 * to @a dst_path.
293 * Copy a possibly live Subversion repository from @a src_path to
294 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the
295 * source filesystem as part of the copy operation; currently, this
296 * means deleting copied, unused logfiles for a Berkeley DB source
297 * repository.
299 svn_error_t *
300 svn_repos_hotcopy(const char *src_path,
301 const char *dst_path,
302 svn_boolean_t clean_logs,
303 apr_pool_t *pool);
306 * Run database recovery procedures on the repository at @a path,
307 * returning the database to a consistent state. Use @a pool for all
308 * allocation.
310 * Acquires an exclusive lock on the repository, recovers the
311 * database, and releases the lock. If an exclusive lock can't be
312 * acquired, returns error.
314 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
315 * returned if the lock is not immediately available.
317 * If @a start_callback is not NULL, it will be called with @a
318 * start_callback_baton as argument before the recovery starts, but
319 * after the exclusive lock has been acquired.
321 * If @a cancel_func is not @c NULL, it is called periodically with
322 * @a cancel_baton as argument to see if the client wishes to cancel
323 * the recovery.
325 * @note On some platforms the exclusive lock does not exclude other
326 * threads in the same process so this function should only be called
327 * by a single threaded process, or by a multi-threaded process when
328 * no other threads are accessing the repository.
330 * @since New in 1.5.
332 svn_error_t *
333 svn_repos_recover3(const char *path,
334 svn_boolean_t nonblocking,
335 svn_error_t *(*start_callback)(void *baton),
336 void *start_callback_baton,
337 svn_cancel_func_t cancel_func,
338 void * cancel_baton,
339 apr_pool_t *pool);
342 * Similar to svn_repos_recover3(), but without cancellation support.
344 * @deprecated Provided for backward compatibility with the 1.4 API.
346 svn_error_t *
347 svn_repos_recover2(const char *path,
348 svn_boolean_t nonblocking,
349 svn_error_t *(*start_callback)(void *baton),
350 void *start_callback_baton,
351 apr_pool_t *pool);
354 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
355 * with no callbacks provided.
357 * @deprecated Provided for backward compatibility with the 1.0 API.
359 svn_error_t *svn_repos_recover(const char *path, apr_pool_t *pool);
361 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
362 * returning log file paths relative to the root of the repository.
364 * @copydoc svn_fs_berkeley_logfiles()
366 svn_error_t *
367 svn_repos_db_logfiles(apr_array_header_t **logfiles,
368 const char *path,
369 svn_boolean_t only_unused,
370 apr_pool_t *pool);
374 /* Repository Paths */
376 /** Return the top-level repository path allocated in @a pool. */
377 const char *svn_repos_path(svn_repos_t *repos, apr_pool_t *pool);
379 /** Return the path to @a repos's filesystem directory, allocated in
380 * @a pool.
382 const char *svn_repos_db_env(svn_repos_t *repos, apr_pool_t *pool);
384 /** Return path to @a repos's config directory, allocated in @a pool. */
385 const char *svn_repos_conf_dir(svn_repos_t *repos, apr_pool_t *pool);
387 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
388 const char *svn_repos_svnserve_conf(svn_repos_t *repos, apr_pool_t *pool);
390 /** Return path to @a repos's lock directory, allocated in @a pool. */
391 const char *svn_repos_lock_dir(svn_repos_t *repos, apr_pool_t *pool);
393 /** Return path to @a repos's db lockfile, allocated in @a pool. */
394 const char *svn_repos_db_lockfile(svn_repos_t *repos, apr_pool_t *pool);
396 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
397 const char *svn_repos_db_logs_lockfile(svn_repos_t *repos, apr_pool_t *pool);
399 /** Return the path to @a repos's hook directory, allocated in @a pool. */
400 const char *svn_repos_hook_dir(svn_repos_t *repos, apr_pool_t *pool);
402 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
403 const char *svn_repos_start_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
405 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
406 const char *svn_repos_pre_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
408 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
409 const char *svn_repos_post_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
411 /** Return the path to @a repos's pre-revprop-change hook, allocated in
412 * @a pool.
414 const char *
415 svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
416 apr_pool_t *pool);
418 /** Return the path to @a repos's post-revprop-change hook, allocated in
419 * @a pool.
421 const char *
422 svn_repos_post_revprop_change_hook(svn_repos_t *repos,
423 apr_pool_t *pool);
426 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
427 * @{
428 * @since New in 1.2. */
430 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
431 const char *svn_repos_pre_lock_hook(svn_repos_t *repos, apr_pool_t *pool);
433 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
434 const char *svn_repos_post_lock_hook(svn_repos_t *repos, apr_pool_t *pool);
436 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
437 const char *svn_repos_pre_unlock_hook(svn_repos_t *repos, apr_pool_t *pool);
439 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
440 const char *svn_repos_post_unlock_hook(svn_repos_t *repos, apr_pool_t *pool);
442 /** @} */
444 /* ---------------------------------------------------------------*/
446 /* Reporting the state of a working copy, for updates. */
450 * Construct and return a @a report_baton that will be passed to the
451 * other functions in this section to describe the state of a pre-existing
452 * tree (typically, a working copy). When the report is finished,
453 * @a editor/@a edit_baton will be driven in such a way as to transform the
454 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
455 * reported hierarchy to @a tgt_path.
457 * @a fs_base is the absolute path of the node in the filesystem at which
458 * the comparison should be rooted. @a target is a single path component,
459 * used to limit the scope of the report to a single entry of @a fs_base,
460 * or "" if all of @a fs_base itself is the main subject of the report.
462 * @a tgt_path and @a revnum is the fs path/revision pair that is the
463 * "target" of the delta. @a tgt_path should be provided only when
464 * the source and target paths of the report differ. That is, @a tgt_path
465 * should *only* be specified when specifying that the resultant editor
466 * drive be one that transforms the reported hierarchy into a pristine tree
467 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path
468 * will indicate that the editor should be driven in such a way as to
469 * transform the reported hierarchy to revision @a revnum, preserving the
470 * reported hierarchy.
472 * @a text_deltas instructs the driver of the @a editor to enable
473 * the generation of text deltas.
475 * @a ignore_ancestry instructs the driver to ignore node ancestry
476 * when determining how to transmit differences.
478 * @a send_copyfrom_args instructs the driver to send 'copyfrom'
479 * arguments to the editor's add_file() and add_directory() methods,
480 * whenever it deems feasible.
482 * The @a authz_read_func and @a authz_read_baton are passed along to
483 * svn_repos_dir_delta2(); see that function for how they are used.
485 * All allocation for the context and collected state will occur in
486 * @a pool.
488 * @a depth is the requested depth of the editor drive.
490 * If @a depth is @c svn_depth_unknown, the editor will affect only the
491 * paths reported by the individual calls to @c svn_repos_set_path3 and
492 * @c svn_repos_link_path3.
494 * For example, if the reported tree is the @c A subdir of the Greek Tree
495 * (see Subversion's test suite), at depth @c svn_depth_empty, but the
496 * @c A/B subdir is reported at depth @c svn_depth_infinity, then
497 * repository-side changes to @c A/mu, or underneath @c A/C and @c
498 * A/D, would not be reflected in the editor drive, but changes
499 * underneath @c A/B would be.
501 * Additionally, the editor driver will call @c add_directory and
502 * and @c add_file for directories with an appropriate depth. For
503 * example, a directory reported at @c svn_depth_files will receive
504 * file (but not directory) additions. A directory at @c svn_depth_empty
505 * will receive neither.
507 * If @a depth is @c svn_depth_files, @c svn_depth_immediates or
508 * @c svn_depth_infinity and @a depth is greater than the reported depth
509 * of the working copy, then the editor driver will emit editor
510 * operations so as to upgrade the working copy to this depth.
512 * If @a depth is @c svn_depth_empty, @c svn_depth_files,
513 * @c svn_depth_immediates and @a depth is lower
514 * than or equal to the depth of the working copy, then the editor
515 * operations will affect only paths at or above @a depth.
517 * @since New in 1.5.
519 svn_error_t *
520 svn_repos_begin_report2(void **report_baton,
521 svn_revnum_t revnum,
522 svn_repos_t *repos,
523 const char *fs_base,
524 const char *target,
525 const char *tgt_path,
526 svn_boolean_t text_deltas,
527 svn_depth_t depth,
528 svn_boolean_t ignore_ancestry,
529 svn_boolean_t send_copyfrom_args,
530 const svn_delta_editor_t *editor,
531 void *edit_baton,
532 svn_repos_authz_func_t authz_read_func,
533 void *authz_read_baton,
534 apr_pool_t *pool);
537 * The same as svn_repos_begin_report2(), but taking a boolean
538 * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
540 * If @a recurse is TRUE, the editor driver will drive the editor with
541 * a depth of @c svn_depth_infinity; if FALSE, then with a depth of
542 * @c svn_depth_files.
544 * @note @a username is ignored, and has been removed in a revised
545 * version of this API.
547 * @deprecated Provided for backward compatibility with the 1.4 API.
549 svn_error_t *
550 svn_repos_begin_report(void **report_baton,
551 svn_revnum_t revnum,
552 const char *username,
553 svn_repos_t *repos,
554 const char *fs_base,
555 const char *target,
556 const char *tgt_path,
557 svn_boolean_t text_deltas,
558 svn_boolean_t recurse,
559 svn_boolean_t ignore_ancestry,
560 const svn_delta_editor_t *editor,
561 void *edit_baton,
562 svn_repos_authz_func_t authz_read_func,
563 void *authz_read_baton,
564 apr_pool_t *pool);
568 * Given a @a report_baton constructed by svn_repos_begin_report2(),
569 * record the presence of @a path, at @a revision with depth @a depth,
570 * in the current tree.
572 * @a path is relative to the anchor/target used in the creation of the
573 * @a report_baton.
575 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
576 * represents a locally-added path with no revision number, or @a
577 * depth is @c svn_depth_exclude.
579 * @a path may not be underneath a path on which svn_repos_set_path3()
580 * was previously called with @c svn_depth_exclude in this report.
582 * The first call of this in a given report usually passes an empty
583 * @a path; this is used to set up the correct root revision for the editor
584 * drive.
586 * A depth of @c svn_depth_unknown is not allowed, and results in an
587 * error.
589 * If @a start_empty is TRUE and @a path is a directory, then require the
590 * caller to explicitly provide all the children of @a path - do not assume
591 * that the tree also contains all the children of @a path at @a revision.
592 * This is for 'low confidence' client reporting.
594 * If the caller has a lock token for @a path, then @a lock_token should
595 * be set to that token. Else, @a lock_token should be NULL.
597 * All temporary allocations are done in @a pool.
599 * @since New in 1.5.
601 svn_error_t *
602 svn_repos_set_path3(void *report_baton,
603 const char *path,
604 svn_revnum_t revision,
605 svn_depth_t depth,
606 svn_boolean_t start_empty,
607 const char *lock_token,
608 apr_pool_t *pool);
611 * Similar to svn_repos_set_path3(), but with @a depth set to
612 * @c svn_depth_infinity.
614 * @deprecated Provided for backward compatibility with the 1.4 API.
616 svn_error_t *
617 svn_repos_set_path2(void *report_baton,
618 const char *path,
619 svn_revnum_t revision,
620 svn_boolean_t start_empty,
621 const char *lock_token,
622 apr_pool_t *pool);
625 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
627 * @deprecated Provided for backward compatibility with the 1.1 API.
629 svn_error_t *
630 svn_repos_set_path(void *report_baton,
631 const char *path,
632 svn_revnum_t revision,
633 svn_boolean_t start_empty,
634 apr_pool_t *pool);
637 * Given a @a report_baton constructed by svn_repos_begin_report2(),
638 * record the presence of @a path in the current tree, containing the contents
639 * of @a link_path at @a revision with depth @a depth.
641 * A depth of @c svn_depth_unknown is not allowed, and results in an
642 * error.
644 * @a path may not be underneath a path on which svn_repos_set_path3()
645 * was previously called with @c svn_depth_exclude in this report.
647 * Note that while @a path is relative to the anchor/target used in the
648 * creation of the @a report_baton, @a link_path is an absolute filesystem
649 * path!
651 * If @a start_empty is TRUE and @a path is a directory, then require the
652 * caller to explicitly provide all the children of @a path - do not assume
653 * that the tree also contains all the children of @a link_path at
654 * @a revision. This is for 'low confidence' client reporting.
656 * If the caller has a lock token for @a link_path, then @a lock_token
657 * should be set to that token. Else, @a lock_token should be NULL.
659 * All temporary allocations are done in @a pool.
661 * @since New in 1.5.
663 svn_error_t *
664 svn_repos_link_path3(void *report_baton,
665 const char *path,
666 const char *link_path,
667 svn_revnum_t revision,
668 svn_depth_t depth,
669 svn_boolean_t start_empty,
670 const char *lock_token,
671 apr_pool_t *pool);
674 * Similar to svn_repos_link_path3(), but with @a depth set to
675 * @c svn_depth_infinity.
677 * @deprecated Provided for backward compatibility with the 1.4 API.
679 svn_error_t *
680 svn_repos_link_path2(void *report_baton,
681 const char *path,
682 const char *link_path,
683 svn_revnum_t revision,
684 svn_boolean_t start_empty,
685 const char *lock_token,
686 apr_pool_t *pool);
689 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
691 * @deprecated Provided for backward compatibility with the 1.1 API.
693 svn_error_t *
694 svn_repos_link_path(void *report_baton,
695 const char *path,
696 const char *link_path,
697 svn_revnum_t revision,
698 svn_boolean_t start_empty,
699 apr_pool_t *pool);
701 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
702 * record the non-existence of @a path in the current tree.
704 * @a path may not be underneath a path on which svn_repos_set_path3()
705 * was previously called with @c svn_depth_exclude in this report.
707 * (This allows the reporter's driver to describe missing pieces of a
708 * working copy, so that 'svn up' can recreate them.)
710 * All temporary allocations are done in @a pool.
712 svn_error_t *
713 svn_repos_delete_path(void *report_baton,
714 const char *path,
715 apr_pool_t *pool);
717 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
718 * finish the report and drive the editor as specified when the report
719 * baton was constructed.
721 * If an error occurs during the driving of the editor, do NOT abort the
722 * edit; that responsibility belongs to the caller of this function, if
723 * it happens at all.
725 * After the call to this function, @a report_baton is no longer valid;
726 * it should not be passed to any other reporting functions, including
727 * svn_repos_abort_report().
729 svn_error_t *
730 svn_repos_finish_report(void *report_baton,
731 apr_pool_t *pool);
734 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
735 * abort the report. This function can be called anytime before
736 * svn_repos_finish_report() is called.
738 * After the call to this function, @a report_baton is no longer valid;
739 * it should not be passed to any other reporting functions.
741 svn_error_t *
742 svn_repos_abort_report(void *report_baton,
743 apr_pool_t *pool);
746 /* ---------------------------------------------------------------*/
748 /* The magical dir_delta update routines. */
750 /** Use the provided @a editor and @a edit_baton to describe the changes
751 * necessary for making a given node (and its descendants, if it is a
752 * directory) under @a src_root look exactly like @a tgt_path under
753 * @a tgt_root. @a src_entry is the node to update. If @a src_entry
754 * is empty, then compute the difference between the entire tree
755 * anchored at @a src_parent_dir under @a src_root and @a tgt_path
756 * under @a tgt_root. Else, describe the changes needed to update
757 * only that entry in @a src_parent_dir. Typically, callers of this
758 * function will use a @a tgt_path that is the concatenation of @a
759 * src_parent_dir and @a src_entry.
761 * @a src_root and @a tgt_root can both be either revision or transaction
762 * roots. If @a tgt_root is a revision, @a editor's set_target_revision()
763 * will be called with the @a tgt_root's revision number, else it will
764 * not be called at all.
766 * If @a authz_read_func is non-NULL, invoke it before any call to
768 * @a editor->open_root
769 * @a editor->add_directory
770 * @a editor->open_directory
771 * @a editor->add_file
772 * @a editor->open_file
774 * passing @a tgt_root, the same path that would be passed to the
775 * editor function in question, and @a authz_read_baton. If the
776 * @a *allowed parameter comes back TRUE, then proceed with the planned
777 * editor call; else if FALSE, then invoke @a editor->absent_file or
778 * @a editor->absent_directory as appropriate, except if the planned
779 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
781 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
782 * the window handler returned by @a editor->apply_textdelta().
784 * If @a depth is @c svn_depth_empty, invoke @a editor calls only on
785 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
786 * If @a depth is @c svn_depth_files, also invoke the editor on file
787 * children, if any; if @c svn_depth_immediates, invoke it on
788 * immediate subdirectories as well as files; if @c svn_depth_infinity,
789 * recurse fully.
791 * If @a entry_props is @c TRUE, accompany each opened/added entry with
792 * propchange editor calls that relay special "entry props" (this
793 * is typically used only for working copy updates).
795 * @a ignore_ancestry instructs the function to ignore node ancestry
796 * when determining how to transmit differences.
798 * Before completing successfully, this function calls @a editor's
799 * close_edit(), so the caller should expect its @a edit_baton to be
800 * invalid after its use with this function.
802 * Do any allocation necessary for the delta computation in @a pool.
803 * This function's maximum memory consumption is at most roughly
804 * proportional to the greatest depth of the tree under @a tgt_root, not
805 * the total size of the delta.
807 * ### svn_repos_dir_delta2 is mostly superceded by the reporter
808 * ### functionality (svn_repos_begin_report2 and friends).
809 * ### svn_repos_dir_delta2 does allow the roots to be transaction
810 * ### roots rather than just revision roots, and it has the
811 * ### entry_props flag. Almost all of Subversion's own code uses the
812 * ### reporter instead; there are some stray references to the
813 * ### svn_repos_dir_delta[2] in comments which should probably
814 * ### actually refer to the reporter.
816 svn_error_t *
817 svn_repos_dir_delta2(svn_fs_root_t *src_root,
818 const char *src_parent_dir,
819 const char *src_entry,
820 svn_fs_root_t *tgt_root,
821 const char *tgt_path,
822 const svn_delta_editor_t *editor,
823 void *edit_baton,
824 svn_repos_authz_func_t authz_read_func,
825 void *authz_read_baton,
826 svn_boolean_t text_deltas,
827 svn_depth_t depth,
828 svn_boolean_t entry_props,
829 svn_boolean_t ignore_ancestry,
830 apr_pool_t *pool);
833 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
834 * @c svn_depth_infinity for @a depth, and if @a recurse is FALSE,
835 * pass @c svn_depth_files for @a depth.
837 * @deprecated Provided for backward compatibility with the 1.4 API.
839 svn_error_t *
840 svn_repos_dir_delta(svn_fs_root_t *src_root,
841 const char *src_parent_dir,
842 const char *src_entry,
843 svn_fs_root_t *tgt_root,
844 const char *tgt_path,
845 const svn_delta_editor_t *editor,
846 void *edit_baton,
847 svn_repos_authz_func_t authz_read_func,
848 void *authz_read_baton,
849 svn_boolean_t text_deltas,
850 svn_boolean_t recurse,
851 svn_boolean_t entry_props,
852 svn_boolean_t ignore_ancestry,
853 apr_pool_t *pool);
856 /** Use the provided @a editor and @a edit_baton to describe the
857 * skeletal changes made in a particular filesystem @a root
858 * (revision or transaction).
860 * Changes will be limited to those within @a base_dir, and if
861 * @a low_water_mark is set to something other than @c SVN_INVALID_REVNUM
862 * it is assumed that the client has no knowledge of revisions prior to
863 * @a low_water_mark. Together, these two arguments define the portion of
864 * the tree that the client is assumed to have knowledge of, and thus any
865 * copies of data from outside that part of the tree will be sent in their
866 * entirety, not as simple copies or deltas against a previous version.
868 * The @a editor passed to this function should be aware of the fact
869 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
870 * change_file_prop(), and apply_textdelta() functions will not
871 * contain meaningful data, and merely serve as indications that
872 * properties or textual contents were changed.
874 * If @a send_deltas is @c TRUE, the text and property deltas for changes
875 * will be sent, otherwise NULL text deltas and empty prop changes will be
876 * used.
878 * If @a authz_read_func is non-NULL, it will be used to determine if the
879 * user has read access to the data being accessed. Data that the user
880 * cannot access will be skipped.
882 * @note This editor driver passes SVN_INVALID_REVNUM for all
883 * revision parameters in the editor interface except the copyfrom
884 * parameter of the add_file() and add_directory() editor functions.
886 * @since New in 1.4.
888 svn_error_t *
889 svn_repos_replay2(svn_fs_root_t *root,
890 const char *base_dir,
891 svn_revnum_t low_water_mark,
892 svn_boolean_t send_deltas,
893 const svn_delta_editor_t *editor,
894 void *edit_baton,
895 svn_repos_authz_func_t authz_read_func,
896 void *authz_read_baton,
897 apr_pool_t *pool);
900 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
901 * @a low_water_mark set to @c SVN_INVALID_REVNUM, @a send_deltas
902 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
903 * set to @c NULL.
905 * @deprecated Provided for backward compatibility with the 1.3 API.
907 svn_error_t *
908 svn_repos_replay(svn_fs_root_t *root,
909 const svn_delta_editor_t *editor,
910 void *edit_baton,
911 apr_pool_t *pool);
913 /* ---------------------------------------------------------------*/
915 /* Making commits. */
918 * Return an @a editor and @a edit_baton to commit changes to the
919 * filesystem of @a repos, beginning at location 'rev:@a base_path',
920 * where "rev" is the argument given to open_root().
922 * @a repos is a previously opened repository. @a repos_url is the
923 * decoded URL to the base of the repository, and is used to check
924 * copyfrom paths. @a txn is a filesystem transaction object to use
925 * during the commit, or @c NULL to indicate that this function should
926 * create (and fully manage) a new transaction.
928 * Store the contents of @a revprop_table, a hash mapping <tt>const
929 * char *</tt> property names to @c svn_string_t values, as properties
930 * of the commit transaction, including author and log message if
931 * present.
933 * @note @c SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
934 * it will be overwritten when the transaction is committed.
936 * Iff @a authz_callback is provided, check read/write authorizations
937 * on paths accessed by editor operations. An operation which fails
938 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
939 * SVN_ERR_AUTHZ_UNWRITABLE.
941 * Calling @a (*editor)->close_edit completes the commit. Before
942 * @c close_edit returns, but after the commit has succeeded, it will
943 * invoke @a callback with the new revision number, the commit date (as a
944 * <tt>const char *</tt>), commit author (as a <tt>const char *</tt>), and
945 * @a callback_baton as arguments. If @a callback returns an error, that
946 * error will be returned from @c close_edit, otherwise if there was a
947 * post-commit hook failure, then that error will be returned and will
948 * have code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
950 * Calling @a (*editor)->abort_edit aborts the commit, and will also
951 * abort the commit transaction unless @a txn was supplied (not @c
952 * NULL). Callers who supply their own transactions are responsible
953 * for cleaning them up (either by committing them, or aborting them).
955 * @since New in 1.5.
957 svn_error_t *
958 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
959 void **edit_baton,
960 svn_repos_t *repos,
961 svn_fs_txn_t *txn,
962 const char *repos_url,
963 const char *base_path,
964 apr_hash_t *revprop_table,
965 svn_commit_callback2_t callback,
966 void *callback_baton,
967 svn_repos_authz_callback_t authz_callback,
968 void *authz_baton,
969 apr_pool_t *pool);
972 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
973 * set to a hash containing @a user and @a log_msg as the
974 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
975 * respectively. @a user and @a log_msg may both be @c NULL.
977 * @since New in 1.4.
979 * @deprecated Provided for backward compatibility with the 1.4 API.
981 svn_error_t *
982 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
983 void **edit_baton,
984 svn_repos_t *repos,
985 svn_fs_txn_t *txn,
986 const char *repos_url,
987 const char *base_path,
988 const char *user,
989 const char *log_msg,
990 svn_commit_callback2_t callback,
991 void *callback_baton,
992 svn_repos_authz_callback_t authz_callback,
993 void *authz_baton,
994 apr_pool_t *pool);
997 * Similar to svn_repos_get_commit_editor4(), but
998 * uses the svn_commit_callback_t type.
1000 * @since New in 1.3.
1002 * @deprecated Provided for backward compatibility with the 1.3 API.
1004 svn_error_t *
1005 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1006 void **edit_baton,
1007 svn_repos_t *repos,
1008 svn_fs_txn_t *txn,
1009 const char *repos_url,
1010 const char *base_path,
1011 const char *user,
1012 const char *log_msg,
1013 svn_commit_callback_t callback,
1014 void *callback_baton,
1015 svn_repos_authz_callback_t authz_callback,
1016 void *authz_baton,
1017 apr_pool_t *pool);
1020 * Similar to svn_repos_get_commit_editor3(), but with @a
1021 * authz_callback and @a authz_baton set to @c NULL.
1023 * @deprecated Provided for backward compatibility with the 1.2 API.
1025 svn_error_t *
1026 svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1027 void **edit_baton,
1028 svn_repos_t *repos,
1029 svn_fs_txn_t *txn,
1030 const char *repos_url,
1031 const char *base_path,
1032 const char *user,
1033 const char *log_msg,
1034 svn_commit_callback_t callback,
1035 void *callback_baton,
1036 apr_pool_t *pool);
1040 * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1041 * set to @c NULL.
1043 * @deprecated Provided for backward compatibility with the 1.1 API.
1045 svn_error_t *
1046 svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1047 void **edit_baton,
1048 svn_repos_t *repos,
1049 const char *repos_url,
1050 const char *base_path,
1051 const char *user,
1052 const char *log_msg,
1053 svn_commit_callback_t callback,
1054 void *callback_baton,
1055 apr_pool_t *pool);
1057 /* ---------------------------------------------------------------*/
1059 /* Finding particular revisions. */
1061 /** Set @a *revision to the revision number in @a repos's filesystem that was
1062 * youngest at time @a tm.
1064 svn_error_t *
1065 svn_repos_dated_revision(svn_revnum_t *revision,
1066 svn_repos_t *repos,
1067 apr_time_t tm,
1068 apr_pool_t *pool);
1071 /** Given a @a root/@a path within some filesystem, return three pieces of
1072 * information allocated in @a pool:
1074 * - set @a *committed_rev to the revision in which the object was
1075 * last modified. (In fs parlance, this is the revision in which
1076 * the particular node-rev-id was 'created'.)
1078 * - set @a *committed_date to the date of said revision, or @c NULL
1079 * if not available.
1081 * - set @a *last_author to the author of said revision, or @c NULL
1082 * if not available.
1084 svn_error_t *
1085 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
1086 const char **committed_date,
1087 const char **last_author,
1088 svn_fs_root_t *root,
1089 const char *path,
1090 apr_pool_t *pool);
1094 * Set @a *dirent to an @c svn_dirent_t associated with @a path in @a
1095 * root. If @a path does not exist in @a root, set @a *dirent to
1096 * NULL. Use @a pool for memory allocation.
1098 * @since New in 1.2.
1100 svn_error_t *
1101 svn_repos_stat(svn_dirent_t **dirent,
1102 svn_fs_root_t *root,
1103 const char *path,
1104 apr_pool_t *pool);
1108 * Given @a path which exists at revision @a start in @a fs, set
1109 * @a *deleted to the revision @a path was first deleted, within the
1110 * inclusive revision range set by @a start and @a end. If @a path
1111 * does not exist at revision @a start or was not deleted within the
1112 * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1113 * Use @a pool for memory allocation.
1115 * @since New in 1.5.
1117 svn_error_t *
1118 svn_repos_deleted_rev(svn_fs_t *fs,
1119 const char *path,
1120 svn_revnum_t start,
1121 svn_revnum_t end,
1122 svn_revnum_t *deleted,
1123 apr_pool_t *pool);
1126 /** Callback type for use with svn_repos_history(). @a path and @a
1127 * revision represent interesting history locations in the lifetime
1128 * of the path passed to svn_repos_history(). @a baton is the same
1129 * baton given to svn_repos_history(). @a pool is provided for the
1130 * convenience of the implementor, who should not expect it to live
1131 * longer than a single callback call.
1133 * Signal to callback driver to stop processing/invoking this callback
1134 * by returning the @c SVN_ERR_CEASE_INVOCATION error code.
1136 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1137 const char *path,
1138 svn_revnum_t revision,
1139 apr_pool_t *pool);
1142 * Call @a history_func (with @a history_baton) for each interesting
1143 * history location in the lifetime of @a path in @a fs, from the
1144 * youngest of @a end and @a start to the oldest. Stop processing if
1145 * @a history_func returns @c SVN_ERR_CEASE_INVOCATION. Only cross
1146 * filesystem copy history if @a cross_copies is @c TRUE. And do all
1147 * of this in @a pool.
1149 * If @a authz_read_func is non-NULL, then use it (and @a
1150 * authz_read_baton) to verify that @a path in @a end is readable; if
1151 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability
1152 * of every ancestral path/revision pair before pushing them at @a
1153 * history_func. If a pair is deemed unreadable, then do not send
1154 * them; instead, immediately stop traversing history and return
1155 * SVN_NO_ERROR.
1157 * @since New in 1.1.
1159 svn_error_t *
1160 svn_repos_history2(svn_fs_t *fs,
1161 const char *path,
1162 svn_repos_history_func_t history_func,
1163 void *history_baton,
1164 svn_repos_authz_func_t authz_read_func,
1165 void *authz_read_baton,
1166 svn_revnum_t start,
1167 svn_revnum_t end,
1168 svn_boolean_t cross_copies,
1169 apr_pool_t *pool);
1172 * Similar to svn_repos_history2(), but with @a authz_read_func
1173 * and @a authz_read_baton always set to NULL.
1175 * @deprecated Provided for backward compatibility with the 1.0 API.
1177 svn_error_t *
1178 svn_repos_history(svn_fs_t *fs,
1179 const char *path,
1180 svn_repos_history_func_t history_func,
1181 void *history_baton,
1182 svn_revnum_t start,
1183 svn_revnum_t end,
1184 svn_boolean_t cross_copies,
1185 apr_pool_t *pool);
1189 * Set @a *locations to be a mapping of the revisions to the paths of
1190 * the file @a fs_path present at the repository in revision
1191 * @a peg_revision, where the revisions are taken out of the array
1192 * @a location_revisions.
1194 * @a location_revisions is an array of svn_revnum_t's and @a *locations
1195 * maps 'svn_revnum_t *' to 'const char *'.
1197 * If optional @a authz_read_func is non-NULL, then use it (and @a
1198 * authz_read_baton) to verify that the peg-object is readable. If not,
1199 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func
1200 * to check that every path returned in the hash is readable. If an
1201 * unreadable path is encountered, stop tracing and return
1202 * SVN_NO_ERROR.
1204 * @a pool is used for all allocations.
1206 * @since New in 1.1.
1208 svn_error_t *
1209 svn_repos_trace_node_locations(svn_fs_t *fs,
1210 apr_hash_t **locations,
1211 const char *fs_path,
1212 svn_revnum_t peg_revision,
1213 apr_array_header_t *location_revisions,
1214 svn_repos_authz_func_t authz_read_func,
1215 void *authz_read_baton,
1216 apr_pool_t *pool);
1220 * Call @a receiver and @a receiver_baton to report successive
1221 * location segments in revisions between @a start_rev and @a end_rev
1222 * (inclusive) for the line of history identified by the peg-object @a
1223 * path in @a peg_revision (and in @a repos).
1225 * @a end_rev may be @c SVN_INVALID_REVNUM to indicate that you want
1226 * to trace the history of the object to its origin.
1228 * @a start_rev may be @c SVN_INVALID_REVNUM to indicate "the HEAD
1229 * revision". Otherwise, @a start_rev must be younger than @a end_rev
1230 * (unless @a end_rev is @c SVN_INVALID_REVNUM).
1232 * @a peg_revision may be @c SVN_INVALID_REVNUM to indicate "the HEAD
1233 * revision", and must evaluate to be at least as young as @a start_rev.
1235 * If optional @a authz_read_func is not @c NULL, then use it (and @a
1236 * authz_read_baton) to verify that the peg-object is readable. If
1237 * not, return @c SVN_ERR_AUTHZ_UNREADABLE. Also use the @a
1238 * authz_read_func to check that every path reported in a location
1239 * segment is readable. If an unreadable path is encountered, report
1240 * a final (possibly truncated) location segment (if any), stop
1241 * tracing history, and return @c SVN_NO_ERROR.
1243 * @a pool is used for all allocations.
1245 * @since New in 1.5.
1247 svn_error_t *
1248 svn_repos_node_location_segments(svn_repos_t *repos,
1249 const char *path,
1250 svn_revnum_t peg_revision,
1251 svn_revnum_t start_rev,
1252 svn_revnum_t end_rev,
1253 svn_location_segment_receiver_t receiver,
1254 void *receiver_baton,
1255 svn_repos_authz_func_t authz_read_func,
1256 void *authz_read_baton,
1257 apr_pool_t *pool);
1260 /* ### other queries we can do someday --
1262 * fetch the last revision created by <user>
1263 (once usernames become revision properties!)
1264 * fetch the last revision where <path> was modified
1270 /* ---------------------------------------------------------------*/
1272 /* Retrieving log messages. */
1276 * Invoke @a receiver with @a receiver_baton on each log message from
1277 * @a start to @a end in @a repos's filesystem. @a start may be greater
1278 * or less than @a end; this just controls whether the log messages are
1279 * processed in descending or ascending revision number order.
1281 * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest.
1283 * If @a paths is non-NULL and has one or more elements, then only show
1284 * revisions in which at least one of @a paths was changed (i.e., if
1285 * file, text or props changed; if dir, props or entries changed or any node
1286 * changed below it). Each path is a <tt>const char *</tt> representing
1287 * an absolute path in the repository.
1289 * If @a limit is non-zero then only invoke @a receiver on the first
1290 * @a limit logs.
1292 * If @a discover_changed_paths, then each call to @a receiver passes a
1293 * hash mapping paths committed in that revision to information about them
1294 * as the receiver's @a changed_paths argument.
1295 * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
1297 * If @a strict_node_history is set, copy history (if any exists) will
1298 * not be traversed while harvesting revision logs for each path.
1300 * If @a revprops is NULL, retrieve all revprops; else, retrieve only the
1301 * revprops named in the array (i.e. retrieve none if the array is empty).
1303 * If any invocation of @a receiver returns error, return that error
1304 * immediately and without wrapping it.
1306 * If @a start or @a end is a non-existent revision, return the error
1307 * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
1309 * If optional @a authz_read_func is non-NULL, then use this function
1310 * (along with optional @a authz_read_baton) to check the readability
1311 * of each changed-path in each revision about to be "pushed" at
1312 * @a receiver. If a revision has some changed-paths readable and
1313 * others unreadable, unreadable paths are omitted from the
1314 * changed_paths field and only svn:author and svn:date will be
1315 * available in the revprops field. If a revision has no
1316 * changed-paths readable at all, then all paths are omitted and no
1317 * revprops are available.
1319 * See also the documentation for @c svn_log_entry_receiver_t.
1321 * Use @a pool for temporary allocations.
1323 * @since New in 1.5.
1325 svn_error_t *
1326 svn_repos_get_logs4(svn_repos_t *repos,
1327 const apr_array_header_t *paths,
1328 svn_revnum_t start,
1329 svn_revnum_t end,
1330 int limit,
1331 svn_boolean_t discover_changed_paths,
1332 svn_boolean_t strict_node_history,
1333 svn_boolean_t include_merged_revisions,
1334 const apr_array_header_t *revprops,
1335 svn_repos_authz_func_t authz_read_func,
1336 void *authz_read_baton,
1337 svn_log_entry_receiver_t receiver,
1338 void *receiver_baton,
1339 apr_pool_t *pool);
1342 * Same as svn_repos_get_logs4(), but with @a receiver being @c
1343 * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t.
1344 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
1345 * svn:author, svn:date, and svn:log.
1347 * @since New in 1.2.
1348 * @deprecated Provided for backward compatibility with the 1.4 API.
1350 svn_error_t *
1351 svn_repos_get_logs3(svn_repos_t *repos,
1352 const apr_array_header_t *paths,
1353 svn_revnum_t start,
1354 svn_revnum_t end,
1355 int limit,
1356 svn_boolean_t discover_changed_paths,
1357 svn_boolean_t strict_node_history,
1358 svn_repos_authz_func_t authz_read_func,
1359 void *authz_read_baton,
1360 svn_log_message_receiver_t receiver,
1361 void *receiver_baton,
1362 apr_pool_t *pool);
1366 * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
1368 * @deprecated Provided for backward compatibility with the 1.1 API.
1370 svn_error_t *
1371 svn_repos_get_logs2(svn_repos_t *repos,
1372 const apr_array_header_t *paths,
1373 svn_revnum_t start,
1374 svn_revnum_t end,
1375 svn_boolean_t discover_changed_paths,
1376 svn_boolean_t strict_node_history,
1377 svn_repos_authz_func_t authz_read_func,
1378 void *authz_read_baton,
1379 svn_log_message_receiver_t receiver,
1380 void *receiver_baton,
1381 apr_pool_t *pool);
1384 * Same as svn_repos_get_logs2(), but with @a authz_read_func and
1385 * @a authz_read_baton always set to NULL.
1387 * @deprecated Provided for backward compatibility with the 1.0 API.
1389 svn_error_t *
1390 svn_repos_get_logs(svn_repos_t *repos,
1391 const apr_array_header_t *paths,
1392 svn_revnum_t start,
1393 svn_revnum_t end,
1394 svn_boolean_t discover_changed_paths,
1395 svn_boolean_t strict_node_history,
1396 svn_log_message_receiver_t receiver,
1397 void *receiver_baton,
1398 apr_pool_t *pool);
1402 /* ---------------------------------------------------------------*/
1404 /* Retrieving mergeinfo. */
1407 * Fetch the mergeinfo for @a paths at @a rev, and save it to @a
1408 * *catalog. It will never be @c NULL but may be empty.
1410 * @a inherit indicates whether explicit, explicit or inherited, or
1411 * only inherited mergeinfo for @a paths is fetched.
1413 * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest.
1415 * If @a include_descendants is TRUE, then additionally return the
1416 * mergeinfo for any descendant of any element of @a paths which has
1417 * the @c SVN_PROP_MERGEINFO property explicitly set on it. (Note
1418 * that inheritance is only taken into account for the elements in @a
1419 * paths; descendants of the elements in @a paths which get their
1420 * mergeinfo via inheritance are not included in @a *mergeoutput.)
1422 * If optional @a authz_read_func is non-NULL, then use this function
1423 * (along with optional @a authz_read_baton) to check the readability
1424 * of each path which mergeinfo was requested for (from @a paths).
1425 * Silently omit unreadable paths from the request for mergeinfo.
1427 * Use @a pool for temporary allocations.
1429 * @since New in 1.5.
1431 svn_error_t *
1432 svn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1433 svn_repos_t *repos,
1434 const apr_array_header_t *paths,
1435 svn_revnum_t revision,
1436 svn_mergeinfo_inheritance_t inherit,
1437 svn_boolean_t include_descendants,
1438 svn_repos_authz_func_t authz_read_func,
1439 void *authz_read_baton,
1440 apr_pool_t *pool);
1443 /* ---------------------------------------------------------------*/
1445 /* Retrieving multiple revisions of a file. */
1448 * Retrieve a subset of the interesting revisions of a file @a path in
1449 * @a repos as seen in revision @a end. Invoke @a handler with
1450 * @a handler_baton as its first argument for each such revision.
1451 * @a pool is used for all allocations. See svn_fs_history_prev() for
1452 * a discussion of interesting revisions.
1454 * If optional @a authz_read_func is non-NULL, then use this function
1455 * (along with optional @a authz_read_baton) to check the readability
1456 * of the rev-path in each interesting revision encountered.
1458 * Revision discovery happens from @a end to @a start, and if an
1459 * unreadable revision is encountered before @a start is reached, then
1460 * revision discovery stops and only the revisions from @a end to the
1461 * oldest readable revision are returned (So it will appear that @a
1462 * path was added without history in the latter revision).
1464 * If there is an interesting revision of the file that is less than or
1465 * equal to start, the iteration will start at that revision. Else, the
1466 * iteration will start at the first revision of the file in the repository,
1467 * which has to be less than or equal to end. Note that if the function
1468 * succeeds, @a handler will have been called at least once.
1470 * In a series of calls, the file contents for the first interesting revision
1471 * will be provided as a text delta against the empty file. In the following
1472 * calls, the delta will be against the contents for the previous call.
1474 * If @a include_merged_revisions is TRUE, revisions which a included as a
1475 * result of a merge between @a start and @a end will be included.
1477 * @since New in 1.5.
1479 svn_error_t *
1480 svn_repos_get_file_revs2(svn_repos_t *repos,
1481 const char *path,
1482 svn_revnum_t start,
1483 svn_revnum_t end,
1484 svn_boolean_t include_merged_revisions,
1485 svn_repos_authz_func_t authz_read_func,
1486 void *authz_read_baton,
1487 svn_file_rev_handler_t handler,
1488 void *handler_baton,
1489 apr_pool_t *pool);
1492 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
1493 * set to FALSE.
1495 * @deprecated Provided for backward compatibility with the 1.4 API.
1496 * @since New in 1.1.
1498 svn_error_t *
1499 svn_repos_get_file_revs(svn_repos_t *repos,
1500 const char *path,
1501 svn_revnum_t start,
1502 svn_revnum_t end,
1503 svn_repos_authz_func_t authz_read_func,
1504 void *authz_read_baton,
1505 svn_repos_file_rev_handler_t handler,
1506 void *handler_baton,
1507 apr_pool_t *pool);
1510 /* ---------------------------------------------------------------*/
1513 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
1514 * routines.
1515 * @{
1518 /** Like svn_fs_commit_txn(), but invoke the @a repos's pre- and
1519 * post-commit hooks around the commit. Use @a pool for any necessary
1520 * allocations.
1522 * If the pre-commit hook or svn_fs_commit_txn() fails, throw the
1523 * original error to caller. If an error occurs when running the
1524 * post-commit hook, return the original error wrapped with
1525 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. If the caller sees this
1526 * error, it knows that the commit succeeded anyway.
1528 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
1530 svn_error_t *
1531 svn_repos_fs_commit_txn(const char **conflict_p,
1532 svn_repos_t *repos,
1533 svn_revnum_t *new_rev,
1534 svn_fs_txn_t *txn,
1535 apr_pool_t *pool);
1537 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
1538 * <tt>const char *</tt> property names to @c svn_string_t values, to
1539 * set the properties on transaction @a *txn_p. @a repos is the
1540 * repository object which contains the filesystem. @a rev, @a
1541 * *txn_p, and @a pool are as in svn_fs_begin_txn().
1543 * Before a txn is created, the repository's start-commit hooks are
1544 * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
1545 * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned.
1547 * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property,
1548 * which will be set on the transaction, but that will be overwritten
1549 * when the transaction is committed.
1551 * @since New in 1.5.
1553 svn_error_t *
1554 svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
1555 svn_repos_t *repos,
1556 svn_revnum_t rev,
1557 apr_hash_t *revprop_table,
1558 apr_pool_t *pool);
1562 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
1563 * set to a hash containing @a author and @a log_msg as the
1564 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
1565 * respectively. @a author and @a log_msg may both be @c NULL.
1567 * @deprecated Provided for backward compatibility with the 1.4 API.
1569 svn_error_t *
1570 svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
1571 svn_repos_t *repos,
1572 svn_revnum_t rev,
1573 const char *author,
1574 const char *log_msg,
1575 apr_pool_t *pool);
1578 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
1579 * property on transaction @a *txn_p. @a repos is the repository object
1580 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in
1581 * svn_fs_begin_txn().
1583 * ### Someday: before a txn is created, some kind of read-hook could
1584 * be called here.
1586 svn_error_t *
1587 svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
1588 svn_repos_t *repos,
1589 svn_revnum_t rev,
1590 const char *author,
1591 apr_pool_t *pool);
1594 /** @defgroup svn_repos_fs_locks Repository lock wrappers
1595 * @{
1596 * @since New in 1.2. */
1598 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
1599 * post-lock hooks before and after the locking action. Use @a pool
1600 * for any necessary allocations.
1602 * If the pre-lock hook or svn_fs_lock() fails, throw the original
1603 * error to caller. If an error occurs when running the post-lock
1604 * hook, return the original error wrapped with
1605 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
1606 * error, it knows that the lock succeeded anyway.
1608 svn_error_t *
1609 svn_repos_fs_lock(svn_lock_t **lock,
1610 svn_repos_t *repos,
1611 const char *path,
1612 const char *token,
1613 const char *comment,
1614 svn_boolean_t is_dav_comment,
1615 apr_time_t expiration_date,
1616 svn_revnum_t current_rev,
1617 svn_boolean_t steal_lock,
1618 apr_pool_t *pool);
1621 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
1622 * post-unlock hooks before and after the unlocking action. Use @a
1623 * pool for any necessary allocations.
1625 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
1626 * error to caller. If an error occurs when running the post-unlock
1627 * hook, return the original error wrapped with
1628 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this
1629 * error, it knows that the unlock succeeded anyway.
1631 svn_error_t *
1632 svn_repos_fs_unlock(svn_repos_t *repos,
1633 const char *path,
1634 const char *token,
1635 svn_boolean_t break_lock,
1636 apr_pool_t *pool);
1640 /** Look up all the locks in and under @a path in @a repos, setting @a
1641 * *locks to a hash which maps <tt>const char *</tt> paths to the @c
1642 * svn_lock_t locks associated with those paths. Use @a
1643 * authz_read_func and @a authz_read_baton to "screen" all returned
1644 * locks. That is: do not return any locks on any paths that are
1645 * unreadable in HEAD, just silently omit them.
1647 svn_error_t *
1648 svn_repos_fs_get_locks(apr_hash_t **locks,
1649 svn_repos_t *repos,
1650 const char *path,
1651 svn_repos_authz_func_t authz_read_func,
1652 void *authz_read_baton,
1653 apr_pool_t *pool);
1655 /** @} */
1658 * Like svn_fs_change_rev_prop(), but invoke the @a repos's pre- and
1659 * post-revprop-change hooks around the change as specified by @a
1660 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
1661 * (respectively). Use @a pool for temporary allocations.
1663 * @a rev is the revision whose property to change, @a name is the
1664 * name of the property, and @a new_value is the new value of the
1665 * property. @a author is the authenticated username of the person
1666 * changing the property value, or NULL if not available.
1668 * If @a authz_read_func is non-NULL, then use it (with @a
1669 * authz_read_baton) to validate the changed-paths associated with @a
1670 * rev. If the revision contains any unreadable changed paths, then
1671 * return SVN_ERR_AUTHZ_UNREADABLE.
1673 * @since New in 1.5.
1675 svn_error_t *
1676 svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
1677 svn_revnum_t rev,
1678 const char *author,
1679 const char *name,
1680 const svn_string_t *new_value,
1681 svn_boolean_t
1682 use_pre_revprop_change_hook,
1683 svn_boolean_t
1684 use_post_revprop_change_hook,
1685 svn_repos_authz_func_t
1686 authz_read_func,
1687 void *authz_read_baton,
1688 apr_pool_t *pool);
1691 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
1692 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
1693 * always set to @c TRUE.
1695 * @deprecated Provided for backward compatibility with the 1.4 API.
1697 svn_error_t *
1698 svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
1699 svn_revnum_t rev,
1700 const char *author,
1701 const char *name,
1702 const svn_string_t *new_value,
1703 svn_repos_authz_func_t
1704 authz_read_func,
1705 void *authz_read_baton,
1706 apr_pool_t *pool);
1709 * Similar to svn_repos_fs_change_rev_prop2(), but with the
1710 * @a authz_read_func parameter always NULL.
1712 * @deprecated Provided for backward compatibility with the 1.0 API.
1714 svn_error_t *
1715 svn_repos_fs_change_rev_prop(svn_repos_t *repos,
1716 svn_revnum_t rev,
1717 const char *author,
1718 const char *name,
1719 const svn_string_t *new_value,
1720 apr_pool_t *pool);
1725 * Set @a *value_p to the value of the property named @a propname on
1726 * revision @a rev in the filesystem opened in @a repos. If @a rev
1727 * has no property by that name, set @a *value_p to zero. Allocate
1728 * the result in @a pool.
1730 * If @a authz_read_func is non-NULL, then use it (with @a
1731 * authz_read_baton) to validate the changed-paths associated with @a
1732 * rev. If the changed-paths are all unreadable, then set @a *value_p
1733 * to zero unconditionally. If only some of the changed-paths are
1734 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
1735 * fetched, but return 0 for any other property.
1737 * @since New in 1.1.
1739 svn_error_t *
1740 svn_repos_fs_revision_prop(svn_string_t **value_p,
1741 svn_repos_t *repos,
1742 svn_revnum_t rev,
1743 const char *propname,
1744 svn_repos_authz_func_t
1745 authz_read_func,
1746 void *authz_read_baton,
1747 apr_pool_t *pool);
1751 * Set @a *table_p to the entire property list of revision @a rev in
1752 * filesystem opened in @a repos, as a hash table allocated in @a
1753 * pool. The table maps <tt>char *</tt> property names to @c
1754 * svn_string_t * values; the names and values are allocated in @a
1755 * pool.
1757 * If @a authz_read_func is non-NULL, then use it (with @a
1758 * authz_read_baton) to validate the changed-paths associated with @a
1759 * rev. If the changed-paths are all unreadable, then return an empty
1760 * hash. If only some of the changed-paths are unreadable, then return
1761 * an empty hash, except for 'svn:author' and 'svn:date' properties
1762 * (assuming those properties exist).
1764 * @since New in 1.1.
1766 svn_error_t *
1767 svn_repos_fs_revision_proplist(apr_hash_t **table_p,
1768 svn_repos_t *repos,
1769 svn_revnum_t rev,
1770 svn_repos_authz_func_t
1771 authz_read_func,
1772 void *authz_read_baton,
1773 apr_pool_t *pool);
1777 /* ---------------------------------------------------------------*/
1779 /* Prop-changing wrappers for libsvn_fs routines. */
1781 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
1782 above with the hook-related functions. */
1785 /** Validating wrapper for svn_fs_change_node_prop() (which see for
1786 * argument descriptions).
1788 svn_error_t *
1789 svn_repos_fs_change_node_prop(svn_fs_root_t *root,
1790 const char *path,
1791 const char *name,
1792 const svn_string_t *value,
1793 apr_pool_t *pool);
1795 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
1796 * argument descriptions).
1798 svn_error_t *
1799 svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
1800 const char *name,
1801 const svn_string_t *value,
1802 apr_pool_t *pool);
1804 /** Validating wrapper for svn_fs_change_txn_props() (which see for
1805 * argument descriptions).
1807 * @since New in 1.5.
1809 svn_error_t *
1810 svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
1811 apr_array_header_t *props,
1812 apr_pool_t *pool);
1814 /** @} */
1816 /* ---------------------------------------------------------------*/
1819 * @defgroup svn_repos_inspection Data structures and editor things for
1820 * repository inspection.
1821 * @{
1823 * As it turns out, the svn_repos_dir_delta2() interface can be
1824 * extremely useful for examining the repository, or more exactly,
1825 * changes to the repository. svn_repos_dir_delta2() allows for
1826 * differences between two trees to be described using an editor.
1828 * By using the editor obtained from svn_repos_node_editor() with
1829 * svn_repos_dir_delta2(), the description of how to transform one tree
1830 * into another can be used to build an in-memory linked-list tree,
1831 * which each node representing a repository node that was changed as a
1832 * result of having svn_repos_dir_delta2() drive that editor.
1835 /** A node in the repository. */
1836 typedef struct svn_repos_node_t
1838 /** Node type (file, dir, etc.) */
1839 svn_node_kind_t kind;
1841 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
1842 char action;
1844 /** Were there any textual mods? (files only) */
1845 svn_boolean_t text_mod;
1847 /** Where there any property mods? */
1848 svn_boolean_t prop_mod;
1850 /** The name of this node as it appears in its parent's entries list */
1851 const char *name;
1853 /** The filesystem revision where this was copied from (if any) */
1854 svn_revnum_t copyfrom_rev;
1856 /** The filesystem path where this was copied from (if any) */
1857 const char *copyfrom_path;
1859 /** Pointer to the next sibling of this node */
1860 struct svn_repos_node_t *sibling;
1862 /** Pointer to the first child of this node */
1863 struct svn_repos_node_t *child;
1865 /** Pointer to the parent of this node */
1866 struct svn_repos_node_t *parent;
1868 } svn_repos_node_t;
1871 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
1872 * svn_repos_dir_delta2(), builds an <tt>svn_repos_node_t *</tt> tree
1873 * representing the delta from @a base_root to @a root in @a repos's
1874 * filesystem.
1876 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
1877 * node afterwards.
1879 * Note that the delta includes "bubbled-up" directories; that is,
1880 * many of the directory nodes will have no prop_mods.
1882 * Allocate the tree and its contents in @a node_pool; do all other
1883 * allocation in @a pool.
1885 svn_error_t *
1886 svn_repos_node_editor(const svn_delta_editor_t **editor,
1887 void **edit_baton,
1888 svn_repos_t *repos,
1889 svn_fs_root_t *base_root,
1890 svn_fs_root_t *root,
1891 apr_pool_t *node_pool,
1892 apr_pool_t *pool);
1894 /** Return the root node of the linked-list tree generated by driving
1895 * the editor created by svn_repos_node_editor() with
1896 * svn_repos_dir_delta2(), which is stored in @a edit_baton. This is
1897 * only really useful if used *after* the editor drive is completed.
1899 svn_repos_node_t *svn_repos_node_from_baton(void *edit_baton);
1901 /** @} */
1903 /* ---------------------------------------------------------------*/
1906 * @defgroup svn_repos_dump_load Dumping and loading filesystem data
1907 * @{
1909 * The filesystem 'dump' format contains nothing but the abstract
1910 * structure of the filesystem -- independent of any internal node-id
1911 * schema or database back-end. All of the data in the dumpfile is
1912 * acquired by public function calls into svn_fs.h. Similarly, the
1913 * parser which reads the dumpfile is able to reconstruct the
1914 * filesystem using only public svn_fs.h routines.
1916 * Thus the dump/load feature's main purpose is for *migrating* data
1917 * from one svn filesystem to another -- presumably two filesystems
1918 * which have different internal implementations.
1920 * If you simply want to backup your filesystem, you're probably
1921 * better off using the built-in facilities of the DB backend (using
1922 * Berkeley DB's hot-backup feature, for example.)
1924 * For a description of the dumpfile format, see
1925 * /trunk/notes/fs_dumprestore.txt.
1928 /* The RFC822-style headers in our dumpfile format. */
1929 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version"
1930 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3
1931 #define SVN_REPOS_DUMPFILE_UUID "UUID"
1932 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length"
1934 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number"
1936 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path"
1937 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind"
1938 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action"
1939 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path"
1940 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev"
1941 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM "Text-copy-source-md5"
1942 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM "Text-content-md5"
1944 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length"
1945 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length"
1947 /* @since New in 1.1. */
1948 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta"
1949 /* @since New in 1.1. */
1950 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta"
1951 /* @since New in 1.5. */
1952 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM "Text-delta-base-md5"
1954 /** The different "actions" attached to nodes in the dumpfile. */
1955 enum svn_node_action
1957 svn_node_action_change,
1958 svn_node_action_add,
1959 svn_node_action_delete,
1960 svn_node_action_replace
1963 /** The different policies for processing the UUID in the dumpfile. */
1964 enum svn_repos_load_uuid
1966 svn_repos_load_uuid_default,
1967 svn_repos_load_uuid_ignore,
1968 svn_repos_load_uuid_force
1973 * Verify the contents of the file system in @a repos.
1975 * If @a feedback_stream is not @c NULL, write feedback to it (lines of
1976 * the form "* Verified revision %ld\n").
1978 * If @a start_rev is @c SVN_INVALID_REVNUM, then start verifying at
1979 * revision 0. If @a end_rev is @c SVN_INVALID_REVNUM, then verify
1980 * through the @c HEAD revision.
1982 * If @a cancel_func is not @c NULL, call it periodically with @a
1983 * cancel_baton as argument to see if the caller wishes to cancel the
1984 * verification.
1986 * @since New in 1.5.
1988 svn_error_t *
1989 svn_repos_verify_fs(svn_repos_t *repos,
1990 svn_stream_t *feedback_stream,
1991 svn_revnum_t start_rev,
1992 svn_revnum_t end_rev,
1993 svn_cancel_func_t cancel_func,
1994 void *cancel_baton,
1995 apr_pool_t *pool);
1999 * Dump the contents of the filesystem within already-open @a repos into
2000 * writable @a dumpstream. Begin at revision @a start_rev, and dump every
2001 * revision up through @a end_rev. Use @a pool for all allocation. If
2002 * non-@c NULL, send feedback to @a feedback_stream. If @a dumpstream is
2003 * @c NULL, this is effectively a primitive verify. It is not complete,
2004 * however; see svn_fs_verify instead.
2006 * If @a start_rev is @c SVN_INVALID_REVNUM, then start dumping at revision
2007 * 0. If @a end_rev is @c SVN_INVALID_REVNUM, then dump through the @c HEAD
2008 * revision.
2010 * If @a incremental is @c TRUE, the first revision dumped will be a diff
2011 * against the previous revision (usually it looks like a full dump of
2012 * the tree).
2014 * If @a use_deltas is @c TRUE, output only node properties which have
2015 * changed relative to the previous contents, and output text contents
2016 * as svndiff data against the previous contents. Regardless of how
2017 * this flag is set, the first revision of a non-incremental dump will
2018 * be done with full plain text. A dump with @a use_deltas set cannot
2019 * be loaded by Subversion 1.0.x.
2021 * If @a cancel_func is not @c NULL, it is called periodically with
2022 * @a cancel_baton as argument to see if the client wishes to cancel
2023 * the dump.
2025 * @since New in 1.1.
2027 svn_error_t *
2028 svn_repos_dump_fs2(svn_repos_t *repos,
2029 svn_stream_t *dumpstream,
2030 svn_stream_t *feedback_stream,
2031 svn_revnum_t start_rev,
2032 svn_revnum_t end_rev,
2033 svn_boolean_t incremental,
2034 svn_boolean_t use_deltas,
2035 svn_cancel_func_t cancel_func,
2036 void *cancel_baton,
2037 apr_pool_t *pool);
2041 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
2042 * parameter always set to @c FALSE.
2044 * @deprecated Provided for backward compatibility with the 1.0 API.
2046 svn_error_t *
2047 svn_repos_dump_fs(svn_repos_t *repos,
2048 svn_stream_t *dumpstream,
2049 svn_stream_t *feedback_stream,
2050 svn_revnum_t start_rev,
2051 svn_revnum_t end_rev,
2052 svn_boolean_t incremental,
2053 svn_cancel_func_t cancel_func,
2054 void *cancel_baton,
2055 apr_pool_t *pool);
2059 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
2060 * filesystem revisions in already-open @a repos, handling uuids
2061 * in accordance with @a uuid_action.
2063 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
2064 * filesystem revisions in already-open @a repos. Use @a pool for all
2065 * allocation. If non-@c NULL, send feedback to @a feedback_stream.
2067 * If the dumpstream contains copy history that is unavailable in the
2068 * repository, an error will be thrown.
2070 * The repository's UUID will be updated iff
2071 * the dumpstream contains a UUID and
2072 * @a uuid_action is not equal to @c svn_repos_load_uuid_ignore and
2073 * either the repository contains no revisions or
2074 * @a uuid_action is equal to @c svn_repos_load_uuid_force.
2076 * If the dumpstream contains no UUID, then @a uuid_action is
2077 * ignored and the repository UUID is not touched.
2079 * If @a parent_dir is not NULL, then the parser will reparent all the
2080 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2081 * must be an existing directory in the repository.
2083 * If @a use_pre_commit_hook is set, call the repository's pre-commit
2084 * hook before committing each loaded revision.
2086 * If @a use_post_commit_hook is set, call the repository's
2087 * post-commit hook after committing each loaded revision.
2089 * If @a cancel_func is not @c NULL, it is called periodically with
2090 * @a cancel_baton as argument to see if the client wishes to cancel
2091 * the load.
2093 * @since New in 1.2.
2095 svn_error_t *
2096 svn_repos_load_fs2(svn_repos_t *repos,
2097 svn_stream_t *dumpstream,
2098 svn_stream_t *feedback_stream,
2099 enum svn_repos_load_uuid uuid_action,
2100 const char *parent_dir,
2101 svn_boolean_t use_pre_commit_hook,
2102 svn_boolean_t use_post_commit_hook,
2103 svn_cancel_func_t cancel_func,
2104 void *cancel_baton,
2105 apr_pool_t *pool);
2108 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
2109 * @a use_post_commit_hook always @c FALSE.
2111 * @deprecated Provided for backward compatibility with the 1.0 API.
2113 svn_error_t *
2114 svn_repos_load_fs(svn_repos_t *repos,
2115 svn_stream_t *dumpstream,
2116 svn_stream_t *feedback_stream,
2117 enum svn_repos_load_uuid uuid_action,
2118 const char *parent_dir,
2119 svn_cancel_func_t cancel_func,
2120 void *cancel_baton,
2121 apr_pool_t *pool);
2125 * A vtable that is driven by svn_repos_parse_dumpstream2().
2127 * @since New in 1.1.
2129 typedef struct svn_repos_parse_fns2_t
2131 /** The parser has discovered a new revision record within the
2132 * parsing session represented by @a parse_baton. All the headers are
2133 * placed in @a headers (allocated in @a pool), which maps <tt>const
2134 * char *</tt> header-name ==> <tt>const char *</tt> header-value.
2135 * The @a revision_baton received back (also allocated in @a pool)
2136 * represents the revision.
2138 svn_error_t *(*new_revision_record)(void **revision_baton,
2139 apr_hash_t *headers,
2140 void *parse_baton,
2141 apr_pool_t *pool);
2143 /** The parser has discovered a new uuid record within the parsing
2144 * session represented by @a parse_baton. The uuid's value is
2145 * @a uuid, and it is allocated in @a pool.
2147 svn_error_t *(*uuid_record)(const char *uuid,
2148 void *parse_baton,
2149 apr_pool_t *pool);
2151 /** The parser has discovered a new node record within the current
2152 * revision represented by @a revision_baton. All the headers are
2153 * placed in @a headers (as with @c new_revision_record), allocated in
2154 * @a pool. The @a node_baton received back is allocated in @a pool
2155 * and represents the node.
2157 svn_error_t *(*new_node_record)(void **node_baton,
2158 apr_hash_t *headers,
2159 void *revision_baton,
2160 apr_pool_t *pool);
2162 /** For a given @a revision_baton, set a property @a name to @a value. */
2163 svn_error_t *(*set_revision_property)(void *revision_baton,
2164 const char *name,
2165 const svn_string_t *value);
2167 /** For a given @a node_baton, set a property @a name to @a value. */
2168 svn_error_t *(*set_node_property)(void *node_baton,
2169 const char *name,
2170 const svn_string_t *value);
2172 /** For a given @a node_baton, delete property @a name. */
2173 svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
2175 /** For a given @a node_baton, remove all properties. */
2176 svn_error_t *(*remove_node_props)(void *node_baton);
2178 /** For a given @a node_baton, receive a writable @a stream capable of
2179 * receiving the node's fulltext. After writing the fulltext, call
2180 * the stream's close() function.
2182 * If a @c NULL is returned instead of a stream, the vtable is
2183 * indicating that no text is desired, and the parser will not
2184 * attempt to send it.
2186 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2187 void *node_baton);
2189 /** For a given @a node_baton, set @a handler and @a handler_baton
2190 * to a window handler and baton capable of receiving a delta
2191 * against the node's previous contents. A NULL window will be
2192 * sent to the handler after all the windows are sent.
2194 * If a @c NULL is returned instead of a handler, the vtable is
2195 * indicating that no delta is desired, and the parser will not
2196 * attempt to send it.
2198 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
2199 void **handler_baton,
2200 void *node_baton);
2202 /** The parser has reached the end of the current node represented by
2203 * @a node_baton, it can be freed.
2205 svn_error_t *(*close_node)(void *node_baton);
2207 /** The parser has reached the end of the current revision
2208 * represented by @a revision_baton. In other words, there are no more
2209 * changed nodes within the revision. The baton can be freed.
2211 svn_error_t *(*close_revision)(void *revision_baton);
2213 } svn_repos_parse_fns2_t;
2215 /** @deprecated Provided for backward compatibility with the 1.2 API. */
2216 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
2220 * Read and parse dumpfile-formatted @a stream, calling callbacks in
2221 * @a parse_fns/@a parse_baton, and using @a pool for allocations.
2223 * If @a cancel_func is not @c NULL, it is called periodically with
2224 * @a cancel_baton as argument to see if the client wishes to cancel
2225 * the dump.
2227 * This parser has built-in knowledge of the dumpfile format, but only
2228 * in a general sense:
2230 * * it recognizes revision and node records by looking for either
2231 * a REVISION_NUMBER or NODE_PATH headers.
2233 * * it recognizes the CONTENT-LENGTH headers, so it knows if and
2234 * how to suck up the content body.
2236 * * it knows how to parse a content body into two parts: props
2237 * and text, and pass the pieces to the vtable.
2239 * This is enough knowledge to make it easy on vtable implementors,
2240 * but still allow expansion of the format: most headers are ignored.
2242 * @since New in 1.1.
2244 svn_error_t *
2245 svn_repos_parse_dumpstream2(svn_stream_t *stream,
2246 const svn_repos_parse_fns2_t *parse_fns,
2247 void *parse_baton,
2248 svn_cancel_func_t cancel_func,
2249 void *cancel_baton,
2250 apr_pool_t *pool);
2254 * Set @a *parser and @a *parse_baton to a vtable parser which commits new
2255 * revisions to the fs in @a repos. The constructed parser will treat
2256 * UUID records in a manner consistent with @a uuid_action. Use @a pool
2257 * to operate on the fs.
2259 * If @a use_history is set, then the parser will require relative
2260 * 'copyfrom' history to exist in the repository when it encounters
2261 * nodes that are added-with-history.
2263 * If @a parent_dir is not NULL, then the parser will reparent all the
2264 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2265 * must be an existing directory in the repository.
2267 * Print all parsing feedback to @a outstream (if non-@c NULL).
2270 * @since New in 1.1.
2272 svn_error_t *
2273 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
2274 void **parse_baton,
2275 svn_repos_t *repos,
2276 svn_boolean_t use_history,
2277 enum svn_repos_load_uuid uuid_action,
2278 svn_stream_t *outstream,
2279 const char *parent_dir,
2280 apr_pool_t *pool);
2284 * A vtable that is driven by svn_repos_parse_dumpstream().
2285 * Similar to @c svn_repos_parse_fns2_t except that it lacks
2286 * the delete_node_property and apply_textdelta callbacks.
2288 * @deprecated Provided for backward compatibility with the 1.0 API.
2290 typedef struct svn_repos_parse_fns_t
2292 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2293 svn_error_t *(*new_revision_record)(void **revision_baton,
2294 apr_hash_t *headers,
2295 void *parse_baton,
2296 apr_pool_t *pool);
2297 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2298 svn_error_t *(*uuid_record)(const char *uuid,
2299 void *parse_baton,
2300 apr_pool_t *pool);
2301 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2302 svn_error_t *(*new_node_record)(void **node_baton,
2303 apr_hash_t *headers,
2304 void *revision_baton,
2305 apr_pool_t *pool);
2306 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2307 svn_error_t *(*set_revision_property)(void *revision_baton,
2308 const char *name,
2309 const svn_string_t *value);
2310 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2311 svn_error_t *(*set_node_property)(void *node_baton,
2312 const char *name,
2313 const svn_string_t *value);
2314 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2315 svn_error_t *(*remove_node_props)(void *node_baton);
2316 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2317 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2318 void *node_baton);
2319 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2320 svn_error_t *(*close_node)(void *node_baton);
2321 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2322 svn_error_t *(*close_revision)(void *revision_baton);
2323 } svn_repos_parser_fns_t;
2327 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
2328 * @c svn_repos_parser_fns_t vtable type.
2330 * @deprecated Provided for backward compatibility with the 1.0 API.
2332 svn_error_t *
2333 svn_repos_parse_dumpstream(svn_stream_t *stream,
2334 const svn_repos_parser_fns_t *parse_fns,
2335 void *parse_baton,
2336 svn_cancel_func_t cancel_func,
2337 void *cancel_baton,
2338 apr_pool_t *pool);
2342 * Similar to svn_repos_get_fs_build_parser2(), but yields the more
2343 * limited svn_repos_parser_fns_t vtable type.
2345 * @deprecated Provided for backward compatibility with the 1.0 API.
2347 svn_error_t *
2348 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
2349 void **parse_baton,
2350 svn_repos_t *repos,
2351 svn_boolean_t use_history,
2352 enum svn_repos_load_uuid uuid_action,
2353 svn_stream_t *outstream,
2354 const char *parent_dir,
2355 apr_pool_t *pool);
2358 /** @} */
2360 /** A data type which stores the authz information.
2362 * @since New in 1.3.
2364 typedef struct svn_authz_t svn_authz_t;
2366 /** Read authz configuration data from @a file (a file or registry
2367 * path) into @a *authz_p, allocated in @a pool.
2369 * If @a file is not a valid authz rule file, then return
2370 * SVN_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then
2371 * undefined. If @a must_exist is TRUE, a missing authz file is also
2372 * an error.
2374 * @since New in 1.3.
2376 svn_error_t *
2377 svn_repos_authz_read(svn_authz_t **authz_p,
2378 const char *file,
2379 svn_boolean_t must_exist,
2380 apr_pool_t *pool);
2383 * Check whether @a user can access @a path in the repository @a
2384 * repos_name with the @a required_access. @a authz lists the ACLs to
2385 * check against. Set @a *access_granted to indicate if the requested
2386 * access is granted.
2388 * If @a path is NULL, then check whether @a user has the @a
2389 * required_access anywhere in the repository. Set @a *access_granted
2390 * to TRUE if at least one path is accessible with the @a
2391 * required_access.
2393 * @since New in 1.3.
2395 svn_error_t *
2396 svn_repos_authz_check_access(svn_authz_t *authz,
2397 const char *repos_name,
2398 const char *path,
2399 const char *user,
2400 svn_repos_authz_access_t required_access,
2401 svn_boolean_t *access_granted,
2402 apr_pool_t *pool);
2406 /** Revision Access Levels
2408 * Like most version control systems, access to versioned objects in
2409 * Subversion is determined on primarily path-based system. Users either
2410 * do or don't have the ability to read a given path.
2412 * However, unlike many version control systems where versioned objects
2413 * maintain their own distinct version information (revision numbers,
2414 * authors, log messages, change timestamps, etc.), Subversion binds
2415 * multiple paths changed as part of a single commit operation into a
2416 * set, calls the whole thing a revision, and hangs commit metadata
2417 * (author, date, log message, etc.) off of that revision. So, commit
2418 * metadata is shared across all the paths changed as part of a given
2419 * commit operation.
2421 * It is common (or, at least, we hope it is) for log messages to give
2422 * detailed information about changes made in the commit to which the log
2423 * message is attached. Such information might include a mention of all
2424 * the files changed, what was changed in them, and so on. But this
2425 * causes a problem when presenting information to readers who aren't
2426 * authorized to read every path in the repository. Simply knowing that
2427 * a given path exists may be a security leak, even if the user can't see
2428 * the contents of the data located at that path.
2430 * So Subversion does what it reasonably can to prevent the leak of this
2431 * information, and does so via a staged revision access policy. A
2432 * reader can be said to have one of three levels of access to a given
2433 * revision's metadata, based solely on the reader's access rights to the
2434 * paths changed or copied in that revision:
2436 * 'full access' -- Granted when the reader has access to all paths
2437 * changed or copied in the revision, or when no paths were
2438 * changed in the revision at all, this access level permits
2439 * full visibility of all revision property names and values,
2440 * and the full changed-paths information.
2442 * 'no access' -- Granted when the reader does not have access to any
2443 * paths changed or copied in the revision, this access level
2444 * denies the reader access to all revision properties and all
2445 * changed-paths information.
2447 * 'partial access' -- Granted when the reader has access to at least
2448 * one, but not all, of the paths changed or copied in the revision,
2449 * this access level permits visibility of the svn:date and
2450 * svn:author revision properties and only the paths of the
2451 * changed-paths information to which the reader has access.
2456 /** An enum defining levels of revision access.
2458 * @since New in 1.5.
2460 typedef enum
2462 svn_repos_revision_access_none,
2463 svn_repos_revision_access_partial,
2464 svn_repos_revision_access_full
2466 svn_repos_revision_access_level_t;
2470 * Set @a access to the access level granted for @a revision in @a
2471 * repos, as determined by consulting the @a authz_read_func callback
2472 * function and its associated @a authz_read_baton.
2474 * @a authz_read_func may be @c NULL, in which case @a access will be
2475 * set to @c svn_repos_revision_access_full.
2477 * @since New in 1.5.
2479 svn_error_t *
2480 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
2481 svn_repos_t *repos,
2482 svn_revnum_t revision,
2483 svn_repos_authz_func_t authz_read_func,
2484 void *authz_read_baton,
2485 apr_pool_t *pool);
2489 /** Capabilities **/
2492 * Store in @a repos the client-reported capabilities @a capabilities,
2493 * which must be allocated in memory at least as long-lived as @a repos.
2495 * The elements of @a capabilities are 'const char *', a subset of
2496 * the constants beginning with @c SVN_RA_CAPABILITY_.
2497 * @a capabilities is not copied, so changing it later will affect
2498 * what is remembered by @a repos.
2500 * @note The capabilities are passed along to the start-commit hook;
2501 * see that hook's template for details.
2503 * @note As of Subversion 1.5, there are no error conditions defined,
2504 * so this always returns SVN_NO_ERROR. In future releases it may
2505 * return error, however, so callers should check.
2507 * @since New in 1.5.
2509 svn_error_t *
2510 svn_repos_remember_client_capabilities(svn_repos_t *repos,
2511 apr_array_header_t *capabilities);
2515 #ifdef __cplusplus
2517 #endif /* __cplusplus */
2519 #endif /* SVN_REPOS_H */