1251881Speter/**
2251881Speter * @copyright
3251881Speter * ====================================================================
4251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
5251881Speter *    or more contributor license agreements.  See the NOTICE file
6251881Speter *    distributed with this work for additional information
7251881Speter *    regarding copyright ownership.  The ASF licenses this file
8251881Speter *    to you under the Apache License, Version 2.0 (the
9251881Speter *    "License"); you may not use this file except in compliance
10251881Speter *    with the License.  You may obtain a copy of the License at
11251881Speter *
12251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
13251881Speter *
14251881Speter *    Unless required by applicable law or agreed to in writing,
15251881Speter *    software distributed under the License is distributed on an
16251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17251881Speter *    KIND, either express or implied.  See the License for the
18251881Speter *    specific language governing permissions and limitations
19251881Speter *    under the License.
20251881Speter * ====================================================================
21251881Speter * @endcopyright
22251881Speter *
23251881Speter * @file svn_repos.h
24251881Speter * @brief Tools built on top of the filesystem.
25251881Speter */
26251881Speter
27251881Speter#ifndef SVN_REPOS_H
28251881Speter#define SVN_REPOS_H
29251881Speter
30251881Speter#include <apr_pools.h>
31251881Speter#include <apr_hash.h>
32251881Speter#include <apr_tables.h>
33251881Speter#include <apr_time.h>
34251881Speter
35251881Speter#include "svn_types.h"
36251881Speter#include "svn_string.h"
37251881Speter#include "svn_delta.h"
38251881Speter#include "svn_fs.h"
39251881Speter#include "svn_io.h"
40251881Speter#include "svn_mergeinfo.h"
41251881Speter
42251881Speter
43251881Speter#ifdef __cplusplus
44251881Speterextern "C" {
45251881Speter#endif /* __cplusplus */
46251881Speter
47251881Speter/* ---------------------------------------------------------------*/
48251881Speter
49251881Speter/**
50251881Speter * Get libsvn_repos version information.
51251881Speter *
52251881Speter * @since New in 1.1.
53251881Speter */
54251881Speterconst svn_version_t *
55251881Spetersvn_repos_version(void);
56251881Speter
57251881Speter
58251881Speter/* Some useful enums.  They need to be declared here for the notification
59251881Speter   system to pick them up. */
60251881Speter/** The different "actions" attached to nodes in the dumpfile. */
61251881Speterenum svn_node_action
62251881Speter{
63251881Speter  svn_node_action_change,
64251881Speter  svn_node_action_add,
65251881Speter  svn_node_action_delete,
66251881Speter  svn_node_action_replace
67251881Speter};
68251881Speter
69289180Speter
70289180Speter/** @defgroup svn_repos_authz_callbacks Repository authorization callbacks
71289180Speter * @{
72289180Speter */
73251881Speter
74289180Speter/** Callback type for checking authorization on a path.
75251881Speter *
76251881Speter * Set @a *allowed to TRUE to indicate that some operation is
77251881Speter * authorized for @a path in @a root, or set it to FALSE to indicate
78251881Speter * unauthorized (presumably according to state stored in @a baton).
79251881Speter *
80251881Speter * Do not assume @a pool has any lifetime beyond this call.
81251881Speter *
82251881Speter * The exact operation being authorized depends on the callback
83251881Speter * implementation.  For read authorization, for example, the caller
84251881Speter * would implement an instance that does read checking, and pass it as
85251881Speter * a parameter named [perhaps] 'authz_read_func'.  The receiver of
86251881Speter * that parameter might also take another parameter named
87251881Speter * 'authz_write_func', which although sharing this type, would be a
88251881Speter * different implementation.
89251881Speter *
90251881Speter * @note If someday we want more sophisticated authorization states
91251881Speter * than just yes/no, @a allowed can become an enum type.
92251881Speter */
93251881Spetertypedef svn_error_t *(*svn_repos_authz_func_t)(svn_boolean_t *allowed,
94251881Speter                                               svn_fs_root_t *root,
95251881Speter                                               const char *path,
96251881Speter                                               void *baton,
97251881Speter                                               apr_pool_t *pool);
98251881Speter
99251881Speter
100251881Speter/** An enum defining the kinds of access authz looks up.
101251881Speter *
102251881Speter * @since New in 1.3.
103251881Speter */
104251881Spetertypedef enum svn_repos_authz_access_t
105251881Speter{
106251881Speter  /** No access. */
107251881Speter  svn_authz_none = 0,
108251881Speter
109251881Speter  /** Path can be read. */
110251881Speter  svn_authz_read = 1,
111251881Speter
112251881Speter  /** Path can be altered. */
113251881Speter  svn_authz_write = 2,
114251881Speter
115251881Speter  /** The other access credentials are recursive. */
116251881Speter  svn_authz_recursive = 4
117251881Speter} svn_repos_authz_access_t;
118251881Speter
119251881Speter
120251881Speter/** Callback type for checking authorization on paths produced by
121251881Speter * the repository commit editor.
122251881Speter *
123251881Speter * Set @a *allowed to TRUE to indicate that the @a required access on
124251881Speter * @a path in @a root is authorized, or set it to FALSE to indicate
125251881Speter * unauthorized (presumable according to state stored in @a baton).
126251881Speter *
127251881Speter * If @a path is NULL, the callback should perform a global authz
128251881Speter * lookup for the @a required access.  That is, the lookup should
129251881Speter * check if the @a required access is granted for at least one path of
130251881Speter * the repository, and set @a *allowed to TRUE if so.  @a root may
131251881Speter * also be NULL if @a path is NULL.
132251881Speter *
133251881Speter * This callback is very similar to svn_repos_authz_func_t, with the
134251881Speter * exception of the addition of the @a required parameter.
135251881Speter * This is due to historical reasons: when authz was first implemented
136251881Speter * for svn_repos_dir_delta2(), it seemed there would need only checks
137251881Speter * for read and write operations, hence the svn_repos_authz_func_t
138251881Speter * callback prototype and usage scenario.  But it was then realized
139251881Speter * that lookups due to copying needed to be recursive, and that
140251881Speter * brute-force recursive lookups didn't square with the O(1)
141251881Speter * performances a copy operation should have.
142251881Speter *
143251881Speter * So a special way to ask for a recursive lookup was introduced.  The
144251881Speter * commit editor needs this capability to retain acceptable
145251881Speter * performance.  Instead of revving the existing callback, causing
146251881Speter * unnecessary revving of functions that don't actually need the
147251881Speter * extended functionality, this second, more complete callback was
148251881Speter * introduced, for use by the commit editor.
149251881Speter *
150251881Speter * Some day, it would be nice to reunite these two callbacks and do
151251881Speter * the necessary revving anyway, but for the time being, this dual
152251881Speter * callback mechanism will do.
153251881Speter */
154251881Spetertypedef svn_error_t *(*svn_repos_authz_callback_t)
155251881Speter  (svn_repos_authz_access_t required,
156251881Speter   svn_boolean_t *allowed,
157251881Speter   svn_fs_root_t *root,
158251881Speter   const char *path,
159251881Speter   void *baton,
160251881Speter   apr_pool_t *pool);
161251881Speter
162289180Speter/** @} */
163289180Speter
164289180Speter
165289180Speter/** @defgroup svn_repos_notifications Repository notifications
166289180Speter * @{
167251881Speter */
168251881Speter
169251881Speter/* Notification system. */
170251881Speter
171251881Speter/** The type of action occurring.
172251881Speter *
173251881Speter * @since New in 1.7.
174251881Speter */
175251881Spetertypedef enum svn_repos_notify_action_t
176251881Speter{
177251881Speter  /** A warning message is waiting. */
178251881Speter  svn_repos_notify_warning = 0,
179251881Speter
180251881Speter  /** A revision has finished being dumped. */
181251881Speter  svn_repos_notify_dump_rev_end,
182251881Speter
183251881Speter  /** A revision has finished being verified. */
184251881Speter  svn_repos_notify_verify_rev_end,
185251881Speter
186251881Speter  /** All revisions have finished being dumped. */
187251881Speter  svn_repos_notify_dump_end,
188251881Speter
189251881Speter  /** All revisions have finished being verified. */
190251881Speter  svn_repos_notify_verify_end,
191251881Speter
192251881Speter  /** packing of an FSFS shard has commenced */
193251881Speter  svn_repos_notify_pack_shard_start,
194251881Speter
195251881Speter  /** packing of an FSFS shard is completed */
196251881Speter  svn_repos_notify_pack_shard_end,
197251881Speter
198251881Speter  /** packing of the shard revprops has commenced */
199251881Speter  svn_repos_notify_pack_shard_start_revprop,
200251881Speter
201251881Speter  /** packing of the shard revprops has completed */
202251881Speter  svn_repos_notify_pack_shard_end_revprop,
203251881Speter
204251881Speter  /** A revision has begun loading */
205251881Speter  svn_repos_notify_load_txn_start,
206251881Speter
207251881Speter  /** A revision has finished loading */
208251881Speter  svn_repos_notify_load_txn_committed,
209251881Speter
210251881Speter  /** A node has begun loading */
211251881Speter  svn_repos_notify_load_node_start,
212251881Speter
213251881Speter  /** A node has finished loading */
214251881Speter  svn_repos_notify_load_node_done,
215251881Speter
216251881Speter  /** A copied node has been encountered */
217251881Speter  svn_repos_notify_load_copied_node,
218251881Speter
219251881Speter  /** Mergeinfo has been normalized */
220251881Speter  svn_repos_notify_load_normalized_mergeinfo,
221251881Speter
222251881Speter  /** The operation has acquired a mutex for the repo. */
223251881Speter  svn_repos_notify_mutex_acquired,
224251881Speter
225251881Speter  /** Recover has started. */
226251881Speter  svn_repos_notify_recover_start,
227251881Speter
228251881Speter  /** Upgrade has started. */
229251881Speter  svn_repos_notify_upgrade_start,
230251881Speter
231251881Speter  /** A revision was skipped during loading. @since New in 1.8. */
232251881Speter  svn_repos_notify_load_skipped_rev,
233251881Speter
234251881Speter  /** The structure of a revision is being verified.  @since New in 1.8. */
235289180Speter  svn_repos_notify_verify_rev_structure,
236251881Speter
237289180Speter  /** A revprop shard got packed. @since New in 1.9. */
238289180Speter  svn_repos_notify_pack_revprops,
239289180Speter
240289180Speter  /** A non-packed revprop shard got removed. @since New in 1.9. */
241289180Speter  svn_repos_notify_cleanup_revprops,
242289180Speter
243289180Speter  /** The repository format got bumped. @since New in 1.9. */
244289180Speter  svn_repos_notify_format_bumped,
245289180Speter
246289180Speter  /** A revision range was copied. @since New in 1.9. */
247362181Sdim  svn_repos_notify_hotcopy_rev_range,
248362181Sdim
249362181Sdim  /** The repository pack did not do anything. @since New in 1.10. */
250362181Sdim  svn_repos_notify_pack_noop,
251362181Sdim
252362181Sdim  /** The revision properties got set. @since New in 1.10. */
253362181Sdim  svn_repos_notify_load_revprop_set
254251881Speter} svn_repos_notify_action_t;
255251881Speter
256289180Speter/** The type of warning occurring.
257251881Speter *
258251881Speter * @since New in 1.7.
259251881Speter */
260251881Spetertypedef enum svn_repos_notify_warning_t
261251881Speter{
262251881Speter  /** Referencing copy source data from a revision earlier than the
263251881Speter   * first revision dumped. */
264251881Speter  svn_repos_notify_warning_found_old_reference,
265251881Speter
266251881Speter  /** An #SVN_PROP_MERGEINFO property's encoded mergeinfo references a
267251881Speter   * revision earlier than the first revision dumped. */
268251881Speter  svn_repos_notify_warning_found_old_mergeinfo,
269251881Speter
270251881Speter  /** Found an invalid path in the filesystem.
271251881Speter   * @see svn_fs.h:"Directory entry names and directory paths" */
272251881Speter  /* ### TODO(doxygen): make that a proper doxygen link */
273251881Speter  /* See svn_fs__path_valid(). */
274289180Speter  svn_repos_notify_warning_invalid_fspath,
275251881Speter
276289180Speter  /**
277289180Speter   * Detected a name collision. Reported when the names of two or more
278289180Speter   * entries in the same directory differ only in character
279289180Speter   * representation (normalization), but are otherwise identical.
280289180Speter   *
281289180Speter   * @since New in 1.9.
282289180Speter   */
283289180Speter  svn_repos_notify_warning_name_collision,
284289180Speter
285289180Speter  /**
286289180Speter   * Detected a mergeinfo path collision. Reported when the paths in
287289180Speter   * two or more entries in the same svn:mergeinfo property differ
288289180Speter   * only in character representation (normalization), but are
289289180Speter   * otherwise identical.
290289180Speter   *
291289180Speter   * @since New in 1.9.
292289180Speter   */
293289180Speter  svn_repos_notify_warning_mergeinfo_collision,
294289180Speter
295289180Speter  /**
296289180Speter   * Detected invalid mergeinfo.
297289180Speter   *
298289180Speter   * @since New in 1.9.
299289180Speter   */
300289180Speter  svn_repos_notify_warning_invalid_mergeinfo
301251881Speter} svn_repos_notify_warning_t;
302251881Speter
303251881Speter/**
304251881Speter * Structure used by #svn_repos_notify_func_t.
305251881Speter *
306251881Speter * The only field guaranteed to be populated is @c action.  Other fields are
307251881Speter * dependent upon the @c action.  (See individual fields for more information.)
308251881Speter *
309251881Speter * @note Callers of notification functions should use
310251881Speter * svn_repos_notify_create() to create structures of this type to allow for
311251881Speter * future extensibility.
312251881Speter *
313251881Speter * @since New in 1.7.
314251881Speter */
315251881Spetertypedef struct svn_repos_notify_t
316251881Speter{
317251881Speter  /** Action that describes what happened in the repository. */
318251881Speter  svn_repos_notify_action_t action;
319251881Speter
320251881Speter  /** For #svn_repos_notify_dump_rev_end and #svn_repos_notify_verify_rev_end,
321289180Speter   * the revision which just completed.
322289180Speter   * For #svn_fs_upgrade_format_bumped, the new format version. */
323251881Speter  svn_revnum_t revision;
324251881Speter
325289180Speter  /** For #svn_repos_notify_warning, the warning message. */
326251881Speter  const char *warning_str;
327289180Speter  /** For #svn_repos_notify_warning, the warning type. */
328251881Speter  svn_repos_notify_warning_t warning;
329251881Speter
330251881Speter  /** For #svn_repos_notify_pack_shard_start,
331251881Speter      #svn_repos_notify_pack_shard_end,
332289180Speter      #svn_repos_notify_pack_revprops,
333289180Speter      #svn_repos_notify_cleanup_revprops
334251881Speter      #svn_repos_notify_pack_shard_start_revprop, and
335251881Speter      #svn_repos_notify_pack_shard_end_revprop, the shard processed. */
336251881Speter  apr_int64_t shard;
337251881Speter
338289180Speter  /** For #svn_repos_notify_load_txn_committed, the revision committed. */
339251881Speter  svn_revnum_t new_revision;
340251881Speter
341289180Speter  /** For #svn_repos_notify_load_txn_committed, the source revision, if
342251881Speter      different from @a new_revision, otherwise #SVN_INVALID_REVNUM.
343289180Speter      For #svn_repos_notify_load_txn_start and
344289180Speter      #svn_repos_notify_load_skipped_rev, the source revision. */
345251881Speter  svn_revnum_t old_revision;
346251881Speter
347251881Speter  /** For #svn_repos_notify_load_node_start, the action being taken on the
348251881Speter      node. */
349251881Speter  enum svn_node_action node_action;
350251881Speter
351251881Speter  /** For #svn_repos_notify_load_node_start, the path of the node. */
352251881Speter  const char *path;
353251881Speter
354289180Speter  /** For #svn_repos_notify_hotcopy_rev_range, the start of the copied
355289180Speter      revision range.
356289180Speter      @since New in 1.9. */
357289180Speter  svn_revnum_t start_revision;
358289180Speter
359289180Speter  /** For #svn_repos_notify_hotcopy_rev_range, the end of the copied
360289180Speter      revision range (might be the same as @a start_revision).
361289180Speter      @since New in 1.9. */
362289180Speter  svn_revnum_t end_revision;
363289180Speter
364251881Speter  /* NOTE: Add new fields at the end to preserve binary compatibility.
365251881Speter     Also, if you add fields here, you have to update
366251881Speter     svn_repos_notify_create(). */
367251881Speter} svn_repos_notify_t;
368251881Speter
369251881Speter/** Callback for providing notification from the repository.
370251881Speter * Returns @c void.  Justification: success of an operation is not dependent
371251881Speter * upon successful notification of that operation.
372251881Speter *
373251881Speter * @since New in 1.7. */
374251881Spetertypedef void (*svn_repos_notify_func_t)(void *baton,
375251881Speter                                        const svn_repos_notify_t *notify,
376251881Speter                                        apr_pool_t *scratch_pool);
377251881Speter
378362181Sdim/** Callback for filtering repository contents during dump.
379362181Sdim *
380362181Sdim * Set @a *include to TRUE to indicate that node, identified by path
381362181Sdim * @a path in @a root should be included in dump, or set it to @c FALSE
382362181Sdim * to indicate that node should be excluded (presumably according to state
383362181Sdim * stored in @a baton).
384362181Sdim *
385362181Sdim * Do not assume @a scratch_pool has any lifetime beyond this call.
386362181Sdim *
387362181Sdim * @since New in 1.10.
388362181Sdim */
389362181Sdimtypedef svn_error_t * (*svn_repos_dump_filter_func_t)(
390362181Sdim  svn_boolean_t *include,
391362181Sdim  svn_fs_root_t *root,
392362181Sdim  const char *path,
393362181Sdim  void *baton,
394362181Sdim  apr_pool_t *scratch_pool);
395362181Sdim
396251881Speter/**
397251881Speter * Allocate an #svn_repos_notify_t structure in @a result_pool, initialize
398251881Speter * and return it.
399251881Speter *
400251881Speter * @since New in 1.7.
401251881Speter */
402251881Spetersvn_repos_notify_t *
403251881Spetersvn_repos_notify_create(svn_repos_notify_action_t action,
404251881Speter                        apr_pool_t *result_pool);
405251881Speter
406289180Speter/** @} */
407289180Speter
408289180Speter
409251881Speter/** The repository object. */
410251881Spetertypedef struct svn_repos_t svn_repos_t;
411251881Speter
412251881Speter/* Opening and creating repositories. */
413251881Speter
414251881Speter
415251881Speter/** Find the root path of the repository that contains @a path.
416251881Speter *
417251881Speter * If a repository was found, the path to the root of the repository
418251881Speter * is returned, else @c NULL. The pointer to the returned path may be
419251881Speter * equal to @a path.
420251881Speter */
421251881Speterconst char *
422251881Spetersvn_repos_find_root_path(const char *path,
423251881Speter                         apr_pool_t *pool);
424251881Speter
425251881Speter/** Set @a *repos_p to a repository object for the repository at @a path.
426251881Speter *
427289180Speter * Allocate @a *repos_p in @a result_pool.
428251881Speter *
429251881Speter * Acquires a shared lock on the repository, and attaches a cleanup
430289180Speter * function to @a result_pool to remove the lock.  If no lock can be acquired,
431251881Speter * returns error, with undefined effect on @a *repos_p.  If an exclusive
432251881Speter * lock is present, this blocks until it's gone.  @a fs_config will be
433251881Speter * passed to the filesystem initialization function and may be @c NULL.
434251881Speter *
435289180Speter * Use @a scratch_pool for temporary allocations.
436289180Speter *
437289180Speter * @since New in 1.9.
438289180Speter */
439289180Spetersvn_error_t *
440289180Spetersvn_repos_open3(svn_repos_t **repos_p,
441289180Speter                const char *path,
442289180Speter                apr_hash_t *fs_config,
443289180Speter                apr_pool_t *result_pool,
444289180Speter                apr_pool_t *scratch_pool);
445289180Speter
446289180Speter/** Similar to svn_repos_open3() but without @a scratch_pool.
447289180Speter *
448289180Speter * @deprecated Provided for backward compatibility with 1.8 API.
449251881Speter * @since New in 1.7.
450251881Speter */
451289180SpeterSVN_DEPRECATED
452251881Spetersvn_error_t *
453251881Spetersvn_repos_open2(svn_repos_t **repos_p,
454251881Speter                const char *path,
455251881Speter                apr_hash_t *fs_config,
456251881Speter                apr_pool_t *pool);
457251881Speter
458251881Speter/** Similar to svn_repos_open2() with @a fs_config set to NULL.
459251881Speter *
460251881Speter * @deprecated Provided for backward compatibility with 1.6 API.
461251881Speter */
462251881SpeterSVN_DEPRECATED
463251881Spetersvn_error_t *
464251881Spetersvn_repos_open(svn_repos_t **repos_p,
465251881Speter               const char *path,
466251881Speter               apr_pool_t *pool);
467251881Speter
468251881Speter/** Create a new Subversion repository at @a path, building the necessary
469251881Speter * directory structure, creating the filesystem, and so on.
470251881Speter * Return the repository object in @a *repos_p, allocated in @a pool.
471251881Speter *
472251881Speter * @a config is a client configuration hash of #svn_config_t * items
473251881Speter * keyed on config category names, and may be NULL.
474251881Speter *
475251881Speter * @a fs_config is passed to the filesystem, and may be NULL.
476251881Speter *
477251881Speter * @a unused_1 and @a unused_2 are not used and should be NULL.
478251881Speter */
479251881Spetersvn_error_t *
480251881Spetersvn_repos_create(svn_repos_t **repos_p,
481251881Speter                 const char *path,
482251881Speter                 const char *unused_1,
483251881Speter                 const char *unused_2,
484251881Speter                 apr_hash_t *config,
485251881Speter                 apr_hash_t *fs_config,
486251881Speter                 apr_pool_t *pool);
487251881Speter
488251881Speter/**
489251881Speter * Upgrade the Subversion repository (and its underlying versioned
490251881Speter * filesystem) located in the directory @a path to the latest version
491251881Speter * supported by this library.  If the requested upgrade is not
492251881Speter * supported due to the current state of the repository or it
493251881Speter * underlying filesystem, return #SVN_ERR_REPOS_UNSUPPORTED_UPGRADE
494251881Speter * or #SVN_ERR_FS_UNSUPPORTED_UPGRADE (respectively) and make no
495251881Speter * changes to the repository or filesystem.
496251881Speter *
497251881Speter * Acquires an exclusive lock on the repository, upgrades the
498251881Speter * repository, and releases the lock.  If an exclusive lock can't be
499251881Speter * acquired, returns error.
500251881Speter *
501251881Speter * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
502251881Speter * returned if the lock is not immediately available.
503251881Speter *
504251881Speter * If @a start_callback is not NULL, it will be called with @a
505251881Speter * start_callback_baton as argument before the upgrade starts, but
506251881Speter * after the exclusive lock has been acquired.
507251881Speter *
508251881Speter * Use @a pool for necessary allocations.
509251881Speter *
510251881Speter * @note This functionality is provided as a convenience for
511251881Speter * administrators wishing to make use of new Subversion functionality
512251881Speter * without a potentially costly full repository dump/load.  As such,
513251881Speter * the operation performs only the minimum amount of work needed to
514251881Speter * accomplish this while maintaining the integrity of the repository.
515251881Speter * It does *not* guarantee the most optimized repository state as a
516251881Speter * dump and subsequent load would.
517251881Speter *
518251881Speter * @note On some platforms the exclusive lock does not exclude other
519251881Speter * threads in the same process so this function should only be called
520251881Speter * by a single threaded process, or by a multi-threaded process when
521251881Speter * no other threads are accessing the repository.
522251881Speter *
523251881Speter * @since New in 1.7.
524251881Speter */
525251881Spetersvn_error_t *
526251881Spetersvn_repos_upgrade2(const char *path,
527251881Speter                   svn_boolean_t nonblocking,
528251881Speter                   svn_repos_notify_func_t notify_func,
529251881Speter                   void *notify_baton,
530251881Speter                   apr_pool_t *pool);
531251881Speter
532251881Speter/**
533251881Speter * Similar to svn_repos_upgrade2(), but with @a start_callback and baton,
534251881Speter * rather than a notify_callback / baton
535251881Speter *
536251881Speter * @since New in 1.5.
537251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
538251881Speter */
539251881SpeterSVN_DEPRECATED
540251881Spetersvn_error_t *
541251881Spetersvn_repos_upgrade(const char *path,
542251881Speter                  svn_boolean_t nonblocking,
543251881Speter                  svn_error_t *(*start_callback)(void *baton),
544251881Speter                  void *start_callback_baton,
545251881Speter                  apr_pool_t *pool);
546251881Speter
547251881Speter/** Destroy the Subversion repository found at @a path, using @a pool for any
548251881Speter * necessary allocations.
549251881Speter */
550251881Spetersvn_error_t *
551251881Spetersvn_repos_delete(const char *path,
552251881Speter                 apr_pool_t *pool);
553251881Speter
554289180Speter
555289180Speter/** @defgroup svn_repos_capabilities Repository capabilities
556289180Speter * @{
557289180Speter */
558289180Speter
559251881Speter/**
560251881Speter * Set @a *has to TRUE if @a repos has @a capability (one of the
561251881Speter * capabilities beginning with @c "SVN_REPOS_CAPABILITY_"), else set
562251881Speter * @a *has to FALSE.
563251881Speter *
564251881Speter * If @a capability isn't recognized, throw #SVN_ERR_UNKNOWN_CAPABILITY,
565251881Speter * with the effect on @a *has undefined.
566251881Speter *
567251881Speter * Use @a pool for all allocation.
568251881Speter *
569251881Speter * @since New in 1.5.
570251881Speter */
571251881Spetersvn_error_t *
572251881Spetersvn_repos_has_capability(svn_repos_t *repos,
573251881Speter                         svn_boolean_t *has,
574251881Speter                         const char *capability,
575251881Speter                         apr_pool_t *pool);
576251881Speter
577289180Speter/**
578289180Speter * Return a set of @a capabilities supported by the running Subversion
579289180Speter * library and by @a repos.  (Capabilities supported by this version of
580289180Speter * Subversion but not by @a repos are not listed.  This may happen when
581289180Speter * svn_repos_upgrade2() has not been called after a software upgrade.)
582289180Speter *
583289180Speter * The set is represented as a hash whose const char * keys are the set
584289180Speter * members.  The values are not defined.
585289180Speter *
586289180Speter * Allocate @a capabilities in @a result_pool and use @a scratch_pool for
587289180Speter * temporary allocations.
588289180Speter *
589289180Speter * @see svn_repos_info_format
590289180Speter *
591289180Speter * @since New in 1.9.
592289180Speter */
593289180Spetersvn_error_t *
594289180Spetersvn_repos_capabilities(apr_hash_t **capabilities,
595289180Speter                       svn_repos_t *repos,
596289180Speter                       apr_pool_t *result_pool,
597289180Speter                       apr_pool_t *scratch_pool);
598251881Speter
599251881Speter/**
600251881Speter * The capability of doing the right thing with merge-tracking
601251881Speter * information, both storing it and responding to queries about it.
602251881Speter *
603251881Speter * @since New in 1.5.
604251881Speter */
605251881Speter#define SVN_REPOS_CAPABILITY_MERGEINFO "mergeinfo"
606251881Speter/*       *** PLEASE READ THIS IF YOU ADD A NEW CAPABILITY ***
607251881Speter *
608251881Speter * @c SVN_REPOS_CAPABILITY_foo strings should not include colons, to
609251881Speter * be consistent with @c SVN_RA_CAPABILITY_foo strings, which forbid
610251881Speter * colons for their own reasons.  While this RA limitation has no
611251881Speter * direct impact on repository capabilities, there's no reason to be
612251881Speter * gratuitously different either.
613251881Speter *
614251881Speter * If you add a capability, update svn_repos_capabilities().
615251881Speter */
616251881Speter
617289180Speter/** @} */
618251881Speter
619289180Speter
620289180Speter/**
621289180Speter * Store in @a repos the client-reported capabilities @a capabilities,
622289180Speter * which must be allocated in memory at least as long-lived as @a repos.
623289180Speter *
624289180Speter * The elements of @a capabilities are 'const char *', a subset of
625289180Speter * the constants beginning with @c SVN_RA_CAPABILITY_.
626289180Speter * @a capabilities is not copied, so changing it later will affect
627289180Speter * what is remembered by @a repos.
628289180Speter *
629289180Speter * @note The capabilities are passed along to the start-commit hook;
630289180Speter * see that hook's template for details.
631289180Speter *
632289180Speter * @note As of Subversion 1.5, there are no error conditions defined,
633289180Speter * so this always returns SVN_NO_ERROR.  In future releases it may
634289180Speter * return error, however, so callers should check.
635289180Speter *
636289180Speter * @since New in 1.5.
637289180Speter */
638289180Spetersvn_error_t *
639289180Spetersvn_repos_remember_client_capabilities(svn_repos_t *repos,
640289180Speter                                       const apr_array_header_t *capabilities);
641289180Speter
642289180Speter
643251881Speter/** Return the filesystem associated with repository object @a repos. */
644251881Spetersvn_fs_t *
645251881Spetersvn_repos_fs(svn_repos_t *repos);
646251881Speter
647289180Speter/** Return the type of filesystem associated with repository object
648289180Speter * @a repos allocated in @a result_pool.
649289180Speter *
650289180Speter * @see #svn_fs_backend_names
651289180Speter *
652289180Speter * @since New in 1.9.
653289180Speter */
654289180Speterconst char *
655289180Spetersvn_repos_fs_type(svn_repos_t *repos,
656289180Speter                  apr_pool_t *result_pool);
657251881Speter
658251881Speter/** Make a hot copy of the Subversion repository found at @a src_path
659251881Speter * to @a dst_path.
660251881Speter *
661251881Speter * Copy a possibly live Subversion repository from @a src_path to
662251881Speter * @a dst_path.  If @a clean_logs is @c TRUE, perform cleanup on the
663251881Speter * source filesystem as part of the copy operation; currently, this
664251881Speter * means deleting copied, unused logfiles for a Berkeley DB source
665251881Speter * repository.
666251881Speter *
667251881Speter * If @a incremental is TRUE, make an effort to not re-copy information
668251881Speter * already present in the destination. If incremental hotcopy is not
669251881Speter * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
670251881Speter *
671289180Speter * For each revision range copied, the @a notify_func function will be
672289180Speter * called with the @a notify_baton and a notification structure containing
673289180Speter * appropriate values in @c start_revision and @c end_revision (both
674289180Speter * inclusive). @c start_revision might be equal to @c end_revision in
675289180Speter * case the copied range consists of a single revision.  Currently, this
676289180Speter * notification is not triggered by the BDB backend. @a notify_func
677289180Speter * may be @c NULL if this notification is not required.
678289180Speter *
679289180Speter * The optional @a cancel_func callback will be invoked with
680289180Speter * @a cancel_baton as usual to allow the user to preempt this potentially
681289180Speter * lengthy operation.
682362181Sdim *
683289180Speter * Use @a scratch_pool for temporary allocations.
684289180Speter *
685289180Speter * @since New in 1.9.
686289180Speter */
687289180Spetersvn_error_t *
688289180Spetersvn_repos_hotcopy3(const char *src_path,
689289180Speter                   const char *dst_path,
690289180Speter                   svn_boolean_t clean_logs,
691289180Speter                   svn_boolean_t incremental,
692289180Speter                   svn_repos_notify_func_t notify_func,
693289180Speter                   void *notify_baton,
694289180Speter                   svn_cancel_func_t cancel_func,
695289180Speter                   void *cancel_baton,
696289180Speter                   apr_pool_t *scratch_pool);
697289180Speter
698289180Speter/**
699289180Speter * Like svn_repos_hotcopy3(), but with @a notify_func and @a notify_baton
700289180Speter * always passed as @c NULL.
701289180Speter *
702251881Speter * @since New in 1.8.
703289180Speter * @deprecated Provided for backward compatibility with the 1.8 API.
704251881Speter */
705289180SpeterSVN_DEPRECATED
706251881Spetersvn_error_t *
707251881Spetersvn_repos_hotcopy2(const char *src_path,
708251881Speter                   const char *dst_path,
709251881Speter                   svn_boolean_t clean_logs,
710251881Speter                   svn_boolean_t incremental,
711251881Speter                   svn_cancel_func_t cancel_func,
712251881Speter                   void *cancel_baton,
713251881Speter                   apr_pool_t *pool);
714251881Speter
715251881Speter/**
716251881Speter * Like svn_repos_hotcopy2(), but with @a incremental always passed as
717251881Speter * @c FALSE and without cancellation support.
718251881Speter *
719251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
720251881Speter */
721251881SpeterSVN_DEPRECATED
722251881Spetersvn_error_t *
723251881Spetersvn_repos_hotcopy(const char *src_path,
724251881Speter                  const char *dst_path,
725251881Speter                  svn_boolean_t clean_logs,
726251881Speter                  apr_pool_t *pool);
727251881Speter
728251881Speter
729251881Speter/**
730251881Speter * Possibly update the repository, @a repos, to use a more efficient
731251881Speter * filesystem representation.  Use @a pool for allocations.
732251881Speter *
733251881Speter * @since New in 1.7.
734251881Speter */
735251881Spetersvn_error_t *
736251881Spetersvn_repos_fs_pack2(svn_repos_t *repos,
737251881Speter                   svn_repos_notify_func_t notify_func,
738251881Speter                   void *notify_baton,
739251881Speter                   svn_cancel_func_t cancel_func,
740251881Speter                   void *cancel_baton,
741251881Speter                   apr_pool_t *pool);
742251881Speter
743251881Speter/**
744251881Speter * Similar to svn_repos_fs_pack2(), but with a #svn_fs_pack_notify_t instead
745251881Speter * of a #svn_repos_notify_t.
746251881Speter *
747251881Speter * @since New in 1.6.
748251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
749251881Speter */
750251881SpeterSVN_DEPRECATED
751251881Spetersvn_error_t *
752251881Spetersvn_repos_fs_pack(svn_repos_t *repos,
753251881Speter                  svn_fs_pack_notify_t notify_func,
754251881Speter                  void *notify_baton,
755251881Speter                  svn_cancel_func_t cancel_func,
756251881Speter                  void *cancel_baton,
757251881Speter                  apr_pool_t *pool);
758251881Speter
759251881Speter/**
760251881Speter * Run database recovery procedures on the repository at @a path,
761251881Speter * returning the database to a consistent state.  Use @a pool for all
762251881Speter * allocation.
763251881Speter *
764251881Speter * Acquires an exclusive lock on the repository, recovers the
765251881Speter * database, and releases the lock.  If an exclusive lock can't be
766251881Speter * acquired, returns error.
767251881Speter *
768251881Speter * If @a nonblocking is TRUE, an error of type EWOULDBLOCK is
769251881Speter * returned if the lock is not immediately available.
770251881Speter *
771251881Speter * If @a notify_func is not NULL, it will be called with @a
772251881Speter * notify_baton as argument before the recovery starts, but
773251881Speter * after the exclusive lock has been acquired.
774251881Speter *
775251881Speter * If @a cancel_func is not @c NULL, it is called periodically with
776251881Speter * @a cancel_baton as argument to see if the client wishes to cancel
777251881Speter * the recovery.
778251881Speter *
779251881Speter * @note On some platforms the exclusive lock does not exclude other
780251881Speter * threads in the same process so this function should only be called
781251881Speter * by a single threaded process, or by a multi-threaded process when
782251881Speter * no other threads are accessing the repository.
783251881Speter *
784251881Speter * @since New in 1.7.
785251881Speter */
786251881Spetersvn_error_t *
787251881Spetersvn_repos_recover4(const char *path,
788251881Speter                   svn_boolean_t nonblocking,
789251881Speter                   svn_repos_notify_func_t notify_func,
790251881Speter                   void *notify_baton,
791251881Speter                   svn_cancel_func_t cancel_func,
792251881Speter                   void * cancel_baton,
793251881Speter                   apr_pool_t *pool);
794251881Speter
795251881Speter/**
796251881Speter * Similar to svn_repos_recover4(), but with @a start callback in place of
797251881Speter * the notify_func / baton.
798251881Speter *
799251881Speter * @since New in 1.5.
800251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
801251881Speter */
802251881SpeterSVN_DEPRECATED
803251881Spetersvn_error_t *
804251881Spetersvn_repos_recover3(const char *path,
805251881Speter                   svn_boolean_t nonblocking,
806251881Speter                   svn_error_t *(*start_callback)(void *baton),
807251881Speter                   void *start_callback_baton,
808251881Speter                   svn_cancel_func_t cancel_func,
809251881Speter                   void * cancel_baton,
810251881Speter                   apr_pool_t *pool);
811251881Speter
812251881Speter/**
813251881Speter * Similar to svn_repos_recover3(), but without cancellation support.
814251881Speter *
815251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
816251881Speter */
817251881SpeterSVN_DEPRECATED
818251881Spetersvn_error_t *
819251881Spetersvn_repos_recover2(const char *path,
820251881Speter                   svn_boolean_t nonblocking,
821251881Speter                   svn_error_t *(*start_callback)(void *baton),
822251881Speter                   void *start_callback_baton,
823251881Speter                   apr_pool_t *pool);
824251881Speter
825251881Speter/**
826251881Speter * Similar to svn_repos_recover2(), but with nonblocking set to FALSE, and
827251881Speter * with no callbacks provided.
828251881Speter *
829251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
830251881Speter */
831251881SpeterSVN_DEPRECATED
832251881Spetersvn_error_t *
833251881Spetersvn_repos_recover(const char *path,
834251881Speter                  apr_pool_t *pool);
835251881Speter
836251881Speter/**
837251881Speter * Callback for svn_repos_freeze.
838251881Speter *
839251881Speter * @since New in 1.8.
840251881Speter */
841251881Spetertypedef svn_error_t *(*svn_repos_freeze_func_t)(void *baton, apr_pool_t *pool);
842251881Speter
843251881Speter/**
844251881Speter * Take an exclusive lock on each of the repositories in @a paths to
845251881Speter * prevent commits and then while holding all the locks invoke @a
846251881Speter * freeze_func passing @a freeze_baton.  Each repository may be readable by
847251881Speter * Subversion while frozen, or may be unreadable, depending on which
848251881Speter * FS backend the repository uses.  Repositories are locked in the
849251881Speter * order in which they are specified in the array.
850251881Speter *
851289180Speter * @note @a freeze_func must not, directly or indirectly, call any function
852289180Speter * that attempts to take out a lock on the underlying repository.  These
853289180Speter * include functions for packing, hotcopying, setting revprops and commits.
854289180Speter * Attempts to do so may result in a deadlock.
855289180Speter *
856251881Speter * @note On some platforms the exclusive lock does not exclude other
857251881Speter * threads in the same process so this function should only be called
858251881Speter * by a single threaded process, or by a multi-threaded process when
859251881Speter * no other threads are accessing the repositories.
860251881Speter *
861251881Speter * @since New in 1.8.
862251881Speter */
863251881Spetersvn_error_t *
864362181Sdimsvn_repos_freeze(const apr_array_header_t *paths,
865251881Speter                 svn_repos_freeze_func_t freeze_func,
866251881Speter                 void *freeze_baton,
867251881Speter                 apr_pool_t *pool);
868251881Speter
869251881Speter/** This function is a wrapper around svn_fs_berkeley_logfiles(),
870251881Speter * returning log file paths relative to the root of the repository.
871251881Speter *
872251881Speter * @copydoc svn_fs_berkeley_logfiles()
873251881Speter */
874251881Spetersvn_error_t *
875251881Spetersvn_repos_db_logfiles(apr_array_header_t **logfiles,
876251881Speter                      const char *path,
877251881Speter                      svn_boolean_t only_unused,
878251881Speter                      apr_pool_t *pool);
879251881Speter
880251881Speter
881251881Speter
882251881Speter/* Repository Paths */
883251881Speter
884251881Speter/** Return the top-level repository path allocated in @a pool. */
885251881Speterconst char *
886251881Spetersvn_repos_path(svn_repos_t *repos,
887251881Speter               apr_pool_t *pool);
888251881Speter
889251881Speter/** Return the path to @a repos's filesystem directory, allocated in
890251881Speter * @a pool.
891251881Speter */
892251881Speterconst char *
893251881Spetersvn_repos_db_env(svn_repos_t *repos,
894251881Speter                 apr_pool_t *pool);
895251881Speter
896251881Speter/** Return path to @a repos's config directory, allocated in @a pool. */
897251881Speterconst char *
898251881Spetersvn_repos_conf_dir(svn_repos_t *repos,
899251881Speter                   apr_pool_t *pool);
900251881Speter
901251881Speter/** Return path to @a repos's svnserve.conf, allocated in @a pool. */
902251881Speterconst char *
903251881Spetersvn_repos_svnserve_conf(svn_repos_t *repos,
904251881Speter                        apr_pool_t *pool);
905251881Speter
906251881Speter/** Return path to @a repos's lock directory, allocated in @a pool. */
907251881Speterconst char *
908251881Spetersvn_repos_lock_dir(svn_repos_t *repos,
909251881Speter                   apr_pool_t *pool);
910251881Speter
911251881Speter/** Return path to @a repos's db lockfile, allocated in @a pool. */
912251881Speterconst char *
913251881Spetersvn_repos_db_lockfile(svn_repos_t *repos,
914251881Speter                      apr_pool_t *pool);
915251881Speter
916251881Speter/** Return path to @a repos's db logs lockfile, allocated in @a pool. */
917251881Speterconst char *
918251881Spetersvn_repos_db_logs_lockfile(svn_repos_t *repos,
919251881Speter                           apr_pool_t *pool);
920251881Speter
921251881Speter/** Return the path to @a repos's hook directory, allocated in @a pool. */
922251881Speterconst char *
923251881Spetersvn_repos_hook_dir(svn_repos_t *repos,
924251881Speter                   apr_pool_t *pool);
925251881Speter
926251881Speter/** Return the path to @a repos's start-commit hook, allocated in @a pool. */
927251881Speterconst char *
928251881Spetersvn_repos_start_commit_hook(svn_repos_t *repos,
929251881Speter                            apr_pool_t *pool);
930251881Speter
931251881Speter/** Return the path to @a repos's pre-commit hook, allocated in @a pool. */
932251881Speterconst char *
933251881Spetersvn_repos_pre_commit_hook(svn_repos_t *repos,
934251881Speter                          apr_pool_t *pool);
935251881Speter
936251881Speter/** Return the path to @a repos's post-commit hook, allocated in @a pool. */
937251881Speterconst char *
938251881Spetersvn_repos_post_commit_hook(svn_repos_t *repos,
939251881Speter                           apr_pool_t *pool);
940251881Speter
941251881Speter/** Return the path to @a repos's pre-revprop-change hook, allocated in
942251881Speter * @a pool.
943251881Speter */
944251881Speterconst char *
945251881Spetersvn_repos_pre_revprop_change_hook(svn_repos_t *repos,
946251881Speter                                  apr_pool_t *pool);
947251881Speter
948251881Speter/** Return the path to @a repos's post-revprop-change hook, allocated in
949251881Speter * @a pool.
950251881Speter */
951251881Speterconst char *
952251881Spetersvn_repos_post_revprop_change_hook(svn_repos_t *repos,
953251881Speter                                   apr_pool_t *pool);
954251881Speter
955251881Speter
956251881Speter/** @defgroup svn_repos_lock_hooks Paths to lock hooks
957251881Speter * @{
958251881Speter * @since New in 1.2. */
959251881Speter
960251881Speter/** Return the path to @a repos's pre-lock hook, allocated in @a pool. */
961251881Speterconst char *
962251881Spetersvn_repos_pre_lock_hook(svn_repos_t *repos,
963251881Speter                        apr_pool_t *pool);
964251881Speter
965251881Speter/** Return the path to @a repos's post-lock hook, allocated in @a pool. */
966251881Speterconst char *
967251881Spetersvn_repos_post_lock_hook(svn_repos_t *repos,
968251881Speter                         apr_pool_t *pool);
969251881Speter
970251881Speter/** Return the path to @a repos's pre-unlock hook, allocated in @a pool. */
971251881Speterconst char *
972251881Spetersvn_repos_pre_unlock_hook(svn_repos_t *repos,
973251881Speter                          apr_pool_t *pool);
974251881Speter
975251881Speter/** Return the path to @a repos's post-unlock hook, allocated in @a pool. */
976251881Speterconst char *
977251881Spetersvn_repos_post_unlock_hook(svn_repos_t *repos,
978251881Speter                           apr_pool_t *pool);
979251881Speter
980251881Speter/** Specify that Subversion should consult the configuration file
981251881Speter * located at @a hooks_env_path to determine how to setup the
982251881Speter * environment for hook scripts invoked for the repository @a repos.
983251881Speter * As a special case, if @a hooks_env_path is @c NULL, look for the
984251881Speter * file in its default location within the repository disk structure.
985251881Speter * If @a hooks_env_path is not absolute, it specifies a path relative
986251881Speter * to the parent of the file's default location.
987251881Speter *
988251881Speter * Use @a scratch_pool for temporary allocations.
989251881Speter *
990251881Speter * If this function is not called, or if the specified configuration
991251881Speter * file does not define any environment variables, hooks will run in
992251881Speter * an empty environment.
993251881Speter *
994251881Speter * @since New in 1.8.
995251881Speter */
996251881Spetersvn_error_t *
997251881Spetersvn_repos_hooks_setenv(svn_repos_t *repos,
998251881Speter                       const char *hooks_env_path,
999251881Speter                       apr_pool_t *scratch_pool);
1000251881Speter
1001251881Speter/** @} */
1002251881Speter
1003251881Speter/* ---------------------------------------------------------------*/
1004251881Speter
1005251881Speter/* Reporting the state of a working copy, for updates. */
1006251881Speter
1007251881Speter
1008251881Speter/**
1009251881Speter * Construct and return a @a report_baton that will be passed to the
1010251881Speter * other functions in this section to describe the state of a pre-existing
1011251881Speter * tree (typically, a working copy).  When the report is finished,
1012251881Speter * @a editor/@a edit_baton will be driven in such a way as to transform the
1013251881Speter * existing tree to @a revnum and, if @a tgt_path is non-NULL, switch the
1014251881Speter * reported hierarchy to @a tgt_path.
1015251881Speter *
1016251881Speter * @a fs_base is the absolute path of the node in the filesystem at which
1017251881Speter * the comparison should be rooted.  @a target is a single path component,
1018251881Speter * used to limit the scope of the report to a single entry of @a fs_base,
1019251881Speter * or "" if all of @a fs_base itself is the main subject of the report.
1020251881Speter *
1021251881Speter * @a tgt_path and @a revnum is the fs path/revision pair that is the
1022251881Speter * "target" of the delta.  @a tgt_path should be provided only when
1023251881Speter * the source and target paths of the report differ.  That is, @a tgt_path
1024251881Speter * should *only* be specified when specifying that the resultant editor
1025251881Speter * drive be one that transforms the reported hierarchy into a pristine tree
1026251881Speter * of @a tgt_path at revision @a revnum.  A @c NULL value for @a tgt_path
1027251881Speter * will indicate that the editor should be driven in such a way as to
1028251881Speter * transform the reported hierarchy to revision @a revnum, preserving the
1029251881Speter * reported hierarchy.
1030251881Speter *
1031251881Speter * @a text_deltas instructs the driver of the @a editor to enable
1032251881Speter * the generation of text deltas.
1033251881Speter *
1034251881Speter * @a ignore_ancestry instructs the driver to ignore node ancestry
1035251881Speter * when determining how to transmit differences.
1036251881Speter *
1037251881Speter * @a send_copyfrom_args instructs the driver to send 'copyfrom'
1038251881Speter * arguments to the editor's add_file() and add_directory() methods,
1039362181Sdim * and therefore to send their content as deltas against the copy source,
1040362181Sdim * whenever it deems feasible. The implementation only does so for
1041362181Sdim * add_file(), and only when the file itself is the copy root (not when
1042362181Sdim * the file is part of a copied subtree).
1043251881Speter *
1044251881Speter * Use @a authz_read_func and @a authz_read_baton (if not @c NULL) to
1045251881Speter * avoid sending data through @a editor/@a edit_baton which is not
1046251881Speter * authorized for transmission.
1047251881Speter *
1048251881Speter * @a zero_copy_limit controls the maximum size (in bytes) at which
1049251881Speter * data blocks may be sent using the zero-copy code path.  On that
1050251881Speter * path, a number of in-memory copy operations have been eliminated to
1051251881Speter * maximize throughput.  However, until the whole block has been
1052251881Speter * pushed to the network stack, other clients block, so be careful
1053251881Speter * when using larger values here.  Pass 0 for @a zero_copy_limit to
1054251881Speter * disable this optimization altogether.
1055251881Speter *
1056289180Speter * @note Never activate this optimization if @a editor might access
1057251881Speter * any FSFS data structures (and, hence, caches).  So, it is basically
1058251881Speter * safe for networked editors only.
1059251881Speter *
1060251881Speter * All allocation for the context and collected state will occur in
1061251881Speter * @a pool.
1062251881Speter *
1063251881Speter * @a depth is the requested depth of the editor drive.
1064251881Speter *
1065251881Speter * If @a depth is #svn_depth_unknown, the editor will affect only the
1066251881Speter * paths reported by the individual calls to svn_repos_set_path3() and
1067251881Speter * svn_repos_link_path3().
1068251881Speter *
1069251881Speter * For example, if the reported tree is the @c A subdir of the Greek Tree
1070251881Speter * (see Subversion's test suite), at depth #svn_depth_empty, but the
1071251881Speter * @c A/B subdir is reported at depth #svn_depth_infinity, then
1072251881Speter * repository-side changes to @c A/mu, or underneath @c A/C and @c
1073251881Speter * A/D, would not be reflected in the editor drive, but changes
1074251881Speter * underneath @c A/B would be.
1075251881Speter *
1076251881Speter * Additionally, the editor driver will call @c add_directory and
1077251881Speter * and @c add_file for directories with an appropriate depth.  For
1078251881Speter * example, a directory reported at #svn_depth_files will receive
1079251881Speter * file (but not directory) additions.  A directory at #svn_depth_empty
1080251881Speter * will receive neither.
1081251881Speter *
1082251881Speter * If @a depth is #svn_depth_files, #svn_depth_immediates or
1083251881Speter * #svn_depth_infinity and @a depth is greater than the reported depth
1084251881Speter * of the working copy, then the editor driver will emit editor
1085251881Speter * operations so as to upgrade the working copy to this depth.
1086251881Speter *
1087251881Speter * If @a depth is #svn_depth_empty, #svn_depth_files,
1088251881Speter * #svn_depth_immediates and @a depth is lower
1089251881Speter * than or equal to the depth of the working copy, then the editor
1090251881Speter * operations will affect only paths at or above @a depth.
1091251881Speter *
1092251881Speter * @since New in 1.8.
1093251881Speter */
1094251881Spetersvn_error_t *
1095251881Spetersvn_repos_begin_report3(void **report_baton,
1096251881Speter                        svn_revnum_t revnum,
1097251881Speter                        svn_repos_t *repos,
1098251881Speter                        const char *fs_base,
1099251881Speter                        const char *target,
1100251881Speter                        const char *tgt_path,
1101251881Speter                        svn_boolean_t text_deltas,
1102251881Speter                        svn_depth_t depth,
1103251881Speter                        svn_boolean_t ignore_ancestry,
1104251881Speter                        svn_boolean_t send_copyfrom_args,
1105251881Speter                        const svn_delta_editor_t *editor,
1106251881Speter                        void *edit_baton,
1107251881Speter                        svn_repos_authz_func_t authz_read_func,
1108251881Speter                        void *authz_read_baton,
1109251881Speter                        apr_size_t zero_copy_limit,
1110251881Speter                        apr_pool_t *pool);
1111251881Speter
1112251881Speter/**
1113251881Speter * The same as svn_repos_begin_report3(), but with @a zero_copy_limit
1114251881Speter * always passed as 0.
1115251881Speter *
1116251881Speter * @since New in 1.5.
1117251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
1118251881Speter */
1119251881SpeterSVN_DEPRECATED
1120251881Spetersvn_error_t *
1121251881Spetersvn_repos_begin_report2(void **report_baton,
1122251881Speter                        svn_revnum_t revnum,
1123251881Speter                        svn_repos_t *repos,
1124251881Speter                        const char *fs_base,
1125251881Speter                        const char *target,
1126251881Speter                        const char *tgt_path,
1127251881Speter                        svn_boolean_t text_deltas,
1128251881Speter                        svn_depth_t depth,
1129251881Speter                        svn_boolean_t ignore_ancestry,
1130251881Speter                        svn_boolean_t send_copyfrom_args,
1131251881Speter                        const svn_delta_editor_t *editor,
1132251881Speter                        void *edit_baton,
1133251881Speter                        svn_repos_authz_func_t authz_read_func,
1134251881Speter                        void *authz_read_baton,
1135251881Speter                        apr_pool_t *pool);
1136251881Speter
1137251881Speter/**
1138251881Speter * The same as svn_repos_begin_report2(), but taking a boolean
1139251881Speter * @a recurse flag, and sending FALSE for @a send_copyfrom_args.
1140251881Speter *
1141251881Speter * If @a recurse is TRUE, the editor driver will drive the editor with
1142251881Speter * a depth of #svn_depth_infinity; if FALSE, then with a depth of
1143251881Speter * #svn_depth_files.
1144251881Speter *
1145251881Speter * @note @a username is ignored, and has been removed in a revised
1146251881Speter * version of this API.
1147251881Speter *
1148251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
1149251881Speter */
1150251881SpeterSVN_DEPRECATED
1151251881Spetersvn_error_t *
1152251881Spetersvn_repos_begin_report(void **report_baton,
1153251881Speter                       svn_revnum_t revnum,
1154251881Speter                       const char *username,
1155251881Speter                       svn_repos_t *repos,
1156251881Speter                       const char *fs_base,
1157251881Speter                       const char *target,
1158251881Speter                       const char *tgt_path,
1159251881Speter                       svn_boolean_t text_deltas,
1160251881Speter                       svn_boolean_t recurse,
1161251881Speter                       svn_boolean_t ignore_ancestry,
1162251881Speter                       const svn_delta_editor_t *editor,
1163251881Speter                       void *edit_baton,
1164251881Speter                       svn_repos_authz_func_t authz_read_func,
1165251881Speter                       void *authz_read_baton,
1166251881Speter                       apr_pool_t *pool);
1167251881Speter
1168251881Speter
1169251881Speter/**
1170251881Speter * Given a @a report_baton constructed by svn_repos_begin_report3(),
1171251881Speter * record the presence of @a path, at @a revision with depth @a depth,
1172251881Speter * in the current tree.
1173251881Speter *
1174251881Speter * @a path is relative to the anchor/target used in the creation of the
1175251881Speter * @a report_baton.
1176251881Speter *
1177251881Speter * @a revision may be SVN_INVALID_REVNUM if (for example) @a path
1178251881Speter * represents a locally-added path with no revision number, or @a
1179251881Speter * depth is #svn_depth_exclude.
1180251881Speter *
1181251881Speter * @a path may not be underneath a path on which svn_repos_set_path3()
1182251881Speter * was previously called with #svn_depth_exclude in this report.
1183251881Speter *
1184251881Speter * The first call of this in a given report usually passes an empty
1185251881Speter * @a path; this is used to set up the correct root revision for the editor
1186251881Speter * drive.
1187251881Speter *
1188251881Speter * A depth of #svn_depth_unknown is not allowed, and results in an
1189251881Speter * error.
1190251881Speter *
1191251881Speter * If @a start_empty is TRUE and @a path is a directory, then require the
1192251881Speter * caller to explicitly provide all the children of @a path - do not assume
1193251881Speter * that the tree also contains all the children of @a path at @a revision.
1194251881Speter * This is for 'low confidence' client reporting.
1195251881Speter *
1196251881Speter * If the caller has a lock token for @a path, then @a lock_token should
1197251881Speter * be set to that token.  Else, @a lock_token should be NULL.
1198251881Speter *
1199251881Speter * All temporary allocations are done in @a pool.
1200251881Speter *
1201251881Speter * @since New in 1.5.
1202251881Speter */
1203251881Spetersvn_error_t *
1204251881Spetersvn_repos_set_path3(void *report_baton,
1205251881Speter                    const char *path,
1206251881Speter                    svn_revnum_t revision,
1207251881Speter                    svn_depth_t depth,
1208251881Speter                    svn_boolean_t start_empty,
1209251881Speter                    const char *lock_token,
1210251881Speter                    apr_pool_t *pool);
1211251881Speter
1212251881Speter/**
1213251881Speter * Similar to svn_repos_set_path3(), but with @a depth set to
1214251881Speter * #svn_depth_infinity.
1215251881Speter *
1216251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
1217251881Speter */
1218251881SpeterSVN_DEPRECATED
1219251881Spetersvn_error_t *
1220251881Spetersvn_repos_set_path2(void *report_baton,
1221251881Speter                    const char *path,
1222251881Speter                    svn_revnum_t revision,
1223251881Speter                    svn_boolean_t start_empty,
1224251881Speter                    const char *lock_token,
1225251881Speter                    apr_pool_t *pool);
1226251881Speter
1227251881Speter/**
1228251881Speter * Similar to svn_repos_set_path2(), but with @a lock_token set to @c NULL.
1229251881Speter *
1230251881Speter * @deprecated Provided for backward compatibility with the 1.1 API.
1231251881Speter */
1232251881SpeterSVN_DEPRECATED
1233251881Spetersvn_error_t *
1234251881Spetersvn_repos_set_path(void *report_baton,
1235251881Speter                   const char *path,
1236251881Speter                   svn_revnum_t revision,
1237251881Speter                   svn_boolean_t start_empty,
1238251881Speter                   apr_pool_t *pool);
1239251881Speter
1240251881Speter/**
1241251881Speter * Given a @a report_baton constructed by svn_repos_begin_report3(),
1242251881Speter * record the presence of @a path in the current tree, containing the contents
1243251881Speter * of @a link_path at @a revision with depth @a depth.
1244251881Speter *
1245251881Speter * A depth of #svn_depth_unknown is not allowed, and results in an
1246251881Speter * error.
1247251881Speter *
1248251881Speter * @a path may not be underneath a path on which svn_repos_set_path3()
1249251881Speter * was previously called with #svn_depth_exclude in this report.
1250251881Speter *
1251251881Speter * Note that while @a path is relative to the anchor/target used in the
1252251881Speter * creation of the @a report_baton, @a link_path is an absolute filesystem
1253251881Speter * path!
1254251881Speter *
1255251881Speter * If @a start_empty is TRUE and @a path is a directory, then require the
1256251881Speter * caller to explicitly provide all the children of @a path - do not assume
1257251881Speter * that the tree also contains all the children of @a link_path at
1258251881Speter * @a revision.  This is for 'low confidence' client reporting.
1259251881Speter *
1260251881Speter * If the caller has a lock token for @a link_path, then @a lock_token
1261251881Speter * should be set to that token.  Else, @a lock_token should be NULL.
1262251881Speter *
1263251881Speter * All temporary allocations are done in @a pool.
1264251881Speter *
1265251881Speter * @since New in 1.5.
1266251881Speter */
1267251881Spetersvn_error_t *
1268251881Spetersvn_repos_link_path3(void *report_baton,
1269251881Speter                     const char *path,
1270251881Speter                     const char *link_path,
1271251881Speter                     svn_revnum_t revision,
1272251881Speter                     svn_depth_t depth,
1273251881Speter                     svn_boolean_t start_empty,
1274251881Speter                     const char *lock_token,
1275251881Speter                     apr_pool_t *pool);
1276251881Speter
1277251881Speter/**
1278251881Speter * Similar to svn_repos_link_path3(), but with @a depth set to
1279251881Speter * #svn_depth_infinity.
1280251881Speter *
1281251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
1282251881Speter */
1283251881SpeterSVN_DEPRECATED
1284251881Spetersvn_error_t *
1285251881Spetersvn_repos_link_path2(void *report_baton,
1286251881Speter                     const char *path,
1287251881Speter                     const char *link_path,
1288251881Speter                     svn_revnum_t revision,
1289251881Speter                     svn_boolean_t start_empty,
1290251881Speter                     const char *lock_token,
1291251881Speter                     apr_pool_t *pool);
1292251881Speter
1293251881Speter/**
1294251881Speter * Similar to svn_repos_link_path2(), but with @a lock_token set to @c NULL.
1295251881Speter *
1296251881Speter * @deprecated Provided for backward compatibility with the 1.1 API.
1297251881Speter */
1298251881SpeterSVN_DEPRECATED
1299251881Spetersvn_error_t *
1300251881Spetersvn_repos_link_path(void *report_baton,
1301251881Speter                    const char *path,
1302251881Speter                    const char *link_path,
1303251881Speter                    svn_revnum_t revision,
1304251881Speter                    svn_boolean_t start_empty,
1305251881Speter                    apr_pool_t *pool);
1306251881Speter
1307251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(),
1308251881Speter * record the non-existence of @a path in the current tree.
1309251881Speter *
1310251881Speter * @a path may not be underneath a path on which svn_repos_set_path3()
1311251881Speter * was previously called with #svn_depth_exclude in this report.
1312251881Speter *
1313251881Speter * (This allows the reporter's driver to describe missing pieces of a
1314251881Speter * working copy, so that 'svn up' can recreate them.)
1315251881Speter *
1316251881Speter * All temporary allocations are done in @a pool.
1317251881Speter */
1318251881Spetersvn_error_t *
1319251881Spetersvn_repos_delete_path(void *report_baton,
1320251881Speter                      const char *path,
1321251881Speter                      apr_pool_t *pool);
1322251881Speter
1323251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(),
1324251881Speter * finish the report and drive the editor as specified when the report
1325251881Speter * baton was constructed.
1326251881Speter *
1327251881Speter * If an error occurs during the driving of the editor, do NOT abort the
1328251881Speter * edit; that responsibility belongs to the caller of this function, if
1329251881Speter * it happens at all.
1330251881Speter *
1331251881Speter * After the call to this function, @a report_baton is no longer valid;
1332251881Speter * it should not be passed to any other reporting functions, including
1333251881Speter * svn_repos_abort_report(), even if this function returns an error.
1334251881Speter */
1335251881Spetersvn_error_t *
1336251881Spetersvn_repos_finish_report(void *report_baton,
1337251881Speter                        apr_pool_t *pool);
1338251881Speter
1339251881Speter
1340251881Speter/** Given a @a report_baton constructed by svn_repos_begin_report3(),
1341251881Speter * abort the report.  This function can be called anytime before
1342251881Speter * svn_repos_finish_report() is called.
1343251881Speter *
1344251881Speter * After the call to this function, @a report_baton is no longer valid;
1345251881Speter * it should not be passed to any other reporting functions.
1346251881Speter */
1347251881Spetersvn_error_t *
1348251881Spetersvn_repos_abort_report(void *report_baton,
1349251881Speter                       apr_pool_t *pool);
1350251881Speter
1351251881Speter
1352251881Speter/* ---------------------------------------------------------------*/
1353251881Speter
1354251881Speter/* The magical dir_delta update routines. */
1355251881Speter
1356251881Speter/** Use the provided @a editor and @a edit_baton to describe the changes
1357251881Speter * necessary for making a given node (and its descendants, if it is a
1358251881Speter * directory) under @a src_root look exactly like @a tgt_path under
1359251881Speter * @a tgt_root.  @a src_entry is the node to update.  If @a src_entry
1360251881Speter * is empty, then compute the difference between the entire tree
1361251881Speter * anchored at @a src_parent_dir under @a src_root and @a tgt_path
1362251881Speter * under @a tgt_root.  Else, describe the changes needed to update
1363251881Speter * only that entry in @a src_parent_dir.  Typically, callers of this
1364251881Speter * function will use a @a tgt_path that is the concatenation of @a
1365251881Speter * src_parent_dir and @a src_entry.
1366251881Speter *
1367251881Speter * @a src_root and @a tgt_root can both be either revision or transaction
1368251881Speter * roots.  If @a tgt_root is a revision, @a editor's set_target_revision()
1369251881Speter * will be called with the @a tgt_root's revision number, else it will
1370251881Speter * not be called at all.
1371251881Speter *
1372251881Speter * If @a authz_read_func is non-NULL, invoke it before any call to
1373251881Speter *
1374251881Speter *    @a editor->open_root
1375251881Speter *    @a editor->add_directory
1376251881Speter *    @a editor->open_directory
1377251881Speter *    @a editor->add_file
1378251881Speter *    @a editor->open_file
1379251881Speter *
1380251881Speter * passing @a tgt_root, the same path that would be passed to the
1381251881Speter * editor function in question, and @a authz_read_baton.  If the
1382251881Speter * @a *allowed parameter comes back TRUE, then proceed with the planned
1383251881Speter * editor call; else if FALSE, then invoke @a editor->absent_file or
1384251881Speter * @a editor->absent_directory as appropriate, except if the planned
1385251881Speter * editor call was open_root, throw SVN_ERR_AUTHZ_ROOT_UNREADABLE.
1386251881Speter *
1387251881Speter * If @a text_deltas is @c FALSE, send a single @c NULL txdelta window to
1388251881Speter * the window handler returned by @a editor->apply_textdelta().
1389251881Speter *
1390251881Speter * If @a depth is #svn_depth_empty, invoke @a editor calls only on
1391251881Speter * @a src_entry (or @a src_parent_dir, if @a src_entry is empty).
1392251881Speter * If @a depth is #svn_depth_files, also invoke the editor on file
1393251881Speter * children, if any; if #svn_depth_immediates, invoke it on
1394251881Speter * immediate subdirectories as well as files; if #svn_depth_infinity,
1395251881Speter * recurse fully.
1396251881Speter *
1397251881Speter * If @a entry_props is @c TRUE, accompany each opened/added entry with
1398251881Speter * propchange editor calls that relay special "entry props" (this
1399251881Speter * is typically used only for working copy updates).
1400251881Speter *
1401251881Speter * @a ignore_ancestry instructs the function to ignore node ancestry
1402251881Speter * when determining how to transmit differences.
1403251881Speter *
1404251881Speter * Before completing successfully, this function calls @a editor's
1405251881Speter * close_edit(), so the caller should expect its @a edit_baton to be
1406251881Speter * invalid after its use with this function.
1407251881Speter *
1408251881Speter * Do any allocation necessary for the delta computation in @a pool.
1409251881Speter * This function's maximum memory consumption is at most roughly
1410251881Speter * proportional to the greatest depth of the tree under @a tgt_root, not
1411251881Speter * the total size of the delta.
1412251881Speter *
1413251881Speter * ### svn_repos_dir_delta2 is mostly superseded by the reporter
1414251881Speter * ### functionality (svn_repos_begin_report3 and friends).
1415251881Speter * ### svn_repos_dir_delta2 does allow the roots to be transaction
1416251881Speter * ### roots rather than just revision roots, and it has the
1417251881Speter * ### entry_props flag.  Almost all of Subversion's own code uses the
1418251881Speter * ### reporter instead; there are some stray references to the
1419251881Speter * ### svn_repos_dir_delta[2] in comments which should probably
1420251881Speter * ### actually refer to the reporter.
1421251881Speter *
1422251881Speter * @since New in 1.5.
1423251881Speter */
1424251881Spetersvn_error_t *
1425251881Spetersvn_repos_dir_delta2(svn_fs_root_t *src_root,
1426251881Speter                     const char *src_parent_dir,
1427251881Speter                     const char *src_entry,
1428251881Speter                     svn_fs_root_t *tgt_root,
1429251881Speter                     const char *tgt_path,
1430251881Speter                     const svn_delta_editor_t *editor,
1431251881Speter                     void *edit_baton,
1432251881Speter                     svn_repos_authz_func_t authz_read_func,
1433251881Speter                     void *authz_read_baton,
1434251881Speter                     svn_boolean_t text_deltas,
1435251881Speter                     svn_depth_t depth,
1436251881Speter                     svn_boolean_t entry_props,
1437251881Speter                     svn_boolean_t ignore_ancestry,
1438251881Speter                     apr_pool_t *pool);
1439251881Speter
1440251881Speter/**
1441251881Speter * Similar to svn_repos_dir_delta2(), but if @a recurse is TRUE, pass
1442251881Speter * #svn_depth_infinity for @a depth, and if @a recurse is FALSE,
1443251881Speter * pass #svn_depth_files for @a depth.
1444251881Speter *
1445251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
1446251881Speter */
1447251881SpeterSVN_DEPRECATED
1448251881Spetersvn_error_t *
1449251881Spetersvn_repos_dir_delta(svn_fs_root_t *src_root,
1450251881Speter                    const char *src_parent_dir,
1451251881Speter                    const char *src_entry,
1452251881Speter                    svn_fs_root_t *tgt_root,
1453251881Speter                    const char *tgt_path,
1454251881Speter                    const svn_delta_editor_t *editor,
1455251881Speter                    void *edit_baton,
1456251881Speter                    svn_repos_authz_func_t authz_read_func,
1457251881Speter                    void *authz_read_baton,
1458251881Speter                    svn_boolean_t text_deltas,
1459251881Speter                    svn_boolean_t recurse,
1460251881Speter                    svn_boolean_t entry_props,
1461251881Speter                    svn_boolean_t ignore_ancestry,
1462251881Speter                    apr_pool_t *pool);
1463251881Speter
1464251881Speter
1465251881Speter/** Use the provided @a editor and @a edit_baton to describe the
1466251881Speter * skeletal changes made in a particular filesystem @a root
1467251881Speter * (revision or transaction).
1468251881Speter *
1469251881Speter * Changes will be limited to those within @a base_dir, and if
1470251881Speter * @a low_water_mark is set to something other than #SVN_INVALID_REVNUM
1471251881Speter * it is assumed that the client has no knowledge of revisions prior to
1472251881Speter * @a low_water_mark.  Together, these two arguments define the portion of
1473251881Speter * the tree that the client is assumed to have knowledge of, and thus any
1474251881Speter * copies of data from outside that part of the tree will be sent in their
1475251881Speter * entirety, not as simple copies or deltas against a previous version.
1476251881Speter *
1477251881Speter * The @a editor passed to this function should be aware of the fact
1478251881Speter * that, if @a send_deltas is FALSE, calls to its change_dir_prop(),
1479251881Speter * change_file_prop(), and apply_textdelta() functions will not
1480251881Speter * contain meaningful data, and merely serve as indications that
1481251881Speter * properties or textual contents were changed.
1482251881Speter *
1483251881Speter * If @a send_deltas is @c TRUE, the text and property deltas for changes
1484251881Speter * will be sent, otherwise NULL text deltas and empty prop changes will be
1485251881Speter * used.
1486251881Speter *
1487251881Speter * If @a authz_read_func is non-NULL, it will be used to determine if the
1488251881Speter * user has read access to the data being accessed.  Data that the user
1489251881Speter * cannot access will be skipped.
1490251881Speter *
1491251881Speter * @note This editor driver passes SVN_INVALID_REVNUM for all
1492251881Speter * revision parameters in the editor interface except the copyfrom
1493251881Speter * parameter of the add_file() and add_directory() editor functions.
1494251881Speter *
1495251881Speter * @since New in 1.4.
1496251881Speter */
1497251881Spetersvn_error_t *
1498251881Spetersvn_repos_replay2(svn_fs_root_t *root,
1499251881Speter                  const char *base_dir,
1500251881Speter                  svn_revnum_t low_water_mark,
1501251881Speter                  svn_boolean_t send_deltas,
1502251881Speter                  const svn_delta_editor_t *editor,
1503251881Speter                  void *edit_baton,
1504251881Speter                  svn_repos_authz_func_t authz_read_func,
1505251881Speter                  void *authz_read_baton,
1506251881Speter                  apr_pool_t *pool);
1507251881Speter
1508251881Speter/**
1509251881Speter * Similar to svn_repos_replay2(), but with @a base_dir set to @c "",
1510251881Speter * @a low_water_mark set to #SVN_INVALID_REVNUM, @a send_deltas
1511251881Speter * set to @c FALSE, and @a authz_read_func and @a authz_read_baton
1512251881Speter * set to @c NULL.
1513251881Speter *
1514251881Speter * @deprecated Provided for backward compatibility with the 1.3 API.
1515251881Speter */
1516251881SpeterSVN_DEPRECATED
1517251881Spetersvn_error_t *
1518251881Spetersvn_repos_replay(svn_fs_root_t *root,
1519251881Speter                 const svn_delta_editor_t *editor,
1520251881Speter                 void *edit_baton,
1521251881Speter                 apr_pool_t *pool);
1522251881Speter
1523251881Speter/* ---------------------------------------------------------------*/
1524251881Speter
1525251881Speter/* Making commits. */
1526251881Speter
1527251881Speter/**
1528251881Speter * Return an @a editor and @a edit_baton to commit changes to the
1529251881Speter * filesystem of @a repos, beginning at location 'rev:@a base_path',
1530251881Speter * where "rev" is the argument given to open_root().
1531251881Speter *
1532289180Speter * @a repos is a previously opened repository.  @a repos_url_decoded is the
1533251881Speter * decoded URL to the base of the repository, and is used to check
1534289180Speter * copyfrom paths.  @a txn is a filesystem transaction object to use
1535251881Speter * during the commit, or @c NULL to indicate that this function should
1536251881Speter * create (and fully manage) a new transaction.
1537251881Speter *
1538251881Speter * Store the contents of @a revprop_table, a hash mapping <tt>const
1539251881Speter * char *</tt> property names to #svn_string_t values, as properties
1540251881Speter * of the commit transaction, including author and log message if
1541251881Speter * present.
1542251881Speter *
1543251881Speter * @note #SVN_PROP_REVISION_DATE may be present in @a revprop_table, but
1544251881Speter * it will be overwritten when the transaction is committed.
1545251881Speter *
1546251881Speter * Iff @a authz_callback is provided, check read/write authorizations
1547251881Speter * on paths accessed by editor operations.  An operation which fails
1548251881Speter * due to authz will return SVN_ERR_AUTHZ_UNREADABLE or
1549251881Speter * SVN_ERR_AUTHZ_UNWRITABLE.
1550251881Speter *
1551251881Speter * Calling @a (*editor)->close_edit completes the commit.
1552251881Speter *
1553251881Speter * If @a commit_callback is non-NULL, then before @c close_edit returns (but
1554251881Speter * after the commit has succeeded) @c close_edit will invoke
1555251881Speter * @a commit_callback with a filled-in #svn_commit_info_t *, @a commit_baton,
1556289180Speter * and @a pool or some subpool thereof as arguments.  The @c repos_root field
1557289180Speter * of the #svn_commit_info_t is @c NULL.  If @a commit_callback
1558251881Speter * returns an error, that error will be returned from @c close_edit,
1559251881Speter * otherwise if there was a post-commit hook failure, then that error
1560251881Speter * will be returned with code SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED.
1561289180Speter * (Note that prior to Subversion 1.6, @a commit_callback cannot be @c NULL;
1562289180Speter * if you don't need a callback, pass a dummy function.)
1563251881Speter *
1564251881Speter * Calling @a (*editor)->abort_edit aborts the commit, and will also
1565251881Speter * abort the commit transaction unless @a txn was supplied (not @c
1566251881Speter * NULL).  Callers who supply their own transactions are responsible
1567251881Speter * for cleaning them up (either by committing them, or aborting them).
1568251881Speter *
1569289180Speter * @since New in 1.5. Since 1.6, @a commit_callback can be @c NULL.
1570251881Speter *
1571289180Speter * @note Yes, @a repos_url_decoded is a <em>decoded</em> URL.  We realize
1572251881Speter * that's sorta wonky.  Sorry about that.
1573289180Speter *
1574289180Speter * @note Like most commit editors, the returned editor requires that the
1575289180Speter * @c copyfrom_path parameter passed to its @c add_file and @c add_directory
1576289180Speter * methods is a full, URI-encoded URL, not a relative path.
1577251881Speter */
1578251881Spetersvn_error_t *
1579251881Spetersvn_repos_get_commit_editor5(const svn_delta_editor_t **editor,
1580251881Speter                             void **edit_baton,
1581251881Speter                             svn_repos_t *repos,
1582251881Speter                             svn_fs_txn_t *txn,
1583289180Speter                             const char *repos_url_decoded,
1584251881Speter                             const char *base_path,
1585251881Speter                             apr_hash_t *revprop_table,
1586251881Speter                             svn_commit_callback2_t commit_callback,
1587251881Speter                             void *commit_baton,
1588251881Speter                             svn_repos_authz_callback_t authz_callback,
1589251881Speter                             void *authz_baton,
1590251881Speter                             apr_pool_t *pool);
1591251881Speter
1592251881Speter/**
1593251881Speter * Similar to svn_repos_get_commit_editor5(), but with @a revprop_table
1594251881Speter * set to a hash containing @a user and @a log_msg as the
1595251881Speter * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
1596251881Speter * respectively.  @a user and @a log_msg may both be @c NULL.
1597251881Speter *
1598251881Speter * @since New in 1.4.
1599251881Speter *
1600251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
1601251881Speter */
1602251881SpeterSVN_DEPRECATED
1603251881Spetersvn_error_t *
1604251881Spetersvn_repos_get_commit_editor4(const svn_delta_editor_t **editor,
1605251881Speter                             void **edit_baton,
1606251881Speter                             svn_repos_t *repos,
1607251881Speter                             svn_fs_txn_t *txn,
1608251881Speter                             const char *repos_url,
1609251881Speter                             const char *base_path,
1610251881Speter                             const char *user,
1611251881Speter                             const char *log_msg,
1612251881Speter                             svn_commit_callback2_t commit_callback,
1613251881Speter                             void *commit_baton,
1614251881Speter                             svn_repos_authz_callback_t authz_callback,
1615251881Speter                             void *authz_baton,
1616251881Speter                             apr_pool_t *pool);
1617251881Speter
1618251881Speter/**
1619251881Speter * Similar to svn_repos_get_commit_editor4(), but
1620251881Speter * uses the svn_commit_callback_t type.
1621251881Speter *
1622251881Speter * @since New in 1.3.
1623251881Speter *
1624251881Speter * @deprecated Provided for backward compatibility with the 1.3 API.
1625251881Speter */
1626251881SpeterSVN_DEPRECATED
1627251881Spetersvn_error_t *
1628251881Spetersvn_repos_get_commit_editor3(const svn_delta_editor_t **editor,
1629251881Speter                             void **edit_baton,
1630251881Speter                             svn_repos_t *repos,
1631251881Speter                             svn_fs_txn_t *txn,
1632251881Speter                             const char *repos_url,
1633251881Speter                             const char *base_path,
1634251881Speter                             const char *user,
1635251881Speter                             const char *log_msg,
1636251881Speter                             svn_commit_callback_t callback,
1637251881Speter                             void *callback_baton,
1638251881Speter                             svn_repos_authz_callback_t authz_callback,
1639251881Speter                             void *authz_baton,
1640251881Speter                             apr_pool_t *pool);
1641251881Speter
1642251881Speter/**
1643251881Speter * Similar to svn_repos_get_commit_editor3(), but with @a
1644251881Speter * authz_callback and @a authz_baton set to @c NULL.
1645251881Speter *
1646251881Speter * @deprecated Provided for backward compatibility with the 1.2 API.
1647251881Speter */
1648251881SpeterSVN_DEPRECATED
1649251881Spetersvn_error_t *
1650251881Spetersvn_repos_get_commit_editor2(const svn_delta_editor_t **editor,
1651251881Speter                             void **edit_baton,
1652251881Speter                             svn_repos_t *repos,
1653251881Speter                             svn_fs_txn_t *txn,
1654251881Speter                             const char *repos_url,
1655251881Speter                             const char *base_path,
1656251881Speter                             const char *user,
1657251881Speter                             const char *log_msg,
1658251881Speter                             svn_commit_callback_t callback,
1659251881Speter                             void *callback_baton,
1660251881Speter                             apr_pool_t *pool);
1661251881Speter
1662251881Speter
1663251881Speter/**
1664251881Speter * Similar to svn_repos_get_commit_editor2(), but with @a txn always
1665251881Speter * set to @c NULL.
1666251881Speter *
1667251881Speter * @deprecated Provided for backward compatibility with the 1.1 API.
1668251881Speter */
1669251881SpeterSVN_DEPRECATED
1670251881Spetersvn_error_t *
1671251881Spetersvn_repos_get_commit_editor(const svn_delta_editor_t **editor,
1672251881Speter                            void **edit_baton,
1673251881Speter                            svn_repos_t *repos,
1674251881Speter                            const char *repos_url,
1675251881Speter                            const char *base_path,
1676251881Speter                            const char *user,
1677251881Speter                            const char *log_msg,
1678251881Speter                            svn_commit_callback_t callback,
1679251881Speter                            void *callback_baton,
1680251881Speter                            apr_pool_t *pool);
1681251881Speter
1682251881Speter/* ---------------------------------------------------------------*/
1683251881Speter
1684251881Speter/* Finding particular revisions. */
1685251881Speter
1686251881Speter/** Set @a *revision to the revision number in @a repos's filesystem that was
1687251881Speter * youngest at time @a tm.
1688251881Speter */
1689251881Spetersvn_error_t *
1690251881Spetersvn_repos_dated_revision(svn_revnum_t *revision,
1691251881Speter                         svn_repos_t *repos,
1692251881Speter                         apr_time_t tm,
1693251881Speter                         apr_pool_t *pool);
1694251881Speter
1695251881Speter
1696251881Speter/** Given a @a root/@a path within some filesystem, return three pieces of
1697251881Speter * information allocated in @a pool:
1698251881Speter *
1699251881Speter *    - set @a *committed_rev to the revision in which the object was
1700251881Speter *      last modified.  (In fs parlance, this is the revision in which
1701251881Speter *      the particular node-rev-id was 'created'.)
1702251881Speter *
1703251881Speter *    - set @a *committed_date to the date of said revision, or @c NULL
1704251881Speter *      if not available.
1705251881Speter *
1706251881Speter *    - set @a *last_author to the author of said revision, or @c NULL
1707251881Speter *      if not available.
1708251881Speter */
1709251881Spetersvn_error_t *
1710251881Spetersvn_repos_get_committed_info(svn_revnum_t *committed_rev,
1711251881Speter                             const char **committed_date,
1712251881Speter                             const char **last_author,
1713251881Speter                             svn_fs_root_t *root,
1714251881Speter                             const char *path,
1715251881Speter                             apr_pool_t *pool);
1716251881Speter
1717251881Speter
1718251881Speter/**
1719251881Speter * Set @a *dirent to an #svn_dirent_t associated with @a path in @a
1720251881Speter * root.  If @a path does not exist in @a root, set @a *dirent to
1721251881Speter * NULL.  Use @a pool for memory allocation.
1722251881Speter *
1723251881Speter * @since New in 1.2.
1724251881Speter */
1725251881Spetersvn_error_t *
1726251881Spetersvn_repos_stat(svn_dirent_t **dirent,
1727251881Speter               svn_fs_root_t *root,
1728251881Speter               const char *path,
1729251881Speter               apr_pool_t *pool);
1730251881Speter
1731362181Sdim/**
1732362181Sdim * Callback type to be used with svn_repos_list().  It will be invoked for
1733362181Sdim * every directory entry found.
1734362181Sdim *
1735362181Sdim * The full path of the entry is given in @a path and @a dirent contains
1736362181Sdim * various additional information.  If svn_repos_list() has been called
1737362181Sdim * with @a path_info_only set, only the @a kind element of this struct
1738362181Sdim * will be valid.
1739362181Sdim *
1740362181Sdim * @a baton is the user-provided receiver baton.  @a scratch_pool may be
1741362181Sdim * used for temporary allocations.
1742362181Sdim *
1743362181Sdim * @since New in 1.10.
1744362181Sdim */
1745362181Sdimtypedef svn_error_t *(* svn_repos_dirent_receiver_t)(const char *path,
1746362181Sdim                                                     svn_dirent_t *dirent,
1747362181Sdim                                                     void *baton,
1748362181Sdim                                                     apr_pool_t *scratch_pool);
1749251881Speter
1750251881Speter/**
1751362181Sdim * Efficiently list everything within a sub-tree.  Specify glob patterns
1752362181Sdim * to search for specific files and folders.
1753362181Sdim *
1754362181Sdim * Walk the sub-tree starting at @a path under @a root up to the given
1755362181Sdim * @a depth.  For each directory entry found, @a receiver will be called
1756362181Sdim * with @a receiver_baton.  The starting @a path will be reported as well.
1757362181Sdim * Because retrieving all elements of a #svn_dirent_t can be expensive,
1758362181Sdim * you may set @a path_info_only to receive only the path name and the node
1759362181Sdim * kind.  The entries will be reported ordered by their path.
1760362181Sdim *
1761362181Sdim * @a patterns is an optional array of <tt>const char *</tt>.  If it is
1762362181Sdim * not @c NULL, only those directory entries will be reported whose last
1763362181Sdim * path segment matches at least one of these patterns.  This feature uses
1764362181Sdim * apr_fnmatch() for glob matching and requiring '.' to matched by dots
1765362181Sdim * in the path.
1766362181Sdim *
1767362181Sdim * If @a authz_read_func is not @c NULL, this function will neither report
1768362181Sdim * entries nor recurse into directories that the user has no access to.
1769362181Sdim *
1770362181Sdim * Cancellation support is provided in the usual way through the optional
1771362181Sdim * @a cancel_func and @a cancel_baton.
1772362181Sdim *
1773362181Sdim * @a path must point to a directory and @a depth must be at least
1774362181Sdim * #svn_depth_empty.
1775362181Sdim *
1776362181Sdim * Use @a scratch_pool for temporary memory allocation.
1777362181Sdim *
1778362181Sdim * @since New in 1.10.
1779362181Sdim */
1780362181Sdimsvn_error_t *
1781362181Sdimsvn_repos_list(svn_fs_root_t *root,
1782362181Sdim               const char *path,
1783362181Sdim               const apr_array_header_t *patterns,
1784362181Sdim               svn_depth_t depth,
1785362181Sdim               svn_boolean_t path_info_only,
1786362181Sdim               svn_repos_authz_func_t authz_read_func,
1787362181Sdim               void *authz_read_baton,
1788362181Sdim               svn_repos_dirent_receiver_t receiver,
1789362181Sdim               void *receiver_baton,
1790362181Sdim               svn_cancel_func_t cancel_func,
1791362181Sdim               void *cancel_baton,
1792362181Sdim               apr_pool_t *scratch_pool);
1793362181Sdim
1794362181Sdim/**
1795251881Speter * Given @a path which exists at revision @a start in @a fs, set
1796251881Speter * @a *deleted to the revision @a path was first deleted, within the
1797251881Speter * inclusive revision range bounded by @a start and @a end.  If @a path
1798251881Speter * does not exist at revision @a start or was not deleted within the
1799251881Speter * specified range, then set @a *deleted to SVN_INVALID_REVNUM.
1800251881Speter * Use @a pool for memory allocation.
1801251881Speter *
1802251881Speter * @since New in 1.5.
1803251881Speter */
1804251881Spetersvn_error_t *
1805251881Spetersvn_repos_deleted_rev(svn_fs_t *fs,
1806251881Speter                      const char *path,
1807251881Speter                      svn_revnum_t start,
1808251881Speter                      svn_revnum_t end,
1809251881Speter                      svn_revnum_t *deleted,
1810251881Speter                      apr_pool_t *pool);
1811251881Speter
1812251881Speter
1813251881Speter/** Callback type for use with svn_repos_history().  @a path and @a
1814251881Speter * revision represent interesting history locations in the lifetime
1815251881Speter * of the path passed to svn_repos_history().  @a baton is the same
1816251881Speter * baton given to svn_repos_history().  @a pool is provided for the
1817251881Speter * convenience of the implementor, who should not expect it to live
1818251881Speter * longer than a single callback call.
1819251881Speter *
1820251881Speter * Signal to callback driver to stop processing/invoking this callback
1821251881Speter * by returning the #SVN_ERR_CEASE_INVOCATION error code.
1822251881Speter *
1823251881Speter * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1824251881Speter */
1825251881Spetertypedef svn_error_t *(*svn_repos_history_func_t)(void *baton,
1826251881Speter                                                 const char *path,
1827251881Speter                                                 svn_revnum_t revision,
1828251881Speter                                                 apr_pool_t *pool);
1829251881Speter
1830251881Speter/**
1831251881Speter * Call @a history_func (with @a history_baton) for each interesting
1832251881Speter * history location in the lifetime of @a path in @a fs, from the
1833251881Speter * youngest of @a end and @a start to the oldest.  Stop processing if
1834251881Speter * @a history_func returns #SVN_ERR_CEASE_INVOCATION.  Only cross
1835251881Speter * filesystem copy history if @a cross_copies is @c TRUE.  And do all
1836251881Speter * of this in @a pool.
1837251881Speter *
1838251881Speter * If @a authz_read_func is non-NULL, then use it (and @a
1839251881Speter * authz_read_baton) to verify that @a path in @a end is readable; if
1840251881Speter * not, return SVN_ERR_AUTHZ_UNREADABLE.  Also verify the readability
1841251881Speter * of every ancestral path/revision pair before pushing them at @a
1842251881Speter * history_func.  If a pair is deemed unreadable, then do not send
1843251881Speter * them; instead, immediately stop traversing history and return
1844251881Speter * SVN_NO_ERROR.
1845251881Speter *
1846251881Speter * @since New in 1.1.
1847251881Speter *
1848251881Speter * @note SVN_ERR_CEASE_INVOCATION is new in 1.5.
1849251881Speter */
1850251881Spetersvn_error_t *
1851251881Spetersvn_repos_history2(svn_fs_t *fs,
1852251881Speter                   const char *path,
1853251881Speter                   svn_repos_history_func_t history_func,
1854251881Speter                   void *history_baton,
1855251881Speter                   svn_repos_authz_func_t authz_read_func,
1856251881Speter                   void *authz_read_baton,
1857251881Speter                   svn_revnum_t start,
1858251881Speter                   svn_revnum_t end,
1859251881Speter                   svn_boolean_t cross_copies,
1860251881Speter                   apr_pool_t *pool);
1861251881Speter
1862251881Speter/**
1863251881Speter * Similar to svn_repos_history2(), but with @a authz_read_func
1864251881Speter * and @a authz_read_baton always set to NULL.
1865251881Speter *
1866251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
1867251881Speter */
1868251881SpeterSVN_DEPRECATED
1869251881Spetersvn_error_t *
1870251881Spetersvn_repos_history(svn_fs_t *fs,
1871251881Speter                  const char *path,
1872251881Speter                  svn_repos_history_func_t history_func,
1873251881Speter                  void *history_baton,
1874251881Speter                  svn_revnum_t start,
1875251881Speter                  svn_revnum_t end,
1876251881Speter                  svn_boolean_t cross_copies,
1877251881Speter                  apr_pool_t *pool);
1878251881Speter
1879251881Speter
1880251881Speter/**
1881251881Speter * Set @a *locations to be a mapping of the revisions to the paths of
1882251881Speter * the file @a fs_path present at the repository in revision
1883251881Speter * @a peg_revision, where the revisions are taken out of the array
1884251881Speter * @a location_revisions.
1885251881Speter *
1886251881Speter * @a location_revisions is an array of svn_revnum_t's and @a *locations
1887251881Speter * maps 'svn_revnum_t *' to 'const char *'.
1888251881Speter *
1889251881Speter * If optional @a authz_read_func is non-NULL, then use it (and @a
1890251881Speter * authz_read_baton) to verify that the peg-object is readable.  If not,
1891251881Speter * return SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a authz_read_func
1892251881Speter * to check that every path returned in the hash is readable.  If an
1893251881Speter * unreadable path is encountered, stop tracing and return
1894251881Speter * SVN_NO_ERROR.
1895251881Speter *
1896251881Speter * @a pool is used for all allocations.
1897251881Speter *
1898251881Speter * @since New in 1.1.
1899251881Speter */
1900251881Spetersvn_error_t *
1901251881Spetersvn_repos_trace_node_locations(svn_fs_t *fs,
1902251881Speter                               apr_hash_t **locations,
1903251881Speter                               const char *fs_path,
1904251881Speter                               svn_revnum_t peg_revision,
1905251881Speter                               const apr_array_header_t *location_revisions,
1906251881Speter                               svn_repos_authz_func_t authz_read_func,
1907251881Speter                               void *authz_read_baton,
1908251881Speter                               apr_pool_t *pool);
1909251881Speter
1910251881Speter
1911251881Speter/**
1912251881Speter * Call @a receiver and @a receiver_baton to report successive
1913251881Speter * location segments in revisions between @a start_rev and @a end_rev
1914251881Speter * (inclusive) for the line of history identified by the peg-object @a
1915251881Speter * path in @a peg_revision (and in @a repos).
1916251881Speter *
1917251881Speter * @a end_rev may be #SVN_INVALID_REVNUM to indicate that you want
1918251881Speter * to trace the history of the object to its origin.
1919251881Speter *
1920251881Speter * @a start_rev may be #SVN_INVALID_REVNUM to indicate "the HEAD
1921251881Speter * revision".  Otherwise, @a start_rev must be younger than @a end_rev
1922251881Speter * (unless @a end_rev is #SVN_INVALID_REVNUM).
1923251881Speter *
1924251881Speter * @a peg_revision may be #SVN_INVALID_REVNUM to indicate "the HEAD
1925251881Speter * revision", and must evaluate to be at least as young as @a start_rev.
1926251881Speter *
1927251881Speter * If optional @a authz_read_func is not @c NULL, then use it (and @a
1928251881Speter * authz_read_baton) to verify that the peg-object is readable.  If
1929251881Speter * not, return #SVN_ERR_AUTHZ_UNREADABLE.  Also use the @a
1930251881Speter * authz_read_func to check that every path reported in a location
1931251881Speter * segment is readable.  If an unreadable path is encountered, report
1932251881Speter * a final (possibly truncated) location segment (if any), stop
1933251881Speter * tracing history, and return #SVN_NO_ERROR.
1934251881Speter *
1935251881Speter * @a pool is used for all allocations.
1936251881Speter *
1937251881Speter * @since New in 1.5.
1938251881Speter */
1939251881Spetersvn_error_t *
1940251881Spetersvn_repos_node_location_segments(svn_repos_t *repos,
1941251881Speter                                 const char *path,
1942251881Speter                                 svn_revnum_t peg_revision,
1943251881Speter                                 svn_revnum_t start_rev,
1944251881Speter                                 svn_revnum_t end_rev,
1945251881Speter                                 svn_location_segment_receiver_t receiver,
1946251881Speter                                 void *receiver_baton,
1947251881Speter                                 svn_repos_authz_func_t authz_read_func,
1948251881Speter                                 void *authz_read_baton,
1949251881Speter                                 apr_pool_t *pool);
1950251881Speter
1951251881Speter
1952251881Speter/* ---------------------------------------------------------------*/
1953251881Speter
1954251881Speter/* Retrieving log messages. */
1955251881Speter
1956362181Sdim/** Path change descriptor.
1957362181Sdim *
1958362181Sdim * @note Identical to #svn_fs_path_change3_t but with all information
1959362181Sdim *       known, i.e. @a node_kind is never #svn_node_unknown and
1960362181Sdim *       @a copyfrom_known is always @c TRUE.
1961362181Sdim *
1962362181Sdim * @note To allow for extending this structure in future releases,
1963362181Sdim * always use svn_repos_path_change_create() to allocate the stucture.
1964362181Sdim *
1965362181Sdim * @see svn_fs_path_change3_t
1966362181Sdim *
1967362181Sdim * @since New in 1.10.
1968362181Sdim */
1969362181Sdimtypedef svn_fs_path_change3_t svn_repos_path_change_t;
1970251881Speter
1971251881Speter/**
1972362181Sdim * Return an #svn_repos_path_change_t structure, allocated in @a result_pool,
1973362181Sdim * with all fields initialized to their respective null/none/empty/invalid
1974362181Sdim * values.
1975362181Sdim *
1976362181Sdim * @note To allow for extending the #svn_repos_path_change_t structure in
1977362181Sdim * future releases, this function should always be used to allocate it.
1978362181Sdim *
1979362181Sdim * @since New in 1.10.
1980362181Sdim */
1981362181Sdimsvn_repos_path_change_t *
1982362181Sdimsvn_repos_path_change_create(apr_pool_t *result_pool);
1983362181Sdim
1984362181Sdim/**
1985362181Sdim * Return a deep copy of @a change, allocated in @a result_pool.
1986362181Sdim *
1987362181Sdim * @since New in 1.10.
1988362181Sdim */
1989362181Sdimsvn_repos_path_change_t *
1990362181Sdimsvn_repos_path_change_dup(svn_repos_path_change_t *change,
1991362181Sdim                          apr_pool_t *result_pool);
1992362181Sdim
1993362181Sdim/** The callback invoked by log message loopers, such as
1994362181Sdim * svn_repos_get_logs5().
1995362181Sdim *
1996362181Sdim * This function is invoked once on each changed path, in a potentially
1997362181Sdim * random order that may even change between invocations for the same
1998362181Sdim * revisions.
1999362181Sdim *
2000362181Sdim * @a baton is what you think it is, and @a change contains relevant
2001362181Sdim * information for the changed path.  Please note that @a change may be
2002362181Sdim * modified within this callback but it will become invalid as soon as
2003362181Sdim * the callback returns.
2004362181Sdim *
2005362181Sdim * Use @a scratch_pool for temporary allocation.  The caller may clear it
2006362181Sdim * between or after invocations.
2007362181Sdim *
2008362181Sdim * @since New in 1.10.
2009362181Sdim */
2010362181Sdimtypedef svn_error_t *(*svn_repos_path_change_receiver_t)(
2011362181Sdim  void *baton,
2012362181Sdim  svn_repos_path_change_t *change,
2013362181Sdim  apr_pool_t *scratch_pool);
2014362181Sdim
2015362181Sdim
2016362181Sdim/**
2017362181Sdim * A structure to represent all the information about a particular log entry.
2018362181Sdim *
2019362181Sdim * @note To allow for extending this structure in future releases,
2020362181Sdim * always use svn_repos_log_entry_create() to allocate the stucture.
2021362181Sdim *
2022362181Sdim * @since New in 1.10.
2023362181Sdim */
2024362181Sdimtypedef struct svn_repos_log_entry_t
2025362181Sdim{
2026362181Sdim  /** The revision of the commit. */
2027362181Sdim  svn_revnum_t revision;
2028362181Sdim
2029362181Sdim  /** The hash of requested revision properties, which may be NULL if it
2030362181Sdim   * would contain no revprops.  Maps (const char *) property name to
2031362181Sdim   * (svn_string_t *) property value. */
2032362181Sdim  apr_hash_t *revprops;
2033362181Sdim
2034362181Sdim  /**
2035362181Sdim   * Whether or not this message has children.
2036362181Sdim   *
2037362181Sdim   * When a log operation requests additional merge information, extra log
2038362181Sdim   * entries may be returned as a result of this entry.  The new entries, are
2039362181Sdim   * considered children of the original entry, and will follow it.  When
2040362181Sdim   * the HAS_CHILDREN flag is set, the receiver should increment its stack
2041362181Sdim   * depth, and wait until an entry is provided with SVN_INVALID_REVNUM which
2042362181Sdim   * indicates the end of the children.
2043362181Sdim   *
2044362181Sdim   * For log operations which do not request additional merge information, the
2045362181Sdim   * HAS_CHILDREN flag is always FALSE.
2046362181Sdim   *
2047362181Sdim   * For more information see:
2048362181Sdim   * https://svn.apache.org/repos/asf/subversion/trunk/notes/merge-tracking/design.html#commutative-reporting
2049362181Sdim   */
2050362181Sdim  svn_boolean_t has_children;
2051362181Sdim
2052362181Sdim  /**
2053362181Sdim   * Whether @a revision should be interpreted as non-inheritable in the
2054362181Sdim   * same sense of #svn_merge_range_t.
2055362181Sdim   *
2056362181Sdim   * Currently always FALSE.
2057362181Sdim   */
2058362181Sdim  svn_boolean_t non_inheritable;
2059362181Sdim
2060362181Sdim  /**
2061362181Sdim   * Whether @a revision is a merged revision resulting from a reverse merge.
2062362181Sdim   */
2063362181Sdim  svn_boolean_t subtractive_merge;
2064362181Sdim
2065362181Sdim  /* NOTE: Add new fields at the end to preserve binary compatibility. */
2066362181Sdim} svn_repos_log_entry_t;
2067362181Sdim
2068362181Sdim/**
2069362181Sdim * Return an #svn_repos_log_entry_t, allocated in @a result_pool,
2070362181Sdim * with all fields initialized to their respective null/none/empty/invalid
2071362181Sdim * values.
2072362181Sdim *
2073362181Sdim * @note To allow for extending the #svn_repos_log_entry_t structure in
2074362181Sdim * future releases, this function should always be used to allocate it.
2075362181Sdim *
2076362181Sdim * @since New in 1.10.
2077362181Sdim */
2078362181Sdimsvn_repos_log_entry_t *
2079362181Sdimsvn_repos_log_entry_create(apr_pool_t *result_pool);
2080362181Sdim
2081362181Sdim/** Return a deep copy of @a log_entry, allocated in @a result_pool.
2082362181Sdim *
2083362181Sdim * @since New in 1.10.
2084362181Sdim */
2085362181Sdimsvn_repos_log_entry_t *
2086362181Sdimsvn_repos_log_entry_dup(const svn_repos_log_entry_t *log_entry,
2087362181Sdim                        apr_pool_t *result_pool);
2088362181Sdim
2089362181Sdim
2090362181Sdim/** The callback invoked by log message loopers, such as
2091362181Sdim * svn_repos_get_logs5().
2092362181Sdim *
2093362181Sdim * This function is invoked once on each log message, in the order
2094362181Sdim * determined by the caller (see above-mentioned functions).
2095362181Sdim *
2096362181Sdim * @a baton is what you think it is, and @a log_entry contains relevant
2097362181Sdim * information for the log message.
2098362181Sdim *
2099362181Sdim * If @a log_entry->has_children is @c TRUE, the message will be followed
2100362181Sdim * immediately by any number of merged revisions (child messages), which are
2101362181Sdim * terminated by an invocation with SVN_INVALID_REVNUM.  This usage may
2102362181Sdim * be recursive.
2103362181Sdim *
2104362181Sdim * Use @a scratch_pool for temporary allocation.  The caller may clear it
2105362181Sdim * between or after invocations.
2106362181Sdim *
2107362181Sdim * @since New in 1.10.
2108362181Sdim */
2109362181Sdimtypedef svn_error_t *(*svn_repos_log_entry_receiver_t)(
2110362181Sdim  void *baton,
2111362181Sdim  svn_repos_log_entry_t *log_entry,
2112362181Sdim  apr_pool_t *scratch_pool);
2113362181Sdim
2114362181Sdim
2115362181Sdim/**
2116362181Sdim * Invoke @a revision_receiver with @a revision_receiver_baton on each
2117362181Sdim * revision from @a start to @a end in @a repos's filesystem.  @a start may
2118362181Sdim * be greater or less than @a end; this just controls whether the log is
2119251881Speter * processed in descending or ascending revision number order.
2120251881Speter *
2121362181Sdim * If not @c NULL, @a path_change_receiver will be invoked with
2122362181Sdim * @a path_change_receiver_baton for each changed path in the respective
2123362181Sdim * revision.  These changes will be reported before the @a revision_receiver
2124362181Sdim * is invoked for that revision.  So, for each revision in the log, there
2125362181Sdim * is a number of calls to @a path_change_receiver followed by a single
2126362181Sdim * invocation of @a revision_receiver, implicitly marking the end of the
2127362181Sdim * changes list for that revision.  If a revision does not contain any
2128362181Sdim * changes (or if none are visible due to @a authz_read_func),
2129362181Sdim * @a path_change_receiver will not be called for that revision.
2130362181Sdim *
2131251881Speter * If @a start or @a end is #SVN_INVALID_REVNUM, it defaults to youngest.
2132251881Speter *
2133251881Speter * If @a paths is non-NULL and has one or more elements, then only show
2134251881Speter * revisions in which at least one of @a paths was changed (i.e., if
2135251881Speter * file, text or props changed; if dir, props or entries changed or any node
2136251881Speter * changed below it).  Each path is a <tt>const char *</tt> representing
2137251881Speter * an absolute path in the repository.  If @a paths is NULL or empty,
2138251881Speter * show all revisions regardless of what paths were changed in those
2139251881Speter * revisions.
2140251881Speter *
2141362181Sdim * If @a limit is greater than zero then only invoke @a revision_receiver
2142362181Sdim * on the first @a limit logs.
2143251881Speter *
2144251881Speter * If @a strict_node_history is set, copy history (if any exists) will
2145251881Speter * not be traversed while harvesting revision logs for each path.
2146251881Speter *
2147251881Speter * If @a include_merged_revisions is set, log information for revisions
2148251881Speter * which have been merged to @a paths will also be returned, unless these
2149251881Speter * revisions are already part of @a start to @a end in @a repos's
2150251881Speter * filesystem, as limited by @a paths. In the latter case those revisions
2151251881Speter * are skipped and @a receiver is not invoked.
2152251881Speter *
2153251881Speter * If @a revprops is NULL, retrieve all revision properties; else, retrieve
2154251881Speter * only the revision properties named by the (const char *) array elements
2155251881Speter * (i.e. retrieve none if the array is empty).
2156251881Speter *
2157362181Sdim * If any invocation of @a revision_receiver or @a path_change_receiver
2158362181Sdim * returnn an error, return that error immediately and without wrapping it.
2159251881Speter *
2160251881Speter * If @a start or @a end is a non-existent revision, return the error
2161362181Sdim * #SVN_ERR_FS_NO_SUCH_REVISION, without ever invoking @a revision_receiver.
2162251881Speter *
2163251881Speter * If optional @a authz_read_func is non-NULL, then use this function
2164251881Speter * (along with optional @a authz_read_baton) to check the readability
2165251881Speter * of each changed-path in each revision about to be "pushed" at
2166362181Sdim * @a path_change_receiver.  If a revision has some changed-paths readable
2167362181Sdim * and others unreadable, unreadable paths are omitted from the
2168362181Sdim * @a path_change_receiver invocations and only svn:author and svn:date
2169362181Sdim * will be available in the revprops field in the @a revision_receiver
2170362181Sdim * callback.  If a revision has no changed-paths readable at all, then all
2171362181Sdim * paths are omitted and no revprops are available.  If
2172362181Sdim * @a path_change_receiver is @c NULL, the same filtering is performed
2173362181Sdim * just without reporting any path changes.
2174251881Speter *
2175362181Sdim * Use @a scratch_pool for temporary allocations.
2176251881Speter *
2177362181Sdim * @see svn_repos_path_change_receiver_t, svn_repos_log_entry_receiver_t
2178251881Speter *
2179362181Sdim * @since New in 1.10.
2180362181Sdim */
2181362181Sdimsvn_error_t *
2182362181Sdimsvn_repos_get_logs5(svn_repos_t *repos,
2183362181Sdim                    const apr_array_header_t *paths,
2184362181Sdim                    svn_revnum_t start,
2185362181Sdim                    svn_revnum_t end,
2186362181Sdim                    int limit,
2187362181Sdim                    svn_boolean_t strict_node_history,
2188362181Sdim                    svn_boolean_t include_merged_revisions,
2189362181Sdim                    const apr_array_header_t *revprops,
2190362181Sdim                    svn_repos_authz_func_t authz_read_func,
2191362181Sdim                    void *authz_read_baton,
2192362181Sdim                    svn_repos_path_change_receiver_t path_change_receiver,
2193362181Sdim                    void *path_change_receiver_baton,
2194362181Sdim                    svn_repos_log_entry_receiver_t revision_receiver,
2195362181Sdim                    void *revision_receiver_baton,
2196362181Sdim                    apr_pool_t *scratch_pool);
2197362181Sdim
2198362181Sdim/**
2199362181Sdim * Similar to svn_repos_get_logs5 but using a #svn_log_entry_receiver_t
2200362181Sdim * @a receiver to receive revision properties and changed paths through a
2201362181Sdim * single callback and the @a discover_changed_paths flag to control it.
2202362181Sdim *
2203362181Sdim * If @a discover_changed_paths, then each call to @a receiver passes a
2204362181Sdim * hash mapping paths committed in that revision to information about them
2205362181Sdim * as the receiver's @a changed_paths argument.
2206362181Sdim * Otherwise, each call to @a receiver passes NULL for @a changed_paths.
2207362181Sdim *
2208362181Sdim * @see svn_log_entry_receiver_t
2209362181Sdim *
2210251881Speter * @since New in 1.5.
2211362181Sdim *
2212362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
2213251881Speter */
2214362181SdimSVN_DEPRECATED
2215251881Spetersvn_error_t *
2216251881Spetersvn_repos_get_logs4(svn_repos_t *repos,
2217251881Speter                    const apr_array_header_t *paths,
2218251881Speter                    svn_revnum_t start,
2219251881Speter                    svn_revnum_t end,
2220251881Speter                    int limit,
2221251881Speter                    svn_boolean_t discover_changed_paths,
2222251881Speter                    svn_boolean_t strict_node_history,
2223251881Speter                    svn_boolean_t include_merged_revisions,
2224251881Speter                    const apr_array_header_t *revprops,
2225251881Speter                    svn_repos_authz_func_t authz_read_func,
2226251881Speter                    void *authz_read_baton,
2227251881Speter                    svn_log_entry_receiver_t receiver,
2228251881Speter                    void *receiver_baton,
2229251881Speter                    apr_pool_t *pool);
2230251881Speter
2231251881Speter/**
2232251881Speter * Same as svn_repos_get_logs4(), but with @a receiver being
2233251881Speter * #svn_log_message_receiver_t instead of #svn_log_entry_receiver_t.
2234251881Speter * Also, @a include_merged_revisions is set to @c FALSE and @a revprops is
2235251881Speter * svn:author, svn:date, and svn:log.  If @a paths is empty, nothing
2236251881Speter * is returned.
2237251881Speter *
2238251881Speter * @since New in 1.2.
2239251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
2240251881Speter */
2241251881SpeterSVN_DEPRECATED
2242251881Spetersvn_error_t *
2243251881Spetersvn_repos_get_logs3(svn_repos_t *repos,
2244251881Speter                    const apr_array_header_t *paths,
2245251881Speter                    svn_revnum_t start,
2246251881Speter                    svn_revnum_t end,
2247251881Speter                    int limit,
2248251881Speter                    svn_boolean_t discover_changed_paths,
2249251881Speter                    svn_boolean_t strict_node_history,
2250251881Speter                    svn_repos_authz_func_t authz_read_func,
2251251881Speter                    void *authz_read_baton,
2252251881Speter                    svn_log_message_receiver_t receiver,
2253251881Speter                    void *receiver_baton,
2254251881Speter                    apr_pool_t *pool);
2255251881Speter
2256251881Speter
2257251881Speter/**
2258251881Speter * Same as svn_repos_get_logs3(), but with @a limit always set to 0.
2259251881Speter *
2260251881Speter * @deprecated Provided for backward compatibility with the 1.1 API.
2261251881Speter */
2262251881SpeterSVN_DEPRECATED
2263251881Spetersvn_error_t *
2264251881Spetersvn_repos_get_logs2(svn_repos_t *repos,
2265251881Speter                    const apr_array_header_t *paths,
2266251881Speter                    svn_revnum_t start,
2267251881Speter                    svn_revnum_t end,
2268251881Speter                    svn_boolean_t discover_changed_paths,
2269251881Speter                    svn_boolean_t strict_node_history,
2270251881Speter                    svn_repos_authz_func_t authz_read_func,
2271251881Speter                    void *authz_read_baton,
2272251881Speter                    svn_log_message_receiver_t receiver,
2273251881Speter                    void *receiver_baton,
2274251881Speter                    apr_pool_t *pool);
2275251881Speter
2276251881Speter/**
2277251881Speter * Same as svn_repos_get_logs2(), but with @a authz_read_func and
2278251881Speter * @a authz_read_baton always set to NULL.
2279251881Speter *
2280251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
2281251881Speter */
2282251881SpeterSVN_DEPRECATED
2283251881Spetersvn_error_t *
2284251881Spetersvn_repos_get_logs(svn_repos_t *repos,
2285251881Speter                   const apr_array_header_t *paths,
2286251881Speter                   svn_revnum_t start,
2287251881Speter                   svn_revnum_t end,
2288251881Speter                   svn_boolean_t discover_changed_paths,
2289251881Speter                   svn_boolean_t strict_node_history,
2290251881Speter                   svn_log_message_receiver_t receiver,
2291251881Speter                   void *receiver_baton,
2292251881Speter                   apr_pool_t *pool);
2293251881Speter
2294251881Speter
2295251881Speter
2296251881Speter/* ---------------------------------------------------------------*/
2297251881Speter
2298251881Speter/* Retrieving mergeinfo. */
2299251881Speter
2300362181Sdim/** Receives parsed @a mergeinfo for the file system path @a path.
2301362181Sdim *
2302362181Sdim * The user-provided @a baton is being passed through by the retrieval
2303362181Sdim * function and @a scratch_pool will be cleared between invocations.
2304362181Sdim *
2305362181Sdim * @since New in 1.10.
2306362181Sdim */
2307362181Sdimtypedef svn_fs_mergeinfo_receiver_t svn_repos_mergeinfo_receiver_t;
2308362181Sdim
2309251881Speter/**
2310362181Sdim * For each node found with mergeinfo on it, invoke @a receiver with
2311362181Sdim * the provided @a receiver_baton.
2312251881Speter *
2313362181Sdim * The paths in @a paths start with '/'.
2314251881Speter *
2315251881Speter * @a inherit indicates whether explicit, explicit or inherited, or
2316251881Speter * only inherited mergeinfo for @a paths is fetched.
2317251881Speter *
2318251881Speter * If @a revision is #SVN_INVALID_REVNUM, it defaults to youngest.
2319251881Speter *
2320251881Speter * If @a include_descendants is TRUE, then additionally return the
2321251881Speter * mergeinfo for any descendant of any element of @a paths which has
2322251881Speter * the #SVN_PROP_MERGEINFO property explicitly set on it.  (Note
2323251881Speter * that inheritance is only taken into account for the elements in @a
2324251881Speter * paths; descendants of the elements in @a paths which get their
2325362181Sdim * mergeinfo via inheritance are not reported to @a receiver.)
2326251881Speter *
2327251881Speter * If optional @a authz_read_func is non-NULL, then use this function
2328251881Speter * (along with optional @a authz_read_baton) to check the readability
2329251881Speter * of each path which mergeinfo was requested for (from @a paths).
2330251881Speter * Silently omit unreadable paths from the request for mergeinfo.
2331251881Speter *
2332362181Sdim * Use @a scratch_pool for temporary allocations.
2333251881Speter *
2334362181Sdim * @since New in 1.10.
2335362181Sdim */
2336362181Sdimsvn_error_t *
2337362181Sdimsvn_repos_fs_get_mergeinfo2(svn_repos_t *repos,
2338362181Sdim                            const apr_array_header_t *paths,
2339362181Sdim                            svn_revnum_t revision,
2340362181Sdim                            svn_mergeinfo_inheritance_t inherit,
2341362181Sdim                            svn_boolean_t include_descendants,
2342362181Sdim                            svn_repos_authz_func_t authz_read_func,
2343362181Sdim                            void *authz_read_baton,
2344362181Sdim                            svn_repos_mergeinfo_receiver_t receiver,
2345362181Sdim                            void *receiver_baton,
2346362181Sdim                            apr_pool_t *scratch_pool);
2347362181Sdim
2348362181Sdim/**
2349362181Sdim * Same as svn_repos_fs_get_mergeinfo2(), but all mergeinfo is being collected
2350362181Sdim * and returned in @a *catalog.  It will never be @c NULL, but may be empty.
2351362181Sdim *
2352251881Speter * @since New in 1.5.
2353362181Sdim *
2354362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
2355251881Speter */
2356362181SdimSVN_DEPRECATED
2357251881Spetersvn_error_t *
2358251881Spetersvn_repos_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
2359251881Speter                           svn_repos_t *repos,
2360251881Speter                           const apr_array_header_t *paths,
2361251881Speter                           svn_revnum_t revision,
2362251881Speter                           svn_mergeinfo_inheritance_t inherit,
2363251881Speter                           svn_boolean_t include_descendants,
2364251881Speter                           svn_repos_authz_func_t authz_read_func,
2365251881Speter                           void *authz_read_baton,
2366251881Speter                           apr_pool_t *pool);
2367251881Speter
2368251881Speter
2369251881Speter/* ---------------------------------------------------------------*/
2370251881Speter
2371251881Speter/* Retrieving multiple revisions of a file. */
2372251881Speter
2373251881Speter/**
2374251881Speter * Retrieve a subset of the interesting revisions of a file @a path in
2375251881Speter * @a repos as seen in revision @a end.  Invoke @a handler with
2376251881Speter * @a handler_baton as its first argument for each such revision.
2377251881Speter * @a pool is used for all allocations.  See svn_fs_history_prev() for
2378251881Speter * a discussion of interesting revisions.
2379251881Speter *
2380251881Speter * If optional @a authz_read_func is non-NULL, then use this function
2381251881Speter * (along with optional @a authz_read_baton) to check the readability
2382251881Speter * of the rev-path in each interesting revision encountered.
2383251881Speter *
2384251881Speter * Revision discovery happens from @a end to @a start, and if an
2385251881Speter * unreadable revision is encountered before @a start is reached, then
2386251881Speter * revision discovery stops and only the revisions from @a end to the
2387251881Speter * oldest readable revision are returned (So it will appear that @a
2388251881Speter * path was added without history in the latter revision).
2389251881Speter *
2390251881Speter * If there is an interesting revision of the file that is less than or
2391251881Speter * equal to start, the iteration will start at that revision.  Else, the
2392251881Speter * iteration will start at the first revision of the file in the repository,
2393251881Speter * which has to be less than or equal to end.  Note that if the function
2394251881Speter * succeeds, @a handler will have been called at least once.
2395251881Speter *
2396251881Speter * In a series of calls, the file contents for the first interesting revision
2397251881Speter * will be provided as a text delta against the empty file.  In the following
2398251881Speter * calls, the delta will be against the contents for the previous call.
2399251881Speter *
2400251881Speter * If @a include_merged_revisions is TRUE, revisions which a included as a
2401251881Speter * result of a merge between @a start and @a end will be included.
2402251881Speter *
2403251881Speter * Since Subversion 1.8 this function has been enabled to support reversion
2404251881Speter * the revision range for @a include_merged_revision @c FALSE reporting by
2405251881Speter * switching @a start with @a end.
2406251881Speter *
2407289180Speter * @note Prior to Subversion 1.9, this function may request delta handlers
2408289180Speter * from @a handler even for empty text deltas.  Starting with 1.9, the
2409289180Speter * delta handler / baton return arguments passed to @a handler will be
2410362181Sdim * NULL unless there is an actual difference in the file contents between
2411289180Speter * the current and the previous call.
2412289180Speter *
2413251881Speter * @since New in 1.5.
2414251881Speter */
2415251881Spetersvn_error_t *
2416251881Spetersvn_repos_get_file_revs2(svn_repos_t *repos,
2417251881Speter                         const char *path,
2418251881Speter                         svn_revnum_t start,
2419251881Speter                         svn_revnum_t end,
2420251881Speter                         svn_boolean_t include_merged_revisions,
2421251881Speter                         svn_repos_authz_func_t authz_read_func,
2422251881Speter                         void *authz_read_baton,
2423251881Speter                         svn_file_rev_handler_t handler,
2424251881Speter                         void *handler_baton,
2425251881Speter                         apr_pool_t *pool);
2426251881Speter
2427251881Speter/**
2428289180Speter * Similar to #svn_file_rev_handler_t, but without the @a
2429289180Speter * result_of_merge parameter.
2430289180Speter *
2431289180Speter * @deprecated Provided for backward compatibility with 1.4 API.
2432289180Speter * @since New in 1.1.
2433289180Speter */
2434289180Spetertypedef svn_error_t *(*svn_repos_file_rev_handler_t)
2435289180Speter  (void *baton,
2436289180Speter   const char *path,
2437289180Speter   svn_revnum_t rev,
2438289180Speter   apr_hash_t *rev_props,
2439289180Speter   svn_txdelta_window_handler_t *delta_handler,
2440289180Speter   void **delta_baton,
2441289180Speter   apr_array_header_t *prop_diffs,
2442289180Speter   apr_pool_t *pool);
2443289180Speter
2444289180Speter/**
2445251881Speter * Similar to svn_repos_get_file_revs2(), with @a include_merged_revisions
2446251881Speter * set to FALSE.
2447251881Speter *
2448251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
2449251881Speter * @since New in 1.1.
2450251881Speter */
2451251881SpeterSVN_DEPRECATED
2452251881Spetersvn_error_t *
2453251881Spetersvn_repos_get_file_revs(svn_repos_t *repos,
2454251881Speter                        const char *path,
2455251881Speter                        svn_revnum_t start,
2456251881Speter                        svn_revnum_t end,
2457251881Speter                        svn_repos_authz_func_t authz_read_func,
2458251881Speter                        void *authz_read_baton,
2459251881Speter                        svn_repos_file_rev_handler_t handler,
2460251881Speter                        void *handler_baton,
2461251881Speter                        apr_pool_t *pool);
2462251881Speter
2463251881Speter
2464251881Speter/* ---------------------------------------------------------------*/
2465251881Speter
2466251881Speter/**
2467251881Speter * @defgroup svn_repos_hook_wrappers Hook-sensitive wrappers for libsvn_fs \
2468251881Speter * routines.
2469251881Speter * @{
2470251881Speter */
2471251881Speter
2472251881Speter/** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
2473251881Speter * post-commit hooks around the commit.  Use @a pool for any necessary
2474251881Speter * allocations.
2475251881Speter *
2476251881Speter * If the pre-commit hook fails, do not attempt to commit the
2477251881Speter * transaction and throw the original error to the caller.
2478251881Speter *
2479251881Speter * A successful commit is indicated by a valid revision value in @a
2480251881Speter * *new_rev, not if svn_fs_commit_txn() returns an error, which can
2481251881Speter * occur during its post commit FS processing.  If the transaction was
2482251881Speter * not committed, then return the associated error and do not execute
2483251881Speter * the post-commit hook.
2484251881Speter *
2485251881Speter * If the commit succeeds the post-commit hook is executed.  If the
2486251881Speter * post-commit hook returns an error, always wrap it with
2487251881Speter * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
2488251881Speter * find the post-commit hook error in the returned error chain.  If
2489251881Speter * both svn_fs_commit_txn() and the post-commit hook return errors,
2490251881Speter * then svn_fs_commit_txn()'s error is the parent error and the
2491251881Speter * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
2492251881Speter * error.
2493251881Speter *
2494251881Speter * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
2495251881Speter */
2496251881Spetersvn_error_t *
2497251881Spetersvn_repos_fs_commit_txn(const char **conflict_p,
2498251881Speter                        svn_repos_t *repos,
2499251881Speter                        svn_revnum_t *new_rev,
2500251881Speter                        svn_fs_txn_t *txn,
2501251881Speter                        apr_pool_t *pool);
2502251881Speter
2503251881Speter/** Like svn_fs_begin_txn(), but use @a revprop_table, a hash mapping
2504251881Speter * <tt>const char *</tt> property names to #svn_string_t values, to
2505251881Speter * set the properties on transaction @a *txn_p.  @a repos is the
2506251881Speter * repository object which contains the filesystem.  @a rev, @a
2507251881Speter * *txn_p, and @a pool are as in svn_fs_begin_txn().
2508251881Speter *
2509251881Speter * Before a txn is created, the repository's start-commit hooks are
2510251881Speter * run; if any of them fail, no txn is created, @a *txn_p is unaffected,
2511251881Speter * and #SVN_ERR_REPOS_HOOK_FAILURE is returned.
2512251881Speter *
2513251881Speter * @note @a revprop_table may contain an #SVN_PROP_REVISION_DATE property,
2514251881Speter * which will be set on the transaction, but that will be overwritten
2515251881Speter * when the transaction is committed.
2516251881Speter *
2517251881Speter * @since New in 1.5.
2518251881Speter */
2519251881Spetersvn_error_t *
2520251881Spetersvn_repos_fs_begin_txn_for_commit2(svn_fs_txn_t **txn_p,
2521251881Speter                                   svn_repos_t *repos,
2522251881Speter                                   svn_revnum_t rev,
2523251881Speter                                   apr_hash_t *revprop_table,
2524251881Speter                                   apr_pool_t *pool);
2525251881Speter
2526251881Speter
2527251881Speter/**
2528251881Speter * Same as svn_repos_fs_begin_txn_for_commit2(), but with @a revprop_table
2529251881Speter * set to a hash containing @a author and @a log_msg as the
2530251881Speter * #SVN_PROP_REVISION_AUTHOR and #SVN_PROP_REVISION_LOG properties,
2531251881Speter * respectively.  @a author and @a log_msg may both be @c NULL.
2532251881Speter *
2533251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
2534251881Speter */
2535251881SpeterSVN_DEPRECATED
2536251881Spetersvn_error_t *
2537251881Spetersvn_repos_fs_begin_txn_for_commit(svn_fs_txn_t **txn_p,
2538251881Speter                                  svn_repos_t *repos,
2539251881Speter                                  svn_revnum_t rev,
2540251881Speter                                  const char *author,
2541251881Speter                                  const char *log_msg,
2542251881Speter                                  apr_pool_t *pool);
2543251881Speter
2544251881Speter
2545251881Speter/** Like svn_fs_begin_txn(), but use @a author to set the corresponding
2546251881Speter * property on transaction @a *txn_p.  @a repos is the repository object
2547251881Speter * which contains the filesystem.  @a rev, @a *txn_p, and @a pool are as in
2548251881Speter * svn_fs_begin_txn().
2549251881Speter *
2550251881Speter * ### Someday: before a txn is created, some kind of read-hook could
2551251881Speter *              be called here.
2552251881Speter *
2553251881Speter * @note This function was never fully implemented, nor used. Ignore it.
2554251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
2555251881Speter */
2556251881SpeterSVN_DEPRECATED
2557251881Spetersvn_error_t *
2558251881Spetersvn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
2559251881Speter                                  svn_repos_t *repos,
2560251881Speter                                  svn_revnum_t rev,
2561251881Speter                                  const char *author,
2562251881Speter                                  apr_pool_t *pool);
2563251881Speter
2564251881Speter
2565251881Speter/** @} */
2566251881Speter
2567251881Speter/** @defgroup svn_repos_fs_locks Repository lock wrappers
2568251881Speter * @{
2569251881Speter */
2570251881Speter
2571289180Speter/** Like svn_fs_lock_many(), but invoke the @a repos's pre- and
2572289180Speter * post-lock hooks before and after the locking action.
2573251881Speter *
2574289180Speter * The pre-lock is run for every path in @a targets. Those targets for
2575289180Speter * which the pre-lock is successful are passed to svn_fs_lock_many and
2576289180Speter * the post-lock is run for those that are successfully locked.
2577289180Speter * Pre-lock hook errors are passed to @a lock_callback.
2578251881Speter *
2579289180Speter * For each path in @a targets @a lock_callback will be invoked
2580289180Speter * passing @a lock_baton and the lock and error that apply to path.
2581289180Speter * @a lock_callback can be NULL in which case it is not called and any
2582289180Speter * errors that would have been passed to the callback are not reported.
2583289180Speter *
2584289180Speter * If an error occurs when running the post-lock hook the error is
2585289180Speter * returned wrapped with #SVN_ERR_REPOS_POST_LOCK_HOOK_FAILED.  If the
2586289180Speter * caller sees this error, it knows that some locks succeeded.
2587289180Speter *
2588251881Speter * The pre-lock hook may cause a different token to be used for the
2589289180Speter * lock, instead of the token supplied; see the pre-lock-hook
2590289180Speter * documentation for more.
2591251881Speter *
2592289180Speter * The lock and path passed to @a lock_callback will be allocated in
2593289180Speter * @a result_pool.  Use @a scratch_pool for temporary allocations.
2594289180Speter *
2595289180Speter * @note This function is not atomic.  If it returns an error, some targets
2596289180Speter * may remain unlocked while others may have been locked.
2597289180Speter *
2598289180Speter * @see svn_fs_lock_many
2599289180Speter *
2600289180Speter * @since New in 1.9.
2601289180Speter */
2602289180Spetersvn_error_t *
2603289180Spetersvn_repos_fs_lock_many(svn_repos_t *repos,
2604289180Speter                       apr_hash_t *lock_targets,
2605289180Speter                       const char *comment,
2606289180Speter                       svn_boolean_t is_dav_comment,
2607289180Speter                       apr_time_t expiration_date,
2608289180Speter                       svn_boolean_t steal_lock,
2609289180Speter                       svn_fs_lock_callback_t lock_callback,
2610289180Speter                       void *lock_baton,
2611289180Speter                       apr_pool_t *result_pool,
2612289180Speter                       apr_pool_t *scratch_pool);
2613289180Speter
2614289180Speter/** Similar to svn_repos_fs_lock_many() but locks only a single path.
2615289180Speter *
2616251881Speter * @since New in 1.2.
2617251881Speter */
2618251881Spetersvn_error_t *
2619251881Spetersvn_repos_fs_lock(svn_lock_t **lock,
2620251881Speter                  svn_repos_t *repos,
2621251881Speter                  const char *path,
2622251881Speter                  const char *token,
2623251881Speter                  const char *comment,
2624251881Speter                  svn_boolean_t is_dav_comment,
2625251881Speter                  apr_time_t expiration_date,
2626251881Speter                  svn_revnum_t current_rev,
2627251881Speter                  svn_boolean_t steal_lock,
2628251881Speter                  apr_pool_t *pool);
2629251881Speter
2630251881Speter
2631289180Speter/** Like svn_fs_unlock_many(), but invoke the @a repos's pre- and
2632289180Speter * post-unlock hooks before and after the unlocking action.
2633251881Speter *
2634289180Speter * The pre-unlock hook is run for every path in @a targets. Those
2635289180Speter * targets for which the pre-unlock is successful are passed to
2636289180Speter * svn_fs_unlock_many and the post-unlock is run for those that are
2637289180Speter * successfully unlocked. Pre-unlock hook errors are passed to @a
2638289180Speter * lock_callback.
2639251881Speter *
2640289180Speter * For each path in @a targets @a lock_callback will be invoked
2641289180Speter * passing @a lock_baton and error that apply to path.  The lock
2642289180Speter * passed to the callback will be NULL.  @a lock_callback can be NULL
2643289180Speter * in which case it is not called and any errors that would have been
2644289180Speter * passed to the callback are not reported.
2645289180Speter *
2646289180Speter * If an error occurs when running the post-unlock hook, return the
2647289180Speter * original error wrapped with #SVN_ERR_REPOS_POST_UNLOCK_HOOK_FAILED.
2648289180Speter * If the caller sees this error, it knows that some unlocks
2649289180Speter * succeeded.
2650289180Speter *
2651289180Speter * The path passed to @a lock_callback will be allocated in @a result_pool.
2652289180Speter * Use @a scratch_pool for temporary allocations.
2653289180Speter *
2654289180Speter * @note This function is not atomic.  If it returns an error, some targets
2655289180Speter * may remain locked while others may have been unlocked.
2656289180Speter *
2657289180Speter * @see svn_fs_unlock_many
2658289180Speter *
2659289180Speter * @since New in 1.9.
2660289180Speter */
2661289180Spetersvn_error_t *
2662289180Spetersvn_repos_fs_unlock_many(svn_repos_t *repos,
2663289180Speter                         apr_hash_t *unlock_targets,
2664289180Speter                         svn_boolean_t break_lock,
2665289180Speter                         svn_fs_lock_callback_t lock_callback,
2666289180Speter                         void *lock_baton,
2667289180Speter                         apr_pool_t *result_pool,
2668289180Speter                         apr_pool_t *scratch_pool);
2669289180Speter
2670289180Speter/** Similar to svn_repos_fs_unlock_many() but only unlocks a single path.
2671289180Speter *
2672251881Speter * @since New in 1.2.
2673251881Speter */
2674251881Spetersvn_error_t *
2675251881Spetersvn_repos_fs_unlock(svn_repos_t *repos,
2676251881Speter                    const char *path,
2677251881Speter                    const char *token,
2678251881Speter                    svn_boolean_t break_lock,
2679251881Speter                    apr_pool_t *pool);
2680251881Speter
2681251881Speter
2682251881Speter
2683251881Speter/** Look up all the locks in and under @a path in @a repos, setting @a
2684251881Speter * *locks to a hash which maps <tt>const char *</tt> paths to the
2685251881Speter * #svn_lock_t locks associated with those paths.  Use @a
2686251881Speter * authz_read_func and @a authz_read_baton to "screen" all returned
2687251881Speter * locks.  That is: do not return any locks on any paths that are
2688251881Speter * unreadable in HEAD, just silently omit them.
2689251881Speter *
2690251881Speter * @a depth limits the returned locks to those associated with paths
2691251881Speter * within the specified depth of @a path, and must be one of the
2692251881Speter * following values:  #svn_depth_empty, #svn_depth_files,
2693251881Speter * #svn_depth_immediates, or #svn_depth_infinity.
2694251881Speter *
2695251881Speter * @since New in 1.7.
2696251881Speter */
2697251881Spetersvn_error_t *
2698251881Spetersvn_repos_fs_get_locks2(apr_hash_t **locks,
2699251881Speter                        svn_repos_t *repos,
2700251881Speter                        const char *path,
2701251881Speter                        svn_depth_t depth,
2702251881Speter                        svn_repos_authz_func_t authz_read_func,
2703251881Speter                        void *authz_read_baton,
2704251881Speter                        apr_pool_t *pool);
2705251881Speter
2706251881Speter/**
2707251881Speter * Similar to svn_repos_fs_get_locks2(), but with @a depth always
2708251881Speter * passed as svn_depth_infinity.
2709251881Speter *
2710251881Speter * @since New in 1.2.
2711251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
2712251881Speter */
2713251881SpeterSVN_DEPRECATED
2714251881Spetersvn_error_t *
2715251881Spetersvn_repos_fs_get_locks(apr_hash_t **locks,
2716251881Speter                       svn_repos_t *repos,
2717251881Speter                       const char *path,
2718251881Speter                       svn_repos_authz_func_t authz_read_func,
2719251881Speter                       void *authz_read_baton,
2720251881Speter                       apr_pool_t *pool);
2721251881Speter
2722251881Speter/** @} */
2723251881Speter
2724289180Speter/** @defgroup svn_repos_properties Versioned and Unversioned Properties
2725289180Speter *
2726289180Speter * Prop-changing and prop-reading wrappers for libsvn_fs routines.
2727289180Speter * @{
2728289180Speter */
2729289180Speter
2730251881Speter/**
2731251881Speter * Like svn_fs_change_rev_prop2(), but validate the name and value of the
2732251881Speter * property and invoke the @a repos's pre- and post-revprop-change hooks
2733251881Speter * around the change as specified by @a use_pre_revprop_change_hook and
2734251881Speter * @a use_post_revprop_change_hook (respectively).
2735251881Speter *
2736251881Speter * @a rev is the revision whose property to change, @a name is the
2737251881Speter * name of the property, and @a new_value is the new value of the
2738251881Speter * property.   If @a old_value_p is not @c NULL, then @a *old_value_p
2739251881Speter * is the expected current (preexisting) value of the property (or @c NULL
2740251881Speter * for "unset").  @a author is the authenticated username of the person
2741251881Speter * changing the property value, or NULL if not available.
2742251881Speter *
2743251881Speter * If @a authz_read_func is non-NULL, then use it (with @a
2744251881Speter * authz_read_baton) to validate the changed-paths associated with @a
2745251881Speter * rev.  If the revision contains any unreadable changed paths, then
2746251881Speter * return #SVN_ERR_AUTHZ_UNREADABLE.
2747251881Speter *
2748251881Speter * Validate @a name and @a new_value like the same way
2749251881Speter * svn_repos_fs_change_node_prop() does.
2750251881Speter *
2751251881Speter * Use @a pool for temporary allocations.
2752251881Speter *
2753251881Speter * @since New in 1.7.
2754251881Speter */
2755251881Spetersvn_error_t *
2756251881Spetersvn_repos_fs_change_rev_prop4(svn_repos_t *repos,
2757251881Speter                              svn_revnum_t rev,
2758251881Speter                              const char *author,
2759251881Speter                              const char *name,
2760251881Speter                              const svn_string_t *const *old_value_p,
2761251881Speter                              const svn_string_t *new_value,
2762289180Speter                              svn_boolean_t use_pre_revprop_change_hook,
2763289180Speter                              svn_boolean_t use_post_revprop_change_hook,
2764289180Speter                              svn_repos_authz_func_t authz_read_func,
2765251881Speter                              void *authz_read_baton,
2766251881Speter                              apr_pool_t *pool);
2767251881Speter
2768251881Speter/**
2769251881Speter * Similar to svn_repos_fs_change_rev_prop4(), but with @a old_value_p always
2770251881Speter * set to @c NULL.  (In other words, it is similar to
2771251881Speter * svn_fs_change_rev_prop().)
2772251881Speter *
2773251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
2774251881Speter * @since New in 1.5.
2775251881Speter */
2776251881SpeterSVN_DEPRECATED
2777251881Spetersvn_error_t *
2778251881Spetersvn_repos_fs_change_rev_prop3(svn_repos_t *repos,
2779251881Speter                              svn_revnum_t rev,
2780251881Speter                              const char *author,
2781251881Speter                              const char *name,
2782251881Speter                              const svn_string_t *new_value,
2783289180Speter                              svn_boolean_t use_pre_revprop_change_hook,
2784289180Speter                              svn_boolean_t use_post_revprop_change_hook,
2785289180Speter                              svn_repos_authz_func_t authz_read_func,
2786251881Speter                              void *authz_read_baton,
2787251881Speter                              apr_pool_t *pool);
2788251881Speter
2789251881Speter/**
2790251881Speter * Similar to svn_repos_fs_change_rev_prop3(), but with the @a
2791251881Speter * use_pre_revprop_change_hook and @a use_post_revprop_change_hook
2792251881Speter * always set to @c TRUE.
2793251881Speter *
2794251881Speter * @deprecated Provided for backward compatibility with the 1.4 API.
2795251881Speter */
2796251881SpeterSVN_DEPRECATED
2797251881Spetersvn_error_t *
2798251881Spetersvn_repos_fs_change_rev_prop2(svn_repos_t *repos,
2799251881Speter                              svn_revnum_t rev,
2800251881Speter                              const char *author,
2801251881Speter                              const char *name,
2802251881Speter                              const svn_string_t *new_value,
2803289180Speter                              svn_repos_authz_func_t authz_read_func,
2804251881Speter                              void *authz_read_baton,
2805251881Speter                              apr_pool_t *pool);
2806251881Speter
2807251881Speter/**
2808251881Speter * Similar to svn_repos_fs_change_rev_prop2(), but with the
2809251881Speter * @a authz_read_func parameter always NULL.
2810251881Speter *
2811251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
2812251881Speter */
2813251881SpeterSVN_DEPRECATED
2814251881Spetersvn_error_t *
2815251881Spetersvn_repos_fs_change_rev_prop(svn_repos_t *repos,
2816251881Speter                             svn_revnum_t rev,
2817251881Speter                             const char *author,
2818251881Speter                             const char *name,
2819251881Speter                             const svn_string_t *new_value,
2820251881Speter                             apr_pool_t *pool);
2821251881Speter
2822251881Speter
2823251881Speter
2824251881Speter/**
2825251881Speter * Set @a *value_p to the value of the property named @a propname on
2826251881Speter * revision @a rev in the filesystem opened in @a repos.  If @a rev
2827251881Speter * has no property by that name, set @a *value_p to zero.  Allocate
2828251881Speter * the result in @a pool.
2829251881Speter *
2830251881Speter * If @a authz_read_func is non-NULL, then use it (with @a
2831251881Speter * authz_read_baton) to validate the changed-paths associated with @a
2832251881Speter * rev.  If the changed-paths are all unreadable, then set @a *value_p
2833251881Speter * to zero unconditionally.  If only some of the changed-paths are
2834251881Speter * unreadable, then allow 'svn:author' and 'svn:date' propvalues to be
2835251881Speter * fetched, but return 0 for any other property.
2836251881Speter *
2837251881Speter * @since New in 1.1.
2838251881Speter */
2839251881Spetersvn_error_t *
2840251881Spetersvn_repos_fs_revision_prop(svn_string_t **value_p,
2841251881Speter                           svn_repos_t *repos,
2842251881Speter                           svn_revnum_t rev,
2843251881Speter                           const char *propname,
2844289180Speter                           svn_repos_authz_func_t authz_read_func,
2845251881Speter                           void *authz_read_baton,
2846251881Speter                           apr_pool_t *pool);
2847251881Speter
2848251881Speter
2849251881Speter/**
2850251881Speter * Set @a *table_p to the entire property list of revision @a rev in
2851251881Speter * filesystem opened in @a repos, as a hash table allocated in @a
2852251881Speter * pool.  The table maps <tt>char *</tt> property names to
2853251881Speter * #svn_string_t * values; the names and values are allocated in @a
2854251881Speter * pool.
2855251881Speter *
2856251881Speter * If @a authz_read_func is non-NULL, then use it (with @a
2857251881Speter * authz_read_baton) to validate the changed-paths associated with @a
2858251881Speter * rev.  If the changed-paths are all unreadable, then return an empty
2859251881Speter * hash. If only some of the changed-paths are unreadable, then return
2860251881Speter * an empty hash, except for 'svn:author' and 'svn:date' properties
2861251881Speter * (assuming those properties exist).
2862251881Speter *
2863251881Speter * @since New in 1.1.
2864251881Speter */
2865251881Spetersvn_error_t *
2866251881Spetersvn_repos_fs_revision_proplist(apr_hash_t **table_p,
2867251881Speter                               svn_repos_t *repos,
2868251881Speter                               svn_revnum_t rev,
2869289180Speter                               svn_repos_authz_func_t authz_read_func,
2870251881Speter                               void *authz_read_baton,
2871251881Speter                               apr_pool_t *pool);
2872251881Speter
2873251881Speter/** Validating wrapper for svn_fs_change_node_prop() (which see for
2874251881Speter * argument descriptions).
2875251881Speter *
2876251881Speter * If @a name's kind is not #svn_prop_regular_kind, return
2877251881Speter * #SVN_ERR_REPOS_BAD_ARGS.  If @a name is an "svn:" property, validate its
2878251881Speter * @a value and return SVN_ERR_BAD_PROPERTY_VALUE if it is invalid for the
2879251881Speter * property.
2880251881Speter *
2881289180Speter * @note Originally, the only properties validated were the "svn:" properties
2882289180Speter * #SVN_PROP_REVISION_LOG and #SVN_PROP_REVISION_DATE. For the current
2883289180Speter * validation rules see the private function svn_repos__validate_prop().
2884251881Speter */
2885251881Spetersvn_error_t *
2886251881Spetersvn_repos_fs_change_node_prop(svn_fs_root_t *root,
2887251881Speter                              const char *path,
2888251881Speter                              const char *name,
2889251881Speter                              const svn_string_t *value,
2890251881Speter                              apr_pool_t *pool);
2891251881Speter
2892289180Speter/**
2893289180Speter * Set @a *inherited_values to a depth-first ordered array of
2894289180Speter * #svn_prop_inherited_item_t * structures (the path_or_url members of
2895289180Speter * which are relative filesystem paths) representing the properties
2896289180Speter * inherited by @a path in @a root.  If no properties are inherited,
2897289180Speter * then set @a *inherited_values to an empty array.
2898289180Speter *
2899289180Speter * if @a propname is NULL then retrieve all explicit and/or inherited
2900289180Speter * properties.  Otherwise retrieve only the properties named @a propname.
2901289180Speter *
2902289180Speter * If optional @a authz_read_func is non-NULL, then use this function
2903289180Speter * (along with optional @a authz_read_baton) to check the readability
2904289180Speter * of each parent path from which properties are inherited. Silently omit
2905289180Speter * properties for unreadable parent paths.
2906289180Speter *
2907289180Speter * Allocate @a *inherited_props in @a result_pool.  Use @a scratch_pool for
2908289180Speter * temporary allocations.
2909289180Speter *
2910289180Speter * @since New in 1.8.
2911289180Speter */
2912289180Spetersvn_error_t *
2913289180Spetersvn_repos_fs_get_inherited_props(apr_array_header_t **inherited_props,
2914289180Speter                                 svn_fs_root_t *root,
2915289180Speter                                 const char *path,
2916289180Speter                                 const char *propname,
2917289180Speter                                 svn_repos_authz_func_t authz_read_func,
2918289180Speter                                 void *authz_read_baton,
2919289180Speter                                 apr_pool_t *result_pool,
2920289180Speter                                 apr_pool_t *scratch_pool);
2921289180Speter
2922251881Speter/** Validating wrapper for svn_fs_change_txn_prop() (which see for
2923251881Speter * argument descriptions).  See svn_repos_fs_change_txn_props() for more
2924251881Speter * information.
2925251881Speter */
2926251881Spetersvn_error_t *
2927251881Spetersvn_repos_fs_change_txn_prop(svn_fs_txn_t *txn,
2928251881Speter                             const char *name,
2929251881Speter                             const svn_string_t *value,
2930251881Speter                             apr_pool_t *pool);
2931251881Speter
2932251881Speter/** Validating wrapper for svn_fs_change_txn_props() (which see for
2933251881Speter * argument descriptions).  Validate properties and their values the
2934251881Speter * same way svn_repos_fs_change_node_prop() does.
2935251881Speter *
2936251881Speter * @since New in 1.5.
2937251881Speter */
2938251881Spetersvn_error_t *
2939251881Spetersvn_repos_fs_change_txn_props(svn_fs_txn_t *txn,
2940251881Speter                              const apr_array_header_t *props,
2941251881Speter                              apr_pool_t *pool);
2942251881Speter
2943289180Speter/** @} */
2944251881Speter
2945289180Speter
2946251881Speter/* ---------------------------------------------------------------*/
2947251881Speter
2948251881Speter/**
2949251881Speter * @defgroup svn_repos_inspection Data structures and editor things for \
2950251881Speter * repository inspection.
2951251881Speter * @{
2952251881Speter *
2953251881Speter * As it turns out, the svn_repos_replay2(), svn_repos_dir_delta2() and
2954251881Speter * svn_repos_begin_report3() interfaces can be extremely useful for
2955251881Speter * examining the repository, or more exactly, changes to the repository.
2956251881Speter * These drivers allows for differences between two trees to be
2957251881Speter * described using an editor.
2958251881Speter *
2959251881Speter * By using the editor obtained from svn_repos_node_editor() with one of
2960251881Speter * the drivers mentioned above, the description of how to transform one
2961251881Speter * tree into another can be used to build an in-memory linked-list tree,
2962251881Speter * which each node representing a repository node that was changed.
2963251881Speter */
2964251881Speter
2965251881Speter/** A node in the repository. */
2966251881Spetertypedef struct svn_repos_node_t
2967251881Speter{
2968251881Speter  /** Node type (file, dir, etc.) */
2969251881Speter  svn_node_kind_t kind;
2970251881Speter
2971251881Speter  /** How this node entered the node tree: 'A'dd, 'D'elete, 'R'eplace */
2972251881Speter  char action;
2973251881Speter
2974251881Speter  /** Were there any textual mods? (files only) */
2975251881Speter  svn_boolean_t text_mod;
2976251881Speter
2977251881Speter  /** Where there any property mods? */
2978251881Speter  svn_boolean_t prop_mod;
2979251881Speter
2980251881Speter  /** The name of this node as it appears in its parent's entries list */
2981251881Speter  const char *name;
2982251881Speter
2983251881Speter  /** The filesystem revision where this was copied from (if any) */
2984251881Speter  svn_revnum_t copyfrom_rev;
2985251881Speter
2986251881Speter  /** The filesystem path where this was copied from (if any) */
2987251881Speter  const char *copyfrom_path;
2988251881Speter
2989251881Speter  /** Pointer to the next sibling of this node */
2990251881Speter  struct svn_repos_node_t *sibling;
2991251881Speter
2992251881Speter  /** Pointer to the first child of this node */
2993251881Speter  struct svn_repos_node_t *child;
2994251881Speter
2995251881Speter  /** Pointer to the parent of this node */
2996251881Speter  struct svn_repos_node_t *parent;
2997251881Speter
2998251881Speter} svn_repos_node_t;
2999251881Speter
3000251881Speter
3001251881Speter/** Set @a *editor and @a *edit_baton to an editor that, when driven by
3002251881Speter * a driver such as svn_repos_replay2(), builds an <tt>svn_repos_node_t *</tt>
3003251881Speter * tree representing the delta from @a base_root to @a root in @a
3004251881Speter * repos's filesystem.
3005251881Speter *
3006251881Speter * The editor can also be driven by svn_repos_dir_delta2() or
3007251881Speter * svn_repos_begin_report3(), but unless you have special needs,
3008251881Speter * svn_repos_replay2() is preferred.
3009251881Speter *
3010251881Speter * Invoke svn_repos_node_from_baton() on @a edit_baton to obtain the root
3011251881Speter * node afterwards.
3012251881Speter *
3013251881Speter * Note that the delta includes "bubbled-up" directories; that is,
3014251881Speter * many of the directory nodes will have no prop_mods.
3015251881Speter *
3016251881Speter * Allocate the tree and its contents in @a node_pool; do all other
3017251881Speter * allocation in @a pool.
3018251881Speter */
3019251881Spetersvn_error_t *
3020251881Spetersvn_repos_node_editor(const svn_delta_editor_t **editor,
3021251881Speter                      void **edit_baton,
3022251881Speter                      svn_repos_t *repos,
3023251881Speter                      svn_fs_root_t *base_root,
3024251881Speter                      svn_fs_root_t *root,
3025251881Speter                      apr_pool_t *node_pool,
3026251881Speter                      apr_pool_t *pool);
3027251881Speter
3028251881Speter/** Return the root node of the linked-list tree generated by driving the
3029251881Speter * editor (associated with @a edit_baton) created by svn_repos_node_editor().
3030251881Speter * This is only really useful if used *after* the editor drive is completed.
3031251881Speter */
3032251881Spetersvn_repos_node_t *
3033251881Spetersvn_repos_node_from_baton(void *edit_baton);
3034251881Speter
3035289180Speter/**
3036289180Speter * Return repository format information for @a repos.
3037289180Speter *
3038289180Speter * Set @a *repos_format to the repository format number of @a repos, which is
3039289180Speter * an integer that increases when incompatible changes are made (such as
3040289180Speter * by #svn_repos_upgrade2).
3041289180Speter *
3042289180Speter * Set @a *supports_version to the version number of the minimum Subversion
3043289180Speter * GA release that can read and write @a repos; allocate it in
3044289180Speter * @a result_pool.  Use @a scratch_pool for temporary allocations.
3045289180Speter *
3046289180Speter * @see svn_fs_info_format, svn_repos_capabilities
3047289180Speter *
3048289180Speter * @since New in 1.9.
3049289180Speter */
3050289180Spetersvn_error_t *
3051289180Spetersvn_repos_info_format(int *repos_format,
3052289180Speter                      svn_version_t **supports_version,
3053289180Speter                      svn_repos_t *repos,
3054289180Speter                      apr_pool_t *result_pool,
3055289180Speter                      apr_pool_t *scratch_pool);
3056289180Speter
3057251881Speter/** @} */
3058251881Speter
3059251881Speter/* ---------------------------------------------------------------*/
3060251881Speter
3061251881Speter/**
3062289180Speter * @defgroup svn_repos_dump_load Dumping, loading and verifying filesystem data
3063251881Speter * @{
3064251881Speter *
3065251881Speter * The filesystem 'dump' format contains nothing but the abstract
3066251881Speter * structure of the filesystem -- independent of any internal node-id
3067251881Speter * schema or database back-end.  All of the data in the dumpfile is
3068251881Speter * acquired by public function calls into svn_fs.h.  Similarly, the
3069251881Speter * parser which reads the dumpfile is able to reconstruct the
3070251881Speter * filesystem using only public svn_fs.h routines.
3071251881Speter *
3072251881Speter * Thus the dump/load feature's main purpose is for *migrating* data
3073251881Speter * from one svn filesystem to another -- presumably two filesystems
3074251881Speter * which have different internal implementations.
3075251881Speter *
3076251881Speter * If you simply want to backup your filesystem, you're probably
3077251881Speter * better off using the built-in facilities of the DB backend (using
3078251881Speter * Berkeley DB's hot-backup feature, for example.)
3079251881Speter *
3080251881Speter * For a description of the dumpfile format, see
3081251881Speter * /trunk/notes/fs_dumprestore.txt.
3082251881Speter */
3083251881Speter
3084251881Speter/* The RFC822-style headers in our dumpfile format. */
3085251881Speter#define SVN_REPOS_DUMPFILE_MAGIC_HEADER            "SVN-fs-dump-format-version"
3086251881Speter#define SVN_REPOS_DUMPFILE_FORMAT_VERSION           3
3087251881Speter#define SVN_REPOS_DUMPFILE_FORMAT_VERSION_DELTAS    3
3088251881Speter#define SVN_REPOS_DUMPFILE_UUID                      "UUID"
3089251881Speter#define SVN_REPOS_DUMPFILE_CONTENT_LENGTH            "Content-length"
3090251881Speter
3091251881Speter#define SVN_REPOS_DUMPFILE_REVISION_NUMBER           "Revision-number"
3092251881Speter
3093251881Speter#define SVN_REPOS_DUMPFILE_NODE_PATH                 "Node-path"
3094251881Speter#define SVN_REPOS_DUMPFILE_NODE_KIND                 "Node-kind"
3095251881Speter#define SVN_REPOS_DUMPFILE_NODE_ACTION               "Node-action"
3096251881Speter#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_PATH        "Node-copyfrom-path"
3097251881Speter#define SVN_REPOS_DUMPFILE_NODE_COPYFROM_REV         "Node-copyfrom-rev"
3098251881Speter/** @since New in 1.6. */
3099251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5      "Text-copy-source-md5"
3100251881Speter/** @since New in 1.6. */
3101251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_SHA1     "Text-copy-source-sha1"
3102251881Speter#define SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_CHECKSUM \
3103251881Speter                                        SVN_REPOS_DUMPFILE_TEXT_COPY_SOURCE_MD5
3104251881Speter/** @since New in 1.6. */
3105251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5          "Text-content-md5"
3106251881Speter/** @since New in 1.6. */
3107251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_SHA1         "Text-content-sha1"
3108251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_CHECKSUM     \
3109251881Speter                                        SVN_REPOS_DUMPFILE_TEXT_CONTENT_MD5
3110251881Speter
3111251881Speter#define SVN_REPOS_DUMPFILE_PROP_CONTENT_LENGTH       "Prop-content-length"
3112251881Speter#define SVN_REPOS_DUMPFILE_TEXT_CONTENT_LENGTH       "Text-content-length"
3113251881Speter
3114251881Speter/** @since New in 1.1. */
3115251881Speter#define SVN_REPOS_DUMPFILE_PROP_DELTA                "Prop-delta"
3116251881Speter/** @since New in 1.1. */
3117251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA                "Text-delta"
3118251881Speter/** @since New in 1.6. */
3119251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5       "Text-delta-base-md5"
3120251881Speter/** @since New in 1.6. */
3121251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_SHA1      "Text-delta-base-sha1"
3122251881Speter/** @since New in 1.5. */
3123251881Speter#define SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_CHECKSUM  \
3124251881Speter                                        SVN_REPOS_DUMPFILE_TEXT_DELTA_BASE_MD5
3125251881Speter
3126289180Speter/** The different policies for processing the UUID in the dumpfile. */
3127289180Speterenum svn_repos_load_uuid
3128289180Speter{
3129289180Speter  /** only update uuid if the repos has no revisions. */
3130289180Speter  svn_repos_load_uuid_default,
3131289180Speter  /** never update uuid. */
3132289180Speter  svn_repos_load_uuid_ignore,
3133289180Speter  /** always update uuid. */
3134289180Speter  svn_repos_load_uuid_force
3135289180Speter};
3136289180Speter
3137289180Speter/** Callback type for use with svn_repos_verify_fs3().  @a revision
3138289180Speter * and @a verify_err are the details of a single verification failure
3139289180Speter * that occurred during the svn_repos_verify_fs3() call.  @a baton is
3140289180Speter * the same baton given to svn_repos_verify_fs3().  @a scratch_pool is
3141289180Speter * provided for the convenience of the implementor, who should not
3142289180Speter * expect it to live longer than a single callback call.
3143289180Speter *
3144289180Speter * @a verify_err will be cleared and becomes invalid after the callback
3145289180Speter * returns, use svn_error_dup() to preserve the error.  If a callback uses
3146289180Speter * @a verify_err as the return value or as a part of the return value, it
3147289180Speter * should also call svn_error_dup() for @a verify_err.  Implementors of this
3148289180Speter * callback are forbidden to call svn_error_clear() for @a verify_err.
3149289180Speter *
3150289180Speter * @see svn_repos_verify_fs3
3151289180Speter *
3152289180Speter * @since New in 1.9.
3153289180Speter */
3154289180Spetertypedef svn_error_t *(*svn_repos_verify_callback_t)(void *baton,
3155289180Speter                                                    svn_revnum_t revision,
3156289180Speter                                                    svn_error_t *verify_err,
3157289180Speter                                                    apr_pool_t *scratch_pool);
3158289180Speter
3159251881Speter/**
3160251881Speter * Verify the contents of the file system in @a repos.
3161251881Speter *
3162289180Speter * Verify the revisions from @a start_rev to @a end_rev inclusive.  If
3163289180Speter * @a start_rev is #SVN_INVALID_REVNUM, start at revision 0; if @a end_rev
3164289180Speter * is #SVN_INVALID_REVNUM, end at the head revision.  @a start_rev must be
3165289180Speter * older than or equal to @a end_rev.  If revision 0 is included in the
3166289180Speter * range, then also verify "global invariants" of the repository, as
3167289180Speter * described in svn_fs_verify().
3168251881Speter *
3169289180Speter * If @a check_normalization is @c TRUE, report any name collisions
3170289180Speter * within the same directory or svn:mergeinfo property where the names
3171289180Speter * differ only in character representation, but are otherwise
3172289180Speter * identical.
3173251881Speter *
3174289180Speter * If @a metadata_only is @c TRUE, backends that have a concept of separate
3175289180Speter * metadata verification will only perform that and skip the more expensive
3176289180Speter * file context reconstruction and verification.  For FSFS format 7+ and
3177289180Speter * FSX, this allows for a very fast check against external corruption.
3178251881Speter *
3179289180Speter * If @a verify_callback is not @c NULL, call it with @a verify_baton upon
3180289180Speter * receiving an FS-specific structure failure or a revision verification
3181289180Speter * failure.  Set @c revision callback argument to #SVN_INVALID_REVNUM or
3182289180Speter * to the revision number respectively.  Set @c verify_err to svn_error_t
3183289180Speter * describing the reason of the failure.  @c verify_err will be cleared
3184289180Speter * after the callback returns, use svn_error_dup() to preserve the error.
3185289180Speter * If @a verify_callback returns an error different from #SVN_NO_ERROR,
3186289180Speter * stop verifying the repository and immediately return the error from
3187289180Speter * @a verify_callback.
3188289180Speter *
3189289180Speter * If @a verify_callback is @c NULL, this function returns the first
3190289180Speter * encountered verification error or #SVN_NO_ERROR if there were no failures
3191289180Speter * during the verification.  Errors that prevent the verification process
3192289180Speter * from continuing, such as #SVN_ERR_CANCELLED, are returned immediately
3193289180Speter * and do not trigger an invocation of @a verify_callback.
3194289180Speter *
3195289180Speter * If @a notify_func is not null, then call it with @a notify_baton and
3196289180Speter * with a notification structure in which the fields are set as follows.
3197289180Speter * (For a warning that does not apply to a specific revision, the revision
3198289180Speter * number is #SVN_INVALID_REVNUM.)
3199289180Speter *
3200289180Speter *   For each FS-specific structure warning:
3201289180Speter *      @c action = svn_repos_notify_verify_rev_structure
3202289180Speter *      @c revision = the revision or #SVN_INVALID_REVNUM
3203289180Speter *
3204289180Speter *   For each revision verification warning:
3205289180Speter *      @c action = #svn_repos_notify_warning
3206289180Speter *      @c warning and @c warning_str fields set accordingly
3207289180Speter *        ### TODO: Set @c revision = the revision?
3208289180Speter *
3209289180Speter *   For each successfully verified revision:
3210289180Speter *      @c action = #svn_repos_notify_verify_rev_end
3211289180Speter *      @c revision = the revision
3212289180Speter *
3213289180Speter *   At the end:
3214289180Speter *      @c action = svn_repos_notify_verify_end
3215289180Speter *        ### Do we really need a callback to tell us the function we
3216289180Speter *            called has reached its end and is about to return?
3217289180Speter *        ### Not sent, currently, if a FS structure error is found.
3218289180Speter *
3219251881Speter * If @a cancel_func is not @c NULL, call it periodically with @a
3220251881Speter * cancel_baton as argument to see if the caller wishes to cancel the
3221251881Speter * verification.
3222251881Speter *
3223289180Speter * Use @a scratch_pool for temporary allocation.
3224289180Speter *
3225289180Speter * @see svn_repos_verify_callback_t
3226289180Speter *
3227289180Speter * @since New in 1.9.
3228289180Speter */
3229289180Spetersvn_error_t *
3230289180Spetersvn_repos_verify_fs3(svn_repos_t *repos,
3231289180Speter                     svn_revnum_t start_rev,
3232289180Speter                     svn_revnum_t end_rev,
3233289180Speter                     svn_boolean_t check_normalization,
3234289180Speter                     svn_boolean_t metadata_only,
3235289180Speter                     svn_repos_notify_func_t notify_func,
3236289180Speter                     void *notify_baton,
3237289180Speter                     svn_repos_verify_callback_t verify_callback,
3238289180Speter                     void *verify_baton,
3239289180Speter                     svn_cancel_func_t cancel,
3240289180Speter                     void *cancel_baton,
3241289180Speter                     apr_pool_t *scratch_pool);
3242289180Speter
3243289180Speter/**
3244289180Speter * Like svn_repos_verify_fs3(), but with @a verify_callback and
3245289180Speter * @a verify_baton set to @c NULL and with @a check_normalization
3246289180Speter * and @a metadata_only set to @c FALSE.
3247289180Speter *
3248251881Speter * @since New in 1.7.
3249289180Speter * @deprecated Provided for backward compatibility with the 1.8 API.
3250251881Speter */
3251289180SpeterSVN_DEPRECATED
3252251881Spetersvn_error_t *
3253251881Spetersvn_repos_verify_fs2(svn_repos_t *repos,
3254251881Speter                     svn_revnum_t start_rev,
3255251881Speter                     svn_revnum_t end_rev,
3256251881Speter                     svn_repos_notify_func_t notify_func,
3257251881Speter                     void *notify_baton,
3258251881Speter                     svn_cancel_func_t cancel,
3259251881Speter                     void *cancel_baton,
3260251881Speter                     apr_pool_t *scratch_pool);
3261251881Speter
3262251881Speter/**
3263251881Speter * Similar to svn_repos_verify_fs2(), but with a feedback_stream instead of
3264289180Speter * handling feedback via the notify_func handler.
3265251881Speter *
3266289180Speter * If @a feedback_stream is not @c NULL, write feedback to it (lines of
3267289180Speter * the form "* Verified revision %ld\n").
3268289180Speter *
3269251881Speter * @since New in 1.5.
3270251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
3271251881Speter */
3272251881SpeterSVN_DEPRECATED
3273251881Spetersvn_error_t *
3274251881Spetersvn_repos_verify_fs(svn_repos_t *repos,
3275251881Speter                    svn_stream_t *feedback_stream,
3276251881Speter                    svn_revnum_t start_rev,
3277251881Speter                    svn_revnum_t end_rev,
3278251881Speter                    svn_cancel_func_t cancel_func,
3279251881Speter                    void *cancel_baton,
3280251881Speter                    apr_pool_t *pool);
3281251881Speter
3282251881Speter/**
3283251881Speter * Dump the contents of the filesystem within already-open @a repos into
3284289180Speter * writable @a dumpstream.  If @a dumpstream is
3285251881Speter * @c NULL, this is effectively a primitive verify.  It is not complete,
3286289180Speter * however; see instead svn_repos_verify_fs3().
3287251881Speter *
3288289180Speter * Begin at revision @a start_rev, and dump every revision up through
3289289180Speter * @a end_rev.  If @a start_rev is #SVN_INVALID_REVNUM, start at revision
3290289180Speter * 0.  If @a end_rev is #SVN_INVALID_REVNUM, end at the head revision.
3291251881Speter *
3292251881Speter * If @a incremental is @c TRUE, the first revision dumped will be a diff
3293251881Speter * against the previous revision (usually it looks like a full dump of
3294251881Speter * the tree).
3295251881Speter *
3296251881Speter * If @a use_deltas is @c TRUE, output only node properties which have
3297251881Speter * changed relative to the previous contents, and output text contents
3298251881Speter * as svndiff data against the previous contents.  Regardless of how
3299251881Speter * this flag is set, the first revision of a non-incremental dump will
3300251881Speter * be done with full plain text.  A dump with @a use_deltas set cannot
3301251881Speter * be loaded by Subversion 1.0.x.
3302251881Speter *
3303362181Sdim * If @a include_revprops is @c TRUE, output the revision properties as
3304362181Sdim * well, otherwise omit them.
3305362181Sdim *
3306362181Sdim * If @a include_changes is @c TRUE, output the revision contents, i.e.
3307362181Sdim * tree and node changes.
3308362181Sdim *
3309289180Speter * If @a notify_func is not null, then call it with @a notify_baton and
3310289180Speter * with a notification structure in which the fields are set as follows.
3311289180Speter * (For a warning or error notification that does not apply to a specific
3312289180Speter * revision, the revision number is #SVN_INVALID_REVNUM.)
3313251881Speter *
3314289180Speter *   For each warning:
3315289180Speter *      @c action = #svn_repos_notify_warning
3316289180Speter *      @c warning and @c warning_str fields set accordingly
3317289180Speter *        ### TODO: Set @c revision = the revision or #SVN_INVALID_REVNUM?
3318289180Speter *
3319289180Speter *   For each successfully dumped revision:
3320289180Speter *      @c action = #svn_repos_notify_dump_rev_end
3321289180Speter *      @c revision = the revision
3322289180Speter *
3323289180Speter *   At the end:
3324289180Speter *      @c action = svn_repos_notify_verify_end
3325289180Speter *        ### Do we really need a callback to tell us the function we
3326289180Speter *            called has reached its end and is about to return?
3327289180Speter *
3328289180Speter *   At the end, if there were certain warnings previously:
3329289180Speter *      @c action = #svn_repos_notify_warning
3330289180Speter *      @c warning and @c warning_str fields set accordingly,
3331289180Speter *            reiterating the existence of previous warnings
3332289180Speter *        ### This is a presentation issue. Caller could do this itself.
3333289180Speter *
3334362181Sdim * If @a filter_func is not @c NULL, it is called for each node being
3335362181Sdim * dumped, allowing the caller to exclude it from dump.
3336362181Sdim *
3337251881Speter * If @a cancel_func is not @c NULL, it is called periodically with
3338251881Speter * @a cancel_baton as argument to see if the client wishes to cancel
3339251881Speter * the dump.
3340251881Speter *
3341289180Speter * Use @a scratch_pool for temporary allocation.
3342289180Speter *
3343362181Sdim * @since New in 1.10.
3344362181Sdim */
3345362181Sdimsvn_error_t *
3346362181Sdimsvn_repos_dump_fs4(svn_repos_t *repos,
3347362181Sdim                   svn_stream_t *stream,
3348362181Sdim                   svn_revnum_t start_rev,
3349362181Sdim                   svn_revnum_t end_rev,
3350362181Sdim                   svn_boolean_t incremental,
3351362181Sdim                   svn_boolean_t use_deltas,
3352362181Sdim                   svn_boolean_t include_revprops,
3353362181Sdim                   svn_boolean_t include_changes,
3354362181Sdim                   svn_repos_notify_func_t notify_func,
3355362181Sdim                   void *notify_baton,
3356362181Sdim                   svn_repos_dump_filter_func_t filter_func,
3357362181Sdim                   void *filter_baton,
3358362181Sdim                   svn_cancel_func_t cancel_func,
3359362181Sdim                   void *cancel_baton,
3360362181Sdim                   apr_pool_t *pool);
3361362181Sdim
3362362181Sdim/**
3363362181Sdim * Similar to svn_repos_dump_fs4(), but with @a include_revprops and
3364362181Sdim * @a include_changes both set to @c TRUE and @a filter_func and
3365362181Sdim * @a filter_baton set to @c NULL.
3366362181Sdim *
3367251881Speter * @since New in 1.7.
3368362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
3369251881Speter */
3370362181SdimSVN_DEPRECATED
3371251881Spetersvn_error_t *
3372251881Spetersvn_repos_dump_fs3(svn_repos_t *repos,
3373251881Speter                   svn_stream_t *dumpstream,
3374251881Speter                   svn_revnum_t start_rev,
3375251881Speter                   svn_revnum_t end_rev,
3376251881Speter                   svn_boolean_t incremental,
3377251881Speter                   svn_boolean_t use_deltas,
3378251881Speter                   svn_repos_notify_func_t notify_func,
3379251881Speter                   void *notify_baton,
3380251881Speter                   svn_cancel_func_t cancel_func,
3381251881Speter                   void *cancel_baton,
3382251881Speter                   apr_pool_t *scratch_pool);
3383251881Speter
3384251881Speter/**
3385251881Speter * Similar to svn_repos_dump_fs3(), but with a feedback_stream instead of
3386251881Speter * handling feedback via the notify_func handler
3387251881Speter *
3388251881Speter * @since New in 1.1.
3389251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
3390251881Speter */
3391251881SpeterSVN_DEPRECATED
3392251881Spetersvn_error_t *
3393251881Spetersvn_repos_dump_fs2(svn_repos_t *repos,
3394251881Speter                   svn_stream_t *dumpstream,
3395251881Speter                   svn_stream_t *feedback_stream,
3396251881Speter                   svn_revnum_t start_rev,
3397251881Speter                   svn_revnum_t end_rev,
3398251881Speter                   svn_boolean_t incremental,
3399251881Speter                   svn_boolean_t use_deltas,
3400251881Speter                   svn_cancel_func_t cancel_func,
3401251881Speter                   void *cancel_baton,
3402251881Speter                   apr_pool_t *pool);
3403251881Speter
3404251881Speter/**
3405251881Speter * Similar to svn_repos_dump_fs2(), but with the @a use_deltas
3406251881Speter * parameter always set to @c FALSE.
3407251881Speter *
3408251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
3409251881Speter */
3410251881SpeterSVN_DEPRECATED
3411251881Spetersvn_error_t *
3412251881Spetersvn_repos_dump_fs(svn_repos_t *repos,
3413251881Speter                  svn_stream_t *dumpstream,
3414251881Speter                  svn_stream_t *feedback_stream,
3415251881Speter                  svn_revnum_t start_rev,
3416251881Speter                  svn_revnum_t end_rev,
3417251881Speter                  svn_boolean_t incremental,
3418251881Speter                  svn_cancel_func_t cancel_func,
3419251881Speter                  void *cancel_baton,
3420251881Speter                  apr_pool_t *pool);
3421251881Speter
3422251881Speter
3423251881Speter/**
3424251881Speter * Read and parse dumpfile-formatted @a dumpstream, reconstructing
3425251881Speter * filesystem revisions in already-open @a repos, handling uuids in
3426251881Speter * accordance with @a uuid_action.  Use @a pool for all allocation.
3427251881Speter *
3428251881Speter * If the dumpstream contains copy history that is unavailable in the
3429251881Speter * repository, an error will be thrown.
3430251881Speter *
3431251881Speter * The repository's UUID will be updated iff
3432251881Speter *   the dumpstream contains a UUID and
3433251881Speter *   @a uuid_action is not equal to #svn_repos_load_uuid_ignore and
3434251881Speter *   either the repository contains no revisions or
3435251881Speter *          @a uuid_action is equal to #svn_repos_load_uuid_force.
3436251881Speter *
3437251881Speter * If the dumpstream contains no UUID, then @a uuid_action is
3438251881Speter * ignored and the repository UUID is not touched.
3439251881Speter *
3440251881Speter * @a start_rev and @a end_rev act as filters, the lower and upper
3441251881Speter * (inclusive) range values of revisions in @a dumpstream which will
3442251881Speter * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
3443251881Speter * which case no revision-based filtering occurs at all), or both are
3444251881Speter * valid revisions (where @a start_rev is older than or equivalent to
3445251881Speter * @a end_rev).
3446251881Speter *
3447251881Speter * If @a parent_dir is not NULL, then the parser will reparent all the
3448251881Speter * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
3449251881Speter * must be an existing directory in the repository.
3450251881Speter *
3451251881Speter * If @a use_pre_commit_hook is set, call the repository's pre-commit
3452251881Speter * hook before committing each loaded revision.
3453251881Speter *
3454251881Speter * If @a use_post_commit_hook is set, call the repository's
3455251881Speter * post-commit hook after committing each loaded revision.
3456251881Speter *
3457251881Speter * If @a validate_props is set, then validate Subversion revision and
3458251881Speter * node properties (those in the svn: namespace) against established
3459251881Speter * rules for those things.
3460251881Speter *
3461289180Speter * If @a ignore_dates is set, ignore any revision datestamps found in
3462289180Speter * @a dumpstream, allowing the revisions created by the load process
3463289180Speter * to be stamped as if they were newly created via the normal commit
3464289180Speter * process.
3465289180Speter *
3466362181Sdim * If @a normalize_props is set, attempt to normalize invalid Subversion
3467362181Sdim * revision and node properties (those in the svn: namespace) so that
3468362181Sdim * their values would follow the established rules for them.  For example,
3469362181Sdim * for such properties, typically the value must be in UTF-8 with LF
3470362181Sdim * line endings.
3471362181Sdim *
3472362181Sdim * @note The details or the performed normalizations are deliberately
3473362181Sdim * left unspecified and may change in the future.
3474362181Sdim *
3475251881Speter * If non-NULL, use @a notify_func and @a notify_baton to send notification
3476251881Speter * of events to the caller.
3477251881Speter *
3478251881Speter * If @a cancel_func is not @c NULL, it is called periodically with
3479251881Speter * @a cancel_baton as argument to see if the client wishes to cancel
3480251881Speter * the load.
3481251881Speter *
3482362181Sdim * @since New in 1.10.
3483362181Sdim */
3484362181Sdimsvn_error_t *
3485362181Sdimsvn_repos_load_fs6(svn_repos_t *repos,
3486362181Sdim                   svn_stream_t *dumpstream,
3487362181Sdim                   svn_revnum_t start_rev,
3488362181Sdim                   svn_revnum_t end_rev,
3489362181Sdim                   enum svn_repos_load_uuid uuid_action,
3490362181Sdim                   const char *parent_dir,
3491362181Sdim                   svn_boolean_t use_pre_commit_hook,
3492362181Sdim                   svn_boolean_t use_post_commit_hook,
3493362181Sdim                   svn_boolean_t validate_props,
3494362181Sdim                   svn_boolean_t ignore_dates,
3495362181Sdim                   svn_boolean_t normalize_props,
3496362181Sdim                   svn_repos_notify_func_t notify_func,
3497362181Sdim                   void *notify_baton,
3498362181Sdim                   svn_cancel_func_t cancel_func,
3499362181Sdim                   void *cancel_baton,
3500362181Sdim                   apr_pool_t *pool);
3501362181Sdim
3502362181Sdim/**
3503362181Sdim * Similar to svn_repos_load_fs6(), but with the @a normalize_props
3504362181Sdim * parameter always set to @c FALSE.
3505362181Sdim *
3506289180Speter * @since New in 1.9.
3507362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
3508289180Speter */
3509362181SdimSVN_DEPRECATED
3510289180Spetersvn_error_t *
3511289180Spetersvn_repos_load_fs5(svn_repos_t *repos,
3512289180Speter                   svn_stream_t *dumpstream,
3513289180Speter                   svn_revnum_t start_rev,
3514289180Speter                   svn_revnum_t end_rev,
3515289180Speter                   enum svn_repos_load_uuid uuid_action,
3516289180Speter                   const char *parent_dir,
3517289180Speter                   svn_boolean_t use_pre_commit_hook,
3518289180Speter                   svn_boolean_t use_post_commit_hook,
3519289180Speter                   svn_boolean_t validate_props,
3520289180Speter                   svn_boolean_t ignore_dates,
3521289180Speter                   svn_repos_notify_func_t notify_func,
3522289180Speter                   void *notify_baton,
3523289180Speter                   svn_cancel_func_t cancel_func,
3524289180Speter                   void *cancel_baton,
3525289180Speter                   apr_pool_t *pool);
3526289180Speter
3527289180Speter/** Similar to svn_repos_load_fs5(), but with @a ignore_dates
3528289180Speter * always passed as FALSE.
3529289180Speter *
3530251881Speter * @since New in 1.8.
3531289180Speter * @deprecated Provided for backward compatibility with the 1.8 API.
3532251881Speter */
3533289180SpeterSVN_DEPRECATED
3534251881Spetersvn_error_t *
3535251881Spetersvn_repos_load_fs4(svn_repos_t *repos,
3536251881Speter                   svn_stream_t *dumpstream,
3537251881Speter                   svn_revnum_t start_rev,
3538251881Speter                   svn_revnum_t end_rev,
3539251881Speter                   enum svn_repos_load_uuid uuid_action,
3540251881Speter                   const char *parent_dir,
3541251881Speter                   svn_boolean_t use_pre_commit_hook,
3542251881Speter                   svn_boolean_t use_post_commit_hook,
3543251881Speter                   svn_boolean_t validate_props,
3544251881Speter                   svn_repos_notify_func_t notify_func,
3545251881Speter                   void *notify_baton,
3546251881Speter                   svn_cancel_func_t cancel_func,
3547251881Speter                   void *cancel_baton,
3548251881Speter                   apr_pool_t *pool);
3549251881Speter
3550251881Speter/** Similar to svn_repos_load_fs4(), but with @a start_rev and @a
3551251881Speter * end_rev always passed as #SVN_INVALID_REVNUM.
3552251881Speter *
3553251881Speter * @since New in 1.7.
3554251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
3555251881Speter */
3556251881SpeterSVN_DEPRECATED
3557251881Spetersvn_error_t *
3558251881Spetersvn_repos_load_fs3(svn_repos_t *repos,
3559251881Speter                   svn_stream_t *dumpstream,
3560251881Speter                   enum svn_repos_load_uuid uuid_action,
3561251881Speter                   const char *parent_dir,
3562251881Speter                   svn_boolean_t use_pre_commit_hook,
3563251881Speter                   svn_boolean_t use_post_commit_hook,
3564251881Speter                   svn_boolean_t validate_props,
3565251881Speter                   svn_repos_notify_func_t notify_func,
3566251881Speter                   void *notify_baton,
3567251881Speter                   svn_cancel_func_t cancel_func,
3568251881Speter                   void *cancel_baton,
3569251881Speter                   apr_pool_t *pool);
3570251881Speter
3571251881Speter/**
3572251881Speter * Similar to svn_repos_load_fs3(), but with @a feedback_stream in
3573251881Speter * place of the #svn_repos_notify_func_t and baton and with
3574251881Speter * @a validate_props always FALSE.
3575251881Speter *
3576251881Speter * @since New in 1.2.
3577251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
3578251881Speter */
3579251881SpeterSVN_DEPRECATED
3580251881Spetersvn_error_t *
3581251881Spetersvn_repos_load_fs2(svn_repos_t *repos,
3582251881Speter                   svn_stream_t *dumpstream,
3583251881Speter                   svn_stream_t *feedback_stream,
3584251881Speter                   enum svn_repos_load_uuid uuid_action,
3585251881Speter                   const char *parent_dir,
3586251881Speter                   svn_boolean_t use_pre_commit_hook,
3587251881Speter                   svn_boolean_t use_post_commit_hook,
3588251881Speter                   svn_cancel_func_t cancel_func,
3589251881Speter                   void *cancel_baton,
3590251881Speter                   apr_pool_t *pool);
3591251881Speter
3592251881Speter/**
3593251881Speter * Similar to svn_repos_load_fs2(), but with @a use_pre_commit_hook and
3594251881Speter * @a use_post_commit_hook always @c FALSE.
3595251881Speter *
3596251881Speter * @deprecated Provided for backward compatibility with the 1.1 API.
3597251881Speter */
3598251881SpeterSVN_DEPRECATED
3599251881Spetersvn_error_t *
3600251881Spetersvn_repos_load_fs(svn_repos_t *repos,
3601251881Speter                  svn_stream_t *dumpstream,
3602251881Speter                  svn_stream_t *feedback_stream,
3603251881Speter                  enum svn_repos_load_uuid uuid_action,
3604251881Speter                  const char *parent_dir,
3605251881Speter                  svn_cancel_func_t cancel_func,
3606251881Speter                  void *cancel_baton,
3607251881Speter                  apr_pool_t *pool);
3608251881Speter
3609362181Sdim/**
3610362181Sdim * Read and parse dumpfile-formatted @a dumpstream, extracting the
3611362181Sdim * revision properties from it and apply them to the already-open
3612362181Sdim * @a repos.  Use @a scratch_pool for temporary allocations.
3613362181Sdim *
3614362181Sdim * If, after filtering by the @a start_rev and @a end_rev, the dumpstream
3615362181Sdim * contains revisions missing in @a repos, an error will be thrown.
3616362181Sdim *
3617362181Sdim * @a start_rev and @a end_rev act as filters, the lower and upper
3618362181Sdim * (inclusive) range values of revisions in @a dumpstream which will
3619362181Sdim * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
3620362181Sdim * which case no revision-based filtering occurs at all), or both are
3621362181Sdim * valid revisions (where @a start_rev is older than or equivalent to
3622362181Sdim * @a end_rev).
3623362181Sdim *
3624362181Sdim * If @a validate_props is set, then validate Subversion revision
3625362181Sdim * properties (those in the svn: namespace) against established
3626362181Sdim * rules for those things.
3627362181Sdim *
3628362181Sdim * If @a ignore_dates is set, ignore any revision datestamps found in
3629362181Sdim * @a dumpstream, keeping whatever timestamps the revisions currently
3630362181Sdim * have.
3631362181Sdim *
3632362181Sdim * If @a normalize_props is set, attempt to normalize invalid Subversion
3633362181Sdim * revision and node properties (those in the svn: namespace) so that
3634362181Sdim * their values would follow the established rules for them.  For example,
3635362181Sdim * for such properties, typically the value must be in UTF-8 with LF
3636362181Sdim * line endings.
3637362181Sdim *
3638362181Sdim * @note The details or the performed normalizations are deliberately
3639362181Sdim * left unspecified and may change in the future.
3640362181Sdim *
3641362181Sdim * If non-NULL, use @a notify_func and @a notify_baton to send notification
3642362181Sdim * of events to the caller.
3643362181Sdim *
3644362181Sdim * If @a cancel_func is not @c NULL, it is called periodically with
3645362181Sdim * @a cancel_baton as argument to see if the client wishes to cancel
3646362181Sdim * the load.
3647362181Sdim *
3648362181Sdim * @remark No repository hooks will be triggered.
3649362181Sdim *
3650362181Sdim * @since New in 1.10.
3651362181Sdim */
3652362181Sdimsvn_error_t *
3653362181Sdimsvn_repos_load_fs_revprops(svn_repos_t *repos,
3654362181Sdim                           svn_stream_t *dumpstream,
3655362181Sdim                           svn_revnum_t start_rev,
3656362181Sdim                           svn_revnum_t end_rev,
3657362181Sdim                           svn_boolean_t validate_props,
3658362181Sdim                           svn_boolean_t ignore_dates,
3659362181Sdim                           svn_boolean_t normalize_props,
3660362181Sdim                           svn_repos_notify_func_t notify_func,
3661362181Sdim                           void *notify_baton,
3662362181Sdim                           svn_cancel_func_t cancel_func,
3663362181Sdim                           void *cancel_baton,
3664362181Sdim                           apr_pool_t *scratch_pool);
3665251881Speter
3666251881Speter/**
3667251881Speter * A vtable that is driven by svn_repos_parse_dumpstream3().
3668251881Speter *
3669251881Speter * @since New in 1.8.
3670251881Speter */
3671251881Spetertypedef struct svn_repos_parse_fns3_t
3672251881Speter{
3673251881Speter  /** The parser has discovered a new "magic header" record within the
3674251881Speter   * parsing session represented by @a parse_baton.  The dump-format
3675251881Speter   * version number is @a version.
3676251881Speter   */
3677251881Speter  svn_error_t *(*magic_header_record)(int version,
3678251881Speter                                      void *parse_baton,
3679251881Speter                                      apr_pool_t *pool);
3680251881Speter
3681251881Speter  /** The parser has discovered a new uuid record within the parsing
3682251881Speter   * session represented by @a parse_baton.  The uuid's value is
3683251881Speter   * @a uuid, and it is allocated in @a pool.
3684251881Speter   */
3685251881Speter  svn_error_t *(*uuid_record)(const char *uuid,
3686251881Speter                              void *parse_baton,
3687251881Speter                              apr_pool_t *pool);
3688251881Speter
3689251881Speter  /** The parser has discovered a new revision record within the
3690251881Speter   * parsing session represented by @a parse_baton.  All the headers are
3691251881Speter   * placed in @a headers (allocated in @a pool), which maps <tt>const
3692251881Speter   * char *</tt> header-name ==> <tt>const char *</tt> header-value.
3693251881Speter   * The @a revision_baton received back (also allocated in @a pool)
3694251881Speter   * represents the revision.
3695251881Speter   */
3696251881Speter  svn_error_t *(*new_revision_record)(void **revision_baton,
3697251881Speter                                      apr_hash_t *headers,
3698251881Speter                                      void *parse_baton,
3699251881Speter                                      apr_pool_t *pool);
3700251881Speter
3701251881Speter  /** The parser has discovered a new node record within the current
3702251881Speter   * revision represented by @a revision_baton.  All the headers are
3703251881Speter   * placed in @a headers (as with @c new_revision_record), allocated in
3704251881Speter   * @a pool.  The @a node_baton received back is allocated in @a pool
3705251881Speter   * and represents the node.
3706251881Speter   */
3707251881Speter  svn_error_t *(*new_node_record)(void **node_baton,
3708251881Speter                                  apr_hash_t *headers,
3709251881Speter                                  void *revision_baton,
3710251881Speter                                  apr_pool_t *pool);
3711251881Speter
3712251881Speter  /** For a given @a revision_baton, set a property @a name to @a value. */
3713251881Speter  svn_error_t *(*set_revision_property)(void *revision_baton,
3714251881Speter                                        const char *name,
3715251881Speter                                        const svn_string_t *value);
3716251881Speter
3717251881Speter  /** For a given @a node_baton, set a property @a name to @a value. */
3718251881Speter  svn_error_t *(*set_node_property)(void *node_baton,
3719251881Speter                                    const char *name,
3720251881Speter                                    const svn_string_t *value);
3721251881Speter
3722251881Speter  /** For a given @a node_baton, delete property @a name. */
3723251881Speter  svn_error_t *(*delete_node_property)(void *node_baton, const char *name);
3724251881Speter
3725251881Speter  /** For a given @a node_baton, remove all properties. */
3726251881Speter  svn_error_t *(*remove_node_props)(void *node_baton);
3727251881Speter
3728289180Speter  /** For a given @a node_baton, set @a stream to a writable stream
3729289180Speter   * capable of receiving the node's fulltext.  The parser will write
3730289180Speter   * the fulltext to the stream and then close the stream to signal
3731289180Speter   * completion.
3732251881Speter   *
3733251881Speter   * If a @c NULL is returned instead of a stream, the vtable is
3734251881Speter   * indicating that no text is desired, and the parser will not
3735251881Speter   * attempt to send it.
3736251881Speter   */
3737251881Speter  svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3738251881Speter                               void *node_baton);
3739251881Speter
3740251881Speter  /** For a given @a node_baton, set @a handler and @a handler_baton
3741251881Speter   * to a window handler and baton capable of receiving a delta
3742289180Speter   * against the node's previous contents.  The parser will send all
3743289180Speter   * the windows of data to this handler, and will then send a NULL
3744289180Speter   * window to signal completion.
3745251881Speter   *
3746251881Speter   * If a @c NULL is returned instead of a handler, the vtable is
3747251881Speter   * indicating that no delta is desired, and the parser will not
3748251881Speter   * attempt to send it.
3749251881Speter   */
3750251881Speter  svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3751251881Speter                                  void **handler_baton,
3752251881Speter                                  void *node_baton);
3753251881Speter
3754251881Speter  /** The parser has reached the end of the current node represented by
3755251881Speter   * @a node_baton, it can be freed.
3756251881Speter   */
3757251881Speter  svn_error_t *(*close_node)(void *node_baton);
3758251881Speter
3759251881Speter  /** The parser has reached the end of the current revision
3760251881Speter   * represented by @a revision_baton.  In other words, there are no more
3761251881Speter   * changed nodes within the revision.  The baton can be freed.
3762251881Speter   */
3763251881Speter  svn_error_t *(*close_revision)(void *revision_baton);
3764251881Speter
3765251881Speter} svn_repos_parse_fns3_t;
3766251881Speter
3767251881Speter
3768251881Speter/**
3769251881Speter * Read and parse dumpfile-formatted @a stream, calling callbacks in
3770251881Speter * @a parse_fns/@a parse_baton, and using @a pool for allocations.
3771251881Speter *
3772251881Speter * If @a deltas_are_text is @c TRUE, handle text-deltas with the @a
3773251881Speter * set_fulltext callback.  This is useful when manipulating a dump
3774251881Speter * stream without loading it.  Otherwise handle text-deltas with the
3775251881Speter * @a apply_textdelta callback.
3776251881Speter *
3777251881Speter * If @a cancel_func is not @c NULL, it is called periodically with
3778251881Speter * @a cancel_baton as argument to see if the client wishes to cancel
3779251881Speter * the dump.
3780251881Speter *
3781251881Speter * This parser has built-in knowledge of the dumpfile format, but only
3782251881Speter * in a limited sense:
3783251881Speter *
3784251881Speter *    * it recognizes the "magic" format-version header.
3785251881Speter *
3786251881Speter *    * it recognizes the UUID header.
3787251881Speter *
3788251881Speter *    * it recognizes revision and node records by looking for either
3789251881Speter *      a REVISION_NUMBER or NODE_PATH headers.
3790251881Speter *
3791251881Speter *    * it recognizes the CONTENT-LENGTH headers, so it knows if and
3792251881Speter *      how to suck up the content body.
3793251881Speter *
3794251881Speter *    * it knows how to parse a content body into two parts:  props
3795251881Speter *      and text, and pass the pieces to the vtable.
3796251881Speter *
3797251881Speter * This is enough knowledge to make it easy on vtable implementors,
3798251881Speter * but still allow expansion of the format: most headers do not have
3799251881Speter * to be handled explicitly.
3800251881Speter *
3801289180Speter * ### [JAF] Wouldn't it be more efficient to support a start/end rev
3802289180Speter *     range here than only supporting it in receivers such as
3803289180Speter *     svn_repos_get_fs_build_parser4()? This parser could then skip over
3804289180Speter *     chunks of the input stream before the oldest required rev, and
3805289180Speter *     could stop reading entirely after the youngest required rev.
3806289180Speter *
3807251881Speter * @since New in 1.8.
3808362181Sdim
3809362181Sdim * @since Starting in 1.10, @a parse_fns may contain NULL pointers for
3810362181Sdim * those callbacks that the caller is not interested in.
3811251881Speter */
3812251881Spetersvn_error_t *
3813251881Spetersvn_repos_parse_dumpstream3(svn_stream_t *stream,
3814251881Speter                            const svn_repos_parse_fns3_t *parse_fns,
3815251881Speter                            void *parse_baton,
3816251881Speter                            svn_boolean_t deltas_are_text,
3817251881Speter                            svn_cancel_func_t cancel_func,
3818251881Speter                            void *cancel_baton,
3819251881Speter                            apr_pool_t *pool);
3820251881Speter
3821251881Speter
3822251881Speter/**
3823251881Speter * Set @a *parser and @a *parse_baton to a vtable parser which commits new
3824251881Speter * revisions to the fs in @a repos.  The constructed parser will treat
3825251881Speter * UUID records in a manner consistent with @a uuid_action.  Use @a pool
3826251881Speter * to operate on the fs.
3827251881Speter *
3828251881Speter * @a start_rev and @a end_rev act as filters, the lower and upper
3829289180Speter * (inclusive) range values of revisions which will
3830251881Speter * be loaded.  Either both of these values are #SVN_INVALID_REVNUM (in
3831251881Speter * which case no revision-based filtering occurs at all), or both are
3832251881Speter * valid revisions (where @a start_rev is older than or equivalent to
3833289180Speter * @a end_rev).  They refer to dump stream revision numbers rather than
3834289180Speter * committed revision numbers.
3835251881Speter *
3836289180Speter * If @a use_history is true, then when the parser encounters a node that
3837289180Speter * is added-with-history, it will require 'copy-from' history to exist in
3838289180Speter * the repository at the relative (adjusted) copy-from revision and path.
3839289180Speter * It will perform a copy from that source location, and will fail if no
3840289180Speter * suitable source exists there. If @a use_history is false, then it will
3841289180Speter * instead convert every copy to a plain add.
3842251881Speter *
3843289180Speter * ### The 'use_history=FALSE' case is unused and untested in Subversion.
3844289180Speter *     It seems to me it would not work with a deltas dumpfile (a driver
3845289180Speter *     that calls the @c apply_textdelta method), as it would not have
3846289180Speter *     access to the delta base text.
3847289180Speter *
3848289180Speter * If @a use_pre_commit_hook is set, call the repository's pre-commit
3849289180Speter * hook before committing each loaded revision.
3850289180Speter *
3851289180Speter * If @a use_post_commit_hook is set, call the repository's
3852289180Speter * post-commit hook after committing each loaded revision.
3853289180Speter *
3854251881Speter * If @a validate_props is set, then validate Subversion revision and
3855251881Speter * node properties (those in the svn: namespace) against established
3856251881Speter * rules for those things.
3857251881Speter *
3858289180Speter * If @a ignore_dates is set, ignore any revision datestamps found in
3859289180Speter * @a dumpstream, allowing the revisions created by the load process
3860289180Speter * to be stamped as if they were newly created via the normal commit
3861289180Speter * process.
3862289180Speter *
3863362181Sdim * If @a normalize_props is set, attempt to normalize invalid Subversion
3864362181Sdim * revision and node properties (those in the svn: namespace) so that
3865362181Sdim * their values would follow the established rules for them.  For example,
3866362181Sdim * for such properties, typically the value must be in UTF-8 with LF
3867362181Sdim * line endings.
3868362181Sdim *
3869362181Sdim * @note The details or the performed normalizations are deliberately
3870362181Sdim * left unspecified and may change in the future.
3871362181Sdim *
3872251881Speter * If @a parent_dir is not NULL, then the parser will reparent all the
3873251881Speter * loaded nodes, from root to @a parent_dir.  The directory @a parent_dir
3874251881Speter * must be an existing directory in the repository.
3875251881Speter *
3876362181Sdim * @since New in 1.10.
3877362181Sdim */
3878362181Sdimsvn_error_t *
3879362181Sdimsvn_repos_get_fs_build_parser6(const svn_repos_parse_fns3_t **parser,
3880362181Sdim                               void **parse_baton,
3881362181Sdim                               svn_repos_t *repos,
3882362181Sdim                               svn_revnum_t start_rev,
3883362181Sdim                               svn_revnum_t end_rev,
3884362181Sdim                               svn_boolean_t use_history,
3885362181Sdim                               svn_boolean_t validate_props,
3886362181Sdim                               enum svn_repos_load_uuid uuid_action,
3887362181Sdim                               const char *parent_dir,
3888362181Sdim                               svn_boolean_t use_pre_commit_hook,
3889362181Sdim                               svn_boolean_t use_post_commit_hook,
3890362181Sdim                               svn_boolean_t ignore_dates,
3891362181Sdim                               svn_boolean_t normalize_props,
3892362181Sdim                               svn_repos_notify_func_t notify_func,
3893362181Sdim                               void *notify_baton,
3894362181Sdim                               apr_pool_t *pool);
3895362181Sdim
3896362181Sdim/**
3897362181Sdim * Similar to svn_repos_get_fs_build_parser6(), but with the
3898362181Sdim * @a normalize_props parameter always set to @c FALSE.
3899362181Sdim *
3900289180Speter * @since New in 1.9.
3901362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
3902289180Speter */
3903362181SdimSVN_DEPRECATED
3904289180Spetersvn_error_t *
3905289180Spetersvn_repos_get_fs_build_parser5(const svn_repos_parse_fns3_t **parser,
3906289180Speter                               void **parse_baton,
3907289180Speter                               svn_repos_t *repos,
3908289180Speter                               svn_revnum_t start_rev,
3909289180Speter                               svn_revnum_t end_rev,
3910289180Speter                               svn_boolean_t use_history,
3911289180Speter                               svn_boolean_t validate_props,
3912289180Speter                               enum svn_repos_load_uuid uuid_action,
3913289180Speter                               const char *parent_dir,
3914289180Speter                               svn_boolean_t use_pre_commit_hook,
3915289180Speter                               svn_boolean_t use_post_commit_hook,
3916289180Speter                               svn_boolean_t ignore_dates,
3917289180Speter                               svn_repos_notify_func_t notify_func,
3918289180Speter                               void *notify_baton,
3919289180Speter                               apr_pool_t *pool);
3920289180Speter
3921289180Speter/**
3922289180Speter * Similar to svn_repos_get_fs_build_parser5(), but with the
3923289180Speter * @c use_pre_commit_hook, @c use_post_commit_hook and @c ignore_dates
3924289180Speter * arguments all false.
3925289180Speter *
3926251881Speter * @since New in 1.8.
3927289180Speter * @deprecated Provided for backward compatibility with the 1.8 API.
3928251881Speter */
3929289180SpeterSVN_DEPRECATED
3930251881Spetersvn_error_t *
3931251881Spetersvn_repos_get_fs_build_parser4(const svn_repos_parse_fns3_t **parser,
3932251881Speter                               void **parse_baton,
3933251881Speter                               svn_repos_t *repos,
3934251881Speter                               svn_revnum_t start_rev,
3935251881Speter                               svn_revnum_t end_rev,
3936251881Speter                               svn_boolean_t use_history,
3937251881Speter                               svn_boolean_t validate_props,
3938251881Speter                               enum svn_repos_load_uuid uuid_action,
3939251881Speter                               const char *parent_dir,
3940251881Speter                               svn_repos_notify_func_t notify_func,
3941251881Speter                               void *notify_baton,
3942251881Speter                               apr_pool_t *pool);
3943251881Speter
3944251881Speter
3945289180Speter
3946251881Speter/**
3947251881Speter * A vtable that is driven by svn_repos_parse_dumpstream2().
3948251881Speter * Similar to #svn_repos_parse_fns3_t except that it lacks
3949289180Speter * the magic_header_record callback.
3950251881Speter *
3951251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
3952251881Speter */
3953251881Spetertypedef struct svn_repos_parse_fns2_t
3954251881Speter{
3955251881Speter  /** Same as #svn_repos_parse_fns3_t.new_revision_record. */
3956251881Speter  svn_error_t *(*new_revision_record)(void **revision_baton,
3957251881Speter                                      apr_hash_t *headers,
3958251881Speter                                      void *parse_baton,
3959251881Speter                                      apr_pool_t *pool);
3960251881Speter  /** Same as #svn_repos_parse_fns3_t.uuid_record. */
3961251881Speter  svn_error_t *(*uuid_record)(const char *uuid,
3962251881Speter                              void *parse_baton,
3963251881Speter                              apr_pool_t *pool);
3964251881Speter  /** Same as #svn_repos_parse_fns3_t.new_node_record. */
3965251881Speter  svn_error_t *(*new_node_record)(void **node_baton,
3966251881Speter                                  apr_hash_t *headers,
3967251881Speter                                  void *revision_baton,
3968251881Speter                                  apr_pool_t *pool);
3969251881Speter  /** Same as #svn_repos_parse_fns3_t.set_revision_property. */
3970251881Speter  svn_error_t *(*set_revision_property)(void *revision_baton,
3971251881Speter                                        const char *name,
3972251881Speter                                        const svn_string_t *value);
3973251881Speter  /** Same as #svn_repos_parse_fns3_t.set_node_property. */
3974251881Speter  svn_error_t *(*set_node_property)(void *node_baton,
3975251881Speter                                    const char *name,
3976251881Speter                                    const svn_string_t *value);
3977251881Speter  /** Same as #svn_repos_parse_fns3_t.delete_node_property. */
3978251881Speter  svn_error_t *(*delete_node_property)(void *node_baton,
3979251881Speter                                       const char *name);
3980251881Speter  /** Same as #svn_repos_parse_fns3_t.remove_node_props. */
3981251881Speter  svn_error_t *(*remove_node_props)(void *node_baton);
3982251881Speter  /** Same as #svn_repos_parse_fns3_t.set_fulltext. */
3983251881Speter  svn_error_t *(*set_fulltext)(svn_stream_t **stream,
3984251881Speter                               void *node_baton);
3985251881Speter  /** Same as #svn_repos_parse_fns3_t.apply_textdelta. */
3986251881Speter  svn_error_t *(*apply_textdelta)(svn_txdelta_window_handler_t *handler,
3987251881Speter                                  void **handler_baton,
3988251881Speter                                  void *node_baton);
3989251881Speter  /** Same as #svn_repos_parse_fns3_t.close_node. */
3990251881Speter  svn_error_t *(*close_node)(void *node_baton);
3991251881Speter  /** Same as #svn_repos_parse_fns3_t.close_revision. */
3992251881Speter  svn_error_t *(*close_revision)(void *revision_baton);
3993251881Speter} svn_repos_parse_fns2_t;
3994251881Speter
3995251881Speter/** @deprecated Provided for backward compatibility with the 1.7 API. */
3996251881Spetertypedef svn_repos_parse_fns2_t svn_repos_parser_fns2_t;
3997251881Speter
3998251881Speter
3999251881Speter/**
4000251881Speter * A vtable that is driven by svn_repos_parse_dumpstream().
4001251881Speter * Similar to #svn_repos_parse_fns2_t except that it lacks
4002251881Speter * the delete_node_property and apply_textdelta callbacks.
4003251881Speter *
4004251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
4005251881Speter */
4006251881Spetertypedef struct svn_repos_parse_fns_t
4007251881Speter{
4008251881Speter  /** Same as #svn_repos_parse_fns2_t.new_revision_record. */
4009251881Speter  svn_error_t *(*new_revision_record)(void **revision_baton,
4010251881Speter                                      apr_hash_t *headers,
4011251881Speter                                      void *parse_baton,
4012251881Speter                                      apr_pool_t *pool);
4013251881Speter  /** Same as #svn_repos_parse_fns2_t.uuid_record. */
4014251881Speter  svn_error_t *(*uuid_record)(const char *uuid,
4015251881Speter                              void *parse_baton,
4016251881Speter                              apr_pool_t *pool);
4017251881Speter  /** Same as #svn_repos_parse_fns2_t.new_node_record. */
4018251881Speter  svn_error_t *(*new_node_record)(void **node_baton,
4019251881Speter                                  apr_hash_t *headers,
4020251881Speter                                  void *revision_baton,
4021251881Speter                                  apr_pool_t *pool);
4022251881Speter  /** Same as #svn_repos_parse_fns2_t.set_revision_property. */
4023251881Speter  svn_error_t *(*set_revision_property)(void *revision_baton,
4024251881Speter                                        const char *name,
4025251881Speter                                        const svn_string_t *value);
4026251881Speter  /** Same as #svn_repos_parse_fns2_t.set_node_property. */
4027251881Speter  svn_error_t *(*set_node_property)(void *node_baton,
4028251881Speter                                    const char *name,
4029251881Speter                                    const svn_string_t *value);
4030251881Speter  /** Same as #svn_repos_parse_fns2_t.remove_node_props. */
4031251881Speter  svn_error_t *(*remove_node_props)(void *node_baton);
4032251881Speter  /** Same as #svn_repos_parse_fns2_t.set_fulltext. */
4033251881Speter  svn_error_t *(*set_fulltext)(svn_stream_t **stream,
4034251881Speter                               void *node_baton);
4035251881Speter  /** Same as #svn_repos_parse_fns2_t.close_node. */
4036251881Speter  svn_error_t *(*close_node)(void *node_baton);
4037251881Speter  /** Same as #svn_repos_parse_fns2_t.close_revision. */
4038251881Speter  svn_error_t *(*close_revision)(void *revision_baton);
4039251881Speter} svn_repos_parser_fns_t;
4040251881Speter
4041251881Speter
4042251881Speter/**
4043251881Speter * Similar to svn_repos_parse_dumpstream3(), but uses the more limited
4044251881Speter * #svn_repos_parser_fns2_t vtable type.
4045251881Speter *
4046251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
4047251881Speter */
4048251881SpeterSVN_DEPRECATED
4049251881Spetersvn_error_t *
4050251881Spetersvn_repos_parse_dumpstream2(svn_stream_t *stream,
4051251881Speter                            const svn_repos_parser_fns2_t *parse_fns,
4052251881Speter                            void *parse_baton,
4053251881Speter                            svn_cancel_func_t cancel_func,
4054251881Speter                            void *cancel_baton,
4055251881Speter                            apr_pool_t *pool);
4056251881Speter
4057251881Speter/**
4058251881Speter * Similar to svn_repos_parse_dumpstream2(), but uses the more limited
4059251881Speter * #svn_repos_parser_fns_t vtable type.
4060251881Speter *
4061251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
4062251881Speter */
4063251881SpeterSVN_DEPRECATED
4064251881Spetersvn_error_t *
4065251881Spetersvn_repos_parse_dumpstream(svn_stream_t *stream,
4066251881Speter                           const svn_repos_parser_fns_t *parse_fns,
4067251881Speter                           void *parse_baton,
4068251881Speter                           svn_cancel_func_t cancel_func,
4069251881Speter                           void *cancel_baton,
4070251881Speter                           apr_pool_t *pool);
4071251881Speter
4072251881Speter/**
4073251881Speter * Similar to svn_repos_get_fs_build_parser4(), but with @a start_rev
4074251881Speter * and @a end_rev always passed as #SVN_INVALID_REVNUM, and yielding
4075251881Speter * the more limited svn_repos_parse_fns2_t.
4076251881Speter *
4077251881Speter * @since New in 1.7.
4078251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
4079251881Speter */
4080251881SpeterSVN_DEPRECATED
4081251881Spetersvn_error_t *
4082251881Spetersvn_repos_get_fs_build_parser3(const svn_repos_parse_fns2_t **parser,
4083251881Speter                               void **parse_baton,
4084251881Speter                               svn_repos_t *repos,
4085251881Speter                               svn_boolean_t use_history,
4086251881Speter                               svn_boolean_t validate_props,
4087251881Speter                               enum svn_repos_load_uuid uuid_action,
4088251881Speter                               const char *parent_dir,
4089251881Speter                               svn_repos_notify_func_t notify_func,
4090251881Speter                               void *notify_baton,
4091251881Speter                               apr_pool_t *pool);
4092251881Speter
4093251881Speter/**
4094251881Speter * Similar to svn_repos_get_fs_build_parser3(), but with @a outstream
4095251881Speter * in place if a #svn_repos_notify_func_t and baton and with
4096251881Speter * @a validate_props always FALSE.
4097251881Speter *
4098251881Speter * @since New in 1.1.
4099251881Speter * @deprecated Provided for backward compatibility with the 1.6 API.
4100251881Speter */
4101251881SpeterSVN_DEPRECATED
4102251881Spetersvn_error_t *
4103251881Spetersvn_repos_get_fs_build_parser2(const svn_repos_parse_fns2_t **parser,
4104251881Speter                               void **parse_baton,
4105251881Speter                               svn_repos_t *repos,
4106251881Speter                               svn_boolean_t use_history,
4107251881Speter                               enum svn_repos_load_uuid uuid_action,
4108251881Speter                               svn_stream_t *outstream,
4109251881Speter                               const char *parent_dir,
4110251881Speter                               apr_pool_t *pool);
4111251881Speter
4112251881Speter/**
4113251881Speter * Similar to svn_repos_get_fs_build_parser2(), but yields the more
4114251881Speter * limited svn_repos_parser_fns_t vtable type.
4115251881Speter *
4116251881Speter * @deprecated Provided for backward compatibility with the 1.0 API.
4117251881Speter */
4118251881SpeterSVN_DEPRECATED
4119251881Spetersvn_error_t *
4120251881Spetersvn_repos_get_fs_build_parser(const svn_repos_parser_fns_t **parser,
4121251881Speter                              void **parse_baton,
4122251881Speter                              svn_repos_t *repos,
4123251881Speter                              svn_boolean_t use_history,
4124251881Speter                              enum svn_repos_load_uuid uuid_action,
4125251881Speter                              svn_stream_t *outstream,
4126251881Speter                              const char *parent_dir,
4127251881Speter                              apr_pool_t *pool);
4128251881Speter
4129251881Speter
4130251881Speter/** @} */
4131251881Speter
4132251881Speter/** A data type which stores the authz information.
4133251881Speter *
4134251881Speter * @since New in 1.3.
4135251881Speter */
4136251881Spetertypedef struct svn_authz_t svn_authz_t;
4137251881Speter
4138251881Speter/**
4139362181Sdim * This should be called before any other authz function.
4140362181Sdim *
4141362181Sdim * @a pool must support multi-threaded access if the application will use
4142362181Sdim * authz from multiple threads.
4143362181Sdim *
4144362181Sdim * @since New in 1.10.
4145362181Sdim */
4146362181Sdimsvn_error_t *
4147362181Sdimsvn_repos_authz_initialize(apr_pool_t *pool);
4148362181Sdim
4149362181Sdim/**
4150362181Sdim * Callback for reporting authz file parsing warnings.
4151362181Sdim *
4152362181Sdim * The implementation may use @a scratch_pool for temporary
4153362181Sdim * allocations but should not assume that the lifetime of that pool
4154362181Sdim * persists past the callback invocation.
4155362181Sdim *
4156362181Sdim * The implementation @e must @e not clear @a error.
4157362181Sdim */
4158362181Sdimtypedef void (*svn_repos_authz_warning_func_t)(void *baton,
4159362181Sdim                                               const svn_error_t *error,
4160362181Sdim                                               apr_pool_t *scratch_pool);
4161362181Sdim
4162362181Sdim/**
4163251881Speter * Read authz configuration data from @a path (a dirent, an absolute file url
4164251881Speter * or a registry path) into @a *authz_p, allocated in @a pool.
4165251881Speter *
4166251881Speter * If @a groups_path (a dirent, an absolute file url, or a registry path) is
4167251881Speter * set, use the global groups parsed from it.
4168251881Speter *
4169251881Speter * If @a path or @a groups_path is not a valid authz rule file, then return
4170251881Speter * #SVN_ERR_AUTHZ_INVALID_CONFIG.  The contents of @a *authz_p is then
4171251881Speter * undefined.  If @a must_exist is TRUE, a missing authz or groups file
4172251881Speter * is also an error other than #SVN_ERR_AUTHZ_INVALID_CONFIG (exact error
4173251881Speter * depends on the access type).
4174251881Speter *
4175362181Sdim * For efficient access of in-repository authz, you may provide @a repos_hint
4176362181Sdim * which will be tried first and may remove the need to open a temporary
4177362181Sdim * repository instance.  Otherwise, set it to NULL and the repositories will
4178362181Sdim * be opened as needed.
4179362181Sdim *
4180362181Sdim * If the @a warning_func callback is not @c NULL, it is called
4181362181Sdim * (with @a warning_baton) to report non-fatal warnings emitted by
4182362181Sdim * the parser.
4183362181Sdim *
4184362181Sdim * @since New in 1.12.
4185362181Sdim */
4186362181Sdimsvn_error_t *
4187362181Sdimsvn_repos_authz_read4(svn_authz_t **authz_p,
4188362181Sdim                      const char *path,
4189362181Sdim                      const char *groups_path,
4190362181Sdim                      svn_boolean_t must_exist,
4191362181Sdim                      svn_repos_t *repos_hint,
4192362181Sdim                      svn_repos_authz_warning_func_t warning_func,
4193362181Sdim                      void *warning_baton,
4194362181Sdim                      apr_pool_t *result_pool,
4195362181Sdim                      apr_pool_t *scratch_pool);
4196362181Sdim
4197362181Sdim/**
4198362181Sdim * Similar to svn_repos_authz_read3(), but with @a warning_func and
4199362181Sdim * @a warning_baton set to @c NULL.
4200362181Sdim *
4201362181Sdim * @since New in 1.10.
4202362181Sdim * @deprecated Provided for backward compatibility with the 1.11 API.
4203362181Sdim */
4204362181SdimSVN_DEPRECATED
4205362181Sdimsvn_error_t *
4206362181Sdimsvn_repos_authz_read3(svn_authz_t **authz_p,
4207362181Sdim                      const char *path,
4208362181Sdim                      const char *groups_path,
4209362181Sdim                      svn_boolean_t must_exist,
4210362181Sdim                      svn_repos_t *repos_hint,
4211362181Sdim                      apr_pool_t *result_pool,
4212362181Sdim                      apr_pool_t *scratch_pool);
4213362181Sdim
4214362181Sdim/**
4215362181Sdim * Similar to svn_repos_authz_read3(), but with @a repos_hint set to @c NULL.
4216362181Sdim *
4217251881Speter * @since New in 1.8.
4218362181Sdim * @deprecated Provided for backward compatibility with the 1.9 API.
4219251881Speter */
4220362181SdimSVN_DEPRECATED
4221251881Spetersvn_error_t *
4222251881Spetersvn_repos_authz_read2(svn_authz_t **authz_p,
4223251881Speter                      const char *path,
4224251881Speter                      const char *groups_path,
4225251881Speter                      svn_boolean_t must_exist,
4226251881Speter                      apr_pool_t *pool);
4227251881Speter
4228251881Speter
4229251881Speter/**
4230251881Speter * Similar to svn_repos_authz_read2(), but with @a groups_path and @a
4231251881Speter * repos_root always passed as @c NULL.
4232251881Speter *
4233251881Speter * @since New in 1.3.
4234251881Speter * @deprecated Provided for backward compatibility with the 1.7 API.
4235251881Speter */
4236251881SpeterSVN_DEPRECATED
4237251881Spetersvn_error_t *
4238251881Spetersvn_repos_authz_read(svn_authz_t **authz_p,
4239251881Speter                     const char *file,
4240251881Speter                     svn_boolean_t must_exist,
4241251881Speter                     apr_pool_t *pool);
4242251881Speter
4243251881Speter/**
4244251881Speter * Read authz configuration data from @a stream into @a *authz_p,
4245362181Sdim * allocated in @a result_pool.
4246251881Speter *
4247251881Speter * If @a groups_stream is set, use the global groups parsed from it.
4248251881Speter *
4249362181Sdim * If the @a warning_func callback is not @c NULL, it is called
4250362181Sdim * (with @a warning_baton) to report non-fatal warnings emitted by
4251362181Sdim * the parser.
4252362181Sdim *
4253362181Sdim * Uses @a scratch_pool for temporary aloocations.
4254362181Sdim *
4255362181Sdim * @since New in 1.12.
4256362181Sdim */
4257362181Sdimsvn_error_t *
4258362181Sdimsvn_repos_authz_parse2(svn_authz_t **authz_p,
4259362181Sdim                       svn_stream_t *stream,
4260362181Sdim                       svn_stream_t *groups_stream,
4261362181Sdim                       svn_repos_authz_warning_func_t warning_func,
4262362181Sdim                       void *warning_baton,
4263362181Sdim                       apr_pool_t *result_pool,
4264362181Sdim                       apr_pool_t *scratch_pool);
4265362181Sdim
4266362181Sdim/**
4267362181Sdim * Similar to svn_repos_authz_parse2(), but with @a warning_func and
4268362181Sdim * @a warning_baton set to @c NULL.
4269362181Sdim *
4270251881Speter * @since New in 1.8.
4271362181Sdim * @deprecated Provided for backward compatibility with the 1.11 API.
4272251881Speter */
4273362181SdimSVN_DEPRECATED
4274251881Spetersvn_error_t *
4275251881Spetersvn_repos_authz_parse(svn_authz_t **authz_p,
4276251881Speter                      svn_stream_t *stream,
4277251881Speter                      svn_stream_t *groups_stream,
4278251881Speter                      apr_pool_t *pool);
4279251881Speter
4280251881Speter/**
4281251881Speter * Check whether @a user can access @a path in the repository @a
4282251881Speter * repos_name with the @a required_access.  @a authz lists the ACLs to
4283251881Speter * check against.  Set @a *access_granted to indicate if the requested
4284251881Speter * access is granted.
4285251881Speter *
4286251881Speter * If @a path is NULL, then check whether @a user has the @a
4287251881Speter * required_access anywhere in the repository.  Set @a *access_granted
4288251881Speter * to TRUE if at least one path is accessible with the @a
4289251881Speter * required_access.
4290251881Speter *
4291251881Speter * For compatibility with 1.6, and earlier, @a repos_name can be NULL
4292251881Speter * in which case it is equivalent to a @a repos_name of "".
4293251881Speter *
4294251881Speter * @note Presently, @a repos_name must byte-for-byte match the repos_name
4295251881Speter * specified in the authz file; it is treated as an opaque string, and not
4296251881Speter * as a dirent.
4297251881Speter *
4298251881Speter * @since New in 1.3.
4299251881Speter */
4300251881Spetersvn_error_t *
4301251881Spetersvn_repos_authz_check_access(svn_authz_t *authz,
4302251881Speter                             const char *repos_name,
4303251881Speter                             const char *path,
4304251881Speter                             const char *user,
4305251881Speter                             svn_repos_authz_access_t required_access,
4306251881Speter                             svn_boolean_t *access_granted,
4307251881Speter                             apr_pool_t *pool);
4308251881Speter
4309251881Speter
4310251881Speter
4311251881Speter/** Revision Access Levels
4312251881Speter *
4313251881Speter * Like most version control systems, access to versioned objects in
4314251881Speter * Subversion is determined on primarily path-based system.  Users either
4315251881Speter * do or don't have the ability to read a given path.
4316251881Speter *
4317251881Speter * However, unlike many version control systems where versioned objects
4318251881Speter * maintain their own distinct version information (revision numbers,
4319251881Speter * authors, log messages, change timestamps, etc.), Subversion binds
4320251881Speter * multiple paths changed as part of a single commit operation into a
4321251881Speter * set, calls the whole thing a revision, and hangs commit metadata
4322251881Speter * (author, date, log message, etc.) off of that revision.  So, commit
4323251881Speter * metadata is shared across all the paths changed as part of a given
4324251881Speter * commit operation.
4325251881Speter *
4326251881Speter * It is common (or, at least, we hope it is) for log messages to give
4327251881Speter * detailed information about changes made in the commit to which the log
4328251881Speter * message is attached.  Such information might include a mention of all
4329251881Speter * the files changed, what was changed in them, and so on.  But this
4330251881Speter * causes a problem when presenting information to readers who aren't
4331251881Speter * authorized to read every path in the repository.  Simply knowing that
4332251881Speter * a given path exists may be a security leak, even if the user can't see
4333251881Speter * the contents of the data located at that path.
4334251881Speter *
4335251881Speter * So Subversion does what it reasonably can to prevent the leak of this
4336251881Speter * information, and does so via a staged revision access policy.  A
4337251881Speter * reader can be said to have one of three levels of access to a given
4338251881Speter * revision's metadata, based solely on the reader's access rights to the
4339251881Speter * paths changed or copied in that revision:
4340251881Speter *
4341251881Speter *   'full access' -- Granted when the reader has access to all paths
4342251881Speter *      changed or copied in the revision, or when no paths were
4343251881Speter *      changed in the revision at all, this access level permits
4344251881Speter *      full visibility of all revision property names and values,
4345251881Speter *      and the full changed-paths information.
4346251881Speter *
4347251881Speter *   'no access' -- Granted when the reader does not have access to any
4348251881Speter *      paths changed or copied in the revision, this access level
4349251881Speter *      denies the reader access to all revision properties and all
4350251881Speter *      changed-paths information.
4351251881Speter *
4352251881Speter *   'partial access' -- Granted when the reader has access to at least
4353251881Speter *      one, but not all, of the paths changed or copied in the revision,
4354251881Speter *      this access level permits visibility of the svn:date and
4355251881Speter *      svn:author revision properties and only the paths of the
4356251881Speter *      changed-paths information to which the reader has access.
4357251881Speter *
4358251881Speter */
4359251881Speter
4360251881Speter
4361251881Speter/** An enum defining levels of revision access.
4362251881Speter *
4363251881Speter * @since New in 1.5.
4364251881Speter */
4365251881Spetertypedef enum svn_repos_revision_access_level_t
4366251881Speter{
4367251881Speter  /** no access allowed to the revision properties and all changed-paths
4368289180Speter   * information. */
4369251881Speter  svn_repos_revision_access_none,
4370251881Speter  /** access granted to some (svn:date and svn:author) revision properties and
4371251881Speter   * changed-paths information on paths the read has access to. */
4372251881Speter  svn_repos_revision_access_partial,
4373251881Speter  /** access granted to all revision properites and changed-paths
4374251881Speter   * information. */
4375251881Speter  svn_repos_revision_access_full
4376251881Speter}
4377251881Spetersvn_repos_revision_access_level_t;
4378251881Speter
4379251881Speter
4380251881Speter/**
4381251881Speter * Set @a access to the access level granted for @a revision in @a
4382251881Speter * repos, as determined by consulting the @a authz_read_func callback
4383251881Speter * function and its associated @a authz_read_baton.
4384251881Speter *
4385251881Speter * @a authz_read_func may be @c NULL, in which case @a access will be
4386251881Speter * set to #svn_repos_revision_access_full.
4387251881Speter *
4388251881Speter * @since New in 1.5.
4389251881Speter */
4390251881Spetersvn_error_t *
4391251881Spetersvn_repos_check_revision_access(svn_repos_revision_access_level_t *access_level,
4392251881Speter                                svn_repos_t *repos,
4393251881Speter                                svn_revnum_t revision,
4394251881Speter                                svn_repos_authz_func_t authz_read_func,
4395251881Speter                                void *authz_read_baton,
4396251881Speter                                apr_pool_t *pool);
4397251881Speter
4398251881Speter
4399251881Speter#ifdef __cplusplus
4400251881Speter}
4401251881Speter#endif /* __cplusplus */
4402251881Speter
4403251881Speter#endif /* SVN_REPOS_H */
4404