In the command-line client, forbid
[svn.git] / subversion / include / svn_repos.h
blob7242d29c3199c25a06b74dceab62a0ea02340629
1 /**
2 * @copyright
3 * ====================================================================
4 * Copyright (c) 2000-2007 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 *svn_repos_find_root_path(const char *path,
170 apr_pool_t *pool);
172 /** Set @a *repos_p to a repository object for the repository at @a path.
174 * Allocate @a *repos_p in @a pool.
176 * Acquires a shared lock on the repository, and attaches a cleanup
177 * function to @a pool to remove the lock. If no lock can be acquired,
178 * returns error, with undefined effect on @a *repos_p. If an exclusive
179 * lock is present, this blocks until it's gone.
181 svn_error_t *svn_repos_open(svn_repos_t **repos_p,
182 const char *path,
183 apr_pool_t *pool);
185 /** Create a new Subversion repository at @a path, building the necessary
186 * directory structure, creating the filesystem, and so on.
187 * Return the repository object in @a *repos_p, allocated in @a pool.
189 * @a config is a client configuration hash of @c svn_config_t * items
190 * keyed on config category names, and may be NULL.
192 * @a fs_config is passed to the filesystem, and may be NULL.
194 * @a unused_1 and @a unused_2 are not used and should be NULL.
196 svn_error_t *svn_repos_create(svn_repos_t **repos_p,
197 const char *path,
198 const char *unused_1,
199 const char *unused_2,
200 apr_hash_t *config,
201 apr_hash_t *fs_config,
202 apr_pool_t *pool);
204 /** Destroy the Subversion repository found at @a path, using @a pool for any
205 * necessary allocations.
207 svn_error_t *svn_repos_delete(const char *path, apr_pool_t *pool);
209 /** Return the filesystem associated with repository object @a repos. */
210 svn_fs_t *svn_repos_fs(svn_repos_t *repos);
213 /** Make a hot copy of the Subversion repository found at @a src_path
214 * to @a dst_path.
216 * Copy a possibly live Subversion repository from @a src_path to
217 * @a dst_path. If @a clean_logs is @c TRUE, perform cleanup on the
218 * source filesystem as part of the copy operation; currently, this
219 * means deleting copied, unused logfiles for a Berkeley DB source
220 * repository.
222 svn_error_t *svn_repos_hotcopy(const char *src_path,
223 const char *dst_path,
224 svn_boolean_t clean_logs,
225 apr_pool_t *pool);
228 * Run database recovery procedures on the repository at @a path,
229 * returning the database to a consistent state. Use @a pool for all
230 * allocation.
232 * Acquires an exclusive lock on the repository, recovers the
233 * database, and releases the lock. If an exclusive lock can't be
234 * acquired, returns error.
236 * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
237 * returned if the lock is not immediately available.
239 * If @a start_callback is not NULL, it will be called with @a
240 * start_callback_baton as argument before the recovery starts, but
241 * after the exclusive lock has been acquired.
243 * If @a cancel_func is not @c NULL, it is called periodically with
244 * @a cancel_baton as argument to see if the client wishes to cancel
245 * the recovery.
247 * @note On some platforms the exclusive lock does not exclude other
248 * threads in the same process so this function should only be called
249 * by a single threaded process, or by a multi-threaded process when
250 * no other threads are accessing the repository.
252 * @since New in 1.5.
254 svn_error_t *svn_repos_recover3(const char *path,
255 svn_boolean_t nonblocking,
256 svn_error_t *(*start_callback)(void *baton),
257 void *start_callback_baton,
258 svn_cancel_func_t cancel_func,
259 void * cancel_baton,
260 apr_pool_t *pool);
263 * Similar to svn_repos_recover3(), but without cancellation support.
265 * @deprecated Provided for backward compatibility with the 1.4 API.
267 svn_error_t *svn_repos_recover2(const char *path,
268 svn_boolean_t nonblocking,
269 svn_error_t *(*start_callback)(void *baton),
270 void *start_callback_baton,
271 apr_pool_t *pool);
274 * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
275 * with no callbacks provided.
277 * @deprecated Provided for backward compatibility with the 1.0 API.
279 svn_error_t *svn_repos_recover(const char *path, apr_pool_t *pool);
281 /** This function is a wrapper around svn_fs_berkeley_logfiles(),
282 * returning log file paths relative to the root of the repository.
284 * @copydoc svn_fs_berkeley_logfiles()
286 svn_error_t *svn_repos_db_logfiles(apr_array_header_t **logfiles,
287 const char *path,
288 svn_boolean_t only_unused,
289 apr_pool_t *pool);
293 /* Repository Paths */
295 /** Return the top-level repository path allocated in @a pool. */
296 const char *svn_repos_path(svn_repos_t *repos, apr_pool_t *pool);
298 /** Return the path to @a repos's filesystem directory, allocated in
299 * @a pool.
301 const char *svn_repos_db_env(svn_repos_t *repos, apr_pool_t *pool);
303 /** Return path to @a repos's config directory, allocated in @a pool. */
304 const char *svn_repos_conf_dir(svn_repos_t *repos, apr_pool_t *pool);
306 /** Return path to @a repos's svnserve.conf, allocated in @a pool. */
307 const char *svn_repos_svnserve_conf(svn_repos_t *repos, apr_pool_t *pool);
309 /** Return path to @a repos's lock directory, allocated in @a pool. */
310 const char *svn_repos_lock_dir(svn_repos_t *repos, apr_pool_t *pool);
312 /** Return path to @a repos's db lockfile, allocated in @a pool. */
313 const char *svn_repos_db_lockfile(svn_repos_t *repos, apr_pool_t *pool);
315 /** Return path to @a repos's db logs lockfile, allocated in @a pool. */
316 const char *svn_repos_db_logs_lockfile(svn_repos_t *repos, apr_pool_t *pool);
318 /** Return the path to @a repos's hook directory, allocated in @a pool. */
319 const char *svn_repos_hook_dir(svn_repos_t *repos, apr_pool_t *pool);
321 /** Return the path to @a repos's start-commit hook, allocated in @a pool. */
322 const char *svn_repos_start_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
324 /** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
325 const char *svn_repos_pre_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
327 /** Return the path to @a repos's post-commit hook, allocated in @a pool. */
328 const char *svn_repos_post_commit_hook(svn_repos_t *repos, apr_pool_t *pool);
330 /** Return the path to @a repos's pre-revprop-change hook, allocated in
331 * @a pool.
333 const char *svn_repos_pre_revprop_change_hook(svn_repos_t *repos,
334 apr_pool_t *pool);
336 /** Return the path to @a repos's post-revprop-change hook, allocated in
337 * @a pool.
339 const char *svn_repos_post_revprop_change_hook(svn_repos_t *repos,
340 apr_pool_t *pool);
343 /** @defgroup svn_repos_lock_hooks Paths to lock hooks
344 * @{
345 * @since New in 1.2. */
347 /** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
348 const char *svn_repos_pre_lock_hook(svn_repos_t *repos, apr_pool_t *pool);
350 /** Return the path to @a repos's post-lock hook, allocated in @a pool. */
351 const char *svn_repos_post_lock_hook(svn_repos_t *repos, apr_pool_t *pool);
353 /** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
354 const char *svn_repos_pre_unlock_hook(svn_repos_t *repos, apr_pool_t *pool);
356 /** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
357 const char *svn_repos_post_unlock_hook(svn_repos_t *repos, apr_pool_t *pool);
359 /** @} */
361 /* ---------------------------------------------------------------*/
363 /* Reporting the state of a working copy, for updates. */
367 * Construct and return a @a report_baton that will be passed to the
368 * other functions in this section to describe the state of a pre-existing
369 * tree (typically, a working copy). When the report is finished,
370 * @a editor/@a edit_baton will be driven in such a way as to transform the
371 * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
372 * reported hierarchy to @a tgt_path.
374 * @a fs_base is the absolute path of the node in the filesystem at which
375 * the comparison should be rooted. @a target is a single path component,
376 * used to limit the scope of the report to a single entry of @a fs_base,
377 * or "" if all of @a fs_base itself is the main subject of the report.
379 * @a tgt_path and @a revnum is the fs path/revision pair that is the
380 * "target" of the delta. @a tgt_path should be provided only when
381 * the source and target paths of the report differ. That is, @a tgt_path
382 * should *only* be specified when specifying that the resultant editor
383 * drive be one that transforms the reported hierarchy into a pristine tree
384 * of @a tgt_path at revision @a revnum. A @c NULL value for @a tgt_path
385 * will indicate that the editor should be driven in such a way as to
386 * transform the reported hierarchy to revision @a revnum, preserving the
387 * reported hierarchy.
389 * @a text_deltas instructs the driver of the @a editor to enable
390 * the generation of text deltas.
392 * @a ignore_ancestry instructs the driver to ignore node ancestry
393 * when determining how to transmit differences.
395 * @a send_copyfrom_args instructs the driver to send 'copyfrom'
396 * arguments to the editor's add_file() and add_directory() methods,
397 * whenever it deems feasible.
399 * The @a authz_read_func and @a authz_read_baton are passed along to
400 * svn_repos_dir_delta2(); see that function for how they are used.
402 * All allocation for the context and collected state will occur in
403 * @a pool.
405 * @a depth is the requested depth of the editor drive.
407 * If @a depth is @c svn_depth_unknown, the editor will affect only the
408 * paths reported by the individual calls to @c svn_repos_set_path3 and
409 * @c svn_repos_link_path3.
411 * For example, if the reported tree is the @c A subdir of the Greek Tree
412 * (see Subversion's test suite), at depth @c svn_depth_empty, but the
413 * @c A/B subdir is reported at depth @c svn_depth_infinity, then
414 * repository-side changes to @c A/mu, or underneath @c A/C and @c
415 * A/D, would not be reflected in the editor drive, but changes
416 * underneath @c A/B would be.
418 * Additionally, the editor driver will call @c add_directory and
419 * and @c add_file for directories with an appropriate depth. For
420 * example, a directory reported at @c svn_depth_files will receive
421 * file (but not directory) additions. A directory at @c svn_depth_empty
422 * will receive neither.
424 * If @a depth is @c svn_depth_files, @c svn_depth_immediates or
425 * @c svn_depth_infinity and @a depth is greater than the reported depth
426 * of the working copy, then the editor driver will emit editor
427 * operations so as to upgrade the working copy to this depth.
429 * If @a depth is @c svn_depth_empty, @c svn_depth_files,
430 * @c svn_depth_immediates and @a depth is lower
431 * than or equal to the depth of the working copy, then the editor
432 * operations will affect only paths at or above @a depth.
434 * @since New in 1.5.
436 svn_error_t *
437 svn_repos_begin_report2(void **report_baton,
438 svn_revnum_t revnum,
439 svn_repos_t *repos,
440 const char *fs_base,
441 const char *target,
442 const char *tgt_path,
443 svn_boolean_t text_deltas,
444 svn_depth_t depth,
445 svn_boolean_t ignore_ancestry,
446 svn_boolean_t send_copyfrom_args,
447 const svn_delta_editor_t *editor,
448 void *edit_baton,
449 svn_repos_authz_func_t authz_read_func,
450 void *authz_read_baton,
451 apr_pool_t *pool);
454 * The same as svn_repos_begin_report2(), but taking a boolean
455 * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
457 * If @a recurse is TRUE, the editor driver will drive the editor with
458 * a depth of @c svn_depth_infinity; if FALSE, then with a depth of
459 * @c svn_depth_files.
461 * @note @a username is ignored, and has been removed in a revised
462 * version of this API.
464 * @deprecated Provided for backward compatibility with the 1.4 API.
466 svn_error_t *
467 svn_repos_begin_report(void **report_baton,
468 svn_revnum_t revnum,
469 const char *username,
470 svn_repos_t *repos,
471 const char *fs_base,
472 const char *target,
473 const char *tgt_path,
474 svn_boolean_t text_deltas,
475 svn_boolean_t recurse,
476 svn_boolean_t ignore_ancestry,
477 const svn_delta_editor_t *editor,
478 void *edit_baton,
479 svn_repos_authz_func_t authz_read_func,
480 void *authz_read_baton,
481 apr_pool_t *pool);
485 * Given a @a report_baton constructed by svn_repos_begin_report2(),
486 * record the presence of @a path, at @a revision with depth @a depth,
487 * in the current tree.
489 * @a path is relative to the anchor/target used in the creation of the
490 * @a report_baton.
492 * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
493 * represents a locally-added path with no revision number, or @a
494 * depth is @c svn_depth_exclude.
496 * @a path may not be underneath a path on which svn_repos_set_path3()
497 * was previously called with @c svn_depth_exclude in this report.
499 * The first call of this in a given report usually passes an empty
500 * @a path; this is used to set up the correct root revision for the editor
501 * drive.
503 * A depth of @c svn_depth_unknown is not allowed, and results in an
504 * error.
506 * If @a start_empty is TRUE and @a path is a directory, then require the
507 * caller to explicitly provide all the children of @a path - do not assume
508 * that the tree also contains all the children of @a path at @a revision.
509 * This is for 'low confidence' client reporting.
511 * If the caller has a lock token for @a path, then @a lock_token should
512 * be set to that token. Else, @a lock_token should be NULL.
514 * All temporary allocations are done in @a pool.
516 * @since New in 1.5.
518 svn_error_t *svn_repos_set_path3(void *report_baton,
519 const char *path,
520 svn_revnum_t revision,
521 svn_depth_t depth,
522 svn_boolean_t start_empty,
523 const char *lock_token,
524 apr_pool_t *pool);
527 * Similar to svn_repos_set_path3(), but with @a depth set to
528 * @c svn_depth_infinity.
530 * @deprecated Provided for backward compatibility with the 1.4 API.
532 svn_error_t *svn_repos_set_path2(void *report_baton,
533 const char *path,
534 svn_revnum_t revision,
535 svn_boolean_t start_empty,
536 const char *lock_token,
537 apr_pool_t *pool);
540 * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
542 * @deprecated Provided for backward compatibility with the 1.1 API.
544 svn_error_t *svn_repos_set_path(void *report_baton,
545 const char *path,
546 svn_revnum_t revision,
547 svn_boolean_t start_empty,
548 apr_pool_t *pool);
551 * Given a @a report_baton constructed by svn_repos_begin_report2(),
552 * record the presence of @a path in the current tree, containing the contents
553 * of @a link_path at @a revision with depth @a depth.
555 * A depth of @c svn_depth_unknown is not allowed, and results in an
556 * error.
558 * @a path may not be underneath a path on which svn_repos_set_path3()
559 * was previously called with @c svn_depth_exclude in this report.
561 * Note that while @a path is relative to the anchor/target used in the
562 * creation of the @a report_baton, @a link_path is an absolute filesystem
563 * path!
565 * If @a start_empty is TRUE and @a path is a directory, then require the
566 * caller to explicitly provide all the children of @a path - do not assume
567 * that the tree also contains all the children of @a link_path at
568 * @a revision. This is for 'low confidence' client reporting.
570 * If the caller has a lock token for @a link_path, then @a lock_token
571 * should be set to that token. Else, @a lock_token should be NULL.
573 * All temporary allocations are done in @a pool.
575 * @since New in 1.5.
577 svn_error_t *svn_repos_link_path3(void *report_baton,
578 const char *path,
579 const char *link_path,
580 svn_revnum_t revision,
581 svn_depth_t depth,
582 svn_boolean_t start_empty,
583 const char *lock_token,
584 apr_pool_t *pool);
587 * Similar to svn_repos_link_path3(), but with @a depth set to
588 * @c svn_depth_infinity.
590 * @deprecated Provided for backward compatibility with the 1.4 API.
592 svn_error_t *svn_repos_link_path2(void *report_baton,
593 const char *path,
594 const char *link_path,
595 svn_revnum_t revision,
596 svn_boolean_t start_empty,
597 const char *lock_token,
598 apr_pool_t *pool);
601 * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
603 * @deprecated Provided for backward compatibility with the 1.1 API.
605 svn_error_t *svn_repos_link_path(void *report_baton,
606 const char *path,
607 const char *link_path,
608 svn_revnum_t revision,
609 svn_boolean_t start_empty,
610 apr_pool_t *pool);
612 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
613 * record the non-existence of @a path in the current tree.
615 * @a path may not be underneath a path on which svn_repos_set_path3()
616 * was previously called with @c svn_depth_exclude in this report.
618 * (This allows the reporter's driver to describe missing pieces of a
619 * working copy, so that 'svn up' can recreate them.)
621 * All temporary allocations are done in @a pool.
623 svn_error_t *svn_repos_delete_path(void *report_baton,
624 const char *path,
625 apr_pool_t *pool);
627 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
628 * finish the report and drive the editor as specified when the report
629 * baton was constructed.
631 * If an error occurs during the driving of the editor, do NOT abort the
632 * edit; that responsibility belongs to the caller of this function, if
633 * it happens at all.
635 * After the call to this function, @a report_baton is no longer valid;
636 * it should not be passed to any other reporting functions, including
637 * svn_repos_abort_report().
639 svn_error_t *svn_repos_finish_report(void *report_baton,
640 apr_pool_t *pool);
643 /** Given a @a report_baton constructed by svn_repos_begin_report2(),
644 * abort the report. This function can be called anytime before
645 * svn_repos_finish_report() is called.
647 * After the call to this function, @a report_baton is no longer valid;
648 * it should not be passed to any other reporting functions.
650 svn_error_t *svn_repos_abort_report(void *report_baton,
651 apr_pool_t *pool);
654 /* ---------------------------------------------------------------*/
656 /* The magical dir_delta update routines. */
658 /** Use the provided @a editor and @a edit_baton to describe the changes
659 * necessary for making a given node (and its descendants, if it is a
660 * directory) under @a src_root look exactly like @a tgt_path under
661 * @a tgt_root. @a src_entry is the node to update. If @a src_entry
662 * is empty, then compute the difference between the entire tree
663 * anchored at @a src_parent_dir under @a src_root and @a tgt_path
664 * under @a tgt_root. Else, describe the changes needed to update
665 * only that entry in @a src_parent_dir. Typically, callers of this
666 * function will use a @a tgt_path that is the concatenation of @a
667 * src_parent_dir and @a src_entry.
669 * @a src_root and @a tgt_root can both be either revision or transaction
670 * roots. If @a tgt_root is a revision, @a editor's set_target_revision()
671 * will be called with the @a tgt_root's revision number, else it will
672 * not be called at all.
674 * If @a authz_read_func is non-NULL, invoke it before any call to
676 * @a editor->open_root
677 * @a editor->add_directory
678 * @a editor->open_directory
679 * @a editor->add_file
680 * @a editor->open_file
682 * passing @a tgt_root, the same path that would be passed to the
683 * editor function in question, and @a authz_read_baton. If the
684 * @a *allowed parameter comes back TRUE, then proceed with the planned
685 * editor call; else if FALSE, then invoke @a editor->absent_file or
686 * @a editor->absent_directory as appropriate, except if the planned
687 * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
689 * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
690 * the window handler returned by @a editor->apply_textdelta().
692 * If @a depth is @c svn_depth_empty, invoke @a editor calls only on
693 * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
694 * If @a depth is @c svn_depth_files, also invoke the editor on file
695 * children, if any; if @c svn_depth_immediates, invoke it on
696 * immediate subdirectories as well as files; if @c svn_depth_infinity,
697 * recurse fully.
699 * If @a entry_props is @c TRUE, accompany each opened/added entry with
700 * propchange editor calls that relay special "entry props" (this
701 * is typically used only for working copy updates).
703 * @a ignore_ancestry instructs the function to ignore node ancestry
704 * when determining how to transmit differences.
706 * Before completing successfully, this function calls @a editor's
707 * close_edit(), so the caller should expect its @a edit_baton to be
708 * invalid after its use with this function.
710 * Do any allocation necessary for the delta computation in @a pool.
711 * This function's maximum memory consumption is at most roughly
712 * proportional to the greatest depth of the tree under @a tgt_root, not
713 * the total size of the delta.
715 * ### svn_repos_dir_delta2 is mostly superceded by the reporter
716 * ### functionality (svn_repos_begin_report2 and friends).
717 * ### svn_repos_dir_delta2 does allow the roots to be transaction
718 * ### roots rather than just revision roots, and it has the
719 * ### entry_props flag. Almost all of Subversion's own code uses the
720 * ### reporter instead; there are some stray references to the
721 * ### svn_repos_dir_delta[2] in comments which should probably
722 * ### actually refer to the reporter.
724 svn_error_t *
725 svn_repos_dir_delta2(svn_fs_root_t *src_root,
726 const char *src_parent_dir,
727 const char *src_entry,
728 svn_fs_root_t *tgt_root,
729 const char *tgt_path,
730 const svn_delta_editor_t *editor,
731 void *edit_baton,
732 svn_repos_authz_func_t authz_read_func,
733 void *authz_read_baton,
734 svn_boolean_t text_deltas,
735 svn_depth_t depth,
736 svn_boolean_t entry_props,
737 svn_boolean_t ignore_ancestry,
738 apr_pool_t *pool);
741 * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
742 * @c svn_depth_infinity for @a depth, and if @a recurse is FALSE,
743 * pass @c svn_depth_files for @a depth.
745 * @deprecated Provided for backward compatibility with the 1.4 API.
747 svn_error_t *
748 svn_repos_dir_delta(svn_fs_root_t *src_root,
749 const char *src_parent_dir,
750 const char *src_entry,
751 svn_fs_root_t *tgt_root,
752 const char *tgt_path,
753 const svn_delta_editor_t *editor,
754 void *edit_baton,
755 svn_repos_authz_func_t authz_read_func,
756 void *authz_read_baton,
757 svn_boolean_t text_deltas,
758 svn_boolean_t recurse,
759 svn_boolean_t entry_props,
760 svn_boolean_t ignore_ancestry,
761 apr_pool_t *pool);
764 /** Use the provided @a editor and @a edit_baton to describe the
765 * skeletal changes made in a particular filesystem @a root
766 * (revision or transaction).
768 * Changes will be limited to those within @a base_dir, and if
769 * @a low_water_mark is set to something other than @c SVN_INVALID_REVNUM
770 * it is assumed that the client has no knowledge of revisions prior to
771 * @a low_water_mark. Together, these two arguments define the portion of
772 * the tree that the client is assumed to have knowledge of, and thus any
773 * copies of data from outside that part of the tree will be sent in their
774 * entirety, not as simple copies or deltas against a previous version.
776 * The @a editor passed to this function should be aware of the fact
777 * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
778 * change_file_prop(), and apply_textdelta() functions will not
779 * contain meaningful data, and merely serve as indications that
780 * properties or textual contents were changed.
782 * If @a send_deltas is @c TRUE, the text and property deltas for changes
783 * will be sent, otherwise NULL text deltas and empty prop changes will be
784 * used.
786 * If @a authz_read_func is non-NULL, it will be used to determine if the
787 * user has read access to the data being accessed. Data that the user
788 * cannot access will be skipped.
790 * @note This editor driver passes SVN_INVALID_REVNUM for all
791 * revision parameters in the editor interface except the copyfrom
792 * parameter of the add_file() and add_directory() editor functions.
794 * @since New in 1.4.
796 svn_error_t *
797 svn_repos_replay2(svn_fs_root_t *root,
798 const char *base_dir,
799 svn_revnum_t low_water_mark,
800 svn_boolean_t send_deltas,
801 const svn_delta_editor_t *editor,
802 void *edit_baton,
803 svn_repos_authz_func_t authz_read_func,
804 void *authz_read_baton,
805 apr_pool_t *pool);
808 * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
809 * @a low_water_mark set to @c SVN_INVALID_REVNUM, @a send_deltas
810 * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
811 * set to @c NULL.
813 * @deprecated Provided for backward compatibility with the 1.3 API.
815 svn_error_t *
816 svn_repos_replay(svn_fs_root_t *root,
817 const svn_delta_editor_t *editor,
818 void *edit_baton,
819 apr_pool_t *pool);
821 /* ---------------------------------------------------------------*/
823 /* Making commits. */
826 * Return an @a editor and @a edit_baton to commit changes to the
827 * filesystem of @a repos, beginning at location 'rev:@a base_path',
828 * where "rev" is the argument given to open_root().
830 * @a repos is a previously opened repository. @a repos_url is the
831 * decoded URL to the base of the repository, and is used to check
832 * copyfrom paths. @a txn is a filesystem transaction object to use
833 * during the commit, or @c NULL to indicate that this function should
834 * create (and fully manage) a new transaction.
836 * Store the contents of @a revprop_table, a hash mapping <tt>const
837 * char *</tt> property names to @c svn_string_t values, as properties
838 * of the commit transaction, including author and log message if
839 * present.
841 * @note @c SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
842 * it will be overwritten when the transaction is committed.
844 * Iff @a authz_callback is provided, check read/write authorizations
845 * on paths accessed by editor operations. An operation which fails
846 * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
847 * SVN_ERR_AUTHZ_UNWRITABLE.
849 * Calling @a (*editor)->close_edit completes the commit. Before
850 * @c close_edit returns, but after the commit has succeeded, it will
851 * invoke @a callback with the new revision number, the commit date (as a
852 * <tt>const char *</tt>), commit author (as a <tt>const char *</tt>), and
853 * @a callback_baton as arguments. If @a callback returns an error, that
854 * error will be returned from @c close_edit, otherwise if there was a
855 * post-commit hook failure, then that error will be returned and will
856 * have code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
858 * Calling @a (*editor)->abort_edit aborts the commit, and will also
859 * abort the commit transaction unless @a txn was supplied (not @c
860 * NULL). Callers who supply their own transactions are responsible
861 * for cleaning them up (either by committing them, or aborting them).
863 * @since New in 1.5.
865 svn_error_t *
866 svn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
867 void **edit_baton,
868 svn_repos_t *repos,
869 svn_fs_txn_t *txn,
870 const char *repos_url,
871 const char *base_path,
872 apr_hash_t *revprop_table,
873 svn_commit_callback2_t callback,
874 void *callback_baton,
875 svn_repos_authz_callback_t authz_callback,
876 void *authz_baton,
877 apr_pool_t *pool);
880 * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
881 * set to a hash containing @a user and @a log_msg as the
882 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
883 * respectively. @a user and @a log_msg may both be @c NULL.
885 * @since New in 1.4.
887 * @deprecated Provided for backward compatibility with the 1.4 API.
889 svn_error_t *
890 svn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
891 void **edit_baton,
892 svn_repos_t *repos,
893 svn_fs_txn_t *txn,
894 const char *repos_url,
895 const char *base_path,
896 const char *user,
897 const char *log_msg,
898 svn_commit_callback2_t callback,
899 void *callback_baton,
900 svn_repos_authz_callback_t authz_callback,
901 void *authz_baton,
902 apr_pool_t *pool);
905 * Similar to svn_repos_get_commit_editor4(), but
906 * uses the svn_commit_callback_t type.
908 * @since New in 1.3.
910 * @deprecated Provided for backward compatibility with the 1.3 API.
912 svn_error_t *
913 svn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
914 void **edit_baton,
915 svn_repos_t *repos,
916 svn_fs_txn_t *txn,
917 const char *repos_url,
918 const char *base_path,
919 const char *user,
920 const char *log_msg,
921 svn_commit_callback_t callback,
922 void *callback_baton,
923 svn_repos_authz_callback_t authz_callback,
924 void *authz_baton,
925 apr_pool_t *pool);
928 * Similar to svn_repos_get_commit_editor3(), but with @a
929 * authz_callback and @a authz_baton set to @c NULL.
931 * @deprecated Provided for backward compatibility with the 1.2 API.
933 svn_error_t *svn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
934 void **edit_baton,
935 svn_repos_t *repos,
936 svn_fs_txn_t *txn,
937 const char *repos_url,
938 const char *base_path,
939 const char *user,
940 const char *log_msg,
941 svn_commit_callback_t callback,
942 void *callback_baton,
943 apr_pool_t *pool);
947 * Similar to svn_repos_get_commit_editor2(), but with @a txn always
948 * set to @c NULL.
950 * @deprecated Provided for backward compatibility with the 1.1 API.
952 svn_error_t *svn_repos_get_commit_editor(const svn_delta_editor_t **editor,
953 void **edit_baton,
954 svn_repos_t *repos,
955 const char *repos_url,
956 const char *base_path,
957 const char *user,
958 const char *log_msg,
959 svn_commit_callback_t callback,
960 void *callback_baton,
961 apr_pool_t *pool);
963 /* ---------------------------------------------------------------*/
965 /* Finding particular revisions. */
967 /** Set @a *revision to the revision number in @a repos's filesystem that was
968 * youngest at time @a tm.
970 svn_error_t *
971 svn_repos_dated_revision(svn_revnum_t *revision,
972 svn_repos_t *repos,
973 apr_time_t tm,
974 apr_pool_t *pool);
977 /** Given a @a root/@a path within some filesystem, return three pieces of
978 * information allocated in @a pool:
980 * - set @a *committed_rev to the revision in which the object was
981 * last modified. (In fs parlance, this is the revision in which
982 * the particular node-rev-id was 'created'.)
984 * - set @a *committed_date to the date of said revision, or @c NULL
985 * if not available.
987 * - set @a *last_author to the author of said revision, or @c NULL
988 * if not available.
990 svn_error_t *
991 svn_repos_get_committed_info(svn_revnum_t *committed_rev,
992 const char **committed_date,
993 const char **last_author,
994 svn_fs_root_t *root,
995 const char *path,
996 apr_pool_t *pool);
1000 * Set @a *dirent to an @c svn_dirent_t associated with @a path in @a
1001 * root. If @a path does not exist in @a root, set @a *dirent to
1002 * NULL. Use @a pool for memory allocation.
1004 * @since New in 1.2.
1006 svn_error_t *
1007 svn_repos_stat(svn_dirent_t **dirent,
1008 svn_fs_root_t *root,
1009 const char *path,
1010 apr_pool_t *pool);
1014 * Given @a path which exists at revision @a start in @a fs, set
1015 * @a *deleted to the revision @a path was first deleted, within the
1016 * inclusive revision range set by @a start and @a end. If @a path
1017 * does not exist at revision @a start or was not deleted within the
1018 * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1019 * Use @a pool for memory allocation.
1021 * @since New in 1.5.
1023 svn_error_t *
1024 svn_repos_deleted_rev(svn_fs_t *fs,
1025 const char *path,
1026 svn_revnum_t start,
1027 svn_revnum_t end,
1028 svn_revnum_t *deleted,
1029 apr_pool_t *pool);
1032 /** Callback type for use with svn_repos_history(). @a path and @a
1033 * revision represent interesting history locations in the lifetime
1034 * of the path passed to svn_repos_history(). @a baton is the same
1035 * baton given to svn_repos_history(). @a pool is provided for the
1036 * convenience of the implementor, who should not expect it to live
1037 * longer than a single callback call.
1039 * Signal to callback driver to stop processing/invoking this callback
1040 * by returning the @c SVN_ERR_CEASE_INVOCATION error code.
1042 typedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1043 const char *path,
1044 svn_revnum_t revision,
1045 apr_pool_t *pool);
1048 * Call @a history_func (with @a history_baton) for each interesting
1049 * history location in the lifetime of @a path in @a fs, from the
1050 * youngest of @a end and @a start to the oldest. Stop processing if
1051 * @a history_func returns @c SVN_ERR_CEASE_INVOCATION. Only cross
1052 * filesystem copy history if @a cross_copies is @c TRUE. And do all
1053 * of this in @a pool.
1055 * If @a authz_read_func is non-NULL, then use it (and @a
1056 * authz_read_baton) to verify that @a path in @a end is readable; if
1057 * not, return SVN_ERR_AUTHZ_UNREADABLE. Also verify the readability
1058 * of every ancestral path/revision pair before pushing them at @a
1059 * history_func. If a pair is deemed unreadable, then do not send
1060 * them; instead, immediately stop traversing history and return
1061 * SVN_NO_ERROR.
1063 * @since New in 1.1.
1065 svn_error_t *
1066 svn_repos_history2(svn_fs_t *fs,
1067 const char *path,
1068 svn_repos_history_func_t history_func,
1069 void *history_baton,
1070 svn_repos_authz_func_t authz_read_func,
1071 void *authz_read_baton,
1072 svn_revnum_t start,
1073 svn_revnum_t end,
1074 svn_boolean_t cross_copies,
1075 apr_pool_t *pool);
1078 * Similar to svn_repos_history2(), but with @a authz_read_func
1079 * and @a authz_read_baton always set to NULL.
1081 * @deprecated Provided for backward compatibility with the 1.0 API.
1083 svn_error_t *
1084 svn_repos_history(svn_fs_t *fs,
1085 const char *path,
1086 svn_repos_history_func_t history_func,
1087 void *history_baton,
1088 svn_revnum_t start,
1089 svn_revnum_t end,
1090 svn_boolean_t cross_copies,
1091 apr_pool_t *pool);
1095 * Set @a *locations to be a mapping of the revisions to the paths of
1096 * the file @a fs_path present at the repository in revision
1097 * @a peg_revision, where the revisions are taken out of the array
1098 * @a location_revisions.
1100 * @a location_revisions is an array of svn_revnum_t's and @a *locations
1101 * maps 'svn_revnum_t *' to 'const char *'.
1103 * If optional @a authz_read_func is non-NULL, then use it (and @a
1104 * authz_read_baton) to verify that the peg-object is readable. If not,
1105 * return SVN_ERR_AUTHZ_UNREADABLE. Also use the @a authz_read_func
1106 * to check that every path returned in the hash is readable. If an
1107 * unreadable path is encountered, stop tracing and return
1108 * SVN_NO_ERROR.
1110 * @a pool is used for all allocations.
1112 * @since New in 1.1.
1114 svn_error_t *
1115 svn_repos_trace_node_locations(svn_fs_t *fs,
1116 apr_hash_t **locations,
1117 const char *fs_path,
1118 svn_revnum_t peg_revision,
1119 apr_array_header_t *location_revisions,
1120 svn_repos_authz_func_t authz_read_func,
1121 void *authz_read_baton,
1122 apr_pool_t *pool);
1126 * Call @a receiver and @a receiver_baton to report successive
1127 * location segments in revisions between @a start_rev and @a end_rev
1128 * (inclusive) for the line of history identified by the peg-object @a
1129 * path in @a peg_revision (and in @a repos).
1131 * @a end_rev may be @c SVN_INVALID_REVNUM to indicate that you want
1132 * to trace the history of the object to its origin.
1134 * @a start_rev may be @c SVN_INVALID_REVNUM to indicate "the HEAD
1135 * revision". Otherwise, @a start_rev must be younger than @a end_rev
1136 * (unless @a end_rev is @c SVN_INVALID_REVNUM).
1138 * @a peg_revision may be @c SVN_INVALID_REVNUM to indicate "the HEAD
1139 * revision", and must evaluate to be at least as young as @a start_rev.
1141 * If optional @a authz_read_func is not @c NULL, then use it (and @a
1142 * authz_read_baton) to verify that the peg-object is readable. If
1143 * not, return @c SVN_ERR_AUTHZ_UNREADABLE. Also use the @a
1144 * authz_read_func to check that every path reported in a location
1145 * segment is readable. If an unreadable path is encountered, report
1146 * a final (possibly truncated) location segment (if any), stop
1147 * tracing history, and return @c SVN_NO_ERROR.
1149 * @a pool is used for all allocations.
1151 * @since New in 1.5.
1153 svn_error_t *
1154 svn_repos_node_location_segments(svn_repos_t *repos,
1155 const char *path,
1156 svn_revnum_t peg_revision,
1157 svn_revnum_t start_rev,
1158 svn_revnum_t end_rev,
1159 svn_location_segment_receiver_t receiver,
1160 void *receiver_baton,
1161 svn_repos_authz_func_t authz_read_func,
1162 void *authz_read_baton,
1163 apr_pool_t *pool);
1166 /* ### other queries we can do someday --
1168 * fetch the last revision created by <user>
1169 (once usernames become revision properties!)
1170 * fetch the last revision where <path> was modified
1176 /* ---------------------------------------------------------------*/
1178 /* Retrieving log messages. */
1182 * Invoke @a receiver with @a receiver_baton on each log message from
1183 * @a start to @a end in @a repos's filesystem. @a start may be greater
1184 * or less than @a end; this just controls whether the log messages are
1185 * processed in descending or ascending revision number order.
1187 * If @a start or @a end is @c SVN_INVALID_REVNUM, it defaults to youngest.
1189 * If @a paths is non-NULL and has one or more elements, then only show
1190 * revisions in which at least one of @a paths was changed (i.e., if
1191 * file, text or props changed; if dir, props or entries changed or any node
1192 * changed below it). Each path is a <tt>const char *</tt> representing
1193 * an absolute path in the repository.
1195 * If @a limit is non-zero then only invoke @a receiver on the first
1196 * @a limit logs.
1198 * If @a discover_changed_paths, then each call to @a receiver passes a
1199 * hash mapping paths committed in that revision to information about them
1200 * as the receiver's @a changed_paths argument.
1201 * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
1203 * If @a strict_node_history is set, copy history (if any exists) will
1204 * not be traversed while harvesting revision logs for each path.
1206 * If @a revprops is NULL, retrieve all revprops; else, retrieve only the
1207 * revprops named in the array (i.e. retrieve none if the array is empty).
1209 * If any invocation of @a receiver returns error, return that error
1210 * immediately and without wrapping it.
1212 * If @a start or @a end is a non-existent revision, return the error
1213 * @c SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a receiver.
1215 * If optional @a authz_read_func is non-NULL, then use this function
1216 * (along with optional @a authz_read_baton) to check the readability
1217 * of each changed-path in each revision about to be "pushed" at
1218 * @a receiver. If a revision has some changed-paths readable and
1219 * others unreadable, unreadable paths are omitted from the
1220 * changed_paths field and only svn:author and svn:date will be
1221 * available in the revprops field. If a revision has no
1222 * changed-paths readable at all, then all paths are omitted and no
1223 * revprops are available.
1225 * See also the documentation for @c svn_log_entry_receiver_t.
1227 * Use @a pool for temporary allocations.
1229 * @since New in 1.5.
1231 svn_error_t *
1232 svn_repos_get_logs4(svn_repos_t *repos,
1233 const apr_array_header_t *paths,
1234 svn_revnum_t start,
1235 svn_revnum_t end,
1236 int limit,
1237 svn_boolean_t discover_changed_paths,
1238 svn_boolean_t strict_node_history,
1239 svn_boolean_t include_merged_revisions,
1240 apr_array_header_t *revprops,
1241 svn_repos_authz_func_t authz_read_func,
1242 void *authz_read_baton,
1243 svn_log_entry_receiver_t receiver,
1244 void *receiver_baton,
1245 apr_pool_t *pool);
1248 * Same as svn_repos_get_logs4(), but with @a receiver being @c
1249 * svn_log_message_receiver_t instead of @c svn_log_entry_receiver_t.
1250 * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
1251 * svn:author, svn:date, and svn:log.
1253 * @since New in 1.2.
1254 * @deprecated Provided for backward compatibility with the 1.4 API.
1256 svn_error_t *
1257 svn_repos_get_logs3(svn_repos_t *repos,
1258 const apr_array_header_t *paths,
1259 svn_revnum_t start,
1260 svn_revnum_t end,
1261 int limit,
1262 svn_boolean_t discover_changed_paths,
1263 svn_boolean_t strict_node_history,
1264 svn_repos_authz_func_t authz_read_func,
1265 void *authz_read_baton,
1266 svn_log_message_receiver_t receiver,
1267 void *receiver_baton,
1268 apr_pool_t *pool);
1272 * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
1274 * @deprecated Provided for backward compatibility with the 1.1 API.
1276 svn_error_t *
1277 svn_repos_get_logs2(svn_repos_t *repos,
1278 const apr_array_header_t *paths,
1279 svn_revnum_t start,
1280 svn_revnum_t end,
1281 svn_boolean_t discover_changed_paths,
1282 svn_boolean_t strict_node_history,
1283 svn_repos_authz_func_t authz_read_func,
1284 void *authz_read_baton,
1285 svn_log_message_receiver_t receiver,
1286 void *receiver_baton,
1287 apr_pool_t *pool);
1290 * Same as svn_repos_get_logs2(), but with @a authz_read_func and
1291 * @a authz_read_baton always set to NULL.
1293 * @deprecated Provided for backward compatibility with the 1.0 API.
1295 svn_error_t *
1296 svn_repos_get_logs(svn_repos_t *repos,
1297 const apr_array_header_t *paths,
1298 svn_revnum_t start,
1299 svn_revnum_t end,
1300 svn_boolean_t discover_changed_paths,
1301 svn_boolean_t strict_node_history,
1302 svn_log_message_receiver_t receiver,
1303 void *receiver_baton,
1304 apr_pool_t *pool);
1308 /* ---------------------------------------------------------------*/
1310 /* Retrieving mergeinfo. */
1313 * Fetch the mergeinfo for @a paths at @a rev, and save it to @a
1314 * mergeoutput. @a mergeoutput is a mapping of @c char * target paths
1315 * (from @a paths) to textual (@c char *) representations of merge
1316 * info (as managed by svn_mergeinfo.h), or @c NULL if there is no
1317 * mergeinfo visible or available.
1319 * @a inherit indicates whether explicit, explicit or inherited, or
1320 * only inherited mergeinfo for @a paths is fetched.
1322 * If @a revision is @c SVN_INVALID_REVNUM, it defaults to youngest.
1324 * If optional @a authz_read_func is non-NULL, then use this function
1325 * (along with optional @a authz_read_baton) to check the readability
1326 * of each path which mergeinfo was requested for (from @a paths).
1327 * Silently omit unreadable paths from the request for mergeinfo.
1329 * Use @a pool for temporary allocations.
1331 * @since New in 1.5.
1333 svn_error_t *
1334 svn_repos_fs_get_mergeinfo(apr_hash_t **mergeoutput,
1335 svn_repos_t *repos,
1336 const apr_array_header_t *paths,
1337 svn_revnum_t revision,
1338 svn_mergeinfo_inheritance_t inherit,
1339 svn_repos_authz_func_t authz_read_func,
1340 void *authz_read_baton,
1341 apr_pool_t *pool);
1344 /* ---------------------------------------------------------------*/
1346 /* Retrieving multiple revisions of a file. */
1349 * Retrieve a subset of the interesting revisions of a file @a path in
1350 * @a repos as seen in revision @a end. Invoke @a handler with
1351 * @a handler_baton as its first argument for each such revision.
1352 * @a pool is used for all allocations. See svn_fs_history_prev() for
1353 * a discussion of interesting revisions.
1355 * If optional @a authz_read_func is non-NULL, then use this function
1356 * (along with optional @a authz_read_baton) to check the readability
1357 * of the rev-path in each interesting revision encountered.
1359 * Revision discovery happens from @a end to @a start, and if an
1360 * unreadable revision is encountered before @a start is reached, then
1361 * revision discovery stops and only the revisions from @a end to the
1362 * oldest readable revision are returned (So it will appear that @a
1363 * path was added without history in the latter revision).
1365 * If there is an interesting revision of the file that is less than or
1366 * equal to start, the iteration will start at that revision. Else, the
1367 * iteration will start at the first revision of the file in the repository,
1368 * which has to be less than or equal to end. Note that if the function
1369 * succeeds, @a handler will have been called at least once.
1371 * In a series of calls, the file contents for the first interesting revision
1372 * will be provided as a text delta against the empty file. In the following
1373 * calls, the delta will be against the contents for the previous call.
1375 * If @a include_merged_revisions is TRUE, revisions which a included as a
1376 * result of a merge between @a start and @a end will be included.
1378 * @since New in 1.5.
1380 svn_error_t *svn_repos_get_file_revs2(svn_repos_t *repos,
1381 const char *path,
1382 svn_revnum_t start,
1383 svn_revnum_t end,
1384 svn_boolean_t include_merged_revisions,
1385 svn_repos_authz_func_t authz_read_func,
1386 void *authz_read_baton,
1387 svn_file_rev_handler_t handler,
1388 void *handler_baton,
1389 apr_pool_t *pool);
1392 * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
1393 * set to FALSE.
1395 * @deprecated Provided for backward compatibility with the 1.4 API.
1396 * @since New in 1.1.
1398 svn_error_t *svn_repos_get_file_revs(svn_repos_t *repos,
1399 const char *path,
1400 svn_revnum_t start,
1401 svn_revnum_t end,
1402 svn_repos_authz_func_t authz_read_func,
1403 void *authz_read_baton,
1404 svn_repos_file_rev_handler_t handler,
1405 void *handler_baton,
1406 apr_pool_t *pool);
1409 /* ---------------------------------------------------------------*/
1412 * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
1413 * routines.
1414 * @{
1417 /** Like svn_fs_commit_txn(), but invoke the @a repos's pre- and
1418 * post-commit hooks around the commit. Use @a pool for any necessary
1419 * allocations.
1421 * If the pre-commit hook or svn_fs_commit_txn() fails, throw the
1422 * original error to caller. If an error occurs when running the
1423 * post-commit hook, return the original error wrapped with
1424 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED. If the caller sees this
1425 * error, it knows that the commit succeeded anyway.
1427 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
1429 svn_error_t *svn_repos_fs_commit_txn(const char **conflict_p,
1430 svn_repos_t *repos,
1431 svn_revnum_t *new_rev,
1432 svn_fs_txn_t *txn,
1433 apr_pool_t *pool);
1435 /** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
1436 * <tt>const char *</tt> property names to @c svn_string_t values, to
1437 * set the properties on transaction @a *txn_p. @a repos is the
1438 * repository object which contains the filesystem. @a rev, @a
1439 * *txn_p, and @a pool are as in svn_fs_begin_txn().
1441 * Before a txn is created, the repository's start-commit hooks are
1442 * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
1443 * and @c SVN_ERR_REPOS_HOOK_FAILURE is returned.
1445 * @note @a revprop_table may contain an @c SVN_PROP_REVISION_DATE property,
1446 * which will be set on the transaction, but that will be overwritten
1447 * when the transaction is committed.
1449 * @since New in 1.5.
1451 svn_error_t *svn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
1452 svn_repos_t *repos,
1453 svn_revnum_t rev,
1454 apr_hash_t *revprop_table,
1455 apr_pool_t *pool);
1459 * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
1460 * set to a hash containing @a author and @a log_msg as the
1461 * @c SVN_PROP_REVISION_AUTHOR and @c SVN_PROP_REVISION_LOG properties,
1462 * respectively. @a author and @a log_msg may both be @c NULL.
1464 * @deprecated Provided for backward compatibility with the 1.4 API.
1466 svn_error_t *svn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
1467 svn_repos_t *repos,
1468 svn_revnum_t rev,
1469 const char *author,
1470 const char *log_msg,
1471 apr_pool_t *pool);
1474 /** Like svn_fs_begin_txn(), but use @a author to set the corresponding
1475 * property on transaction @a *txn_p. @a repos is the repository object
1476 * which contains the filesystem. @a rev, @a *txn_p, and @a pool are as in
1477 * svn_fs_begin_txn().
1479 * ### Someday: before a txn is created, some kind of read-hook could
1480 * be called here.
1482 svn_error_t *svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
1483 svn_repos_t *repos,
1484 svn_revnum_t rev,
1485 const char *author,
1486 apr_pool_t *pool);
1489 /** @defgroup svn_repos_fs_locks Repository lock wrappers
1490 * @{
1491 * @since New in 1.2. */
1493 /** Like svn_fs_lock(), but invoke the @a repos's pre- and
1494 * post-lock hooks before and after the locking action. Use @a pool
1495 * for any necessary allocations.
1497 * If the pre-lock hook or svn_fs_lock() fails, throw the original
1498 * error to caller. If an error occurs when running the post-lock
1499 * hook, return the original error wrapped with
1500 * SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED. If the caller sees this
1501 * error, it knows that the lock succeeded anyway.
1503 svn_error_t *svn_repos_fs_lock(svn_lock_t **lock,
1504 svn_repos_t *repos,
1505 const char *path,
1506 const char *token,
1507 const char *comment,
1508 svn_boolean_t is_dav_comment,
1509 apr_time_t expiration_date,
1510 svn_revnum_t current_rev,
1511 svn_boolean_t steal_lock,
1512 apr_pool_t *pool);
1515 /** Like svn_fs_unlock(), but invoke the @a repos's pre- and
1516 * post-unlock hooks before and after the unlocking action. Use @a
1517 * pool for any necessary allocations.
1519 * If the pre-unlock hook or svn_fs_unlock() fails, throw the original
1520 * error to caller. If an error occurs when running the post-unlock
1521 * hook, return the original error wrapped with
1522 * SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED. If the caller sees this
1523 * error, it knows that the unlock succeeded anyway.
1525 svn_error_t *svn_repos_fs_unlock(svn_repos_t *repos,
1526 const char *path,
1527 const char *token,
1528 svn_boolean_t break_lock,
1529 apr_pool_t *pool);
1533 /** Look up all the locks in and under @a path in @a repos, setting @a
1534 * *locks to a hash which maps <tt>const char *</tt> paths to the @c
1535 * svn_lock_t locks associated with those paths. Use @a
1536 * authz_read_func and @a authz_read_baton to "screen" all returned
1537 * locks. That is: do not return any locks on any paths that are
1538 * unreadable in HEAD, just silently omit them.
1540 svn_error_t *svn_repos_fs_get_locks(apr_hash_t **locks,
1541 svn_repos_t *repos,
1542 const char *path,
1543 svn_repos_authz_func_t authz_read_func,
1544 void *authz_read_baton,
1545 apr_pool_t *pool);
1547 /** @} */
1550 * Like svn_fs_change_rev_prop(), but invoke the @a repos's pre- and
1551 * post-revprop-change hooks around the change as specified by @a
1552 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
1553 * (respectively). Use @a pool for temporary allocations.
1555 * @a rev is the revision whose property to change, @a name is the
1556 * name of the property, and @a new_value is the new value of the
1557 * property. @a author is the authenticated username of the person
1558 * changing the property value, or NULL if not available.
1560 * If @a authz_read_func is non-NULL, then use it (with @a
1561 * authz_read_baton) to validate the changed-paths associated with @a
1562 * rev. If the revision contains any unreadable changed paths, then
1563 * return SVN_ERR_AUTHZ_UNREADABLE.
1565 * @since New in 1.5.
1567 svn_error_t *svn_repos_fs_change_rev_prop3(svn_repos_t *repos,
1568 svn_revnum_t rev,
1569 const char *author,
1570 const char *name,
1571 const svn_string_t *new_value,
1572 svn_boolean_t
1573 use_pre_revprop_change_hook,
1574 svn_boolean_t
1575 use_post_revprop_change_hook,
1576 svn_repos_authz_func_t
1577 authz_read_func,
1578 void *authz_read_baton,
1579 apr_pool_t *pool);
1582 * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
1583 * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
1584 * always set to @c TRUE.
1586 * @deprecated Provided for backward compatibility with the 1.4 API.
1588 svn_error_t *svn_repos_fs_change_rev_prop2(svn_repos_t *repos,
1589 svn_revnum_t rev,
1590 const char *author,
1591 const char *name,
1592 const svn_string_t *new_value,
1593 svn_repos_authz_func_t
1594 authz_read_func,
1595 void *authz_read_baton,
1596 apr_pool_t *pool);
1599 * Similar to svn_repos_fs_change_rev_prop2(), but with the
1600 * @a authz_read_func parameter always NULL.
1602 * @deprecated Provided for backward compatibility with the 1.0 API.
1604 svn_error_t *svn_repos_fs_change_rev_prop(svn_repos_t *repos,
1605 svn_revnum_t rev,
1606 const char *author,
1607 const char *name,
1608 const svn_string_t *new_value,
1609 apr_pool_t *pool);
1614 * Set @a *value_p to the value of the property named @a propname on
1615 * revision @a rev in the filesystem opened in @a repos. If @a rev
1616 * has no property by that name, set @a *value_p to zero. Allocate
1617 * the result in @a pool.
1619 * If @a authz_read_func is non-NULL, then use it (with @a
1620 * authz_read_baton) to validate the changed-paths associated with @a
1621 * rev. If the changed-paths are all unreadable, then set @a *value_p
1622 * to zero unconditionally. If only some of the changed-paths are
1623 * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
1624 * fetched, but return 0 for any other property.
1626 * @since New in 1.1.
1628 svn_error_t *svn_repos_fs_revision_prop(svn_string_t **value_p,
1629 svn_repos_t *repos,
1630 svn_revnum_t rev,
1631 const char *propname,
1632 svn_repos_authz_func_t
1633 authz_read_func,
1634 void *authz_read_baton,
1635 apr_pool_t *pool);
1639 * Set @a *table_p to the entire property list of revision @a rev in
1640 * filesystem opened in @a repos, as a hash table allocated in @a
1641 * pool. The table maps <tt>char *</tt> property names to @c
1642 * svn_string_t * values; the names and values are allocated in @a
1643 * pool.
1645 * If @a authz_read_func is non-NULL, then use it (with @a
1646 * authz_read_baton) to validate the changed-paths associated with @a
1647 * rev. If the changed-paths are all unreadable, then return an empty
1648 * hash. If only some of the changed-paths are unreadable, then return
1649 * an empty hash, except for 'svn:author' and 'svn:date' properties
1650 * (assuming those properties exist).
1652 * @since New in 1.1.
1654 svn_error_t *svn_repos_fs_revision_proplist(apr_hash_t **table_p,
1655 svn_repos_t *repos,
1656 svn_revnum_t rev,
1657 svn_repos_authz_func_t
1658 authz_read_func,
1659 void *authz_read_baton,
1660 apr_pool_t *pool);
1664 /* ---------------------------------------------------------------*/
1666 /* Prop-changing wrappers for libsvn_fs routines. */
1668 /* NOTE: svn_repos_fs_change_rev_prop() also exists, but is located
1669 above with the hook-related functions. */
1672 /** Validating wrapper for svn_fs_change_node_prop() (which see for
1673 * argument descriptions).
1675 svn_error_t *svn_repos_fs_change_node_prop(svn_fs_root_t *root,
1676 const char *path,
1677 const char *name,
1678 const svn_string_t *value,
1679 apr_pool_t *pool);
1681 /** Validating wrapper for svn_fs_change_txn_prop() (which see for
1682 * argument descriptions).
1684 svn_error_t *svn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
1685 const char *name,
1686 const svn_string_t *value,
1687 apr_pool_t *pool);
1689 /** Validating wrapper for svn_fs_change_txn_props() (which see for
1690 * argument descriptions).
1692 * @since New in 1.5.
1694 svn_error_t *svn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
1695 apr_array_header_t *props,
1696 apr_pool_t *pool);
1698 /** @} */
1700 /* ---------------------------------------------------------------*/
1703 * @defgroup svn_repos_inspection Data structures and editor things for
1704 * repository inspection.
1705 * @{
1707 * As it turns out, the svn_repos_dir_delta2() interface can be
1708 * extremely useful for examining the repository, or more exactly,
1709 * changes to the repository. svn_repos_dir_delta2() allows for
1710 * differences between two trees to be described using an editor.
1712 * By using the editor obtained from svn_repos_node_editor() with
1713 * svn_repos_dir_delta2(), the description of how to transform one tree
1714 * into another can be used to build an in-memory linked-list tree,
1715 * which each node representing a repository node that was changed as a
1716 * result of having svn_repos_dir_delta2() drive that editor.
1719 /** A node in the repository. */
1720 typedef struct svn_repos_node_t
1722 /** Node type (file, dir, etc.) */
1723 svn_node_kind_t kind;
1725 /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
1726 char action;
1728 /** Were there any textual mods? (files only) */
1729 svn_boolean_t text_mod;
1731 /** Where there any property mods? */
1732 svn_boolean_t prop_mod;
1734 /** The name of this node as it appears in its parent's entries list */
1735 const char *name;
1737 /** The filesystem revision where this was copied from (if any) */
1738 svn_revnum_t copyfrom_rev;
1740 /** The filesystem path where this was copied from (if any) */
1741 const char *copyfrom_path;
1743 /** Pointer to the next sibling of this node */
1744 struct svn_repos_node_t *sibling;
1746 /** Pointer to the first child of this node */
1747 struct svn_repos_node_t *child;
1749 /** Pointer to the parent of this node */
1750 struct svn_repos_node_t *parent;
1752 } svn_repos_node_t;
1755 /** Set @a *editor and @a *edit_baton to an editor that, when driven by
1756 * svn_repos_dir_delta2(), builds an <tt>svn_repos_node_t *</tt> tree
1757 * representing the delta from @a base_root to @a root in @a repos's
1758 * filesystem.
1760 * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
1761 * node afterwards.
1763 * Note that the delta includes "bubbled-up" directories; that is,
1764 * many of the directory nodes will have no prop_mods.
1766 * Allocate the tree and its contents in @a node_pool; do all other
1767 * allocation in @a pool.
1769 svn_error_t *svn_repos_node_editor(const svn_delta_editor_t **editor,
1770 void **edit_baton,
1771 svn_repos_t *repos,
1772 svn_fs_root_t *base_root,
1773 svn_fs_root_t *root,
1774 apr_pool_t *node_pool,
1775 apr_pool_t *pool);
1777 /** Return the root node of the linked-list tree generated by driving
1778 * the editor created by svn_repos_node_editor() with
1779 * svn_repos_dir_delta2(), which is stored in @a edit_baton. This is
1780 * only really useful if used *after* the editor drive is completed.
1782 svn_repos_node_t *svn_repos_node_from_baton(void *edit_baton);
1784 /** @} */
1786 /* ---------------------------------------------------------------*/
1789 * @defgroup svn_repos_dump_load Dumping and loading filesystem data
1790 * @{
1792 * The filesystem 'dump' format contains nothing but the abstract
1793 * structure of the filesystem -- independent of any internal node-id
1794 * schema or database back-end. All of the data in the dumpfile is
1795 * acquired by public function calls into svn_fs.h. Similarly, the
1796 * parser which reads the dumpfile is able to reconstruct the
1797 * filesystem using only public svn_fs.h routines.
1799 * Thus the dump/load feature's main purpose is for *migrating* data
1800 * from one svn filesystem to another -- presumably two filesystems
1801 * which have different internal implementations.
1803 * If you simply want to backup your filesystem, you're probably
1804 * better off using the built-in facilities of the DB backend (using
1805 * Berkeley DB's hot-backup feature, for example.)
1807 * For a description of the dumpfile format, see
1808 * /trunk/notes/fs_dumprestore.txt.
1811 /* The RFC822-style headers in our dumpfile format. */
1812 #define SVN_REPOS_DUMPFILE_MAGIC_HEADER "SVN-fs-dump-format-version"
1813 #define SVN_REPOS_DUMPFILE_FORMAT_VERSION 3
1814 #define SVN_REPOS_DUMPFILE_UUID "UUID"
1815 #define SVN_REPOS_DUMPFILE_CONTENT_LENGTH "Content-length"
1817 #define SVN_REPOS_DUMPFILE_REVISION_NUMBER "Revision-number"
1819 #define SVN_REPOS_DUMPFILE_NODE_PATH "Node-path"
1820 #define SVN_REPOS_DUMPFILE_NODE_KIND "Node-kind"
1821 #define SVN_REPOS_DUMPFILE_NODE_ACTION "Node-action"
1822 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH "Node-copyfrom-path"
1823 #define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV "Node-copyfrom-rev"
1824 #define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM "Text-copy-source-md5"
1825 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM "Text-content-md5"
1827 #define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH "Prop-content-length"
1828 #define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH "Text-content-length"
1830 /* @since New in 1.1. */
1831 #define SVN_REPOS_DUMPFILE_PROP_DELTA "Prop-delta"
1832 /* @since New in 1.1. */
1833 #define SVN_REPOS_DUMPFILE_TEXT_DELTA "Text-delta"
1834 /* @since New in 1.5. */
1835 #define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM "Text-delta-base-md5"
1837 /** The different "actions" attached to nodes in the dumpfile. */
1838 enum svn_node_action
1840 svn_node_action_change,
1841 svn_node_action_add,
1842 svn_node_action_delete,
1843 svn_node_action_replace
1846 /** The different policies for processing the UUID in the dumpfile. */
1847 enum svn_repos_load_uuid
1849 svn_repos_load_uuid_default,
1850 svn_repos_load_uuid_ignore,
1851 svn_repos_load_uuid_force
1855 * Dump the contents of the filesystem within already-open @a repos into
1856 * writable @a dumpstream. Begin at revision @a start_rev, and dump every
1857 * revision up through @a end_rev. Use @a pool for all allocation. If
1858 * non-@c NULL, send feedback to @a feedback_stream. @a dumpstream can be
1859 * @c NULL for the purpose of verifying the repository.
1861 * If @a start_rev is @c SVN_INVALID_REVNUM, then start dumping at revision
1862 * 0. If @a end_rev is @c SVN_INVALID_REVNUM, then dump through the @c HEAD
1863 * revision.
1865 * If @a incremental is @c TRUE, the first revision dumped will be a diff
1866 * against the previous revision (usually it looks like a full dump of
1867 * the tree).
1869 * If @a use_deltas is @c TRUE, output only node properties which have
1870 * changed relative to the previous contents, and output text contents
1871 * as svndiff data against the previous contents. Regardless of how
1872 * this flag is set, the first revision of a non-incremental dump will
1873 * be done with full plain text. A dump with @a use_deltas set cannot
1874 * be loaded by Subversion 1.0.x.
1876 * If @a cancel_func is not @c NULL, it is called periodically with
1877 * @a cancel_baton as argument to see if the client wishes to cancel
1878 * the dump.
1880 * @since New in 1.1.
1882 svn_error_t *svn_repos_dump_fs2(svn_repos_t *repos,
1883 svn_stream_t *dumpstream,
1884 svn_stream_t *feedback_stream,
1885 svn_revnum_t start_rev,
1886 svn_revnum_t end_rev,
1887 svn_boolean_t incremental,
1888 svn_boolean_t use_deltas,
1889 svn_cancel_func_t cancel_func,
1890 void *cancel_baton,
1891 apr_pool_t *pool);
1895 * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
1896 * parameter always set to @c FALSE.
1898 * @deprecated Provided for backward compatibility with the 1.0 API.
1900 svn_error_t *svn_repos_dump_fs(svn_repos_t *repos,
1901 svn_stream_t *dumpstream,
1902 svn_stream_t *feedback_stream,
1903 svn_revnum_t start_rev,
1904 svn_revnum_t end_rev,
1905 svn_boolean_t incremental,
1906 svn_cancel_func_t cancel_func,
1907 void *cancel_baton,
1908 apr_pool_t *pool);
1912 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
1913 * filesystem revisions in already-open @a repos, handling uuids
1914 * in accordance with @a uuid_action.
1916 * Read and parse dumpfile-formatted @a dumpstream, reconstructing
1917 * filesystem revisions in already-open @a repos. Use @a pool for all
1918 * allocation. If non-@c NULL, send feedback to @a feedback_stream.
1920 * If the dumpstream contains copy history that is unavailable in the
1921 * repository, an error will be thrown.
1923 * The repository's UUID will be updated iff
1924 * the dumpstream contains a UUID and
1925 * @a uuid_action is not equal to @c svn_repos_load_uuid_ignore and
1926 * either the repository contains no revisions or
1927 * @a uuid_action is equal to @c svn_repos_load_uuid_force.
1929 * If the dumpstream contains no UUID, then @a uuid_action is
1930 * ignored and the repository UUID is not touched.
1932 * If @a parent_dir is not NULL, then the parser will reparent all the
1933 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
1934 * must be an existing directory in the repository.
1936 * If @a use_pre_commit_hook is set, call the repository's pre-commit
1937 * hook before committing each loaded revision.
1939 * If @a use_post_commit_hook is set, call the repository's
1940 * post-commit hook after committing each loaded revision.
1942 * If @a cancel_func is not @c NULL, it is called periodically with
1943 * @a cancel_baton as argument to see if the client wishes to cancel
1944 * the load.
1946 * @since New in 1.2.
1948 svn_error_t *svn_repos_load_fs2(svn_repos_t *repos,
1949 svn_stream_t *dumpstream,
1950 svn_stream_t *feedback_stream,
1951 enum svn_repos_load_uuid uuid_action,
1952 const char *parent_dir,
1953 svn_boolean_t use_pre_commit_hook,
1954 svn_boolean_t use_post_commit_hook,
1955 svn_cancel_func_t cancel_func,
1956 void *cancel_baton,
1957 apr_pool_t *pool);
1960 * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
1961 * @a use_post_commit_hook always @c FALSE.
1963 * @deprecated Provided for backward compatibility with the 1.0 API.
1965 svn_error_t *svn_repos_load_fs(svn_repos_t *repos,
1966 svn_stream_t *dumpstream,
1967 svn_stream_t *feedback_stream,
1968 enum svn_repos_load_uuid uuid_action,
1969 const char *parent_dir,
1970 svn_cancel_func_t cancel_func,
1971 void *cancel_baton,
1972 apr_pool_t *pool);
1976 * A vtable that is driven by svn_repos_parse_dumpstream2().
1978 * @since New in 1.1.
1980 typedef struct svn_repos_parse_fns2_t
1982 /** The parser has discovered a new revision record within the
1983 * parsing session represented by @a parse_baton. All the headers are
1984 * placed in @a headers (allocated in @a pool), which maps <tt>const
1985 * char *</tt> header-name ==> <tt>const char *</tt> header-value.
1986 * The @a revision_baton received back (also allocated in @a pool)
1987 * represents the revision.
1989 svn_error_t *(*new_revision_record)(void **revision_baton,
1990 apr_hash_t *headers,
1991 void *parse_baton,
1992 apr_pool_t *pool);
1994 /** The parser has discovered a new uuid record within the parsing
1995 * session represented by @a parse_baton. The uuid's value is
1996 * @a uuid, and it is allocated in @a pool.
1998 svn_error_t *(*uuid_record)(const char *uuid,
1999 void *parse_baton,
2000 apr_pool_t *pool);
2002 /** The parser has discovered a new node record within the current
2003 * revision represented by @a revision_baton. All the headers are
2004 * placed in @a headers (as with @c new_revision_record), allocated in
2005 * @a pool. The @a node_baton received back is allocated in @a pool
2006 * and represents the node.
2008 svn_error_t *(*new_node_record)(void **node_baton,
2009 apr_hash_t *headers,
2010 void *revision_baton,
2011 apr_pool_t *pool);
2013 /** For a given @a revision_baton, set a property @a name to @a value. */
2014 svn_error_t *(*set_revision_property)(void *revision_baton,
2015 const char *name,
2016 const svn_string_t *value);
2018 /** For a given @a node_baton, set a property @a name to @a value. */
2019 svn_error_t *(*set_node_property)(void *node_baton,
2020 const char *name,
2021 const svn_string_t *value);
2023 /** For a given @a node_baton, delete property @a name. */
2024 svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
2026 /** For a given @a node_baton, remove all properties. */
2027 svn_error_t *(*remove_node_props)(void *node_baton);
2029 /** For a given @a node_baton, receive a writable @a stream capable of
2030 * receiving the node's fulltext. After writing the fulltext, call
2031 * the stream's close() function.
2033 * If a @c NULL is returned instead of a stream, the vtable is
2034 * indicating that no text is desired, and the parser will not
2035 * attempt to send it.
2037 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2038 void *node_baton);
2040 /** For a given @a node_baton, set @a handler and @a handler_baton
2041 * to a window handler and baton capable of receiving a delta
2042 * against the node's previous contents. A NULL window will be
2043 * sent to the handler after all the windows are sent.
2045 * If a @c NULL is returned instead of a handler, the vtable is
2046 * indicating that no delta is desired, and the parser will not
2047 * attempt to send it.
2049 svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
2050 void **handler_baton,
2051 void *node_baton);
2053 /** The parser has reached the end of the current node represented by
2054 * @a node_baton, it can be freed.
2056 svn_error_t *(*close_node)(void *node_baton);
2058 /** The parser has reached the end of the current revision
2059 * represented by @a revision_baton. In other words, there are no more
2060 * changed nodes within the revision. The baton can be freed.
2062 svn_error_t *(*close_revision)(void *revision_baton);
2064 } svn_repos_parse_fns2_t;
2066 /** @deprecated Provided for backward compatibility with the 1.2 API. */
2067 typedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
2071 * Read and parse dumpfile-formatted @a stream, calling callbacks in
2072 * @a parse_fns/@a parse_baton, and using @a pool for allocations.
2074 * If @a cancel_func is not @c NULL, it is called periodically with
2075 * @a cancel_baton as argument to see if the client wishes to cancel
2076 * the dump.
2078 * This parser has built-in knowledge of the dumpfile format, but only
2079 * in a general sense:
2081 * * it recognizes revision and node records by looking for either
2082 * a REVISION_NUMBER or NODE_PATH headers.
2084 * * it recognizes the CONTENT-LENGTH headers, so it knows if and
2085 * how to suck up the content body.
2087 * * it knows how to parse a content body into two parts: props
2088 * and text, and pass the pieces to the vtable.
2090 * This is enough knowledge to make it easy on vtable implementors,
2091 * but still allow expansion of the format: most headers are ignored.
2093 * @since New in 1.1.
2095 svn_error_t *
2096 svn_repos_parse_dumpstream2(svn_stream_t *stream,
2097 const svn_repos_parse_fns2_t *parse_fns,
2098 void *parse_baton,
2099 svn_cancel_func_t cancel_func,
2100 void *cancel_baton,
2101 apr_pool_t *pool);
2105 * Set @a *parser and @a *parse_baton to a vtable parser which commits new
2106 * revisions to the fs in @a repos. The constructed parser will treat
2107 * UUID records in a manner consistent with @a uuid_action. Use @a pool
2108 * to operate on the fs.
2110 * If @a use_history is set, then the parser will require relative
2111 * 'copyfrom' history to exist in the repository when it encounters
2112 * nodes that are added-with-history.
2114 * If @a parent_dir is not NULL, then the parser will reparent all the
2115 * loaded nodes, from root to @a parent_dir. The directory @a parent_dir
2116 * must be an existing directory in the repository.
2118 * Print all parsing feedback to @a outstream (if non-@c NULL).
2121 * @since New in 1.1.
2123 svn_error_t *
2124 svn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
2125 void **parse_baton,
2126 svn_repos_t *repos,
2127 svn_boolean_t use_history,
2128 enum svn_repos_load_uuid uuid_action,
2129 svn_stream_t *outstream,
2130 const char *parent_dir,
2131 apr_pool_t *pool);
2135 * A vtable that is driven by svn_repos_parse_dumpstream().
2136 * Similar to @c svn_repos_parse_fns2_t except that it lacks
2137 * the delete_node_property and apply_textdelta callbacks.
2139 * @deprecated Provided for backward compatibility with the 1.0 API.
2141 typedef struct svn_repos_parse_fns_t
2143 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2144 svn_error_t *(*new_revision_record)(void **revision_baton,
2145 apr_hash_t *headers,
2146 void *parse_baton,
2147 apr_pool_t *pool);
2148 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2149 svn_error_t *(*uuid_record)(const char *uuid,
2150 void *parse_baton,
2151 apr_pool_t *pool);
2152 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2153 svn_error_t *(*new_node_record)(void **node_baton,
2154 apr_hash_t *headers,
2155 void *revision_baton,
2156 apr_pool_t *pool);
2157 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2158 svn_error_t *(*set_revision_property)(void *revision_baton,
2159 const char *name,
2160 const svn_string_t *value);
2161 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2162 svn_error_t *(*set_node_property)(void *node_baton,
2163 const char *name,
2164 const svn_string_t *value);
2165 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2166 svn_error_t *(*remove_node_props)(void *node_baton);
2167 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2168 svn_error_t *(*set_fulltext)(svn_stream_t **stream,
2169 void *node_baton);
2170 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2171 svn_error_t *(*close_node)(void *node_baton);
2172 /** Same as the corresponding field in @c svn_repos_parse_fns2_t. */
2173 svn_error_t *(*close_revision)(void *revision_baton);
2174 } svn_repos_parser_fns_t;
2178 * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
2179 * @c svn_repos_parser_fns_t vtable type.
2181 * @deprecated Provided for backward compatibility with the 1.0 API.
2183 svn_error_t *
2184 svn_repos_parse_dumpstream(svn_stream_t *stream,
2185 const svn_repos_parser_fns_t *parse_fns,
2186 void *parse_baton,
2187 svn_cancel_func_t cancel_func,
2188 void *cancel_baton,
2189 apr_pool_t *pool);
2193 * Similar to svn_repos_get_fs_build_parser2(), but yields the more
2194 * limited svn_repos_parser_fns_t vtable type.
2196 * @deprecated Provided for backward compatibility with the 1.0 API.
2198 svn_error_t *
2199 svn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
2200 void **parse_baton,
2201 svn_repos_t *repos,
2202 svn_boolean_t use_history,
2203 enum svn_repos_load_uuid uuid_action,
2204 svn_stream_t *outstream,
2205 const char *parent_dir,
2206 apr_pool_t *pool);
2209 /** @} */
2211 /** A data type which stores the authz information.
2213 * @since New in 1.3.
2215 typedef struct svn_authz_t svn_authz_t;
2217 /** Read authz configuration data from @a file (a file or registry
2218 * path) into @a *authz_p, allocated in @a pool.
2220 * If @a file is not a valid authz rule file, then return
2221 * SVN_AUTHZ_INVALID_CONFIG. The contents of @a *authz_p is then
2222 * undefined. If @a must_exist is TRUE, a missing authz file is also
2223 * an error.
2225 * @since New in 1.3.
2227 svn_error_t *
2228 svn_repos_authz_read(svn_authz_t **authz_p, const char *file,
2229 svn_boolean_t must_exist, apr_pool_t *pool);
2232 * Check whether @a user can access @a path in the repository @a
2233 * repos_name with the @a required_access. @a authz lists the ACLs to
2234 * check against. Set @a *access_granted to indicate if the requested
2235 * access is granted.
2237 * If @a path is NULL, then check whether @a user has the @a
2238 * required_access anywhere in the repository. Set @a *access_granted
2239 * to TRUE if at least one path is accessible with the @a
2240 * required_access.
2242 * @since New in 1.3.
2244 svn_error_t *
2245 svn_repos_authz_check_access(svn_authz_t *authz, const char *repos_name,
2246 const char *path, const char *user,
2247 svn_repos_authz_access_t required_access,
2248 svn_boolean_t *access_granted,
2249 apr_pool_t *pool);
2253 /** Revision Access Levels
2255 * Like most version control systems, access to versioned objects in
2256 * Subversion is determined on primarily path-based system. Users either
2257 * do or don't have the ability to read a given path.
2259 * However, unlike many version control systems where versioned objects
2260 * maintain their own distinct version information (revision numbers,
2261 * authors, log messages, change timestamps, etc.), Subversion binds
2262 * multiple paths changed as part of a single commit operation into a
2263 * set, calls the whole thing a revision, and hangs commit metadata
2264 * (author, date, log message, etc.) off of that revision. So, commit
2265 * metadata is shared across all the paths changed as part of a given
2266 * commit operation.
2268 * It is common (or, at least, we hope it is) for log messages to give
2269 * detailed information about changes made in the commit to which the log
2270 * message is attached. Such information might include a mention of all
2271 * the files changed, what was changed in them, and so on. But this
2272 * causes a problem when presenting information to readers who aren't
2273 * authorized to read every path in the repository. Simply knowing that
2274 * a given path exists may be a security leak, even if the user can't see
2275 * the contents of the data located at that path.
2277 * So Subversion does what it reasonably can to prevent the leak of this
2278 * information, and does so via a staged revision access policy. A
2279 * reader can be said to have one of three levels of access to a given
2280 * revision's metadata, based solely on the reader's access rights to the
2281 * paths changed or copied in that revision:
2283 * 'full access' -- Granted when the reader has access to all paths
2284 * changed or copied in the revision, or when no paths were
2285 * changed in the revision at all, this access level permits
2286 * full visibility of all revision property names and values,
2287 * and the full changed-paths information.
2289 * 'no access' -- Granted when the reader does not have access to any
2290 * paths changed or copied in the revision, this access level
2291 * denies the reader access to all revision properties and all
2292 * changed-paths information.
2294 * 'partial access' -- Granted when the reader has access to at least
2295 * one, but not all, of the paths changed or copied in the revision,
2296 * this access level permits visibility of the svn:date and
2297 * svn:author revision properties and only the paths of the
2298 * changed-paths information to which the reader has access.
2303 /** An enum defining levels of revision access.
2305 * @since New in 1.5.
2307 typedef enum
2309 svn_repos_revision_access_none,
2310 svn_repos_revision_access_partial,
2311 svn_repos_revision_access_full
2313 svn_repos_revision_access_level_t;
2317 * Set @a access to the access level granted for @a revision in @a
2318 * repos, as determined by consulting the @a authz_read_func callback
2319 * function and its associated @a authz_read_baton.
2321 * @a authz_read_func may be @c NULL, in which case @a access will be
2322 * set to @c svn_repos_revision_access_full.
2324 * @since New in 1.5.
2326 svn_error_t *
2327 svn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
2328 svn_repos_t *repos,
2329 svn_revnum_t revision,
2330 svn_repos_authz_func_t authz_read_func,
2331 void *authz_read_baton,
2332 apr_pool_t *pool);
2336 /** Capabilities **/
2339 * Store in @a repos the client-reported capabilities @a capabilities,
2340 * which must be allocated in memory at least as long-lived as @a repos.
2342 * The elements of @a capabilities are 'const char *', a subset of
2343 * the constants beginning with @c SVN_RA_CAPABILITY_.
2344 * @a capabilities is not copied, so changing it later will affect
2345 * what is remembered by @a repos.
2347 * @note The capabilities are passed along to the start-commit hook;
2348 * see that hook's template for details.
2350 * @note As of Subversion 1.5, there are no error conditions defined,
2351 * so this always returns SVN_NO_ERROR. In future releases it may
2352 * return error, however, so callers should check.
2354 * @since New in 1.5.
2356 svn_error_t *
2357 svn_repos_remember_client_capabilities(svn_repos_t *repos,
2358 apr_array_header_t *capabilities);
2362 #ifdef __cplusplus
2364 #endif /* __cplusplus */
2366 #endif /* SVN_REPOS_H */