3 * ====================================================================
4 * Licensed to the Apache Software Foundation (ASF) under one
5 * or more contributor license agreements. See the NOTICE file
6 * distributed with this work for additional information
7 * regarding copyright ownership. The ASF licenses this file
8 * to you under the Apache License, Version 2.0 (the
9 * "License"); you may not use this file except in compliance
10 * with the License. You may obtain a copy of the License at
12 * http://www.apache.org/licenses/LICENSE-2.0
14 * Unless required by applicable law or agreed to in writing,
15 * software distributed under the License is distributed on an
16 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
17 * KIND, either express or implied. See the License for the
18 * specific language governing permissions and limitations
20 * ====================================================================
24 * @brief Interface to the Subversion filesystem.
31 #include <apr_pools.h>
33 #include <apr_tables.h>
34 #include <apr_time.h> /* for apr_time_t */
36 #include "svn_types.h"
37 #include "svn_string.h"
38 #include "svn_delta.h"
40 #include "svn_mergeinfo.h"
41 #include "svn_checksum.h"
46 #endif /* __cplusplus */
50 * Get libsvn_fs version information.
58 * @defgroup fs_handling Filesystem interaction subsystem
62 /* Opening and creating filesystems. */
65 /** An object representing a Subversion filesystem. */
66 typedef struct svn_fs_t svn_fs_t;
69 * @defgroup svn_fs_backend_names Built-in back-ends
70 * Constants defining the currently supported built-in filesystem backends.
75 /** @since New in 1.1. */
76 #define SVN_FS_TYPE_BDB "bdb"
77 /** @since New in 1.1. */
78 #define SVN_FS_TYPE_FSFS "fsfs"
81 * EXPERIMENTAL filesystem backend.
83 * It is not ready for general production use. Please consult the
84 * respective release notes on suggested usage scenarios.
88 #define SVN_FS_TYPE_FSX "fsx"
94 * @name Filesystem configuration options
97 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC "bdb-txn-nosync"
98 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE "bdb-log-autoremove"
100 /** Enable / disable text delta caching for a FSFS repository.
104 #define SVN_FS_CONFIG_FSFS_CACHE_DELTAS "fsfs-cache-deltas"
106 /** Enable / disable full-text caching for a FSFS repository.
110 #define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS "fsfs-cache-fulltexts"
112 /** Enable / disable revprop caching for a FSFS repository.
114 * "2" is allowed, too and means "enable if efficient",
115 * i.e. this will not create warning at runtime if there
116 * if no efficient support for revprop caching.
120 #define SVN_FS_CONFIG_FSFS_CACHE_REVPROPS "fsfs-cache-revprops"
122 /** Select the cache namespace. If you potentially share the cache with
123 * another FS object for the same repository, objects read through one FS
124 * will not need to be read again for the other. In most cases, that is
125 * a very desirable behavior and the default is, therefore, an empty
128 * If you want to be sure that your FS instance will actually read all
129 * requested data at least once, you need to specify a separate namespace
130 * for it. All repository verification code, for instance, should use
131 * some GUID here that is different each time you open an FS instance.
135 #define SVN_FS_CONFIG_FSFS_CACHE_NS "fsfs-cache-namespace"
137 /** Enable / disable the FSFS format 7 "block read" feature.
141 #define SVN_FS_CONFIG_FSFS_BLOCK_READ "fsfs-block-read"
143 /** String with a decimal representation of the FSFS format shard size.
144 * Zero ("0") means that a repository with linear layout should be created.
146 * This option will only be used during the creation of new repositories
147 * and is otherwise ignored.
151 #define SVN_FS_CONFIG_FSFS_SHARD_SIZE "fsfs-shard-size"
153 /** Enable / disable the FSFS format 7 logical addressing feature for a
154 * newly created repository.
156 * This option will only be used during the creation of new repositories
157 * and is otherwise ignored.
161 #define SVN_FS_CONFIG_FSFS_LOG_ADDRESSING "fsfs-log-addressing"
163 /* Note to maintainers: if you add further SVN_FS_CONFIG_FSFS_CACHE_* knobs,
164 update fs_fs.c:verify_as_revision_before_current_plus_plus(). */
166 /** Select the filesystem type. See also #svn_fs_type().
168 * @since New in 1.1. */
169 #define SVN_FS_CONFIG_FS_TYPE "fs-type"
171 /** Create repository format compatible with Subversion versions
176 #define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE "pre-1.4-compatible"
178 /** Create repository format compatible with Subversion versions
183 #define SVN_FS_CONFIG_PRE_1_5_COMPATIBLE "pre-1.5-compatible"
185 /** Create repository format compatible with Subversion versions
190 #define SVN_FS_CONFIG_PRE_1_6_COMPATIBLE "pre-1.6-compatible"
192 /** Create repository format compatible with Subversion versions
197 #define SVN_FS_CONFIG_PRE_1_8_COMPATIBLE "pre-1.8-compatible"
199 /** Create repository format compatible with the specified Subversion
200 * release. The value must be a version in the same format as
201 * #SVN_VER_NUMBER and cannot exceed the current version.
203 * @note The @c patch component would often be ignored, due to our forward
204 * compatibility promises within minor release lines. It should therefore
205 * usually be set to @c 0.
209 #define SVN_FS_CONFIG_COMPATIBLE_VERSION "compatible-version"
214 * Callers should invoke this function to initialize global state in
215 * the FS library before creating FS objects. If this function is
216 * invoked, no FS objects may be created in another thread at the same
217 * time as this invocation, and the provided @a pool must last longer
218 * than any FS object created subsequently.
220 * If this function is not called, the FS library will make a best
221 * effort to bootstrap a mutex for protecting data common to FS
222 * objects; however, there is a small window of failure. Also, a
223 * small amount of data will be leaked if the Subversion FS library is
224 * dynamically unloaded, and using the bdb FS can potentially segfault
225 * or invoke other undefined behavior if this function is not called
226 * with an appropriate pool (such as the pool the module was loaded into)
227 * when loaded dynamically.
229 * If this function is called multiple times before the pool passed to
230 * the first call is destroyed or cleared, the later calls will have
236 svn_fs_initialize(apr_pool_t *pool);
239 /** The type of a warning callback function. @a baton is the value specified
240 * in the call to svn_fs_set_warning_func(); the filesystem passes it through
241 * to the callback. @a err contains the warning message.
243 * The callback function should not clear the error that is passed to it;
244 * its caller should do that.
246 typedef void (*svn_fs_warning_callback_t)(void *baton, svn_error_t *err);
249 /** Provide a callback function, @a warning, that @a fs should use to
250 * report (non-fatal) errors. To print an error, the filesystem will call
251 * @a warning, passing it @a warning_baton and the error.
253 * By default, this is set to a function that will crash the process.
254 * Dumping to @c stderr or <tt>/dev/tty</tt> is not acceptable default
255 * behavior for server processes, since those may both be equivalent to
256 * <tt>/dev/null</tt>.
259 svn_fs_set_warning_func(svn_fs_t *fs,
260 svn_fs_warning_callback_t warning,
261 void *warning_baton);
266 * Create a new, empty Subversion filesystem, stored in the directory
267 * @a path, and return a pointer to it in @a *fs_p. @a path must not
268 * currently exist, but its parent must exist. If @a fs_config is not
269 * @c NULL, the options it contains modify the behavior of the
270 * filesystem. The interpretation of @a fs_config is specific to the
271 * filesystem back-end. The new filesystem may be closed by
272 * destroying @a pool.
274 * @note The lifetime of @a fs_config must not be shorter than @a
275 * pool's. It's a good idea to allocate @a fs_config from @a pool or
276 * one of its ancestors.
278 * If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
279 * value determines the filesystem type for the new filesystem.
280 * Currently defined values are:
282 * SVN_FS_TYPE_BDB Berkeley-DB implementation
283 * SVN_FS_TYPE_FSFS Native-filesystem implementation
284 * SVN_FS_TYPE_FSX Experimental filesystem implementation
286 * If @a fs_config is @c NULL or does not contain a value for
287 * #SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used.
288 * This will typically be BDB for version 1.1 and FSFS for later versions,
289 * though the caller should not rely upon any particular default if they
290 * wish to ensure that a filesystem of a specific type is created.
295 svn_fs_create(svn_fs_t **fs_p,
297 apr_hash_t *fs_config,
301 * Open a Subversion filesystem located in the directory @a path, and
302 * return a pointer to it in @a *fs_p. If @a fs_config is not @c
303 * NULL, the options it contains modify the behavior of the
304 * filesystem. The interpretation of @a fs_config is specific to the
305 * filesystem back-end. The opened filesystem will be allocated in
306 * @a result_pool may be closed by clearing or destroying that pool.
307 * Use @a scratch_pool for temporary allocations.
309 * @note The lifetime of @a fs_config must not be shorter than @a
310 * result_pool's. It's a good idea to allocate @a fs_config from
311 * @a result_pool or one of its ancestors.
313 * Only one thread may operate on any given filesystem object at once.
314 * Two threads may access the same filesystem simultaneously only if
315 * they open separate filesystem objects.
317 * @note You probably don't want to use this directly. Take a look at
318 * svn_repos_open3() instead.
323 svn_fs_open2(svn_fs_t **fs_p,
325 apr_hash_t *fs_config,
326 apr_pool_t *result_pool,
327 apr_pool_t *scratch_pool);
330 * Like svn_fs_open2(), but without @a scratch_pool.
332 * @deprecated Provided for backward compatibility with the 1.8 API.
337 svn_fs_open(svn_fs_t **fs_p,
339 apr_hash_t *fs_config,
342 /** The kind of action being taken by 'upgrade'.
346 typedef enum svn_fs_upgrade_notify_action_t
348 /** Packing of the revprop shard has completed.
349 * The number parameter is the shard being processed. */
350 svn_fs_upgrade_pack_revprops = 0,
352 /** Removal of the non-packed revprop shard is completed.
353 * The number parameter is the shard being processed */
354 svn_fs_upgrade_cleanup_revprops,
356 /** DB format has been set to the new value.
357 * The number parameter is the new format number. */
358 svn_fs_upgrade_format_bumped
359 } svn_fs_upgrade_notify_action_t;
361 /** The type of an upgrade notification function. @a number is specifc
362 * to @a action (see #svn_fs_upgrade_notify_action_t); @a action is the
363 * type of action being performed. @a baton is the corresponding baton
364 * for the notification function, and @a scratch_pool can be used for
365 * temporary allocations, but will be cleared between invocations.
369 typedef svn_error_t *(*svn_fs_upgrade_notify_t)(void *baton,
371 svn_fs_upgrade_notify_action_t action,
372 apr_pool_t *scratch_pool);
375 * Upgrade the Subversion filesystem located in the directory @a path
376 * to the latest version supported by this library. Return
377 * #SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the
378 * filesystem if the requested upgrade is not supported. Use
379 * @a scratch_pool for temporary allocations.
381 * The optional @a notify_func callback is only a general feedback that
382 * the operation is still in process but may be called in e.g. random shard
383 * order and more than once for the same shard.
385 * The optional @a cancel_func callback will be invoked as usual to allow
386 * the user to preempt this potentially lengthy operation.
388 * @note You probably don't want to use this directly. Take a look at
389 * svn_repos_upgrade2() instead.
391 * @note Canceling an upgrade is legal but may leave remnants of previous
392 * format data that may not be cleaned up automatically by later calls.
397 svn_fs_upgrade2(const char *path,
398 svn_fs_upgrade_notify_t notify_func,
400 svn_cancel_func_t cancel_func,
402 apr_pool_t *scratch_pool);
405 * Like svn_fs_upgrade2 but with notify_func, notify_baton, cancel_func
406 * and cancel_baton being set to NULL.
408 * @deprecated Provided for backward compatibility with the 1.8 API.
413 svn_fs_upgrade(const char *path,
417 * Callback function type for progress notification.
419 * @a revision is the number of the revision currently being processed,
420 * #SVN_INVALID_REVNUM if the current stage is not linked to any specific
421 * revision. @a baton is the callback baton.
425 typedef void (*svn_fs_progress_notify_func_t)(svn_revnum_t revision,
430 * Return, in @a *fs_type, a string identifying the back-end type of
431 * the Subversion filesystem located in @a path. Allocate @a *fs_type
434 * The string should be equal to one of the @c SVN_FS_TYPE_* defined
435 * constants, unless the filesystem is a new back-end type added in
436 * a later version of Subversion.
438 * In general, the type should make no difference in the filesystem's
439 * semantics, but there are a few situations (such as backups) where
445 svn_fs_type(const char **fs_type,
450 * Return the path to @a fs's repository, allocated in @a pool.
451 * @note This is just what was passed to svn_fs_create() or
452 * svn_fs_open() -- might be absolute, might not.
457 svn_fs_path(svn_fs_t *fs,
461 * Return a shallow copy of the configuration parameters used to open
462 * @a fs, allocated in @a pool. It may be @c NULL. The contents of the
463 * hash contents remains valid only for @a fs's lifetime.
465 * @note This is just what was passed to svn_fs_create() or svn_fs_open().
466 * You may not modify it.
471 svn_fs_config(svn_fs_t *fs,
475 * Delete the filesystem at @a path.
477 * @note: Deleting a filesystem that has an open svn_fs_t is not
478 * supported. Clear/destroy all pools used to create/open @a path.
484 svn_fs_delete_fs(const char *path,
487 /** The type of a hotcopy notification function. @a start_revision and
488 * @a end_revision indicate the copied revision range. @a baton is the
489 * corresponding baton for the notification function, and @a scratch_pool
490 * can be used for temporary allocations, but will be cleared between
493 typedef void (*svn_fs_hotcopy_notify_t)(void *baton,
494 svn_revnum_t start_revision,
495 svn_revnum_t end_revision,
496 apr_pool_t *scratch_pool);
499 * Copy a possibly live Subversion filesystem from @a src_path to
500 * @a dest_path. If @a clean is @c TRUE, perform cleanup on the
501 * source filesystem as part of the copy operation; currently, this
502 * means deleting copied, unused logfiles for a Berkeley DB source
505 * If @a incremental is TRUE, make an effort to avoid re-copying
506 * information already present in the destination where possible. If
507 * incremental hotcopy is not implemented, raise
508 * #SVN_ERR_UNSUPPORTED_FEATURE.
510 * For each revision range copied, @a notify_func will be called with
511 * staring and ending revision numbers (both inclusive and not necessarily
512 * different) and with the @a notify_baton. Currently, this notification
513 * is not triggered by the BDB backend. @a notify_func may be @c NULL
514 * if this notification is not required.
516 * The optional @a cancel_func callback will be invoked with
517 * @a cancel_baton as usual to allow the user to preempt this potentially
520 * Use @a scratch_pool for temporary allocations.
525 svn_fs_hotcopy3(const char *src_path,
526 const char *dest_path,
528 svn_boolean_t incremental,
529 svn_fs_hotcopy_notify_t notify_func,
531 svn_cancel_func_t cancel_func,
533 apr_pool_t *scratch_pool);
536 * Like svn_fs_hotcopy3(), but with @a notify_func and @a notify_baton
537 * always passed as @c NULL.
539 * @deprecated Provided for backward compatibility with the 1.8 API.
544 svn_fs_hotcopy2(const char *src_path,
545 const char *dest_path,
547 svn_boolean_t incremental,
548 svn_cancel_func_t cancel_func,
550 apr_pool_t *scratch_pool);
553 * Like svn_fs_hotcopy2(), but with @a incremental always passed as @c
554 * TRUE and without cancellation support.
556 * @deprecated Provided for backward compatibility with the 1.7 API.
561 svn_fs_hotcopy(const char *src_path,
562 const char *dest_path,
566 /** Perform any necessary non-catastrophic recovery on the Subversion
567 * filesystem located at @a path.
569 * If @a cancel_func is not @c NULL, it is called periodically with
570 * @a cancel_baton as argument to see if the client wishes to cancel
571 * recovery. BDB filesystems do not currently support cancellation.
573 * Do any necessary allocation within @a pool.
575 * For FSFS filesystems, recovery is currently limited to recreating
576 * the db/current file, and does not require exclusive access.
578 * For BDB filesystems, recovery requires exclusive access, and is
579 * described in detail below.
581 * After an unexpected server exit, due to a server crash or a system
582 * crash, a Subversion filesystem based on Berkeley DB needs to run
583 * recovery procedures to bring the database back into a consistent
584 * state and release any locks that were held by the deceased process.
585 * The recovery procedures require exclusive access to the database
586 * --- while they execute, no other process or thread may access the
589 * In a server with multiple worker processes, like Apache, if a
590 * worker process accessing the filesystem dies, you must stop the
591 * other worker processes, and run recovery. Then, the other worker
592 * processes can re-open the database and resume work.
594 * If the server exited cleanly, there is no need to run recovery, but
595 * there is no harm in it, either, and it take very little time. So
596 * it's a fine idea to run recovery when the server process starts,
597 * before it begins handling any requests.
602 svn_fs_recover(const char *path,
603 svn_cancel_func_t cancel_func,
609 * Callback for svn_fs_freeze().
613 typedef svn_error_t *(*svn_fs_freeze_func_t)(void *baton, apr_pool_t *pool);
616 * Take an exclusive lock on @a fs to prevent commits and then invoke
617 * @a freeze_func passing @a freeze_baton.
619 * @note @a freeze_func must not, directly or indirectly, call any function
620 * that attempts to take out a lock on the underlying repository. These
621 * include functions for packing, hotcopying, setting revprops and commits.
622 * Attempts to do so may result in a deadlock.
624 * @note The BDB backend doesn't implement this feature so most
625 * callers should not call this function directly but should use the
626 * higher level svn_repos_freeze() instead.
628 * @see svn_repos_freeze()
633 svn_fs_freeze(svn_fs_t *fs,
634 svn_fs_freeze_func_t freeze_func,
639 /** Subversion filesystems based on Berkeley DB.
641 * The following functions are specific to Berkeley DB filesystems.
643 * @defgroup svn_fs_bdb Berkeley DB filesystems
647 /** Register an error handling function for Berkeley DB error messages.
649 * @deprecated Provided for backward compatibility with the 1.2 API.
651 * Despite being first declared deprecated in Subversion 1.3, this API
652 * is redundant in versions 1.1 and 1.2 as well.
654 * Berkeley DB's error codes are seldom sufficiently informative to allow
655 * adequate troubleshooting. Berkeley DB provides extra messages through
656 * a callback function - if an error occurs, the @a handler will be called
657 * with two strings: an error message prefix, which will be zero, and
658 * an error message. @a handler might print it out, log it somewhere,
661 * Subversion 1.1 and later install their own handler internally, and
662 * wrap the messages from Berkeley DB into the standard svn_error_t object,
663 * making any information gained through this interface redundant.
665 * It is only worth using this function if your program will be used
666 * with Subversion 1.0.
668 * This function connects to the Berkeley DB @c DBENV->set_errcall interface.
669 * Since that interface supports only a single callback, Subversion's internal
670 * callback is registered with Berkeley DB, and will forward notifications to
671 * a user provided callback after performing its own processing.
675 svn_fs_set_berkeley_errcall(svn_fs_t *fs,
676 void (*handler)(const char *errpfx,
679 /** Set @a *logfiles to an array of <tt>const char *</tt> log file names
680 * of Berkeley DB-based Subversion filesystem.
682 * If @a only_unused is @c TRUE, set @a *logfiles to an array which
683 * contains only the names of Berkeley DB log files no longer in use
684 * by the filesystem. Otherwise, all log files (used and unused) are
687 * This function wraps the Berkeley DB 'log_archive' function
688 * called by the db_archive binary. Repository administrators may
689 * want to run this function periodically and delete the unused log
690 * files, as a way of reclaiming disk space.
693 svn_fs_berkeley_logfiles(apr_array_header_t **logfiles,
695 svn_boolean_t only_unused,
700 * The following functions are similar to their generic counterparts.
702 * In Subversion 1.2 and earlier, they only work on Berkeley DB filesystems.
703 * In Subversion 1.3 and later, they perform largely as aliases for their
704 * generic counterparts (with the exception of recover, which only gained
705 * a generic counterpart in 1.5).
707 * @defgroup svn_fs_bdb_deprecated Berkeley DB filesystem compatibility
711 /** @deprecated Provided for backward compatibility with the 1.0 API. */
714 svn_fs_new(apr_hash_t *fs_config,
717 /** @deprecated Provided for backward compatibility with the 1.0 API. */
720 svn_fs_create_berkeley(svn_fs_t *fs,
723 /** @deprecated Provided for backward compatibility with the 1.0 API. */
726 svn_fs_open_berkeley(svn_fs_t *fs,
729 /** @deprecated Provided for backward compatibility with the 1.0 API. */
732 svn_fs_berkeley_path(svn_fs_t *fs,
735 /** @deprecated Provided for backward compatibility with the 1.0 API. */
738 svn_fs_delete_berkeley(const char *path,
741 /** @deprecated Provided for backward compatibility with the 1.0 API. */
744 svn_fs_hotcopy_berkeley(const char *src_path,
745 const char *dest_path,
746 svn_boolean_t clean_logs,
749 /** @deprecated Provided for backward compatibility with the 1.4 API. */
752 svn_fs_berkeley_recover(const char *path,
759 /** Filesystem Access Contexts.
763 * At certain times, filesystem functions need access to temporary
764 * user data. For example, which user is changing a file? If the
765 * file is locked, has an appropriate lock-token been supplied?
767 * This temporary user data is stored in an "access context" object,
768 * and the access context is then connected to the filesystem object.
769 * Whenever a filesystem function requires information, it can pull
770 * things out of the context as needed.
772 * @defgroup svn_fs_access_ctx Filesystem access contexts
776 /** An opaque object representing temporary user data. */
777 typedef struct svn_fs_access_t svn_fs_access_t;
780 /** Set @a *access_ctx to a new #svn_fs_access_t object representing
781 * @a username, allocated in @a pool. @a username is presumed to
782 * have been authenticated by the caller.
784 * Make a deep copy of @a username.
787 svn_fs_create_access(svn_fs_access_t **access_ctx,
788 const char *username,
792 /** Associate @a access_ctx with an open @a fs.
794 * This function can be run multiple times on the same open
795 * filesystem, in order to change the filesystem access context for
796 * different filesystem operations. Pass a NULL value for @a
797 * access_ctx to disassociate the current access context from the
801 svn_fs_set_access(svn_fs_t *fs,
802 svn_fs_access_t *access_ctx);
805 /** Set @a *access_ctx to the current @a fs access context, or NULL if
806 * there is no current fs access context.
809 svn_fs_get_access(svn_fs_access_t **access_ctx,
813 /** Accessors for the access context: */
815 /** Set @a *username to the name represented by @a access_ctx. */
817 svn_fs_access_get_username(const char **username,
818 svn_fs_access_t *access_ctx);
821 /** Push a lock-token @a token associated with path @a path into the
822 * context @a access_ctx. The context remembers all tokens it
823 * receives, and makes them available to fs functions. The token and
824 * path are not duplicated into @a access_ctx's pool; make sure the
825 * token's lifetime is at least as long as @a access_ctx.
827 * @since New in 1.6. */
829 svn_fs_access_add_lock_token2(svn_fs_access_t *access_ctx,
834 * Same as svn_fs_access_add_lock_token2(), but with @a path set to value 1.
836 * @deprecated Provided for backward compatibility with the 1.5 API.
840 svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx,
846 /** Filesystem Nodes and Node-Revisions.
848 * In a Subversion filesystem, a `node' corresponds roughly to an
849 * `inode' in a Unix filesystem:
850 * - A node is either a file or a directory.
851 * - A node's contents change over time.
852 * - When you change a node's contents, it's still the same node; it's
853 * just been changed. So a node's identity isn't bound to a specific
855 * - If you rename a node, it's still the same node, just under a
856 * different name. So a node's identity isn't bound to a particular
859 * A `node revision' refers to one particular version of a node's contents,
860 * that existed over a specific period of time (one or more repository
861 * revisions). Changing a node's contents always creates a new revision of
862 * that node, which is to say creates a new `node revision'. Once created,
863 * a node revision's contents never change.
865 * When we create a node, its initial contents are the initial revision of
866 * the node. As users make changes to the node over time, we create new
867 * revisions of that same node. When a user commits a change that deletes
868 * a file from the filesystem, we don't delete the node, or any revision
869 * of it --- those stick around to allow us to recreate prior revisions of
870 * the filesystem. Instead, we just remove the reference to the node
871 * from the directory.
873 * Each node revision is a part of exactly one node, and appears only once
874 * in the history of that node. It is uniquely identified by a node
875 * revision id, #svn_fs_id_t. Its node revision id also identifies which
876 * node it is a part of.
878 * @note: Often when we talk about `the node' within the context of a single
879 * revision (or transaction), we implicitly mean `the node as it appears in
880 * this revision (or transaction)', or in other words `the node revision'.
882 * @note: Commonly, a node revision will have the same content as some other
883 * node revisions in the same node and in different nodes. The FS libraries
884 * allow different node revisions to share the same data without storing a
885 * separate copy of the data.
887 * @defgroup svn_fs_nodes Filesystem nodes
891 /** Defines the possible ways two arbitrary (root, path)-pairs may be
896 typedef enum svn_fs_node_relation_t
898 /** The (root, path)-pairs are not related, i.e. none of the other cases
899 * apply. If the roots refer to different @c svn_fs_t instances, then
900 * they are always considered unrelated - even if the underlying
901 * repository is the same.
903 svn_fs_node_unrelated = 0,
905 /** No changes have been made between the (root, path)-pairs, i.e. they
906 * have the same (relative) nodes in their sub-trees, corresponding sub-
907 * tree nodes have the same contents as well as properties and report the
908 * same "created-path" and "created-rev" data. This implies having a
911 * However, due to efficiency considerations, the FS implementation may
912 * report some combinations as merely having a common ancestor
913 * (@a svn_fs_node_common_ancestor) instead of actually being unchanged.
915 svn_fs_node_unchanged,
917 /** The (root, path)-pairs have a common ancestor (which may be one of
918 * them) but there are changes between them, i.e. they don't fall into
919 * the @c svn_fs_node_unchanged category.
921 * Due to efficiency considerations, the FS implementation may falsely
922 * classify some combinations as merely having a common ancestor that
923 * are, in fact, unchanged (@a svn_fs_node_unchanged).
925 svn_fs_node_common_ancestor
927 } svn_fs_node_relation_t;
929 /** An object representing a node-revision id. */
930 typedef struct svn_fs_id_t svn_fs_id_t;
933 /** Return -1, 0, or 1 if node revisions @a a and @a b are respectively
934 * unrelated, equivalent, or otherwise related (part of the same node).
936 * @note Consider using the more expressive #svn_fs_node_relation() instead.
938 * @see #svn_fs_node_relation
941 svn_fs_compare_ids(const svn_fs_id_t *a,
942 const svn_fs_id_t *b);
946 /** Return TRUE if node revisions @a id1 and @a id2 are related (part of the
947 * same node), else return FALSE.
949 * @note Consider using the more expressive #svn_fs_node_relation() instead.
951 * @see #svn_fs_node_relation
954 svn_fs_check_related(const svn_fs_id_t *id1,
955 const svn_fs_id_t *id2);
959 * @note This function is not guaranteed to work with all filesystem
960 * types. There is currently no un-deprecated equivalent; contact the
961 * Subversion developers if you have a need for it.
963 * @deprecated Provided for backward compatibility with the 1.0 API.
967 svn_fs_parse_id(const char *data,
972 /** Return a Subversion string containing the unparsed form of the
973 * node revision id @a id. Allocate the string containing the
974 * unparsed form in @a pool.
977 svn_fs_unparse_id(const svn_fs_id_t *id,
983 /** Filesystem Transactions.
985 * To make a change to a Subversion filesystem:
986 * - Create a transaction object, using svn_fs_begin_txn().
987 * - Call svn_fs_txn_root(), to get the transaction's root directory.
988 * - Make whatever changes you like in that tree.
989 * - Commit the transaction, using svn_fs_commit_txn().
991 * The filesystem implementation guarantees that your commit will
993 * - succeed completely, so that all of the changes are committed to
994 * create a new revision of the filesystem, or
995 * - fail completely, leaving the filesystem unchanged.
997 * Until you commit the transaction, any changes you make are
998 * invisible. Only when your commit succeeds do they become visible
999 * to the outside world, as a new revision of the filesystem.
1001 * If you begin a transaction, and then decide you don't want to make
1002 * the change after all (say, because your net connection with the
1003 * client disappeared before the change was complete), you can call
1004 * svn_fs_abort_txn(), to cancel the entire transaction; this
1005 * leaves the filesystem unchanged.
1007 * The only way to change the contents of files or directories, or
1008 * their properties, is by making a transaction and creating a new
1009 * revision, as described above. Once a revision has been committed, it
1010 * never changes again; the filesystem interface provides no means to
1011 * go back and edit the contents of an old revision. Once history has
1012 * been recorded, it is set in stone. Clients depend on this property
1013 * to do updates and commits reliably; proxies depend on this property
1014 * to cache changes accurately; and so on.
1016 * There are two kinds of nodes in the filesystem: mutable, and
1017 * immutable. Revisions in the filesystem consist entirely of
1018 * immutable nodes, whose contents never change. A transaction in
1019 * progress, which the user is still constructing, uses mutable nodes
1020 * for those nodes which have been changed so far, and refers to
1021 * immutable nodes from existing revisions for portions of the tree
1022 * which haven't been changed yet in that transaction.
1024 * Immutable nodes, as part of revisions, never refer to mutable
1025 * nodes, which are part of uncommitted transactions. Mutable nodes
1026 * may refer to immutable nodes, or other mutable nodes.
1028 * Note that the terms "immutable" and "mutable" describe whether or
1029 * not the nodes have been changed as part of a transaction --- not
1030 * the permissions on the nodes they refer to. Even if you aren't
1031 * authorized to modify the filesystem's root directory, you might be
1032 * authorized to change some descendant of the root; doing so would
1033 * create a new mutable copy of the root directory. Mutability refers
1034 * to the role of the node: part of an existing revision, or part of a
1035 * new one. This is independent of your authorization to make changes
1038 * Transactions are actually persistent objects, stored in the
1039 * database. You can open a filesystem, begin a transaction, and
1040 * close the filesystem, and then a separate process could open the
1041 * filesystem, pick up the same transaction, and continue work on it.
1042 * When a transaction is successfully committed, it is removed from
1045 * Every transaction is assigned a name. You can open a transaction
1046 * by name, and resume work on it, or find out the name of a
1047 * transaction you already have open. You can also list all the
1048 * transactions currently present in the database.
1050 * You may assign properties to transactions; these are name/value
1051 * pairs. When you commit a transaction, all of its properties become
1052 * unversioned revision properties of the new revision. (There is one
1053 * exception: the svn:date property will be automatically set on new
1054 * transactions to the date that the transaction was created, and can
1055 * be overwritten when the transaction is committed by the current
1056 * time; see svn_fs_commit_txn.)
1058 * Transaction names are guaranteed to contain only letters (upper-
1059 * and lower-case), digits, `-', and `.', from the ASCII character
1062 * The Subversion filesystem will make a best effort to not reuse
1063 * transaction names. The Berkeley DB backend generates transaction
1064 * names using a sequence, or a counter, which is stored in the BDB
1065 * database. Each new transaction increments the counter. The
1066 * current value of the counter is not serialized into a filesystem
1067 * dump file, so dumping and restoring the repository will reset the
1068 * sequence and reuse transaction names. The FSFS backend generates a
1069 * transaction name using the hostname, process ID and current time in
1070 * microseconds since 00:00:00 January 1, 1970 UTC. So it is
1071 * extremely unlikely that a transaction name will be reused.
1073 * @defgroup svn_fs_txns Filesystem transactions
1077 /** The type of a Subversion transaction object. */
1078 typedef struct svn_fs_txn_t svn_fs_txn_t;
1081 /** @defgroup svn_fs_begin_txn2_flags Bitmask flags for svn_fs_begin_txn2()
1082 * @since New in 1.2.
1085 /** Do on-the-fly out-of-dateness checks. That is, an fs routine may
1086 * throw error if a caller tries to edit an out-of-date item in the
1089 * @warning ### Not yet implemented.
1091 #define SVN_FS_TXN_CHECK_OOD 0x00001
1093 /** Do on-the-fly lock checks. That is, an fs routine may throw error
1094 * if a caller tries to edit a locked item without having rights to the lock.
1096 #define SVN_FS_TXN_CHECK_LOCKS 0x00002
1098 /** Allow the client to specify the final svn:date of the revision by
1099 * setting or deleting the corresponding transaction property rather
1100 * than have it set automatically when the transaction is committed.
1102 * @since New in 1.9.
1104 #define SVN_FS_TXN_CLIENT_DATE 0x00004
1109 * Begin a new transaction on the filesystem @a fs, based on existing
1110 * revision @a rev. Set @a *txn_p to a pointer to the new transaction.
1111 * When committed, this transaction will create a new revision.
1113 * Allocate the new transaction in @a pool; when @a pool is freed, the new
1114 * transaction will be closed (neither committed nor aborted).
1116 * @a flags determines transaction enforcement behaviors, and is composed
1117 * from the constants SVN_FS_TXN_* (#SVN_FS_TXN_CHECK_OOD etc.).
1119 * @note If you're building a txn for committing, you probably
1120 * don't want to call this directly. Instead, call
1121 * svn_repos_fs_begin_txn_for_commit(), which honors the
1122 * repository's hook configurations.
1124 * @since New in 1.2.
1127 svn_fs_begin_txn2(svn_fs_txn_t **txn_p,
1135 * Same as svn_fs_begin_txn2(), but with @a flags set to 0.
1137 * @deprecated Provided for backward compatibility with the 1.1 API.
1141 svn_fs_begin_txn(svn_fs_txn_t **txn_p,
1150 * @note You usually don't want to call this directly.
1151 * Instead, call svn_repos_fs_commit_txn(), which honors the
1152 * repository's hook configurations.
1154 * If the transaction conflicts with other changes committed to the
1155 * repository, return an #SVN_ERR_FS_CONFLICT error. Otherwise, create
1156 * a new filesystem revision containing the changes made in @a txn,
1157 * storing that new revision number in @a *new_rev, and return zero.
1159 * If #SVN_FS_TXN_CLIENT_DATE was passed to #svn_fs_begin_txn2 any
1160 * svn:date on the transaction will be become the unversioned property
1161 * svn:date on the revision. svn:date can have any value, it does not
1162 * have to be a timestamp. If the transaction has no svn:date the
1163 * revision will have no svn:date.
1165 * If #SVN_FS_TXN_CLIENT_DATE was not passed to #svn_fs_begin_txn2 the
1166 * new revision will have svn:date set to the current time at some
1167 * point during the commit and any svn:date on the transaction will be
1170 * If @a conflict_p is non-zero, use it to provide details on any
1171 * conflicts encountered merging @a txn with the most recent committed
1172 * revisions. If a conflict occurs, set @a *conflict_p to the path of
1173 * the conflict in @a txn, allocated within @a pool;
1174 * otherwise, set @a *conflict_p to NULL.
1176 * If the commit succeeds, @a txn is invalid.
1178 * If the commit fails for any reason, @a *new_rev is an invalid
1179 * revision number, an error other than #SVN_NO_ERROR is returned and
1180 * @a txn is still valid; you can make more operations to resolve the
1181 * conflict, or call svn_fs_abort_txn() to abort the transaction.
1183 * @note Success or failure of the commit of @a txn is determined by
1184 * examining the value of @a *new_rev upon this function's return. If
1185 * the value is a valid revision number, the commit was successful,
1186 * even though a non-@c NULL function return value may indicate that
1187 * something else went wrong in post commit FS processing.
1189 * @note See api-errata/1.8/fs001.txt for information on how this
1190 * function was documented in versions prior to 1.8.
1192 * ### need to document this better. there are four combinations of
1193 * ### return values:
1194 * ### 1) err=NULL. conflict=NULL. new_rev is valid
1195 * ### 2) err=SVN_ERR_FS_CONFLICT. conflict is set. new_rev=SVN_INVALID_REVNUM
1196 * ### 3) err=!NULL. conflict=NULL. new_rev is valid
1197 * ### 4) err=!NULL. conflict=NULL. new_rev=SVN_INVALID_REVNUM
1199 * ### some invariants:
1200 * ### *conflict_p will be non-NULL IFF SVN_ERR_FS_CONFLICT
1201 * ### if *conflict_p is set (and SVN_ERR_FS_CONFLICT), then new_rev
1202 * ### will always be SVN_INVALID_REVNUM
1203 * ### *conflict_p will always be initialized to NULL, or to a valid
1204 * ### conflict string
1205 * ### *new_rev will always be initialized to SVN_INVALID_REVNUM, or
1206 * ### to a valid, committed revision number
1210 svn_fs_commit_txn(const char **conflict_p,
1211 svn_revnum_t *new_rev,
1216 /** Abort the transaction @a txn. Any changes made in @a txn are
1217 * discarded, and the filesystem is left unchanged. Use @a pool for
1218 * any necessary allocations.
1220 * @note This function first sets the state of @a txn to "dead", and
1221 * then attempts to purge it and any related data from the filesystem.
1222 * If some part of the cleanup process fails, @a txn and some portion
1223 * of its data may remain in the database after this function returns.
1224 * Use svn_fs_purge_txn() to retry the transaction cleanup.
1227 svn_fs_abort_txn(svn_fs_txn_t *txn,
1231 /** Cleanup the dead transaction in @a fs whose ID is @a txn_id. Use
1232 * @a pool for all allocations. If the transaction is not yet dead,
1233 * the error #SVN_ERR_FS_TRANSACTION_NOT_DEAD is returned. (The
1234 * caller probably forgot to abort the transaction, or the cleanup
1235 * step of that abort failed for some reason.)
1238 svn_fs_purge_txn(svn_fs_t *fs,
1243 /** Set @a *name_p to the name of the transaction @a txn, as a
1244 * NULL-terminated string. Allocate the name in @a pool.
1247 svn_fs_txn_name(const char **name_p,
1251 /** Return @a txn's base revision. */
1253 svn_fs_txn_base_revision(svn_fs_txn_t *txn);
1257 /** Open the transaction named @a name in the filesystem @a fs. Set @a *txn
1258 * to the transaction.
1260 * If there is no such transaction, #SVN_ERR_FS_NO_SUCH_TRANSACTION is
1261 * the error returned.
1263 * Allocate the new transaction in @a pool; when @a pool is freed, the new
1264 * transaction will be closed (neither committed nor aborted).
1267 svn_fs_open_txn(svn_fs_txn_t **txn,
1273 /** Set @a *names_p to an array of <tt>const char *</tt> ids which are the
1274 * names of all the currently active transactions in the filesystem @a fs.
1275 * Allocate the array in @a pool.
1278 svn_fs_list_transactions(apr_array_header_t **names_p,
1282 /* Transaction properties */
1284 /** Set @a *value_p to the value of the property named @a propname on
1285 * transaction @a txn. If @a txn has no property by that name, set
1286 * @a *value_p to zero. Allocate the result in @a pool.
1289 svn_fs_txn_prop(svn_string_t **value_p,
1291 const char *propname,
1295 /** Set @a *table_p to the entire property list of transaction @a txn, as
1296 * an APR hash table allocated in @a pool. The resulting table maps property
1297 * names to pointers to #svn_string_t objects containing the property value.
1300 svn_fs_txn_proplist(apr_hash_t **table_p,
1305 /** Change a transactions @a txn's property's value, or add/delete a
1306 * property. @a name is the name of the property to change, and @a value
1307 * is the new value of the property, or zero if the property should be
1308 * removed altogether. Do any necessary temporary allocation in @a pool.
1311 svn_fs_change_txn_prop(svn_fs_txn_t *txn,
1313 const svn_string_t *value,
1317 /** Change, add, and/or delete transaction property values in
1318 * transaction @a txn. @a props is an array of <tt>svn_prop_t</tt>
1319 * elements. This is equivalent to calling svn_fs_change_txn_prop()
1320 * multiple times with the @c name and @c value fields of each
1321 * successive <tt>svn_prop_t</tt>, but may be more efficient.
1322 * (Properties not mentioned are left alone.) Do any necessary
1323 * temporary allocation in @a pool.
1325 * @since New in 1.5.
1328 svn_fs_change_txn_props(svn_fs_txn_t *txn,
1329 const apr_array_header_t *props,
1337 * An #svn_fs_root_t object represents the root directory of some
1338 * revision or transaction in a filesystem. To refer to particular
1339 * node or node revision, you provide a root, and a directory path
1340 * relative to that root.
1342 * @defgroup svn_fs_roots Filesystem roots
1346 /** The Filesystem Root object. */
1347 typedef struct svn_fs_root_t svn_fs_root_t;
1350 /** Set @a *root_p to the root directory of revision @a rev in filesystem @a fs.
1351 * Allocate @a *root_p in a private subpool of @a pool; the root can be
1352 * destroyed earlier than @a pool by calling #svn_fs_close_root.
1355 svn_fs_revision_root(svn_fs_root_t **root_p,
1361 /** Set @a *root_p to the root directory of @a txn. Allocate @a *root_p in a
1362 * private subpool of @a pool; the root can be destroyed earlier than @a pool by
1363 * calling #svn_fs_close_root.
1366 svn_fs_txn_root(svn_fs_root_t **root_p,
1371 /** Free the root directory @a root; this only needs to be used if you want to
1372 * free the memory associated with @a root earlier than the time you destroy
1373 * the pool passed to the function that created it (svn_fs_revision_root() or
1374 * svn_fs_txn_root()).
1377 svn_fs_close_root(svn_fs_root_t *root);
1380 /** Return the filesystem to which @a root belongs. */
1382 svn_fs_root_fs(svn_fs_root_t *root);
1385 /** Return @c TRUE iff @a root is a transaction root. */
1387 svn_fs_is_txn_root(svn_fs_root_t *root);
1389 /** Return @c TRUE iff @a root is a revision root. */
1391 svn_fs_is_revision_root(svn_fs_root_t *root);
1394 /** If @a root is the root of a transaction, return the name of the
1395 * transaction, allocated in @a pool; otherwise, return NULL.
1398 svn_fs_txn_root_name(svn_fs_root_t *root,
1401 /** If @a root is the root of a transaction, return the number of the
1402 * revision on which is was based when created. Otherwise, return
1403 * #SVN_INVALID_REVNUM.
1405 * @since New in 1.5.
1408 svn_fs_txn_root_base_revision(svn_fs_root_t *root);
1410 /** If @a root is the root of a revision, return the revision number.
1411 * Otherwise, return #SVN_INVALID_REVNUM.
1414 svn_fs_revision_root_revision(svn_fs_root_t *root);
1419 /** Directory entry names and directory paths.
1421 * Here are the rules for directory entry names, and directory paths:
1423 * A directory entry name is a Unicode string encoded in UTF-8, and
1424 * may not contain the NULL character (U+0000). The name should be in
1425 * Unicode canonical decomposition and ordering. No directory entry
1426 * may be named '.', '..', or the empty string. Given a directory
1427 * entry name which fails to meet these requirements, a filesystem
1428 * function returns an SVN_ERR_FS_PATH_SYNTAX error.
1430 * A directory path is a sequence of zero or more directory entry
1431 * names, separated by slash characters (U+002f), and possibly ending
1432 * with slash characters. Sequences of two or more consecutive slash
1433 * characters are treated as if they were a single slash. If a path
1434 * ends with a slash, it refers to the same node it would without the
1435 * slash, but that node must be a directory, or else the function
1436 * returns an SVN_ERR_FS_NOT_DIRECTORY error.
1438 * A path consisting of the empty string, or a string containing only
1439 * slashes, refers to the root directory.
1441 * @defgroup svn_fs_directories Filesystem directories
1447 /** The kind of change that occurred on the path. */
1448 typedef enum svn_fs_path_change_kind_t
1450 /** path modified in txn */
1451 svn_fs_path_change_modify = 0,
1453 /** path added in txn */
1454 svn_fs_path_change_add,
1456 /** path removed in txn */
1457 svn_fs_path_change_delete,
1459 /** path removed and re-added in txn */
1460 svn_fs_path_change_replace,
1462 /** ignore all previous change items for path (internal-use only) */
1463 svn_fs_path_change_reset
1464 } svn_fs_path_change_kind_t;
1466 /** Change descriptor.
1468 * @note Fields may be added to the end of this structure in future
1469 * versions. Therefore, to preserve binary compatibility, users
1470 * should not directly allocate structures of this type.
1472 * @note The @c text_mod, @c prop_mod and @c mergeinfo_mod flags mean the
1473 * text, properties and mergeinfo property (respectively) were "touched"
1474 * by the commit API; this does not mean the new value is different from
1477 * @since New in 1.6. */
1478 typedef struct svn_fs_path_change2_t
1480 /** node revision id of changed path */
1481 const svn_fs_id_t *node_rev_id;
1483 /** kind of change */
1484 svn_fs_path_change_kind_t change_kind;
1486 /** was the text touched?
1487 * For node_kind=dir: always false. For node_kind=file:
1488 * modify: true iff text touched.
1489 * add (copy): true iff text touched.
1490 * add (plain): always true.
1491 * delete: always false.
1492 * replace: as for the add/copy part of the replacement.
1494 svn_boolean_t text_mod;
1496 /** were the properties touched?
1497 * modify: true iff props touched.
1498 * add (copy): true iff props touched.
1499 * add (plain): true iff props touched.
1500 * delete: always false.
1501 * replace: as for the add/copy part of the replacement.
1503 svn_boolean_t prop_mod;
1505 /** what node kind is the path?
1506 (Note: it is legal for this to be #svn_node_unknown.) */
1507 svn_node_kind_t node_kind;
1509 /** Copyfrom revision and path; this is only valid if copyfrom_known
1511 svn_boolean_t copyfrom_known;
1512 svn_revnum_t copyfrom_rev;
1513 const char *copyfrom_path;
1515 /** was the mergeinfo property touched?
1516 * modify: } true iff svn:mergeinfo property add/del/mod
1517 * add (copy): } and fs format supports this flag.
1519 * delete: always false.
1520 * replace: as for the add/copy part of the replacement.
1521 * (Note: Pre-1.9 repositories will report #svn_tristate_unknown.)
1522 * @since New in 1.9. */
1523 svn_tristate_t mergeinfo_mod;
1524 /* NOTE! Please update svn_fs_path_change2_create() when adding new
1526 } svn_fs_path_change2_t;
1529 /** Similar to #svn_fs_path_change2_t, but without kind and copyfrom
1532 * @deprecated Provided for backwards compatibility with the 1.5 API.
1535 typedef struct svn_fs_path_change_t
1537 /** node revision id of changed path */
1538 const svn_fs_id_t *node_rev_id;
1540 /** kind of change */
1541 svn_fs_path_change_kind_t change_kind;
1543 /** were there text mods? */
1544 svn_boolean_t text_mod;
1546 /** were there property mods? */
1547 svn_boolean_t prop_mod;
1549 } svn_fs_path_change_t;
1552 * Allocate an #svn_fs_path_change2_t structure in @a pool, initialize and
1555 * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
1556 * @c change_kind to @a change_kind. Set all other fields to their
1557 * @c _unknown, @c NULL or invalid value, respectively.
1559 * @since New in 1.6.
1561 svn_fs_path_change2_t *
1562 svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
1563 svn_fs_path_change_kind_t change_kind,
1566 /** Determine what has changed under a @a root.
1568 * Allocate and return a hash @a *changed_paths2_p containing descriptions
1569 * of the paths changed under @a root. The hash is keyed with
1570 * <tt>const char *</tt> paths, and has #svn_fs_path_change2_t * values.
1572 * Callers can assume that this function takes time proportional to
1573 * the amount of data output, and does not need to do tree crawls;
1574 * however, it is possible that some of the @c node_kind fields in the
1575 * #svn_fs_path_change2_t * values will be #svn_node_unknown or
1576 * that and some of the @c copyfrom_known fields will be FALSE.
1578 * Use @a pool for all allocations, including the hash and its values.
1580 * @since New in 1.6.
1583 svn_fs_paths_changed2(apr_hash_t **changed_paths2_p,
1584 svn_fs_root_t *root,
1588 /** Same as svn_fs_paths_changed2(), only with #svn_fs_path_change_t * values
1589 * in the hash (and thus no kind or copyfrom data).
1591 * @deprecated Provided for backward compatibility with the 1.5 API.
1595 svn_fs_paths_changed(apr_hash_t **changed_paths_p,
1596 svn_fs_root_t *root,
1602 /* Operations appropriate to all kinds of nodes. */
1604 /** Set @a *kind_p to the type of node present at @a path under @a
1605 * root. If @a path does not exist under @a root, set @a *kind_p to
1606 * #svn_node_none. Use @a pool for temporary allocation.
1609 svn_fs_check_path(svn_node_kind_t *kind_p,
1610 svn_fs_root_t *root,
1615 /** An opaque node history object. */
1616 typedef struct svn_fs_history_t svn_fs_history_t;
1619 /** Set @a *history_p to an opaque node history object which
1620 * represents @a path under @a root. @a root must be a revision root.
1621 * Allocate the result in @a result_pool and use @a scratch_pool for
1622 * temporary allocations.
1624 * @since New in 1.9.
1627 svn_fs_node_history2(svn_fs_history_t **history_p,
1628 svn_fs_root_t *root,
1630 apr_pool_t *result_pool,
1631 apr_pool_t *scratch_pool);
1633 /** Same as svn_fs_node_history2() but using a single @a pool for all
1636 * @deprecated Provided for backward compatibility with the 1.8 API.
1640 svn_fs_node_history(svn_fs_history_t **history_p,
1641 svn_fs_root_t *root,
1646 /** Set @a *prev_history_p to an opaque node history object which
1647 * represents the previous (or "next oldest") interesting history
1648 * location for the filesystem node represented by @a history, or @c
1649 * NULL if no such previous history exists. If @a cross_copies is @c
1650 * FALSE, also return @c NULL if stepping backwards in history to @a
1651 * *prev_history_p would cross a filesystem copy operation.
1653 * @note If this is the first call to svn_fs_history_prev() for the @a
1654 * history object, it could return a history object whose location is
1655 * the same as the original. This will happen if the original
1656 * location was an interesting one (where the node was modified, or
1657 * took place in a copy event). This behavior allows looping callers
1658 * to avoid the calling svn_fs_history_location() on the object
1659 * returned by svn_fs_node_history(), and instead go ahead and begin
1660 * calling svn_fs_history_prev().
1662 * @note This function uses node-id ancestry alone to determine
1663 * modifiedness, and therefore does NOT claim that in any of the
1664 * returned revisions file contents changed, properties changed,
1665 * directory entries lists changed, etc.
1667 * @note The revisions returned for @a path will be older than or
1668 * the same age as the revision of that path in @a root. That is, if
1669 * @a root is a revision root based on revision X, and @a path was
1670 * modified in some revision(s) younger than X, those revisions
1671 * younger than X will not be included for @a path.
1673 * Allocate the result in @a result_pool and use @a scratch_pool for
1674 * temporary allocations.
1676 * @since New in 1.9. */
1678 svn_fs_history_prev2(svn_fs_history_t **prev_history_p,
1679 svn_fs_history_t *history,
1680 svn_boolean_t cross_copies,
1681 apr_pool_t *result_pool,
1682 apr_pool_t *scratch_pool);
1684 /** Same as svn_fs_history_prev2() but using a single @a pool for all
1687 * @deprecated Provided for backward compatibility with the 1.8 API.
1691 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
1692 svn_fs_history_t *history,
1693 svn_boolean_t cross_copies,
1697 /** Set @a *path and @a *revision to the path and revision,
1698 * respectively, of the @a history object. Use @a pool for all
1702 svn_fs_history_location(const char **path,
1703 svn_revnum_t *revision,
1704 svn_fs_history_t *history,
1708 /** Set @a *is_dir to @c TRUE iff @a path in @a root is a directory.
1709 * Do any necessary temporary allocation in @a pool.
1712 svn_fs_is_dir(svn_boolean_t *is_dir,
1713 svn_fs_root_t *root,
1718 /** Set @a *is_file to @c TRUE iff @a path in @a root is a file.
1719 * Do any necessary temporary allocation in @a pool.
1722 svn_fs_is_file(svn_boolean_t *is_file,
1723 svn_fs_root_t *root,
1728 /** Get the id of a node.
1730 * Set @a *id_p to the node revision ID of @a path in @a root, allocated in
1733 * If @a root is the root of a transaction, keep in mind that other
1734 * changes to the transaction can change which node @a path refers to,
1735 * and even whether the path exists at all.
1738 svn_fs_node_id(const svn_fs_id_t **id_p,
1739 svn_fs_root_t *root,
1743 /** Determine how @a path_a under @a root_a and @a path_b under @a root_b
1744 * are related and return the result in @a relation. There is no restriction
1745 * concerning the roots: They may refer to different repositories, be in
1746 * arbitrary revision order and any of them may pertain to a transaction.
1747 * @a scratch_pool is used for temporary allocations.
1749 * @note Paths from different svn_fs_t will be reported as unrelated even
1750 * if the underlying physical repository is the same.
1752 * @since New in 1.9.
1755 svn_fs_node_relation(svn_fs_node_relation_t *relation,
1756 svn_fs_root_t *root_a,
1758 svn_fs_root_t *root_b,
1760 apr_pool_t *scratch_pool);
1762 /** Set @a *revision to the revision in which the node-revision identified
1763 * by @a path under @a root was created; that is, to the revision in which
1764 * @a path under @a root was last modified. @a *revision will
1765 * be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
1766 * under a transaction root). Note that the root of an unmodified transaction
1767 * is not itself considered to be modified; in that case, return the revision
1768 * upon which the transaction was based.
1770 * Use @a pool for any temporary allocations.
1773 svn_fs_node_created_rev(svn_revnum_t *revision,
1774 svn_fs_root_t *root,
1778 /** Set @a *revision to the revision in which the line of history
1779 * represented by @a path under @a root originated. Use @a pool for
1780 * any temporary allocations. If @a root is a transaction root, @a
1781 * *revision will be set to #SVN_INVALID_REVNUM for any nodes newly
1782 * added in that transaction (brand new files or directories created
1783 * using #svn_fs_make_dir or #svn_fs_make_file).
1785 * @since New in 1.5.
1788 svn_fs_node_origin_rev(svn_revnum_t *revision,
1789 svn_fs_root_t *root,
1793 /** Set @a *created_path to the path at which @a path under @a root was
1794 * created. Use @a pool for all allocations. Callers may use this
1795 * function in conjunction with svn_fs_node_created_rev() to perform a
1796 * reverse lookup of the mapping of (path, revision) -> node-id that
1797 * svn_fs_node_id() performs.
1800 svn_fs_node_created_path(const char **created_path,
1801 svn_fs_root_t *root,
1806 /** Set @a *value_p to the value of the property named @a propname of
1807 * @a path in @a root. If the node has no property by that name, set
1808 * @a *value_p to zero. Allocate the result in @a pool.
1811 svn_fs_node_prop(svn_string_t **value_p,
1812 svn_fs_root_t *root,
1814 const char *propname,
1818 /** Set @a *table_p to the entire property list of @a path in @a root,
1819 * as an APR hash table allocated in @a pool. The resulting table maps
1820 * property names to pointers to #svn_string_t objects containing the
1824 svn_fs_node_proplist(apr_hash_t **table_p,
1825 svn_fs_root_t *root,
1829 /** Set @a *has_props to TRUE if the node @a path in @a root has properties
1830 * and to FALSE if it doesn't have properties. Perform temporary allocations
1831 * in @a scratch_pool.
1833 * @since New in 1.9.
1836 svn_fs_node_has_props(svn_boolean_t *has_props,
1837 svn_fs_root_t *root,
1839 apr_pool_t *scratch_pool);
1842 /** Change a node's property's value, or add/delete a property.
1844 * - @a root and @a path indicate the node whose property should change.
1845 * @a root must be the root of a transaction, not the root of a revision.
1846 * - @a name is the name of the property to change.
1847 * - @a value is the new value of the property, or zero if the property should
1848 * be removed altogether.
1849 * Do any necessary temporary allocation in @a pool.
1852 svn_fs_change_node_prop(svn_fs_root_t *root,
1855 const svn_string_t *value,
1859 /** Determine if the properties of two path/root combinations are different.
1861 * Set @a *different_p to #TRUE if the properties at @a path1 under @a root1
1862 * differ from those at @a path2 under @a root2, or set it to #FALSE if they
1863 * are the same. Both paths must exist under their respective roots, and
1864 * both roots must be in the same filesystem.
1865 * Do any necessary temporary allocation in @a scratch_pool.
1867 * @note For the purposes of preserving accurate history, certain bits of
1868 * code (such as the repository dump code) need to care about the distinction
1869 * between situations when the properties are "different" and "have changed
1870 * across two points in history". We have a pair of functions that can
1871 * answer both of these questions, svn_fs_props_different() and
1872 * svn_fs_props_changed(). See issue 4598 for more details.
1874 * @see svn_fs_props_changed
1876 * @since New in 1.9.
1879 svn_fs_props_different(svn_boolean_t *different_p,
1880 svn_fs_root_t *root1,
1882 svn_fs_root_t *root2,
1884 apr_pool_t *scratch_pool);
1887 /** Determine if the properties of two path/root combinations have changed.
1889 * Set @a *changed_p to #TRUE if the properties at @a path1 under @a root1
1890 * differ from those at @a path2 under @a root2, or set it to #FALSE if they
1891 * are the same. Both paths must exist under their respective roots, and
1892 * both roots must be in the same filesystem.
1893 * Do any necessary temporary allocation in @a pool.
1895 * @note For the purposes of preserving accurate history, certain bits of
1896 * code (such as the repository dump code) need to care about the distinction
1897 * between situations when the properties are "different" and "have changed
1898 * across two points in history". We have a pair of functions that can
1899 * answer both of these questions, svn_fs_props_different() and
1900 * svn_fs_props_changed(). See issue 4598 for more details.
1902 * @note This function can currently return false negatives for FSFS:
1903 * If @a root1 and @a root2 were both transaction roots and the proplists
1904 * of both paths had been changed in their respective transactions,
1905 * @a changed_p would be set to #FALSE.
1907 * @see svn_fs_props_different
1910 svn_fs_props_changed(svn_boolean_t *changed_p,
1911 svn_fs_root_t *root1,
1913 svn_fs_root_t *root2,
1918 /** Discover a node's copy ancestry, if any.
1920 * If the node at @a path in @a root was copied from some other node, set
1921 * @a *rev_p and @a *path_p to the revision and path (expressed as an
1922 * absolute filesystem path) of the other node, allocating @a *path_p
1925 * Else if there is no copy ancestry for the node, set @a *rev_p to
1926 * #SVN_INVALID_REVNUM and @a *path_p to NULL.
1928 * If an error is returned, the values of @a *rev_p and @a *path_p are
1929 * undefined, but otherwise, if one of them is set as described above,
1930 * you may assume the other is set correspondingly.
1932 * @a root may be a revision root or a transaction root.
1935 * - Copy ancestry does not descend. After copying directory D to
1936 * E, E will have copy ancestry referring to D, but E's children
1937 * may not. See also svn_fs_copy().
1939 * - Copy ancestry *under* a copy is preserved. That is, if you
1940 * copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then
1941 * /G/pi2 will still have copy ancestry pointing to /A/D/G/pi.
1942 * We don't know if this is a feature or a bug yet; if it turns
1943 * out to be a bug, then the fix is to make svn_fs_copied_from()
1944 * observe the following logic, which currently callers may
1945 * choose to follow themselves: if node X has copy history, but
1946 * its ancestor A also has copy history, then you may ignore X's
1947 * history if X's revision-of-origin is earlier than A's --
1948 * because that would mean that X's copy history was preserved in
1949 * a copy-under-a-copy scenario. If X's revision-of-origin is
1950 * the same as A's, then it was copied under A during the same
1951 * transaction that created A. (X's revision-of-origin cannot be
1952 * greater than A's, if X has copy history.) @todo See how
1953 * people like this, it can always be hidden behind the curtain
1956 * - Copy ancestry is not stored as a regular subversion property
1957 * because it is not inherited. Copying foo to bar results in a
1958 * revision of bar with copy ancestry; but committing a text
1959 * change to bar right after that results in a new revision of
1960 * bar without copy ancestry.
1963 svn_fs_copied_from(svn_revnum_t *rev_p,
1964 const char **path_p,
1965 svn_fs_root_t *root,
1970 /** Set @a *root_p and @a *path_p to the revision root and path of the
1971 * destination of the most recent copy event that caused @a path to
1972 * exist where it does in @a root, or to NULL if no such copy exists.
1974 * @a *path_p might be a parent of @a path, rather than @a path
1975 * itself. However, it will always be the deepest relevant path.
1976 * That is, if a copy occurs underneath another copy in the same txn,
1977 * this function makes sure to set @a *path_p to the longest copy
1978 * destination path that is still a parent of or equal to @a path.
1980 * Values returned in @a *root_p and @a *path_p will be allocated
1983 * @since New in 1.3.
1986 svn_fs_closest_copy(svn_fs_root_t **root_p,
1987 const char **path_p,
1988 svn_fs_root_t *root,
1993 /** Retrieve mergeinfo for multiple nodes.
1995 * @a *catalog is a catalog for @a paths. It will never be @c NULL,
1998 * @a root is revision root to use when looking up paths.
2000 * @a paths are the paths you are requesting information for.
2002 * @a inherit indicates whether to retrieve explicit,
2003 * explicit-or-inherited, or only inherited mergeinfo.
2005 * If @a adjust_inherited_mergeinfo is @c TRUE, then any inherited
2006 * mergeinfo returned in @a *catalog is normalized to represent the
2007 * inherited mergeinfo on the path which inherits it. This adjusted
2008 * mergeinfo is keyed by the path which inherits it. If
2009 * @a adjust_inherited_mergeinfo is @c FALSE, then any inherited
2010 * mergeinfo is the raw explicit mergeinfo from the nearest parent
2011 * of the path with explicit mergeinfo, unadjusted for the path-wise
2012 * difference between the path and its parent. This may include
2013 * non-inheritable mergeinfo. This unadjusted mergeinfo is keyed by
2014 * the path at which it was found.
2016 * If @a include_descendants is TRUE, then additionally return the
2017 * mergeinfo for any descendant of any element of @a paths which has
2018 * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note
2019 * that inheritance is only taken into account for the elements in @a
2020 * paths; descendants of the elements in @a paths which get their
2021 * mergeinfo via inheritance are not included in @a *catalog.)
2023 * Allocate @a *catalog in result_pool. Do any necessary temporary
2024 * allocations in @a scratch_pool.
2026 * @since New in 1.8.
2029 svn_fs_get_mergeinfo2(svn_mergeinfo_catalog_t *catalog,
2030 svn_fs_root_t *root,
2031 const apr_array_header_t *paths,
2032 svn_mergeinfo_inheritance_t inherit,
2033 svn_boolean_t include_descendants,
2034 svn_boolean_t adjust_inherited_mergeinfo,
2035 apr_pool_t *result_pool,
2036 apr_pool_t *scratch_pool);
2039 * Same as svn_fs_get_mergeinfo2(), but with @a adjust_inherited_mergeinfo
2040 * set always set to @c TRUE and with only one pool.
2042 * @deprecated Provided for backward compatibility with the 1.5 API.
2046 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
2047 svn_fs_root_t *root,
2048 const apr_array_header_t *paths,
2049 svn_mergeinfo_inheritance_t inherit,
2050 svn_boolean_t include_descendants,
2053 /** Merge changes between two nodes into a third node.
2055 * Given nodes @a source and @a target, and a common ancestor @a ancestor,
2056 * modify @a target to contain all the changes made between @a ancestor and
2057 * @a source, as well as the changes made between @a ancestor and @a target.
2058 * @a target_root must be the root of a transaction, not a revision.
2060 * @a source, @a target, and @a ancestor are generally directories; this
2061 * function recursively merges the directories' contents. If they are
2062 * files, this function simply returns an error whenever @a source,
2063 * @a target, and @a ancestor are all distinct node revisions.
2065 * If there are differences between @a ancestor and @a source that conflict
2066 * with changes between @a ancestor and @a target, this function returns an
2067 * #SVN_ERR_FS_CONFLICT error.
2069 * If the merge is successful, @a target is left in the merged state, and
2070 * the base root of @a target's txn is set to the root node of @a source.
2071 * If an error is returned (whether for conflict or otherwise), @a target
2072 * is left unaffected.
2074 * If @a conflict_p is non-NULL, then: a conflict error sets @a *conflict_p
2075 * to the name of the node in @a target which couldn't be merged,
2076 * otherwise, success sets @a *conflict_p to NULL.
2078 * Do any necessary temporary allocation in @a pool.
2081 svn_fs_merge(const char **conflict_p,
2082 svn_fs_root_t *source_root,
2083 const char *source_path,
2084 svn_fs_root_t *target_root,
2085 const char *target_path,
2086 svn_fs_root_t *ancestor_root,
2087 const char *ancestor_path,
2095 /** The type of a Subversion directory entry. */
2096 typedef struct svn_fs_dirent_t
2099 /** The name of this directory entry. */
2102 /** The node revision ID it names. */
2103 const svn_fs_id_t *id;
2105 /** The node kind. */
2106 svn_node_kind_t kind;
2111 /** Set @a *entries_p to a newly allocated APR hash table containing the
2112 * entries of the directory at @a path in @a root. The keys of the table
2113 * are entry names, as byte strings, excluding the final NULL
2114 * character; the table's values are pointers to #svn_fs_dirent_t
2115 * structures. Allocate the table and its contents in @a pool.
2118 svn_fs_dir_entries(apr_hash_t **entries_p,
2119 svn_fs_root_t *root,
2123 /** Take the #svn_fs_dirent_t structures in @a entries as returned by
2124 * #svn_fs_dir_entries for @a root and determine an optimized ordering
2125 * in which data access would most likely be efficient. Set @a *ordered_p
2126 * to a newly allocated APR array of pointers to these #svn_fs_dirent_t
2127 * structures. Allocate the array (but not its contents) in @a result_pool
2128 * and use @a scratch_pool for temporaries.
2130 * @since New in 1.9.
2133 svn_fs_dir_optimal_order(apr_array_header_t **ordered_p,
2134 svn_fs_root_t *root,
2135 apr_hash_t *entries,
2136 apr_pool_t *result_pool,
2137 apr_pool_t *scratch_pool);
2139 /** Create a new directory named @a path in @a root. The new directory has
2140 * no entries, and no properties. @a root must be the root of a transaction,
2143 * Do any necessary temporary allocation in @a pool.
2146 svn_fs_make_dir(svn_fs_root_t *root,
2151 /** Delete the node named @a path in @a root. If the node being deleted is
2152 * a directory, its contents will be deleted recursively. @a root must be
2153 * the root of a transaction, not of a revision. Use @a pool for
2154 * temporary allocation.
2156 * If return #SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a path is
2157 * missing from its parent, that is, the final target of the deletion
2160 * Attempting to remove the root dir also results in an error,
2161 * #SVN_ERR_FS_ROOT_DIR, even if the dir is empty.
2164 svn_fs_delete(svn_fs_root_t *root,
2169 /** Create a copy of @a from_path in @a from_root named @a to_path in
2170 * @a to_root. If @a from_path in @a from_root is a directory, copy the
2171 * tree it refers to recursively.
2173 * The copy will remember its source; use svn_fs_copied_from() to
2174 * access this information.
2176 * @a to_root must be the root of a transaction; @a from_root must be the
2177 * root of a revision. (Requiring @a from_root to be the root of a
2178 * revision makes the implementation trivial: there is no detectable
2179 * difference (modulo node revision ID's) between copying @a from and
2180 * simply adding a reference to it. So the operation takes place in
2181 * constant time. However, there's no reason not to extend this to
2182 * mutable nodes --- it's just more code.) Further, @a to_root and @a
2183 * from_root must represent the same filesystem.
2185 * @note To do a copy without preserving copy history, use
2186 * svn_fs_revision_link().
2188 * Do any necessary temporary allocation in @a pool.
2191 svn_fs_copy(svn_fs_root_t *from_root,
2192 const char *from_path,
2193 svn_fs_root_t *to_root,
2194 const char *to_path,
2198 /** Like svn_fs_copy(), but doesn't record copy history, and preserves
2199 * the PATH. You cannot use svn_fs_copied_from() later to find out
2200 * where this copy came from.
2202 * Use svn_fs_revision_link() in situations where you don't care
2203 * about the copy history, and where @a to_path and @a from_path are
2204 * the same, because it is cheaper than svn_fs_copy().
2207 svn_fs_revision_link(svn_fs_root_t *from_root,
2208 svn_fs_root_t *to_root,
2215 /** Set @a *length_p to the length of the file @a path in @a root, in bytes.
2216 * Do any necessary temporary allocation in @a pool.
2219 svn_fs_file_length(svn_filesize_t *length_p,
2220 svn_fs_root_t *root,
2225 /** Set @a *checksum to the checksum of type @a kind for the file @a path.
2226 * @a *checksum will be allocated out of @a pool, which will also be used
2227 * for temporary allocations.
2229 * If the filesystem does not have a prerecorded checksum of @a kind for
2230 * @a path, and @a force is not TRUE, do not calculate a checksum
2231 * dynamically, just put NULL into @a checksum. (By convention, the NULL
2232 * checksum is considered to match any checksum.)
2236 * You might wonder, why do we only provide this interface for file
2237 * contents, and not for properties or directories?
2239 * The answer is that property lists and directory entry lists are
2240 * essentially data structures, not text. We serialize them for
2241 * transmission, but there is no guarantee that the consumer will
2242 * parse them into the same form, or even the same order, as the
2243 * producer. It's difficult to find a checksumming method that
2244 * reaches the same result given such variation in input. (I suppose
2245 * we could calculate an independent MD5 sum for each propname and
2246 * value, and XOR them together; same with directory entry names.
2247 * Maybe that's the solution?) Anyway, for now we punt. The most
2248 * important data, and the only data that goes through svndiff
2249 * processing, is file contents, so that's what we provide
2252 * Internally, of course, the filesystem checksums everything, because
2253 * it has access to the lowest level storage forms: strings behind
2256 * @since New in 1.6.
2259 svn_fs_file_checksum(svn_checksum_t **checksum,
2260 svn_checksum_kind_t kind,
2261 svn_fs_root_t *root,
2263 svn_boolean_t force,
2267 * Same as svn_fs_file_checksum(), only always put the MD5 checksum of file
2268 * @a path into @a digest, which should point to @c APR_MD5_DIGESTSIZE bytes
2269 * of storage. If the checksum doesn't exist, put all 0's into @a digest.
2271 * @deprecated Provided for backward compatibility with the 1.5 API.
2275 svn_fs_file_md5_checksum(unsigned char digest[],
2276 svn_fs_root_t *root,
2281 /** Set @a *contents to a readable generic stream that will yield the
2282 * contents of the file @a path in @a root. Allocate the stream in
2283 * @a pool. You can only use @a *contents for as long as the underlying
2284 * filesystem is open. If @a path is not a file, return
2285 * #SVN_ERR_FS_NOT_FILE.
2287 * If @a root is the root of a transaction, it is possible that the
2288 * contents of the file @a path will change between calls to
2289 * svn_fs_file_contents(). In that case, the result of reading from
2290 * @a *contents is undefined.
2292 * ### @todo kff: I am worried about lifetime issues with this pool vs
2293 * the trail created farther down the call stack. Trace this function
2297 svn_fs_file_contents(svn_stream_t **contents,
2298 svn_fs_root_t *root,
2303 * Callback function type used with svn_fs_try_process_file_contents()
2304 * that delivers the immutable, non-NULL @a contents of @a len bytes.
2305 * @a baton is an implementation-specific closure.
2307 * Use @a scratch_pool for allocations.
2309 * @since New in 1.8.
2311 typedef svn_error_t *
2312 (*svn_fs_process_contents_func_t)(const unsigned char *contents,
2315 apr_pool_t *scratch_pool);
2317 /** Efficiently deliver the contents of the file @a path in @a root
2318 * via @a processor (with @a baton), setting @a *success to @c TRUE
2319 * upon doing so. Use @a pool for allocations.
2321 * This function is intended to support zero copy data processing. It may
2322 * not be implemented for all data backends or not be applicable for certain
2323 * content. In those cases, @a *success will always be @c FALSE. Also,
2324 * this is a best-effort function which means that there is no guarantee
2325 * that @a processor gets called at all.
2327 * @note @a processor is expected to be a relatively simple function with
2328 * a runtime of O(content size) or less.
2330 * @since New in 1.8.
2333 svn_fs_try_process_file_contents(svn_boolean_t *success,
2334 svn_fs_root_t *root,
2336 svn_fs_process_contents_func_t processor,
2340 /** Create a new file named @a path in @a root. The file's initial contents
2341 * are the empty string, and it has no properties. @a root must be the
2342 * root of a transaction, not a revision.
2344 * Do any necessary temporary allocation in @a pool.
2347 svn_fs_make_file(svn_fs_root_t *root,
2352 /** Apply a text delta to the file @a path in @a root. @a root must be the
2353 * root of a transaction, not a revision.
2355 * Set @a *contents_p to a function ready to receive text delta windows
2356 * describing how to change the file's contents, relative to its
2357 * current contents. Set @a *contents_baton_p to a baton to pass to
2360 * If @a path does not exist in @a root, return an error. (You cannot use
2361 * this routine to create new files; use svn_fs_make_file() to create
2362 * an empty file first.)
2364 * @a base_checksum is the hex MD5 digest for the base text against
2365 * which the delta is to be applied; it is ignored if NULL, and may be
2366 * ignored even if not NULL. If it is not ignored, it must match the
2367 * checksum of the base text against which svndiff data is being
2368 * applied; if not, svn_fs_apply_textdelta() or the @a *contents_p call
2369 * which detects the mismatch will return the error
2370 * #SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may
2371 * still be an error if @a base_checksum is neither NULL nor the
2372 * checksum of the empty string).
2374 * @a result_checksum is the hex MD5 digest for the fulltext that
2375 * results from this delta application. It is ignored if NULL, but if
2376 * not NULL, it must match the checksum of the result; if it does not,
2377 * then the @a *contents_p call which detects the mismatch will return
2378 * the error #SVN_ERR_CHECKSUM_MISMATCH.
2380 * The caller must send all delta windows including the terminating
2381 * NULL window to @a *contents_p before making further changes to the
2384 * Do temporary allocation in @a pool.
2387 svn_fs_apply_textdelta(svn_txdelta_window_handler_t *contents_p,
2388 void **contents_baton_p,
2389 svn_fs_root_t *root,
2391 const char *base_checksum,
2392 const char *result_checksum,
2396 /** Write data directly to the file @a path in @a root. @a root must be the
2397 * root of a transaction, not a revision.
2399 * Set @a *contents_p to a stream ready to receive full textual data.
2400 * When the caller closes this stream, the data replaces the previous
2401 * contents of the file. The caller must write all file data and close
2402 * the stream before making further changes to the transaction.
2404 * If @a path does not exist in @a root, return an error. (You cannot use
2405 * this routine to create new files; use svn_fs_make_file() to create
2406 * an empty file first.)
2408 * @a result_checksum is the hex MD5 digest for the final fulltext
2409 * written to the stream. It is ignored if NULL, but if not null, it
2410 * must match the checksum of the result; if it does not, then the @a
2411 * *contents_p call which detects the mismatch will return the error
2412 * #SVN_ERR_CHECKSUM_MISMATCH.
2414 * Do any necessary temporary allocation in @a pool.
2416 * @note This is like svn_fs_apply_textdelta(), but takes the text
2420 svn_fs_apply_text(svn_stream_t **contents_p,
2421 svn_fs_root_t *root,
2423 const char *result_checksum,
2427 /** Check if the contents of two root/path combos are different.
2429 * Set @a *different_p to #TRUE if the file contents at @a path1 under
2430 * @a root1 differ from those at @a path2 under @a root2, or set it to
2431 * #FALSE if they are the same. Both paths must exist under their
2432 * respective roots, and both roots must be in the same filesystem.
2433 * Do any necessary temporary allocation in @a scratch_pool.
2435 * @note For the purposes of preserving accurate history, certain bits of
2436 * code (such as the repository dump code) need to care about the distinction
2437 * between situations when two files have "different" content and when the
2438 * contents of a given file "have changed" across two points in its history.
2439 * We have a pair of functions that can answer both of these questions,
2440 * svn_fs_contents_different() and svn_fs_contents_changed(). See issue
2441 * 4598 for more details.
2443 * @see svn_fs_contents_changed
2445 * @since New in 1.9.
2448 svn_fs_contents_different(svn_boolean_t *different_p,
2449 svn_fs_root_t *root1,
2451 svn_fs_root_t *root2,
2453 apr_pool_t *scratch_pool);
2455 /** Check if the contents of two root/path combos have changed.
2457 * Set @a *changed_p to #TRUE if the file contents at @a path1 under
2458 * @a root1 differ from those at @a path2 under @a root2, or set it to
2459 * #FALSE if they are the same. Both paths must exist under their
2460 * respective roots, and both roots must be in the same filesystem.
2461 * Do any necessary temporary allocation in @a pool.
2463 * @note svn_fs_contents_changed() was not designed to be used to detect
2464 * when two files have different content, but really to detect when the
2465 * contents of a given file have changed across two points in its history.
2466 * For the purposes of preserving accurate history, certain bits of code
2467 * (such as the repository dump code) need to care about this distinction.
2468 * For example, it's not an error from the FS API point of view to call
2469 * svn_fs_apply_textdelta() and explicitly set a file's contents to exactly
2470 * what they were before the edit was made. We have a pair of functions
2471 * that can answer both of these questions, svn_fs_contents_changed() and
2472 * svn_fs_contents_different(). See issue 4598 for more details.
2474 * @see svn_fs_contents_different
2477 svn_fs_contents_changed(svn_boolean_t *changed_p,
2478 svn_fs_root_t *root1,
2480 svn_fs_root_t *root2,
2486 /* Filesystem revisions. */
2489 /** Set @a *youngest_p to the number of the youngest revision in filesystem
2490 * @a fs. Use @a pool for all temporary allocation.
2492 * The oldest revision in any filesystem is numbered zero.
2495 svn_fs_youngest_rev(svn_revnum_t *youngest_p,
2501 * Return filesystem format information for @a fs.
2503 * Set @a *fs_format to the filesystem format number of @a fs, which is
2504 * an integer that increases when incompatible changes are made (such as
2505 * by #svn_fs_upgrade).
2507 * Set @a *supports_version to the version number of the minimum Subversion GA
2508 * release that can read and write @a fs.
2510 * @see svn_repos_info_format
2512 * @since New in 1.9.
2515 svn_fs_info_format(int *fs_format,
2516 svn_version_t **supports_version,
2518 apr_pool_t *result_pool,
2519 apr_pool_t *scratch_pool);
2522 * Return a list of admin-serviceable config files for @a fs. @a *files
2523 * will be set to an array containing paths as C strings.
2525 * @since New in 1.9.
2528 svn_fs_info_config_files(apr_array_header_t **files,
2530 apr_pool_t *result_pool,
2531 apr_pool_t *scratch_pool);
2535 /** Provide filesystem @a fs the opportunity to compress storage relating to
2536 * associated with @a revision in filesystem @a fs. Use @a pool for all
2539 * @note This can be a time-consuming process, depending the breadth
2540 * of the changes made in @a revision, and the depth of the history of
2541 * those changed paths. This may also be a no op.
2544 svn_fs_deltify_revision(svn_fs_t *fs,
2545 svn_revnum_t revision,
2549 /** Set @a *value_p to the value of the property named @a propname on
2550 * revision @a rev in the filesystem @a fs. If @a rev has no property by
2551 * that name, set @a *value_p to zero. Allocate the result in @a pool.
2554 svn_fs_revision_prop(svn_string_t **value_p,
2557 const char *propname,
2561 /** Set @a *table_p to the entire property list of revision @a rev in
2562 * filesystem @a fs, as an APR hash table allocated in @a pool. The table
2563 * maps <tt>char *</tt> property names to #svn_string_t * values; the names
2564 * and values are allocated in @a pool.
2567 svn_fs_revision_proplist(apr_hash_t **table_p,
2573 /** Change a revision's property's value, or add/delete a property.
2575 * - @a fs is a filesystem, and @a rev is the revision in that filesystem
2576 * whose property should change.
2577 * - @a name is the name of the property to change.
2578 * - if @a old_value_p is not @c NULL, then changing the property will fail with
2579 * error #SVN_ERR_FS_PROP_BASEVALUE_MISMATCH if the present value of the
2580 * property is not @a *old_value_p. (This is an atomic test-and-set).
2581 * @a *old_value_p may be @c NULL, representing that the property must be not
2583 * - @a value is the new value of the property, or zero if the property should
2584 * be removed altogether.
2586 * Note that revision properties are non-historied --- you can change
2587 * them after the revision has been committed. They are not protected
2590 * Do any necessary temporary allocation in @a pool.
2592 * @since New in 1.7.
2595 svn_fs_change_rev_prop2(svn_fs_t *fs,
2598 const svn_string_t *const *old_value_p,
2599 const svn_string_t *value,
2604 * Similar to svn_fs_change_rev_prop2(), but with @a old_value_p passed as
2607 * @deprecated Provided for backward compatibility with the 1.6 API.
2611 svn_fs_change_rev_prop(svn_fs_t *fs,
2614 const svn_string_t *value,
2619 /* Computing deltas. */
2622 /** Set @a *stream_p to a pointer to a delta stream that will turn the
2623 * contents of the file @a source into the contents of the file @a target.
2624 * If @a source_root is zero, use a file with zero length as the source.
2626 * This function does not compare the two files' properties.
2628 * Allocate @a *stream_p, and do any necessary temporary allocation, in
2632 svn_fs_get_file_delta_stream(svn_txdelta_stream_t **stream_p,
2633 svn_fs_root_t *source_root,
2634 const char *source_path,
2635 svn_fs_root_t *target_root,
2636 const char *target_path,
2641 /* UUID manipulation. */
2643 /** Populate @a *uuid with the UUID associated with @a fs. Allocate
2644 @a *uuid in @a pool. */
2646 svn_fs_get_uuid(svn_fs_t *fs,
2651 /** If not @c NULL, associate @a *uuid with @a fs. Otherwise (if @a
2652 * uuid is @c NULL), generate a new UUID for @a fs. Use @a pool for
2656 svn_fs_set_uuid(svn_fs_t *fs,
2661 /** @defgroup svn_fs_locks Filesystem locks
2663 * @since New in 1.2. */
2665 /** A lock represents one user's exclusive right to modify a path in a
2666 * filesystem. In order to create or destroy a lock, a username must
2667 * be associated with the filesystem's access context (see
2668 * #svn_fs_access_t).
2670 * When a lock is created, a 'lock-token' is returned. The lock-token
2671 * is a unique URI that represents the lock (treated as an opaque
2672 * string by the client), and is required to make further use of the
2673 * lock (including removal of the lock.) A lock-token can also be
2674 * queried to return a svn_lock_t structure that describes the details
2675 * of the lock. lock-tokens must not contain any newline character,
2676 * mainly due to the serialization for tokens for pre-commit hook.
2678 * Locks are not secret; anyone can view existing locks in a
2679 * filesystem. Locks are not omnipotent: they can be broken and stolen
2680 * by people who don't "own" the lock. (Though admins can tailor a
2681 * custom break/steal policy via libsvn_repos pre-lock hook script.)
2683 * Locks can be created with an optional expiration date. If a lock
2684 * has an expiration date, then the act of fetching/reading it might
2685 * cause it to automatically expire, returning either nothing or an
2686 * expiration error (depending on the API).
2689 /** Lock information for use with svn_fs_lock_many() [and svn_repos_fs_...].
2691 * @see svn_fs_lock_target_create
2693 * @since New in 1.9.
2695 typedef struct svn_fs_lock_target_t svn_fs_lock_target_t;
2697 /** Create an <tt>svn_fs_lock_target_t</tt> allocated in @a result_pool.
2698 * @a token can be NULL and @a current_rev can be SVN_INVALID_REVNUM.
2700 * The @a token is not duplicated and so must have a lifetime at least as
2701 * long as the returned target object.
2703 * @since New in 1.9.
2705 svn_fs_lock_target_t *svn_fs_lock_target_create(const char *token,
2706 svn_revnum_t current_rev,
2707 apr_pool_t *result_pool);
2709 /** Update @a target changing the token to @a token, @a token can be NULL.
2711 * The @a token is not duplicated and so must have a lifetime at least as
2712 * long as @a target.
2714 * @since New in 1.9.
2716 void svn_fs_lock_target_set_token(svn_fs_lock_target_t *target,
2719 /** The callback invoked by svn_fs_lock_many() and svn_fs_unlock_many().
2721 * @a path and @a lock are allocated in the result_pool passed to
2722 * svn_fs_lock_many/svn_fs_unlock_many and so will persist beyond the
2723 * callback invocation. @a fs_err will be cleared after the callback
2724 * returns, use svn_error_dup() to preserve the error.
2726 * If the callback returns an error no further callbacks will be made
2727 * and svn_fs_lock_many/svn_fs_unlock_many will return an error. The
2728 * caller cannot rely on any particular order for these callbacks and
2729 * cannot rely on interrupting the underlying operation by returning
2730 * an error. Returning an error stops the callbacks but any locks
2731 * that would have been reported in further callbacks may, or may not,
2732 * still be created/released.
2734 * @since New in 1.9.
2736 typedef svn_error_t *(*svn_fs_lock_callback_t)(void *baton,
2738 const svn_lock_t *lock,
2739 svn_error_t *fs_err,
2740 apr_pool_t *scratch_pool);
2742 /** Lock the paths in @a lock_targets in @a fs.
2744 * @a fs must have a username associated with it (see
2745 * #svn_fs_access_t), else return #SVN_ERR_FS_NO_USER. Set the
2746 * 'owner' field in each new lock to the fs username.
2748 * @a comment is optional: it's either an xml-escapable UTF8 string
2749 * which describes the lock, or it is @c NULL.
2751 * @a is_dav_comment describes whether the comment was created by a
2752 * generic DAV client; only mod_dav_svn's autoversioning feature needs
2753 * to use it. If in doubt, pass 0.
2755 * The paths to be locked are passed as the <tt>const char *</tt> keys
2756 * of the @a lock_targets hash. The hash values are
2757 * <tt>svn_fs_lock_target_t *</tt> and provide the token and
2758 * @a current_rev for each path. The token is a lock token such as can
2759 * be generated using svn_fs_generate_lock_token() (indicating that
2760 * the caller wants to dictate the lock token used), or it is @c NULL
2761 * (indicating that the caller wishes to have a new token generated by
2762 * this function). If the token is not @c NULL, and represents an
2763 * existing lock, then the path must match the path associated with
2764 * that existing lock. If @a current_rev is a valid revnum, then do an
2765 * out-of-dateness check. If the revnum is less than the
2766 * last-changed-revision of the path (or if the path doesn't exist in
2767 * HEAD), yield an #SVN_ERR_FS_OUT_OF_DATE error for this path.
2769 * If a path is already locked, then yield #SVN_ERR_FS_PATH_ALREADY_LOCKED,
2770 * unless @a steal_lock is TRUE, in which case "steal" the existing
2771 * lock, even if the FS access-context's username does not match the
2772 * current lock's owner: delete the existing lock on the path, and
2775 * If @a expiration_date is zero, then create a non-expiring lock.
2776 * Else, the lock will expire at @a expiration_date.
2778 * For each path in @a lock_targets @a lock_callback will be invoked
2779 * passing @a lock_baton and the lock and error that apply to path.
2780 * @a lock_callback can be NULL in which case it is not called and any
2781 * errors that would have been passed to the callback are not reported.
2783 * The lock and path passed to @a lock_callback will be allocated in
2784 * @a result_pool. Use @a scratch_pool for temporary allocations.
2786 * @note At this time, only files can be locked.
2788 * @note This function is not atomic. If it returns an error, some targets
2789 * may remain unlocked while others may have been locked.
2791 * @note You probably don't want to use this directly. Take a look at
2792 * svn_repos_fs_lock_many() instead.
2794 * @since New in 1.9.
2797 svn_fs_lock_many(svn_fs_t *fs,
2798 apr_hash_t *lock_targets,
2799 const char *comment,
2800 svn_boolean_t is_dav_comment,
2801 apr_time_t expiration_date,
2802 svn_boolean_t steal_lock,
2803 svn_fs_lock_callback_t lock_callback,
2805 apr_pool_t *result_pool,
2806 apr_pool_t *scratch_pool);
2808 /** Similar to svn_fs_lock_many() but locks only a single @a path and
2809 * returns the lock in @a *lock, allocated in @a pool, or an error.
2811 * @since New in 1.2.
2814 svn_fs_lock(svn_lock_t **lock,
2818 const char *comment,
2819 svn_boolean_t is_dav_comment,
2820 apr_time_t expiration_date,
2821 svn_revnum_t current_rev,
2822 svn_boolean_t steal_lock,
2826 /** Generate a unique lock-token using @a fs. Return in @a *token,
2827 * allocated in @a pool.
2829 * This can be used in to populate lock->token before calling
2830 * svn_fs_attach_lock().
2833 svn_fs_generate_lock_token(const char **token,
2838 /** Remove the locks on the paths in @a unlock_targets in @a fs.
2840 * The paths to be unlocked are passed as <tt>const char *</tt> keys
2841 * of the @a unlock_targets hash with the corresponding lock tokens as
2842 * <tt>const char *</tt> values. If the token doesn't point to a
2843 * lock, yield an #SVN_ERR_FS_BAD_LOCK_TOKEN error for this path. If
2844 * the token points to an expired lock, yield an
2845 * #SVN_ERR_FS_LOCK_EXPIRED error for this path. If @a fs has no
2846 * username associated with it, yield an #SVN_ERR_FS_NO_USER unless @a
2847 * break_lock is specified.
2849 * If the token points to a lock, but the username of @a fs's access
2850 * context doesn't match the lock's owner, yield an
2851 * #SVN_ERR_FS_LOCK_OWNER_MISMATCH. If @a break_lock is TRUE,
2852 * however, don't return error; allow the lock to be "broken" in any
2853 * case. In the latter case, the token shall be @c NULL.
2855 * For each path in @a unlock_targets @a lock_callback will be invoked
2856 * passing @a lock_baton and error that apply to path. The @a lock
2857 * passed to the callback will be NULL. @a lock_callback can be NULL
2858 * in which case it is not called and any errors that would have been
2859 * passed to the callback are not reported.
2861 * The path passed to lock_callback will be allocated in @a result_pool.
2862 * Use @a scratch_pool for temporary allocations.
2864 * @note This function is not atomic. If it returns an error, some targets
2865 * may remain locked while others may have been unlocked.
2867 * @note You probably don't want to use this directly. Take a look at
2868 * svn_repos_fs_unlock_many() instead.
2870 * @since New in 1.9.
2873 svn_fs_unlock_many(svn_fs_t *fs,
2874 apr_hash_t *unlock_targets,
2875 svn_boolean_t break_lock,
2876 svn_fs_lock_callback_t lock_callback,
2878 apr_pool_t *result_pool,
2879 apr_pool_t *scratch_pool);
2881 /** Similar to svn_fs_unlock_many() but only unlocks a single path.
2883 * @since New in 1.2.
2886 svn_fs_unlock(svn_fs_t *fs,
2889 svn_boolean_t break_lock,
2893 /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which
2894 * represents the lock, allocated in @a pool.
2896 * If @a path is not locked or does not exist in HEAD, set @a *lock to NULL.
2899 svn_fs_get_lock(svn_lock_t **lock,
2905 /** The type of a lock discovery callback function. @a baton is the
2906 * value specified in the call to svn_fs_get_locks(); the filesystem
2907 * passes it through to the callback. @a lock is a lock structure.
2908 * @a pool is a temporary subpool for use by the callback
2909 * implementation -- it is cleared after invocation of the callback.
2911 typedef svn_error_t *(*svn_fs_get_locks_callback_t)(void *baton,
2916 /** Report locks on or below @a path in @a fs using the @a
2917 * get_locks_func / @a get_locks_baton. Use @a pool for necessary
2920 * @a depth limits the reported locks to those associated with paths
2921 * within the specified depth of @a path, and must be one of the
2922 * following values: #svn_depth_empty, #svn_depth_files,
2923 * #svn_depth_immediates, or #svn_depth_infinity.
2925 * If the @a get_locks_func callback implementation returns an error,
2926 * lock iteration will terminate and that error will be returned by
2929 * @note Over the course of this function's invocation, locks might be
2930 * added, removed, or modified by concurrent processes. Callers need
2931 * to anticipate and gracefully handle the transience of this
2934 * @since New in 1.7.
2937 svn_fs_get_locks2(svn_fs_t *fs,
2940 svn_fs_get_locks_callback_t get_locks_func,
2941 void *get_locks_baton,
2944 /** Similar to svn_fs_get_locks2(), but with @a depth always passed as
2945 * svn_depth_infinity, and with the following known problem (which is
2946 * not present in svn_fs_get_locks2()):
2948 * @note On Berkeley-DB-backed filesystems in Subversion 1.6 and
2949 * prior, the @a get_locks_func callback will be invoked from within a
2950 * Berkeley-DB transaction trail. Implementors of the callback are,
2951 * as a result, forbidden from calling any svn_fs API functions which
2952 * might themselves attempt to start a new Berkeley DB transaction
2953 * (which is most of this svn_fs API). Yes, this is a nasty
2954 * implementation detail to have to be aware of.
2956 * @deprecated Provided for backward compatibility with the 1.6 API.
2960 svn_fs_get_locks(svn_fs_t *fs,
2962 svn_fs_get_locks_callback_t get_locks_func,
2963 void *get_locks_baton,
2969 * Append a textual list of all available FS modules to the stringbuf
2970 * @a output. Third-party modules are only included if repository
2971 * access has caused them to be loaded.
2973 * @since New in 1.2.
2976 svn_fs_print_modules(svn_stringbuf_t *output,
2980 /** The kind of action being taken by 'pack'. */
2981 typedef enum svn_fs_pack_notify_action_t
2983 /** packing of the shard has commenced */
2984 svn_fs_pack_notify_start = 0,
2986 /** packing of the shard is completed */
2987 svn_fs_pack_notify_end,
2989 /** packing of the shard revprops has commenced
2990 @since New in 1.7. */
2991 svn_fs_pack_notify_start_revprop,
2993 /** packing of the shard revprops has completed
2994 @since New in 1.7. */
2995 svn_fs_pack_notify_end_revprop
2997 } svn_fs_pack_notify_action_t;
2999 /** The type of a pack notification function. @a shard is the shard being
3000 * acted upon; @a action is the type of action being performed. @a baton is
3001 * the corresponding baton for the notification function, and @a pool can
3002 * be used for temporary allocations, but will be cleared between invocations.
3004 typedef svn_error_t *(*svn_fs_pack_notify_t)(void *baton,
3006 svn_fs_pack_notify_action_t action,
3010 * Possibly update the filesystem located in the directory @a path
3011 * to use disk space more efficiently.
3013 * @since New in 1.6.
3016 svn_fs_pack(const char *db_path,
3017 svn_fs_pack_notify_t notify_func,
3019 svn_cancel_func_t cancel_func,
3025 * Perform backend-specific data consistency and correctness validations
3026 * to the Subversion filesystem (mainly the meta-data) located in the
3027 * directory @a path. Use the backend-specific configuration @a fs_config
3028 * when opening the filesystem. @a NULL is valid for all backends.
3029 * Use @a scratch_pool for temporary allocations.
3031 * @a start and @a end define the (minimum) range of revisions to check.
3032 * If @a start is #SVN_INVALID_REVNUM, it defaults to @c r0. Likewise,
3033 * @a end will default to the current youngest repository revision when
3034 * given as #SVN_INVALID_REVNUM. Since meta data checks may have to touch
3035 * other revisions as well, you may receive notifications for revisions
3036 * outside the specified range. In fact, it is perfectly legal for a FS
3037 * implementation to always check all revisions.
3039 * Global invariants are only guaranteed to get verified when @a r0 has
3040 * been included in the range of revisions to check.
3042 * The optional @a notify_func callback is only a general feedback that
3043 * the operation is still in process but may be called in random revisions
3044 * order and more than once for the same revision, i.e. r2, r1, r2 would
3045 * be a valid sequence.
3047 * The optional @a cancel_func callback will be invoked as usual to allow
3048 * the user to preempt this potentially lengthy operation.
3050 * @note You probably don't want to use this directly. Take a look at
3051 * svn_repos_verify_fs2() instead, which does non-backend-specific
3052 * verifications as well.
3054 * @note To ensure a full verification using all tests and covering all
3055 * revisions, you must call this function *and* #svn_fs_verify_root.
3057 * @note Implementors, please do tests that can be done efficiently for
3058 * a single revision in #svn_fs_verify_root. This function is meant for
3059 * global checks or tests that require an expensive context setup.
3061 * @see svn_repos_verify_fs2()
3062 * @see svn_fs_verify_root()
3064 * @since New in 1.8.
3067 svn_fs_verify(const char *path,
3068 apr_hash_t *fs_config,
3071 svn_fs_progress_notify_func_t notify_func,
3073 svn_cancel_func_t cancel_func,
3075 apr_pool_t *scratch_pool);
3078 * Perform backend-specific data consistency and correctness validations
3079 * of @a root in the Subversion filesystem @a fs. @a root is typically
3080 * a revision root (see svn_fs_revision_root()), but may be a
3081 * transaction root. Use @a scratch_pool for temporary allocations.
3083 * @note You probably don't want to use this directly. Take a look at
3084 * svn_repos_verify_fs2() instead, which does non-backend-specific
3085 * verifications as well.
3087 * @note To ensure a full verification using all available tests and
3088 * covering all revisions, you must call both this function and
3091 * @note Implementors, please perform tests that cannot be done
3092 * efficiently for a single revision in #svn_fs_verify. This function
3093 * is intended for local checks that don't require an expensive context
3096 * @see svn_repos_verify_fs2()
3097 * @see svn_fs_verify()
3099 * @since New in 1.8.
3102 svn_fs_verify_root(svn_fs_root_t *root,
3103 apr_pool_t *scratch_pool);
3108 * @defgroup fs_info Filesystem information subsystem
3113 * A structure that provides some information about a filesystem.
3114 * Returned by svn_fs_info() for #SVN_FS_TYPE_FSFS filesystems.
3116 * @note Fields may be added to the end of this structure in future
3117 * versions. Therefore, users shouldn't allocate structures of this
3118 * type, to preserve binary compatibility.
3120 * @since New in 1.9.
3122 typedef struct svn_fs_fsfs_info_t {
3124 /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSFS. */
3125 const char *fs_type;
3127 /** Shard size, or 0 if the filesystem is not currently sharded. */
3130 /** The smallest revision (as #svn_revnum_t) which is not in a pack file.
3131 * @note Zero (0) if (but not iff) the format does not support packing. */
3132 svn_revnum_t min_unpacked_rev;
3134 /** TRUE if logical addressing is enabled for this repository.
3135 * FALSE if repository uses physical addressing. */
3136 svn_boolean_t log_addressing;
3137 /* ### TODO: information about fsfs.conf? rep-cache.db? write locks? */
3139 /* If you add fields here, check whether you need to extend svn_fs_info()
3140 or svn_fs_info_dup(). */
3141 } svn_fs_fsfs_info_t;
3144 * A structure that provides some information about a filesystem.
3145 * Returned by svn_fs_info() for #SVN_FS_TYPE_FSX filesystems.
3147 * @note Fields may be added to the end of this structure in future
3148 * versions. Therefore, users shouldn't allocate structures of this
3149 * type, to preserve binary compatibility.
3151 * @since New in 1.9.
3153 typedef struct svn_fs_fsx_info_t {
3155 /** Filesystem backend (#fs_type), i.e., the string #SVN_FS_TYPE_FSX. */
3156 const char *fs_type;
3158 /** Shard size, always > 0. */
3161 /** The smallest revision which is not in a pack file. */
3162 svn_revnum_t min_unpacked_rev;
3164 /* If you add fields here, check whether you need to extend svn_fs_info()
3165 or svn_fs_info_dup(). */
3167 } svn_fs_fsx_info_t;
3169 /** @see svn_fs_info
3170 * @since New in 1.9. */
3171 typedef struct svn_fs_info_placeholder_t {
3172 /** @see svn_fs_type */
3173 const char *fs_type;
3175 /* Do not add new fields here, to maintain compatibility with the first
3176 released version of svn_fs_fsfs_info_t. */
3177 } svn_fs_info_placeholder_t;
3180 * Set @a *fs_info to a struct describing @a fs. The type of the
3181 * struct depends on the backend: for #SVN_FS_TYPE_FSFS, the struct will be
3182 * of type #svn_fs_fsfs_info_t; for #SVN_FS_TYPE_FSX, it will be of type
3183 * #svn_fs_fsx_info_t; otherwise, the struct is guaranteed to be
3184 * (compatible with) #svn_fs_info_placeholder_t.
3186 * @see #svn_fs_fsfs_info_t, #svn_fs_fsx_info_t
3188 * @since New in 1.9.
3191 svn_fs_info(const svn_fs_info_placeholder_t **fs_info,
3193 apr_pool_t *result_pool,
3194 apr_pool_t *scratch_pool);
3197 * Return a duplicate of @a info, allocated in @a result_pool. The returned
3198 * struct will be of the same type as the passed-in struct, which itself
3199 * must have been returned from svn_fs_info() or svn_fs_info_dup(). No part
3200 * of the new structure will be shared with @a info (except static string
3201 * constants). Use @a scratch_pool for temporary allocations.
3203 * @see #svn_fs_info_placeholder_t, #svn_fs_fsfs_info_t
3205 * @since New in 1.9.
3208 svn_fs_info_dup(const void *info,
3209 apr_pool_t *result_pool,
3210 apr_pool_t *scratch_pool);
3216 #endif /* __cplusplus */
3218 #endif /* SVN_FS_H */