Subversion
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Groups Pages
svn_fs.h
Go to the documentation of this file.
1 /**
2  * @copyright
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
11  *
12  * http://www.apache.org/licenses/LICENSE-2.0
13  *
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
19  * under the License.
20  * ====================================================================
21  * @endcopyright
22  *
23  * @file svn_fs.h
24  * @brief Interface to the Subversion filesystem.
25  */
26 
27 #ifndef SVN_FS_H
28 #define SVN_FS_H
29 
30 #include <apr.h>
31 #include <apr_pools.h>
32 #include <apr_hash.h>
33 #include <apr_tables.h>
34 #include <apr_time.h> /* for apr_time_t */
35 
36 #include "svn_types.h"
37 #include "svn_string.h"
38 #include "svn_delta.h"
39 #include "svn_io.h"
40 #include "svn_mergeinfo.h"
41 #include "svn_checksum.h"
42 
43 
44 #ifdef __cplusplus
45 extern "C" {
46 #endif /* __cplusplus */
47 
48 
49 /**
50  * Get libsvn_fs version information.
51  *
52  * @since New in 1.1.
53  */
54 const svn_version_t *
55 svn_fs_version(void);
56 
57 /**
58  * @defgroup fs_handling Filesystem interaction subsystem
59  * @{
60  */
61 
62 /* Opening and creating filesystems. */
63 
64 
65 /** An object representing a Subversion filesystem. */
66 typedef struct svn_fs_t svn_fs_t;
67 
68 
69 /**
70  * @name Filesystem configuration options
71  * @{
72  */
73 #define SVN_FS_CONFIG_BDB_TXN_NOSYNC "bdb-txn-nosync"
74 #define SVN_FS_CONFIG_BDB_LOG_AUTOREMOVE "bdb-log-autoremove"
75 
76 /** Enable / disable text delta caching for a FSFS repository.
77  *
78  * @since New in 1.7.
79  */
80 #define SVN_FS_CONFIG_FSFS_CACHE_DELTAS "fsfs-cache-deltas"
81 
82 /** Enable / disable full-text caching for a FSFS repository.
83  *
84  * @since New in 1.7.
85  */
86 #define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS "fsfs-cache-fulltexts"
87 
88 /* See also svn_fs_type(). */
89 /** @since New in 1.1. */
90 #define SVN_FS_CONFIG_FS_TYPE "fs-type"
91 /** @since New in 1.1. */
92 #define SVN_FS_TYPE_BDB "bdb"
93 /** @since New in 1.1. */
94 #define SVN_FS_TYPE_FSFS "fsfs"
95 
96 /** Create repository format compatible with Subversion versions
97  * earlier than 1.4.
98  *
99  * @since New in 1.4.
100  */
101 #define SVN_FS_CONFIG_PRE_1_4_COMPATIBLE "pre-1.4-compatible"
102 
103 /** Create repository format compatible with Subversion versions
104  * earlier than 1.5.
105  *
106  * @since New in 1.5.
107  */
108 #define SVN_FS_CONFIG_PRE_1_5_COMPATIBLE "pre-1.5-compatible"
109 
110 /** Create repository format compatible with Subversion versions
111  * earlier than 1.6.
112  *
113  * @since New in 1.6.
114  */
115 #define SVN_FS_CONFIG_PRE_1_6_COMPATIBLE "pre-1.6-compatible"
116 /** @} */
117 
118 
119 /**
120  * Callers should invoke this function to initialize global state in
121  * the FS library before creating FS objects. If this function is
122  * invoked, no FS objects may be created in another thread at the same
123  * time as this invocation, and the provided @a pool must last longer
124  * than any FS object created subsequently.
125  *
126  * If this function is not called, the FS library will make a best
127  * effort to bootstrap a mutex for protecting data common to FS
128  * objects; however, there is a small window of failure. Also, a
129  * small amount of data will be leaked if the Subversion FS library is
130  * dynamically unloaded, and using the bdb FS can potentially segfault
131  * or invoke other undefined behavior if this function is not called
132  * with an appropriate pool (such as the pool the module was loaded into)
133  * when loaded dynamically.
134  *
135  * If this function is called multiple times before the pool passed to
136  * the first call is destroyed or cleared, the later calls will have
137  * no effect.
138  *
139  * @since New in 1.2.
140  */
141 svn_error_t *
142 svn_fs_initialize(apr_pool_t *pool);
143 
144 
145 /** The type of a warning callback function. @a baton is the value specified
146  * in the call to svn_fs_set_warning_func(); the filesystem passes it through
147  * to the callback. @a err contains the warning message.
148  *
149  * The callback function should not clear the error that is passed to it;
150  * its caller should do that.
151  */
152 typedef void (*svn_fs_warning_callback_t)(void *baton, svn_error_t *err);
153 
154 
155 /** Provide a callback function, @a warning, that @a fs should use to
156  * report (non-fatal) errors. To print an error, the filesystem will call
157  * @a warning, passing it @a warning_baton and the error.
158  *
159  * By default, this is set to a function that will crash the process.
160  * Dumping to @c stderr or <tt>/dev/tty</tt> is not acceptable default
161  * behavior for server processes, since those may both be equivalent to
162  * <tt>/dev/null</tt>.
163  */
164 void
167  void *warning_baton);
168 
169 
170 
171 /**
172  * Create a new, empty Subversion filesystem, stored in the directory
173  * @a path, and return a pointer to it in @a *fs_p. @a path must not
174  * currently exist, but its parent must exist. If @a fs_config is not
175  * @c NULL, the options it contains modify the behavior of the
176  * filesystem. The interpretation of @a fs_config is specific to the
177  * filesystem back-end. The new filesystem may be closed by
178  * destroying @a pool.
179  *
180  * @note The lifetime of @a fs_config must not be shorter than @a
181  * pool's. It's a good idea to allocate @a fs_config from @a pool or
182  * one of its ancestors.
183  *
184  * If @a fs_config contains a value for #SVN_FS_CONFIG_FS_TYPE, that
185  * value determines the filesystem type for the new filesystem.
186  * Currently defined values are:
187  *
188  * SVN_FS_TYPE_BDB Berkeley-DB implementation
189  * SVN_FS_TYPE_FSFS Native-filesystem implementation
190  *
191  * If @a fs_config is @c NULL or does not contain a value for
192  * #SVN_FS_CONFIG_FS_TYPE then the default filesystem type will be used.
193  * This will typically be BDB for version 1.1 and FSFS for later versions,
194  * though the caller should not rely upon any particular default if they
195  * wish to ensure that a filesystem of a specific type is created.
196  *
197  * @since New in 1.1.
198  */
199 svn_error_t *
200 svn_fs_create(svn_fs_t **fs_p,
201  const char *path,
202  apr_hash_t *fs_config,
203  apr_pool_t *pool);
204 
205 /**
206  * Open a Subversion filesystem located in the directory @a path, and
207  * return a pointer to it in @a *fs_p. If @a fs_config is not @c
208  * NULL, the options it contains modify the behavior of the
209  * filesystem. The interpretation of @a fs_config is specific to the
210  * filesystem back-end. The opened filesystem may be closed by
211  * destroying @a pool.
212  *
213  * @note The lifetime of @a fs_config must not be shorter than @a
214  * pool's. It's a good idea to allocate @a fs_config from @a pool or
215  * one of its ancestors.
216  *
217  * Only one thread may operate on any given filesystem object at once.
218  * Two threads may access the same filesystem simultaneously only if
219  * they open separate filesystem objects.
220  *
221  * @note You probably don't want to use this directly. Take a look at
222  * svn_repos_open2() instead.
223  *
224  * @since New in 1.1.
225  */
226 svn_error_t *
227 svn_fs_open(svn_fs_t **fs_p,
228  const char *path,
229  apr_hash_t *fs_config,
230  apr_pool_t *pool);
231 
232 /**
233  * Upgrade the Subversion filesystem located in the directory @a path
234  * to the latest version supported by this library. Return
235  * #SVN_ERR_FS_UNSUPPORTED_UPGRADE and make no changes to the
236  * filesystem if the requested upgrade is not supported. Use @a pool
237  * for necessary allocations.
238  *
239  * @note You probably don't want to use this directly. Take a look at
240  * svn_repos_upgrade() instead.
241  *
242  * @since New in 1.5.
243  */
244 svn_error_t *
245 svn_fs_upgrade(const char *path,
246  apr_pool_t *pool);
247 
248 /**
249  * Return, in @a *fs_type, a string identifying the back-end type of
250  * the Subversion filesystem located in @a path. Allocate @a *fs_type
251  * in @a pool.
252  *
253  * The string should be equal to one of the @c SVN_FS_TYPE_* defined
254  * constants, unless the filesystem is a new back-end type added in
255  * a later version of Subversion.
256  *
257  * In general, the type should make no difference in the filesystem's
258  * semantics, but there are a few situations (such as backups) where
259  * it might matter.
260  *
261  * @since New in 1.3.
262  */
263 svn_error_t *
264 svn_fs_type(const char **fs_type,
265  const char *path,
266  apr_pool_t *pool);
267 
268 /**
269  * Return the path to @a fs's repository, allocated in @a pool.
270  * @note This is just what was passed to svn_fs_create() or
271  * svn_fs_open() -- might be absolute, might not.
272  *
273  * @since New in 1.1.
274  */
275 const char *
277  apr_pool_t *pool);
278 
279 /**
280  * Delete the filesystem at @a path.
281  *
282  * @since New in 1.1.
283  */
284 svn_error_t *
285 svn_fs_delete_fs(const char *path,
286  apr_pool_t *pool);
287 
288 /**
289  * Copy a possibly live Subversion filesystem from @a src_path to
290  * @a dest_path. If @a clean is @c TRUE, perform cleanup on the
291  * source filesystem as part of the copy operation; currently, this
292  * means deleting copied, unused logfiles for a Berkeley DB source
293  * filesystem.
294  *
295  * @since New in 1.1.
296  */
297 svn_error_t *
298 svn_fs_hotcopy(const char *src_path,
299  const char *dest_path,
300  svn_boolean_t clean,
301  apr_pool_t *pool);
302 
303 /** Perform any necessary non-catastrophic recovery on the Subversion
304  * filesystem located at @a path.
305  *
306  * If @a cancel_func is not @c NULL, it is called periodically with
307  * @a cancel_baton as argument to see if the client wishes to cancel
308  * recovery. BDB filesystems do not currently support cancellation.
309  *
310  * Do any necessary allocation within @a pool.
311  *
312  * For FSFS filesystems, recovery is currently limited to recreating
313  * the db/current file, and does not require exclusive access.
314  *
315  * For BDB filesystems, recovery requires exclusive access, and is
316  * described in detail below.
317  *
318  * After an unexpected server exit, due to a server crash or a system
319  * crash, a Subversion filesystem based on Berkeley DB needs to run
320  * recovery procedures to bring the database back into a consistent
321  * state and release any locks that were held by the deceased process.
322  * The recovery procedures require exclusive access to the database
323  * --- while they execute, no other process or thread may access the
324  * database.
325  *
326  * In a server with multiple worker processes, like Apache, if a
327  * worker process accessing the filesystem dies, you must stop the
328  * other worker processes, and run recovery. Then, the other worker
329  * processes can re-open the database and resume work.
330  *
331  * If the server exited cleanly, there is no need to run recovery, but
332  * there is no harm in it, either, and it take very little time. So
333  * it's a fine idea to run recovery when the server process starts,
334  * before it begins handling any requests.
335  *
336  * @since New in 1.5.
337  */
338 svn_error_t *
339 svn_fs_recover(const char *path,
340  svn_cancel_func_t cancel_func,
341  void *cancel_baton,
342  apr_pool_t *pool);
343 
344 
345 /** Subversion filesystems based on Berkeley DB.
346  *
347  * The following functions are specific to Berkeley DB filesystems.
348  *
349  * @defgroup svn_fs_bdb Berkeley DB filesystems
350  * @{
351  */
352 
353 /** Register an error handling function for Berkeley DB error messages.
354  *
355  * @deprecated Provided for backward compatibility with the 1.2 API.
356  *
357  * Despite being first declared deprecated in Subversion 1.3, this API
358  * is redundant in versions 1.1 and 1.2 as well.
359  *
360  * Berkeley DB's error codes are seldom sufficiently informative to allow
361  * adequate troubleshooting. Berkeley DB provides extra messages through
362  * a callback function - if an error occurs, the @a handler will be called
363  * with two strings: an error message prefix, which will be zero, and
364  * an error message. @a handler might print it out, log it somewhere,
365  * etc.
366  *
367  * Subversion 1.1 and later install their own handler internally, and
368  * wrap the messages from Berkeley DB into the standard svn_error_t object,
369  * making any information gained through this interface redundant.
370  *
371  * It is only worth using this function if your program will be used
372  * with Subversion 1.0.
373  *
374  * This function connects to the Berkeley DB @c DBENV->set_errcall interface.
375  * Since that interface supports only a single callback, Subversion's internal
376  * callback is registered with Berkeley DB, and will forward notifications to
377  * a user provided callback after performing its own processing.
378  */
380 svn_error_t *
382  void (*handler)(const char *errpfx,
383  char *msg));
384 
385 /** Set @a *logfiles to an array of <tt>const char *</tt> log file names
386  * of Berkeley DB-based Subversion filesystem.
387  *
388  * If @a only_unused is @c TRUE, set @a *logfiles to an array which
389  * contains only the names of Berkeley DB log files no longer in use
390  * by the filesystem. Otherwise, all log files (used and unused) are
391  * returned.
392 
393  * This function wraps the Berkeley DB 'log_archive' function
394  * called by the db_archive binary. Repository administrators may
395  * want to run this function periodically and delete the unused log
396  * files, as a way of reclaiming disk space.
397  */
398 svn_error_t *
399 svn_fs_berkeley_logfiles(apr_array_header_t **logfiles,
400  const char *path,
401  svn_boolean_t only_unused,
402  apr_pool_t *pool);
403 
404 
405 /**
406  * The following functions are similar to their generic counterparts.
407  *
408  * In Subversion 1.2 and earlier, they only work on Berkeley DB filesystems.
409  * In Subversion 1.3 and later, they perform largely as aliases for their
410  * generic counterparts (with the exception of recover, which only gained
411  * a generic counterpart in 1.5).
412  *
413  * @defgroup svn_fs_bdb_deprecated Berkeley DB filesystem compatibility
414  * @{
415  */
416 
417 /** @deprecated Provided for backward compatibility with the 1.0 API. */
419 svn_fs_t *
420 svn_fs_new(apr_hash_t *fs_config,
421  apr_pool_t *pool);
422 
423 /** @deprecated Provided for backward compatibility with the 1.0 API. */
425 svn_error_t *
427  const char *path);
428 
429 /** @deprecated Provided for backward compatibility with the 1.0 API. */
431 svn_error_t *
433  const char *path);
434 
435 /** @deprecated Provided for backward compatibility with the 1.0 API. */
437 const char *
439  apr_pool_t *pool);
440 
441 /** @deprecated Provided for backward compatibility with the 1.0 API. */
443 svn_error_t *
444 svn_fs_delete_berkeley(const char *path,
445  apr_pool_t *pool);
446 
447 /** @deprecated Provided for backward compatibility with the 1.0 API. */
449 svn_error_t *
450 svn_fs_hotcopy_berkeley(const char *src_path,
451  const char *dest_path,
452  svn_boolean_t clean_logs,
453  apr_pool_t *pool);
454 
455 /** @deprecated Provided for backward compatibility with the 1.4 API. */
457 svn_error_t *
458 svn_fs_berkeley_recover(const char *path,
459  apr_pool_t *pool);
460 /** @} */
461 
462 /** @} */
463 
464 
465 /** Filesystem Access Contexts.
466  *
467  * @since New in 1.2.
468  *
469  * At certain times, filesystem functions need access to temporary
470  * user data. For example, which user is changing a file? If the
471  * file is locked, has an appropriate lock-token been supplied?
472  *
473  * This temporary user data is stored in an "access context" object,
474  * and the access context is then connected to the filesystem object.
475  * Whenever a filesystem function requires information, it can pull
476  * things out of the context as needed.
477  *
478  * @defgroup svn_fs_access_ctx Filesystem access contexts
479  * @{
480  */
481 
482 /** An opaque object representing temporary user data. */
484 
485 
486 /** Set @a *access_ctx to a new #svn_fs_access_t object representing
487  * @a username, allocated in @a pool. @a username is presumed to
488  * have been authenticated by the caller.
489  *
490  * Make a deep copy of @a username.
491  */
492 svn_error_t *
494  const char *username,
495  apr_pool_t *pool);
496 
497 
498 /** Associate @a access_ctx with an open @a fs.
499  *
500  * This function can be run multiple times on the same open
501  * filesystem, in order to change the filesystem access context for
502  * different filesystem operations. Pass a NULL value for @a
503  * access_ctx to disassociate the current access context from the
504  * filesystem.
505  */
506 svn_error_t *
508  svn_fs_access_t *access_ctx);
509 
510 
511 /** Set @a *access_ctx to the current @a fs access context, or NULL if
512  * there is no current fs access context.
513  */
514 svn_error_t *
516  svn_fs_t *fs);
517 
518 
519 /** Accessors for the access context: */
520 
521 /** Set @a *username to the name represented by @a access_ctx. */
522 svn_error_t *
523 svn_fs_access_get_username(const char **username,
524  svn_fs_access_t *access_ctx);
525 
526 
527 /** Push a lock-token @a token associated with path @a path into the
528  * context @a access_ctx. The context remembers all tokens it
529  * receives, and makes them available to fs functions. The token and
530  * path are not duplicated into @a access_ctx's pool; make sure the
531  * token's lifetime is at least as long as @a access_ctx.
532  *
533  * @since New in 1.6. */
534 svn_error_t *
536  const char *path,
537  const char *token);
538 
539 /**
540  * Same as svn_fs_access_add_lock_token2(), but with @a path set to value 1.
541  *
542  * @deprecated Provided for backward compatibility with the 1.5 API.
543  */
545 svn_error_t *
547  const char *token);
548 
549 /** @} */
550 
551 
552 /** Filesystem Nodes and Node-Revisions.
553  *
554  * In a Subversion filesystem, a `node' corresponds roughly to an
555  * `inode' in a Unix filesystem:
556  * - A node is either a file or a directory.
557  * - A node's contents change over time.
558  * - When you change a node's contents, it's still the same node; it's
559  * just been changed. So a node's identity isn't bound to a specific
560  * set of contents.
561  * - If you rename a node, it's still the same node, just under a
562  * different name. So a node's identity isn't bound to a particular
563  * filename.
564  *
565  * A `node revision' refers to one particular version of a node's contents,
566  * that existed over a specific period of time (one or more repository
567  * revisions). Changing a node's contents always creates a new revision of
568  * that node, which is to say creates a new `node revision'. Once created,
569  * a node revision's contents never change.
570  *
571  * When we create a node, its initial contents are the initial revision of
572  * the node. As users make changes to the node over time, we create new
573  * revisions of that same node. When a user commits a change that deletes
574  * a file from the filesystem, we don't delete the node, or any revision
575  * of it --- those stick around to allow us to recreate prior revisions of
576  * the filesystem. Instead, we just remove the reference to the node
577  * from the directory.
578  *
579  * Each node revision is a part of exactly one node, and appears only once
580  * in the history of that node. It is uniquely identified by a node
581  * revision id, #svn_fs_id_t. Its node revision id also identifies which
582  * node it is a part of.
583  *
584  * @note: Often when we talk about `the node' within the context of a single
585  * revision (or transaction), we implicitly mean `the node as it appears in
586  * this revision (or transaction)', or in other words `the node revision'.
587  *
588  * @note: Commonly, a node revision will have the same content as some other
589  * node revisions in the same node and in different nodes. The FS libraries
590  * allow different node revisions to share the same data without storing a
591  * separate copy of the data.
592  *
593  * @defgroup svn_fs_nodes Filesystem nodes
594  * @{
595  */
596 
597 /** An object representing a node-revision id. */
598 typedef struct svn_fs_id_t svn_fs_id_t;
599 
600 
601 /** Return -1, 0, or 1 if node revisions @a a and @a b are respectively
602  * unrelated, equivalent, or otherwise related (part of the same node).
603  */
604 int
606  const svn_fs_id_t *b);
607 
608 
609 
610 /** Return TRUE if node revisions @a id1 and @a id2 are related (part of the
611  * same node), else return FALSE.
612  */
615  const svn_fs_id_t *id2);
616 
617 
618 /**
619  * @note This function is not guaranteed to work with all filesystem
620  * types. There is currently no un-deprecated equivalent; contact the
621  * Subversion developers if you have a need for it.
622  *
623  * @deprecated Provided for backward compatibility with the 1.0 API.
624  */
626 svn_fs_id_t *
627 svn_fs_parse_id(const char *data,
628  apr_size_t len,
629  apr_pool_t *pool);
630 
631 
632 /** Return a Subversion string containing the unparsed form of the
633  * node revision id @a id. Allocate the string containing the
634  * unparsed form in @a pool.
635  */
636 svn_string_t *
638  apr_pool_t *pool);
639 
640 /** @} */
641 
642 
643 /** Filesystem Transactions.
644  *
645  * To make a change to a Subversion filesystem:
646  * - Create a transaction object, using svn_fs_begin_txn().
647  * - Call svn_fs_txn_root(), to get the transaction's root directory.
648  * - Make whatever changes you like in that tree.
649  * - Commit the transaction, using svn_fs_commit_txn().
650  *
651  * The filesystem implementation guarantees that your commit will
652  * either:
653  * - succeed completely, so that all of the changes are committed to
654  * create a new revision of the filesystem, or
655  * - fail completely, leaving the filesystem unchanged.
656  *
657  * Until you commit the transaction, any changes you make are
658  * invisible. Only when your commit succeeds do they become visible
659  * to the outside world, as a new revision of the filesystem.
660  *
661  * If you begin a transaction, and then decide you don't want to make
662  * the change after all (say, because your net connection with the
663  * client disappeared before the change was complete), you can call
664  * svn_fs_abort_txn(), to cancel the entire transaction; this
665  * leaves the filesystem unchanged.
666  *
667  * The only way to change the contents of files or directories, or
668  * their properties, is by making a transaction and creating a new
669  * revision, as described above. Once a revision has been committed, it
670  * never changes again; the filesystem interface provides no means to
671  * go back and edit the contents of an old revision. Once history has
672  * been recorded, it is set in stone. Clients depend on this property
673  * to do updates and commits reliably; proxies depend on this property
674  * to cache changes accurately; and so on.
675  *
676  * There are two kinds of nodes in the filesystem: mutable, and
677  * immutable. Revisions in the filesystem consist entirely of
678  * immutable nodes, whose contents never change. A transaction in
679  * progress, which the user is still constructing, uses mutable nodes
680  * for those nodes which have been changed so far, and refers to
681  * immutable nodes from existing revisions for portions of the tree
682  * which haven't been changed yet in that transaction.
683  *
684  * Immutable nodes, as part of revisions, never refer to mutable
685  * nodes, which are part of uncommitted transactions. Mutable nodes
686  * may refer to immutable nodes, or other mutable nodes.
687  *
688  * Note that the terms "immutable" and "mutable" describe whether or
689  * not the nodes have been changed as part of a transaction --- not
690  * the permissions on the nodes they refer to. Even if you aren't
691  * authorized to modify the filesystem's root directory, you might be
692  * authorized to change some descendant of the root; doing so would
693  * create a new mutable copy of the root directory. Mutability refers
694  * to the role of the node: part of an existing revision, or part of a
695  * new one. This is independent of your authorization to make changes
696  * to a given node.
697  *
698  * Transactions are actually persistent objects, stored in the
699  * database. You can open a filesystem, begin a transaction, and
700  * close the filesystem, and then a separate process could open the
701  * filesystem, pick up the same transaction, and continue work on it.
702  * When a transaction is successfully committed, it is removed from
703  * the database.
704  *
705  * Every transaction is assigned a name. You can open a transaction
706  * by name, and resume work on it, or find out the name of a
707  * transaction you already have open. You can also list all the
708  * transactions currently present in the database.
709  *
710  * You may assign properties to transactions; these are name/value
711  * pairs. When you commit a transaction, all of its properties become
712  * unversioned revision properties of the new revision. (There is one
713  * exception: the svn:date property will be automatically set on new
714  * transactions to the date that the transaction was created, and will
715  * be overwritten when the transaction is committed by the current
716  * time; changes to a transaction's svn:date property will not affect
717  * its committed value.)
718  *
719  * Transaction names are guaranteed to contain only letters (upper-
720  * and lower-case), digits, `-', and `.', from the ASCII character
721  * set.
722  *
723  * The Subversion filesystem will make a best effort to not reuse
724  * transaction names. The Berkeley DB backend generates transaction
725  * names using a sequence, or a counter, which is stored in the BDB
726  * database. Each new transaction increments the counter. The
727  * current value of the counter is not serialized into a filesystem
728  * dump file, so dumping and restoring the repository will reset the
729  * sequence and reuse transaction names. The FSFS backend generates a
730  * transaction name using the hostname, process ID and current time in
731  * microseconds since 00:00:00 January 1, 1970 UTC. So it is
732  * extremely unlikely that a transaction name will be reused.
733  *
734  * @defgroup svn_fs_txns Filesystem transactions
735  * @{
736  */
737 
738 /** The type of a Subversion transaction object. */
739 typedef struct svn_fs_txn_t svn_fs_txn_t;
740 
741 
742 /** @defgroup svn_fs_begin_txn2_flags Bitmask flags for svn_fs_begin_txn2()
743  * @since New in 1.2.
744  * @{ */
745 
746 /** Do on-the-fly out-of-dateness checks. That is, an fs routine may
747  * throw error if a caller tries to edit an out-of-date item in the
748  * transaction.
749  *
750  * @warning ### Not yet implemented.
751  */
752 #define SVN_FS_TXN_CHECK_OOD 0x00001
753 
754 /** Do on-the-fly lock checks. That is, an fs routine may throw error
755  * if a caller tries to edit a locked item without having rights to the lock.
756  */
757 #define SVN_FS_TXN_CHECK_LOCKS 0x00002
758 /** @} */
759 
760 /**
761  * Begin a new transaction on the filesystem @a fs, based on existing
762  * revision @a rev. Set @a *txn_p to a pointer to the new transaction.
763  * When committed, this transaction will create a new revision.
764  *
765  * Allocate the new transaction in @a pool; when @a pool is freed, the new
766  * transaction will be closed (neither committed nor aborted).
767  *
768  * @a flags determines transaction enforcement behaviors, and is composed
769  * from the constants SVN_FS_TXN_* (#SVN_FS_TXN_CHECK_OOD etc.).
770  *
771  * @note If you're building a txn for committing, you probably
772  * don't want to call this directly. Instead, call
773  * svn_repos_fs_begin_txn_for_commit(), which honors the
774  * repository's hook configurations.
775  *
776  * @since New in 1.2.
777  */
778 svn_error_t *
780  svn_fs_t *fs,
781  svn_revnum_t rev,
782  apr_uint32_t flags,
783  apr_pool_t *pool);
784 
785 
786 /**
787  * Same as svn_fs_begin_txn2(), but with @a flags set to 0.
788  *
789  * @deprecated Provided for backward compatibility with the 1.1 API.
790  */
792 svn_error_t *
794  svn_fs_t *fs,
795  svn_revnum_t rev,
796  apr_pool_t *pool);
797 
798 
799 
800 /** Commit @a txn.
801  *
802  * @note You usually don't want to call this directly.
803  * Instead, call svn_repos_fs_commit_txn(), which honors the
804  * repository's hook configurations.
805  *
806  * If the transaction conflicts with other changes committed to the
807  * repository, return an #SVN_ERR_FS_CONFLICT error. Otherwise, create
808  * a new filesystem revision containing the changes made in @a txn,
809  * storing that new revision number in @a *new_rev, and return zero.
810  *
811  * If @a conflict_p is non-zero, use it to provide details on any
812  * conflicts encountered merging @a txn with the most recent committed
813  * revisions. If a conflict occurs, set @a *conflict_p to the path of
814  * the conflict in @a txn, with the same lifetime as @a txn;
815  * otherwise, set @a *conflict_p to NULL.
816  *
817  * If the commit succeeds, @a txn is invalid.
818  *
819  * If the commit fails for any reason, @a *new_rev is an invalid
820  * revision number, an error other than #SVN_NO_ERROR is returned and
821  * @a txn is still valid; you can make more operations to resolve the
822  * conflict, or call svn_fs_abort_txn() to abort the transaction.
823  *
824  * @note Success or failure of the commit of @a txn is determined by
825  * examining the value of @a *new_rev upon this function's return. If
826  * the value is a valid revision number, the commit was successful,
827  * even though a non-@c NULL function return value may indicate that
828  * something else went wrong in post commit FS processing.
829  */
830 svn_error_t *
831 svn_fs_commit_txn(const char **conflict_p,
832  svn_revnum_t *new_rev,
833  svn_fs_txn_t *txn,
834  apr_pool_t *pool);
835 
836 
837 /** Abort the transaction @a txn. Any changes made in @a txn are
838  * discarded, and the filesystem is left unchanged. Use @a pool for
839  * any necessary allocations.
840  *
841  * @note This function first sets the state of @a txn to "dead", and
842  * then attempts to purge it and any related data from the filesystem.
843  * If some part of the cleanup process fails, @a txn and some portion
844  * of its data may remain in the database after this function returns.
845  * Use svn_fs_purge_txn() to retry the transaction cleanup.
846  */
847 svn_error_t *
849  apr_pool_t *pool);
850 
851 
852 /** Cleanup the dead transaction in @a fs whose ID is @a txn_id. Use
853  * @a pool for all allocations. If the transaction is not yet dead,
854  * the error #SVN_ERR_FS_TRANSACTION_NOT_DEAD is returned. (The
855  * caller probably forgot to abort the transaction, or the cleanup
856  * step of that abort failed for some reason.)
857  */
858 svn_error_t *
860  const char *txn_id,
861  apr_pool_t *pool);
862 
863 
864 /** Set @a *name_p to the name of the transaction @a txn, as a
865  * NULL-terminated string. Allocate the name in @a pool.
866  */
867 svn_error_t *
868 svn_fs_txn_name(const char **name_p,
869  svn_fs_txn_t *txn,
870  apr_pool_t *pool);
871 
872 /** Return @a txn's base revision. */
875 
876 
877 
878 /** Open the transaction named @a name in the filesystem @a fs. Set @a *txn
879  * to the transaction.
880  *
881  * If there is no such transaction, #SVN_ERR_FS_NO_SUCH_TRANSACTION is
882  * the error returned.
883  *
884  * Allocate the new transaction in @a pool; when @a pool is freed, the new
885  * transaction will be closed (neither committed nor aborted).
886  */
887 svn_error_t *
889  svn_fs_t *fs,
890  const char *name,
891  apr_pool_t *pool);
892 
893 
894 /** Set @a *names_p to an array of <tt>const char *</tt> ids which are the
895  * names of all the currently active transactions in the filesystem @a fs.
896  * Allocate the array in @a pool.
897  */
898 svn_error_t *
899 svn_fs_list_transactions(apr_array_header_t **names_p,
900  svn_fs_t *fs,
901  apr_pool_t *pool);
902 
903 /* Transaction properties */
904 
905 /** Set @a *value_p to the value of the property named @a propname on
906  * transaction @a txn. If @a txn has no property by that name, set
907  * @a *value_p to zero. Allocate the result in @a pool.
908  */
909 svn_error_t *
910 svn_fs_txn_prop(svn_string_t **value_p,
911  svn_fs_txn_t *txn,
912  const char *propname,
913  apr_pool_t *pool);
914 
915 
916 /** Set @a *table_p to the entire property list of transaction @a txn, as
917  * an APR hash table allocated in @a pool. The resulting table maps property
918  * names to pointers to #svn_string_t objects containing the property value.
919  */
920 svn_error_t *
921 svn_fs_txn_proplist(apr_hash_t **table_p,
922  svn_fs_txn_t *txn,
923  apr_pool_t *pool);
924 
925 
926 /** Change a transactions @a txn's property's value, or add/delete a
927  * property. @a name is the name of the property to change, and @a value
928  * is the new value of the property, or zero if the property should be
929  * removed altogether. Do any necessary temporary allocation in @a pool.
930  */
931 svn_error_t *
933  const char *name,
934  const svn_string_t *value,
935  apr_pool_t *pool);
936 
937 
938 /** Change, add, and/or delete transaction property values in
939  * transaction @a txn. @a props is an array of <tt>svn_prop_t</tt>
940  * elements. This is equivalent to calling svn_fs_change_txn_prop()
941  * multiple times with the @c name and @c value fields of each
942  * successive <tt>svn_prop_t</tt>, but may be more efficient.
943  * (Properties not mentioned are left alone.) Do any necessary
944  * temporary allocation in @a pool.
945  *
946  * @since New in 1.5.
947  */
948 svn_error_t *
950  const apr_array_header_t *props,
951  apr_pool_t *pool);
952 
953 /** @} */
954 
955 
956 /** Roots.
957  *
958  * An #svn_fs_root_t object represents the root directory of some
959  * revision or transaction in a filesystem. To refer to particular
960  * node or node revision, you provide a root, and a directory path
961  * relative to that root.
962  *
963  * @defgroup svn_fs_roots Filesystem roots
964  * @{
965  */
966 
967 /** The Filesystem Root object. */
969 
970 
971 /** Set @a *root_p to the root directory of revision @a rev in filesystem @a fs.
972  * Allocate @a *root_p in a private subpool of @a pool; the root can be
973  * destroyed earlier than @a pool by calling #svn_fs_close_root.
974  */
975 svn_error_t *
977  svn_fs_t *fs,
978  svn_revnum_t rev,
979  apr_pool_t *pool);
980 
981 
982 /** Set @a *root_p to the root directory of @a txn. Allocate @a *root_p in a
983  * private subpool of @a pool; the root can be destroyed earlier than @a pool by
984  * calling #svn_fs_close_root.
985  */
986 svn_error_t *
988  svn_fs_txn_t *txn,
989  apr_pool_t *pool);
990 
991 
992 /** Free the root directory @a root; this only needs to be used if you want to
993  * free the memory associated with @a root earlier than the time you destroy
994  * the pool passed to the function that created it (svn_fs_revision_root() or
995  * svn_fs_txn_root()).
996  */
997 void
999 
1000 
1001 /** Return the filesystem to which @a root belongs. */
1002 svn_fs_t *
1004 
1005 
1006 /** Return @c TRUE iff @a root is a transaction root. */
1009 
1010 /** Return @c TRUE iff @a root is a revision root. */
1013 
1014 
1015 /** If @a root is the root of a transaction, return the name of the
1016  * transaction, allocated in @a pool; otherwise, return NULL.
1017  */
1018 const char *
1020  apr_pool_t *pool);
1021 
1022 /** If @a root is the root of a transaction, return the number of the
1023  * revision on which is was based when created. Otherwise, return
1024  * #SVN_INVALID_REVNUM.
1025  *
1026  * @since New in 1.5.
1027  */
1030 
1031 /** If @a root is the root of a revision, return the revision number.
1032  * Otherwise, return #SVN_INVALID_REVNUM.
1033  */
1036 
1037 /** @} */
1038 
1039 
1040 /** Directory entry names and directory paths.
1041  *
1042  * Here are the rules for directory entry names, and directory paths:
1043  *
1044  * A directory entry name is a Unicode string encoded in UTF-8, and
1045  * may not contain the NULL character (U+0000). The name should be in
1046  * Unicode canonical decomposition and ordering. No directory entry
1047  * may be named '.', '..', or the empty string. Given a directory
1048  * entry name which fails to meet these requirements, a filesystem
1049  * function returns an SVN_ERR_FS_PATH_SYNTAX error.
1050  *
1051  * A directory path is a sequence of zero or more directory entry
1052  * names, separated by slash characters (U+002f), and possibly ending
1053  * with slash characters. Sequences of two or more consecutive slash
1054  * characters are treated as if they were a single slash. If a path
1055  * ends with a slash, it refers to the same node it would without the
1056  * slash, but that node must be a directory, or else the function
1057  * returns an SVN_ERR_FS_NOT_DIRECTORY error.
1058  *
1059  * A path consisting of the empty string, or a string containing only
1060  * slashes, refers to the root directory.
1061  *
1062  * @defgroup svn_fs_directories Filesystem directories
1063  * @{
1064  */
1065 
1066 
1067 
1068 /** The kind of change that occurred on the path. */
1070 {
1071  /** path modified in txn */
1073 
1074  /** path added in txn */
1076 
1077  /** path removed in txn */
1079 
1080  /** path removed and re-added in txn */
1082 
1083  /** ignore all previous change items for path (internal-use only) */
1085 
1087 
1088 /** Change descriptor.
1089  *
1090  * @note Fields may be added to the end of this structure in future
1091  * versions. Therefore, to preserve binary compatibility, users
1092  * should not directly allocate structures of this type.
1093  *
1094  * @since New in 1.6. */
1096 {
1097  /** node revision id of changed path */
1099 
1100  /** kind of change */
1102 
1103  /** were there text mods? */
1105 
1106  /** were there property mods? */
1108 
1109  /** what node kind is the path?
1110  (Note: it is legal for this to be #svn_node_unknown.) */
1112 
1113  /** Copyfrom revision and path; this is only valid if copyfrom_known
1114  * is true. */
1116  svn_revnum_t copyfrom_rev;
1117  const char *copyfrom_path;
1118 
1119  /* NOTE! Please update svn_fs_path_change2_create() when adding new
1120  fields here. */
1122 
1123 
1124 /** Similar to #svn_fs_path_change2_t, but without kind and copyfrom
1125  * information.
1126  *
1127  * @deprecated Provided for backwards compatibility with the 1.5 API.
1128  */
1129 
1130 typedef struct svn_fs_path_change_t
1131 {
1132  /** node revision id of changed path */
1134 
1135  /** kind of change */
1137 
1138  /** were there text mods? */
1140 
1141  /** were there property mods? */
1143 
1145 
1146 /**
1147  * Allocate an #svn_fs_path_change2_t structure in @a pool, initialize and
1148  * return it.
1149  *
1150  * Set the @c node_rev_id field of the created struct to @a node_rev_id, and
1151  * @c change_kind to @a change_kind. Set all other fields to their
1152  * @c _unknown, @c NULL or invalid value, respectively.
1153  *
1154  * @since New in 1.6.
1155  */
1157 svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id,
1158  svn_fs_path_change_kind_t change_kind,
1159  apr_pool_t *pool);
1160 
1161 /** Determine what has changed under a @a root.
1162  *
1163  * Allocate and return a hash @a *changed_paths2_p containing descriptions
1164  * of the paths changed under @a root. The hash is keyed with
1165  * <tt>const char *</tt> paths, and has #svn_fs_path_change2_t * values.
1166  *
1167  * Callers can assume that this function takes time proportional to
1168  * the amount of data output, and does not need to do tree crawls;
1169  * however, it is possible that some of the @c node_kind fields in the
1170  * #svn_fs_path_change2_t * values will be #svn_node_unknown or
1171  * that and some of the @c copyfrom_known fields will be FALSE.
1172  *
1173  * Use @a pool for all allocations, including the hash and its values.
1174  *
1175  * @since New in 1.6.
1176  */
1177 svn_error_t *
1178 svn_fs_paths_changed2(apr_hash_t **changed_paths2_p,
1179  svn_fs_root_t *root,
1180  apr_pool_t *pool);
1181 
1182 
1183 /** Same as svn_fs_paths_changed2(), only with #svn_fs_path_change_t * values
1184  * in the hash (and thus no kind or copyfrom data).
1185  *
1186  * @deprecated Provided for backward compatibility with the 1.5 API.
1187  */
1189 svn_error_t *
1190 svn_fs_paths_changed(apr_hash_t **changed_paths_p,
1191  svn_fs_root_t *root,
1192  apr_pool_t *pool);
1193 
1194 /** @} */
1195 
1196 
1197 /* Operations appropriate to all kinds of nodes. */
1198 
1199 /** Set @a *kind_p to the type of node present at @a path under @a
1200  * root. If @a path does not exist under @a root, set @a *kind_p to
1201  * #svn_node_none. Use @a pool for temporary allocation.
1202  */
1203 svn_error_t *
1205  svn_fs_root_t *root,
1206  const char *path,
1207  apr_pool_t *pool);
1208 
1209 
1210 /** An opaque node history object. */
1212 
1213 
1214 /** Set @a *history_p to an opaque node history object which
1215  * represents @a path under @a root. @a root must be a revision root.
1216  * Use @a pool for all allocations.
1217  */
1218 svn_error_t *
1220  svn_fs_root_t *root,
1221  const char *path,
1222  apr_pool_t *pool);
1223 
1224 
1225 /** Set @a *prev_history_p to an opaque node history object which
1226  * represents the previous (or "next oldest") interesting history
1227  * location for the filesystem node represented by @a history, or @c
1228  * NULL if no such previous history exists. If @a cross_copies is @c
1229  * FALSE, also return @c NULL if stepping backwards in history to @a
1230  * *prev_history_p would cross a filesystem copy operation.
1231  *
1232  * @note If this is the first call to svn_fs_history_prev() for the @a
1233  * history object, it could return a history object whose location is
1234  * the same as the original. This will happen if the original
1235  * location was an interesting one (where the node was modified, or
1236  * took place in a copy event). This behavior allows looping callers
1237  * to avoid the calling svn_fs_history_location() on the object
1238  * returned by svn_fs_node_history(), and instead go ahead and begin
1239  * calling svn_fs_history_prev().
1240  *
1241  * @note This function uses node-id ancestry alone to determine
1242  * modifiedness, and therefore does NOT claim that in any of the
1243  * returned revisions file contents changed, properties changed,
1244  * directory entries lists changed, etc.
1245  *
1246  * @note The revisions returned for @a path will be older than or
1247  * the same age as the revision of that path in @a root. That is, if
1248  * @a root is a revision root based on revision X, and @a path was
1249  * modified in some revision(s) younger than X, those revisions
1250  * younger than X will not be included for @a path. */
1251 svn_error_t *
1252 svn_fs_history_prev(svn_fs_history_t **prev_history_p,
1253  svn_fs_history_t *history,
1254  svn_boolean_t cross_copies,
1255  apr_pool_t *pool);
1256 
1257 
1258 /** Set @a *path and @a *revision to the path and revision,
1259  * respectively, of the @a history object. Use @a pool for all
1260  * allocations.
1261  */
1262 svn_error_t *
1263 svn_fs_history_location(const char **path,
1264  svn_revnum_t *revision,
1265  svn_fs_history_t *history,
1266  apr_pool_t *pool);
1267 
1268 
1269 /** Set @a *is_dir to @c TRUE iff @a path in @a root is a directory.
1270  * Do any necessary temporary allocation in @a pool.
1271  */
1272 svn_error_t *
1274  svn_fs_root_t *root,
1275  const char *path,
1276  apr_pool_t *pool);
1277 
1278 
1279 /** Set @a *is_file to @c TRUE iff @a path in @a root is a file.
1280  * Do any necessary temporary allocation in @a pool.
1281  */
1282 svn_error_t *
1283 svn_fs_is_file(svn_boolean_t *is_file,
1284  svn_fs_root_t *root,
1285  const char *path,
1286  apr_pool_t *pool);
1287 
1288 
1289 /** Get the id of a node.
1290  *
1291  * Set @a *id_p to the node revision ID of @a path in @a root, allocated in
1292  * @a pool.
1293  *
1294  * If @a root is the root of a transaction, keep in mind that other
1295  * changes to the transaction can change which node @a path refers to,
1296  * and even whether the path exists at all.
1297  */
1298 svn_error_t *
1299 svn_fs_node_id(const svn_fs_id_t **id_p,
1300  svn_fs_root_t *root,
1301  const char *path,
1302  apr_pool_t *pool);
1303 
1304 /** Set @a *revision to the revision in which @a path under @a root was
1305  * created. Use @a pool for any temporary allocations. @a *revision will
1306  * be set to #SVN_INVALID_REVNUM for uncommitted nodes (i.e. modified nodes
1307  * under a transaction root). Note that the root of an unmodified transaction
1308  * is not itself considered to be modified; in that case, return the revision
1309  * upon which the transaction was based.
1310  */
1311 svn_error_t *
1313  svn_fs_root_t *root,
1314  const char *path,
1315  apr_pool_t *pool);
1316 
1317 /** Set @a *revision to the revision in which the line of history
1318  * represented by @a path under @a root originated. Use @a pool for
1319  * any temporary allocations. If @a root is a transaction root, @a
1320  * *revision will be set to #SVN_INVALID_REVNUM for any nodes newly
1321  * added in that transaction (brand new files or directories created
1322  * using #svn_fs_make_dir or #svn_fs_make_file).
1323  *
1324  * @since New in 1.5.
1325  */
1326 svn_error_t *
1328  svn_fs_root_t *root,
1329  const char *path,
1330  apr_pool_t *pool);
1331 
1332 /** Set @a *created_path to the path at which @a path under @a root was
1333  * created. Use @a pool for all allocations. Callers may use this
1334  * function in conjunction with svn_fs_node_created_rev() to perform a
1335  * reverse lookup of the mapping of (path, revision) -> node-id that
1336  * svn_fs_node_id() performs.
1337  */
1338 svn_error_t *
1339 svn_fs_node_created_path(const char **created_path,
1340  svn_fs_root_t *root,
1341  const char *path,
1342  apr_pool_t *pool);
1343 
1344 
1345 /** Set @a *value_p to the value of the property named @a propname of
1346  * @a path in @a root. If the node has no property by that name, set
1347  * @a *value_p to zero. Allocate the result in @a pool.
1348  */
1349 svn_error_t *
1350 svn_fs_node_prop(svn_string_t **value_p,
1351  svn_fs_root_t *root,
1352  const char *path,
1353  const char *propname,
1354  apr_pool_t *pool);
1355 
1356 
1357 /** Set @a *table_p to the entire property list of @a path in @a root,
1358  * as an APR hash table allocated in @a pool. The resulting table maps
1359  * property names to pointers to #svn_string_t objects containing the
1360  * property value.
1361  */
1362 svn_error_t *
1363 svn_fs_node_proplist(apr_hash_t **table_p,
1364  svn_fs_root_t *root,
1365  const char *path,
1366  apr_pool_t *pool);
1367 
1368 
1369 /** Change a node's property's value, or add/delete a property.
1370  *
1371  * - @a root and @a path indicate the node whose property should change.
1372  * @a root must be the root of a transaction, not the root of a revision.
1373  * - @a name is the name of the property to change.
1374  * - @a value is the new value of the property, or zero if the property should
1375  * be removed altogether.
1376  * Do any necessary temporary allocation in @a pool.
1377  */
1378 svn_error_t *
1380  const char *path,
1381  const char *name,
1382  const svn_string_t *value,
1383  apr_pool_t *pool);
1384 
1385 
1386 /** Determine if the properties of two path/root combinations are different.
1387  *
1388  * Set @a *changed_p to 1 if the properties at @a path1 under @a root1 differ
1389  * from those at @a path2 under @a root2, or set it to 0 if they are the
1390  * same. Both paths must exist under their respective roots, and both
1391  * roots must be in the same filesystem.
1392  */
1393 svn_error_t *
1395  svn_fs_root_t *root1,
1396  const char *path1,
1397  svn_fs_root_t *root2,
1398  const char *path2,
1399  apr_pool_t *pool);
1400 
1401 
1402 /** Discover a node's copy ancestry, if any.
1403  *
1404  * If the node at @a path in @a root was copied from some other node, set
1405  * @a *rev_p and @a *path_p to the revision and path (expressed as an
1406  * absolute filesystem path) of the other node, allocating @a *path_p
1407  * in @a pool.
1408  *
1409  * Else if there is no copy ancestry for the node, set @a *rev_p to
1410  * #SVN_INVALID_REVNUM and @a *path_p to NULL.
1411  *
1412  * If an error is returned, the values of @a *rev_p and @a *path_p are
1413  * undefined, but otherwise, if one of them is set as described above,
1414  * you may assume the other is set correspondingly.
1415  *
1416  * @a root may be a revision root or a transaction root.
1417  *
1418  * Notes:
1419  * - Copy ancestry does not descend. After copying directory D to
1420  * E, E will have copy ancestry referring to D, but E's children
1421  * may not. See also svn_fs_copy().
1422  *
1423  * - Copy ancestry *under* a copy is preserved. That is, if you
1424  * copy /A/D/G/pi to /A/D/G/pi2, and then copy /A/D/G to /G, then
1425  * /G/pi2 will still have copy ancestry pointing to /A/D/G/pi.
1426  * We don't know if this is a feature or a bug yet; if it turns
1427  * out to be a bug, then the fix is to make svn_fs_copied_from()
1428  * observe the following logic, which currently callers may
1429  * choose to follow themselves: if node X has copy history, but
1430  * its ancestor A also has copy history, then you may ignore X's
1431  * history if X's revision-of-origin is earlier than A's --
1432  * because that would mean that X's copy history was preserved in
1433  * a copy-under-a-copy scenario. If X's revision-of-origin is
1434  * the same as A's, then it was copied under A during the same
1435  * transaction that created A. (X's revision-of-origin cannot be
1436  * greater than A's, if X has copy history.) @todo See how
1437  * people like this, it can always be hidden behind the curtain
1438  * if necessary.
1439  *
1440  * - Copy ancestry is not stored as a regular subversion property
1441  * because it is not inherited. Copying foo to bar results in a
1442  * revision of bar with copy ancestry; but committing a text
1443  * change to bar right after that results in a new revision of
1444  * bar without copy ancestry.
1445  */
1446 svn_error_t *
1448  const char **path_p,
1449  svn_fs_root_t *root,
1450  const char *path,
1451  apr_pool_t *pool);
1452 
1453 
1454 /** Set @a *root_p and @a *path_p to the revision root and path of the
1455  * destination of the most recent copy event that caused @a path to
1456  * exist where it does in @a root, or to NULL if no such copy exists.
1457  * When non-NULL, allocate @a *root_p and @a *path_p in @a pool.
1458  *
1459  * @a *path_p might be a parent of @a path, rather than @a path
1460  * itself. However, it will always be the deepest relevant path.
1461  * That is, if a copy occurs underneath another copy in the same txn,
1462  * this function makes sure to set @a *path_p to the longest copy
1463  * destination path that is still a parent of or equal to @a path.
1464  *
1465  * @since New in 1.3.
1466  */
1467 svn_error_t *
1469  const char **path_p,
1470  svn_fs_root_t *root,
1471  const char *path,
1472  apr_pool_t *pool);
1473 
1474 
1475 /** Retrieve mergeinfo for multiple nodes.
1476  *
1477  * @a *catalog is a catalog for @a paths. It will never be @c NULL,
1478  * but may be empty.
1479  *
1480  * @a root is revision root to use when looking up paths.
1481  *
1482  * @a paths are the paths you are requesting information for.
1483  *
1484  * @a inherit indicates whether to retrieve explicit,
1485  * explicit-or-inherited, or only inherited mergeinfo.
1486  *
1487  * If @a include_descendants is TRUE, then additionally return the
1488  * mergeinfo for any descendant of any element of @a paths which has
1489  * the #SVN_PROP_MERGEINFO property explicitly set on it. (Note
1490  * that inheritance is only taken into account for the elements in @a
1491  * paths; descendants of the elements in @a paths which get their
1492  * mergeinfo via inheritance are not included in @a *catalog.)
1493  *
1494  * Do any necessary temporary allocation in @a pool.
1495  *
1496  * @since New in 1.5.
1497  */
1498 svn_error_t *
1499 svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog,
1500  svn_fs_root_t *root,
1501  const apr_array_header_t *paths,
1503  svn_boolean_t include_descendants,
1504  apr_pool_t *pool);
1505 
1506 /** Merge changes between two nodes into a third node.
1507  *
1508  * Given nodes @a source and @a target, and a common ancestor @a ancestor,
1509  * modify @a target to contain all the changes made between @a ancestor and
1510  * @a source, as well as the changes made between @a ancestor and @a target.
1511  * @a target_root must be the root of a transaction, not a revision.
1512  *
1513  * @a source, @a target, and @a ancestor are generally directories; this
1514  * function recursively merges the directories' contents. If they are
1515  * files, this function simply returns an error whenever @a source,
1516  * @a target, and @a ancestor are all distinct node revisions.
1517  *
1518  * If there are differences between @a ancestor and @a source that conflict
1519  * with changes between @a ancestor and @a target, this function returns an
1520  * #SVN_ERR_FS_CONFLICT error.
1521  *
1522  * If the merge is successful, @a target is left in the merged state, and
1523  * the base root of @a target's txn is set to the root node of @a source.
1524  * If an error is returned (whether for conflict or otherwise), @a target
1525  * is left unaffected.
1526  *
1527  * If @a conflict_p is non-NULL, then: a conflict error sets @a *conflict_p
1528  * to the name of the node in @a target which couldn't be merged,
1529  * otherwise, success sets @a *conflict_p to NULL.
1530  *
1531  * Do any necessary temporary allocation in @a pool.
1532  */
1533 svn_error_t *
1534 svn_fs_merge(const char **conflict_p,
1535  svn_fs_root_t *source_root,
1536  const char *source_path,
1537  svn_fs_root_t *target_root,
1538  const char *target_path,
1539  svn_fs_root_t *ancestor_root,
1540  const char *ancestor_path,
1541  apr_pool_t *pool);
1542 
1543 
1544 
1545 /* Directories. */
1546 
1547 
1548 /** The type of a Subversion directory entry. */
1549 typedef struct svn_fs_dirent_t
1550 {
1551 
1552  /** The name of this directory entry. */
1553  const char *name;
1554 
1555  /** The node revision ID it names. */
1556  const svn_fs_id_t *id;
1557 
1558  /** The node kind. */
1560 
1561 } svn_fs_dirent_t;
1562 
1563 
1564 /** Set @a *entries_p to a newly allocated APR hash table containing the
1565  * entries of the directory at @a path in @a root. The keys of the table
1566  * are entry names, as byte strings, excluding the final NULL
1567  * character; the table's values are pointers to #svn_fs_dirent_t
1568  * structures. Allocate the table and its contents in @a pool.
1569  */
1570 svn_error_t *
1571 svn_fs_dir_entries(apr_hash_t **entries_p,
1572  svn_fs_root_t *root,
1573  const char *path,
1574  apr_pool_t *pool);
1575 
1576 
1577 /** Create a new directory named @a path in @a root. The new directory has
1578  * no entries, and no properties. @a root must be the root of a transaction,
1579  * not a revision.
1580  *
1581  * Do any necessary temporary allocation in @a pool.
1582  */
1583 svn_error_t *
1585  const char *path,
1586  apr_pool_t *pool);
1587 
1588 
1589 /** Delete the node named @a path in @a root. If the node being deleted is
1590  * a directory, its contents will be deleted recursively. @a root must be
1591  * the root of a transaction, not of a revision. Use @a pool for
1592  * temporary allocation.
1593  *
1594  * If return #SVN_ERR_FS_NO_SUCH_ENTRY, then the basename of @a path is
1595  * missing from its parent, that is, the final target of the deletion
1596  * is missing.
1597  *
1598  * Attempting to remove the root dir also results in an error,
1599  * #SVN_ERR_FS_ROOT_DIR, even if the dir is empty.
1600  */
1601 svn_error_t *
1603  const char *path,
1604  apr_pool_t *pool);
1605 
1606 
1607 /** Create a copy of @a from_path in @a from_root named @a to_path in
1608  * @a to_root. If @a from_path in @a from_root is a directory, copy the
1609  * tree it refers to recursively.
1610  *
1611  * The copy will remember its source; use svn_fs_copied_from() to
1612  * access this information.
1613  *
1614  * @a to_root must be the root of a transaction; @a from_root must be the
1615  * root of a revision. (Requiring @a from_root to be the root of a
1616  * revision makes the implementation trivial: there is no detectable
1617  * difference (modulo node revision ID's) between copying @a from and
1618  * simply adding a reference to it. So the operation takes place in
1619  * constant time. However, there's no reason not to extend this to
1620  * mutable nodes --- it's just more code.) Further, @a to_root and @a
1621  * from_root must represent the same filesystem.
1622  *
1623  * @note To do a copy without preserving copy history, use
1624  * svn_fs_revision_link().
1625  *
1626  * Do any necessary temporary allocation in @a pool.
1627  */
1628 svn_error_t *
1629 svn_fs_copy(svn_fs_root_t *from_root,
1630  const char *from_path,
1631  svn_fs_root_t *to_root,
1632  const char *to_path,
1633  apr_pool_t *pool);
1634 
1635 
1636 /** Like svn_fs_copy(), but doesn't record copy history, and preserves
1637  * the PATH. You cannot use svn_fs_copied_from() later to find out
1638  * where this copy came from.
1639  *
1640  * Use svn_fs_revision_link() in situations where you don't care
1641  * about the copy history, and where @a to_path and @a from_path are
1642  * the same, because it is cheaper than svn_fs_copy().
1643  */
1644 svn_error_t *
1646  svn_fs_root_t *to_root,
1647  const char *path,
1648  apr_pool_t *pool);
1649 
1650 /* Files. */
1651 
1652 /** Set @a *length_p to the length of the file @a path in @a root, in bytes.
1653  * Do any necessary temporary allocation in @a pool.
1654  */
1655 svn_error_t *
1657  svn_fs_root_t *root,
1658  const char *path,
1659  apr_pool_t *pool);
1660 
1661 
1662 /** Set @a *checksum to the checksum of type @a kind for the file @a path.
1663  * @a *checksum will be allocated out of @a pool, which will also be used
1664  * for temporary allocations.
1665  *
1666  * If the filesystem does not have a prerecorded checksum of @a kind for
1667  * @a path, and @a force is not TRUE, do not calculate a checksum
1668  * dynamically, just put NULL into @a checksum. (By convention, the NULL
1669  * checksum is considered to match any checksum.)
1670  *
1671  * Notes:
1672  *
1673  * You might wonder, why do we only provide this interface for file
1674  * contents, and not for properties or directories?
1675  *
1676  * The answer is that property lists and directory entry lists are
1677  * essentially data structures, not text. We serialize them for
1678  * transmission, but there is no guarantee that the consumer will
1679  * parse them into the same form, or even the same order, as the
1680  * producer. It's difficult to find a checksumming method that
1681  * reaches the same result given such variation in input. (I suppose
1682  * we could calculate an independent MD5 sum for each propname and
1683  * value, and XOR them together; same with directory entry names.
1684  * Maybe that's the solution?) Anyway, for now we punt. The most
1685  * important data, and the only data that goes through svndiff
1686  * processing, is file contents, so that's what we provide
1687  * checksumming for.
1688  *
1689  * Internally, of course, the filesystem checksums everything, because
1690  * it has access to the lowest level storage forms: strings behind
1691  * representations.
1692  *
1693  * @since New in 1.6.
1694  */
1695 svn_error_t *
1697  svn_checksum_kind_t kind,
1698  svn_fs_root_t *root,
1699  const char *path,
1700  svn_boolean_t force,
1701  apr_pool_t *pool);
1702 
1703 /**
1704  * Same as svn_fs_file_checksum(), only always put the MD5 checksum of file
1705  * @a path into @a digest, which should point to @c APR_MD5_DIGESTSIZE bytes
1706  * of storage. If the checksum doesn't exist, put all 0's into @a digest.
1707  *
1708  * @deprecated Provided for backward compatibility with the 1.5 API.
1709  */
1711 svn_error_t *
1712 svn_fs_file_md5_checksum(unsigned char digest[],
1713  svn_fs_root_t *root,
1714  const char *path,
1715  apr_pool_t *pool);
1716 
1717 
1718 /** Set @a *contents to a readable generic stream that will yield the
1719  * contents of the file @a path in @a root. Allocate the stream in
1720  * @a pool. You can only use @a *contents for as long as the underlying
1721  * filesystem is open. If @a path is not a file, return
1722  * #SVN_ERR_FS_NOT_FILE.
1723  *
1724  * If @a root is the root of a transaction, it is possible that the
1725  * contents of the file @a path will change between calls to
1726  * svn_fs_file_contents(). In that case, the result of reading from
1727  * @a *contents is undefined.
1728  *
1729  * ### @todo kff: I am worried about lifetime issues with this pool vs
1730  * the trail created farther down the call stack. Trace this function
1731  * to investigate...
1732  */
1733 svn_error_t *
1735  svn_fs_root_t *root,
1736  const char *path,
1737  apr_pool_t *pool);
1738 
1739 
1740 /** Create a new file named @a path in @a root. The file's initial contents
1741  * are the empty string, and it has no properties. @a root must be the
1742  * root of a transaction, not a revision.
1743  *
1744  * Do any necessary temporary allocation in @a pool.
1745  */
1746 svn_error_t *
1748  const char *path,
1749  apr_pool_t *pool);
1750 
1751 
1752 /** Apply a text delta to the file @a path in @a root. @a root must be the
1753  * root of a transaction, not a revision.
1754  *
1755  * Set @a *contents_p to a function ready to receive text delta windows
1756  * describing how to change the file's contents, relative to its
1757  * current contents. Set @a *contents_baton_p to a baton to pass to
1758  * @a *contents_p.
1759  *
1760  * If @a path does not exist in @a root, return an error. (You cannot use
1761  * this routine to create new files; use svn_fs_make_file() to create
1762  * an empty file first.)
1763  *
1764  * @a base_checksum is the hex MD5 digest for the base text against
1765  * which the delta is to be applied; it is ignored if NULL, and may be
1766  * ignored even if not NULL. If it is not ignored, it must match the
1767  * checksum of the base text against which svndiff data is being
1768  * applied; if not, svn_fs_apply_textdelta() or the @a *contents_p call
1769  * which detects the mismatch will return the error
1770  * #SVN_ERR_CHECKSUM_MISMATCH (if there is no base text, there may
1771  * still be an error if @a base_checksum is neither NULL nor the
1772  * checksum of the empty string).
1773  *
1774  * @a result_checksum is the hex MD5 digest for the fulltext that
1775  * results from this delta application. It is ignored if NULL, but if
1776  * not NULL, it must match the checksum of the result; if it does not,
1777  * then the @a *contents_p call which detects the mismatch will return
1778  * the error #SVN_ERR_CHECKSUM_MISMATCH.
1779  *
1780  * The caller must send all delta windows including the terminating
1781  * NULL window to @a *contents_p before making further changes to the
1782  * transaction.
1783  *
1784  * Do temporary allocation in @a pool.
1785  */
1786 svn_error_t *
1788  void **contents_baton_p,
1789  svn_fs_root_t *root,
1790  const char *path,
1791  const char *base_checksum,
1792  const char *result_checksum,
1793  apr_pool_t *pool);
1794 
1795 
1796 /** Write data directly to the file @a path in @a root. @a root must be the
1797  * root of a transaction, not a revision.
1798  *
1799  * Set @a *contents_p to a stream ready to receive full textual data.
1800  * When the caller closes this stream, the data replaces the previous
1801  * contents of the file. The caller must write all file data and close
1802  * the stream before making further changes to the transaction.
1803  *
1804  * If @a path does not exist in @a root, return an error. (You cannot use
1805  * this routine to create new files; use svn_fs_make_file() to create
1806  * an empty file first.)
1807  *
1808  * @a result_checksum is the hex MD5 digest for the final fulltext
1809  * written to the stream. It is ignored if NULL, but if not null, it
1810  * must match the checksum of the result; if it does not, then the @a
1811  * *contents_p call which detects the mismatch will return the error
1812  * #SVN_ERR_CHECKSUM_MISMATCH.
1813  *
1814  * Do any necessary temporary allocation in @a pool.
1815  *
1816  * ### This is like svn_fs_apply_textdelta(), but takes the text
1817  * straight. It is currently used only by the loader, see
1818  * libsvn_repos/load.c. It should accept a checksum, of course, which
1819  * would come from an (optional) header in the dump file. See
1820  * http://subversion.tigris.org/issues/show_bug.cgi?id=1102 for more.
1821  */
1822 svn_error_t *
1823 svn_fs_apply_text(svn_stream_t **contents_p,
1824  svn_fs_root_t *root,
1825  const char *path,
1826  const char *result_checksum,
1827  apr_pool_t *pool);
1828 
1829 
1830 /** Check if the contents of two root/path combos have changed.
1831  *
1832  * Set @a *changed_p to 1 if the contents at @a path1 under @a root1 differ
1833  * from those at @a path2 under @a root2, or set it to 0 if they are the
1834  * same. Both paths must exist under their respective roots, and both
1835  * roots must be in the same filesystem.
1836  */
1837 svn_error_t *
1839  svn_fs_root_t *root1,
1840  const char *path1,
1841  svn_fs_root_t *root2,
1842  const char *path2,
1843  apr_pool_t *pool);
1844 
1845 
1846 
1847 /* Filesystem revisions. */
1848 
1849 
1850 /** Set @a *youngest_p to the number of the youngest revision in filesystem
1851  * @a fs. Use @a pool for all temporary allocation.
1852  *
1853  * The oldest revision in any filesystem is numbered zero.
1854  */
1855 svn_error_t *
1856 svn_fs_youngest_rev(svn_revnum_t *youngest_p,
1857  svn_fs_t *fs,
1858  apr_pool_t *pool);
1859 
1860 
1861 /** Provide filesystem @a fs the opportunity to compress storage relating to
1862  * associated with @a revision in filesystem @a fs. Use @a pool for all
1863  * allocations.
1864  *
1865  * @note This can be a time-consuming process, depending the breadth
1866  * of the changes made in @a revision, and the depth of the history of
1867  * those changed paths. This may also be a no op.
1868  */
1869 svn_error_t *
1871  svn_revnum_t revision,
1872  apr_pool_t *pool);
1873 
1874 
1875 /** Set @a *value_p to the value of the property named @a propname on
1876  * revision @a rev in the filesystem @a fs. If @a rev has no property by
1877  * that name, set @a *value_p to zero. Allocate the result in @a pool.
1878  */
1879 svn_error_t *
1881  svn_fs_t *fs,
1882  svn_revnum_t rev,
1883  const char *propname,
1884  apr_pool_t *pool);
1885 
1886 
1887 /** Set @a *table_p to the entire property list of revision @a rev in
1888  * filesystem @a fs, as an APR hash table allocated in @a pool. The table
1889  * maps <tt>char *</tt> property names to #svn_string_t * values; the names
1890  * and values are allocated in @a pool.
1891  */
1892 svn_error_t *
1893 svn_fs_revision_proplist(apr_hash_t **table_p,
1894  svn_fs_t *fs,
1895  svn_revnum_t rev,
1896  apr_pool_t *pool);
1897 
1898 
1899 /** Change a revision's property's value, or add/delete a property.
1900  *
1901  * - @a fs is a filesystem, and @a rev is the revision in that filesystem
1902  * whose property should change.
1903  * - @a name is the name of the property to change.
1904  * - if @a old_value_p is not @c NULL, then changing the property will fail with
1905  * error #SVN_ERR_FS_PROP_BASEVALUE_MISMATCH if the present value of the
1906  * property is not @a *old_value_p. (This is an atomic test-and-set).
1907  * @a *old_value_p may be @c NULL, representing that the property must be not
1908  * already set.
1909  * - @a value is the new value of the property, or zero if the property should
1910  * be removed altogether.
1911  *
1912  * Note that revision properties are non-historied --- you can change
1913  * them after the revision has been committed. They are not protected
1914  * via transactions.
1915  *
1916  * Do any necessary temporary allocation in @a pool.
1917  *
1918  * @since New in 1.7.
1919  */
1920 svn_error_t *
1922  svn_revnum_t rev,
1923  const char *name,
1924  const svn_string_t *const *old_value_p,
1925  const svn_string_t *value,
1926  apr_pool_t *pool);
1927 
1928 
1929 /**
1930  * Similar to svn_fs_change_rev_prop2(), but with @a old_value_p passed as
1931  * @c NULL.
1932  *
1933  * @deprecated Provided for backward compatibility with the 1.6 API.
1934  */
1936 svn_error_t *
1938  svn_revnum_t rev,
1939  const char *name,
1940  const svn_string_t *value,
1941  apr_pool_t *pool);
1942 
1943 
1944 
1945 /* Computing deltas. */
1946 
1947 
1948 /** Set @a *stream_p to a pointer to a delta stream that will turn the
1949  * contents of the file @a source into the contents of the file @a target.
1950  * If @a source_root is zero, use a file with zero length as the source.
1951  *
1952  * This function does not compare the two files' properties.
1953  *
1954  * Allocate @a *stream_p, and do any necessary temporary allocation, in
1955  * @a pool.
1956  */
1957 svn_error_t *
1959  svn_fs_root_t *source_root,
1960  const char *source_path,
1961  svn_fs_root_t *target_root,
1962  const char *target_path,
1963  apr_pool_t *pool);
1964 
1965 
1966 
1967 /* UUID manipulation. */
1968 
1969 /** Populate @a *uuid with the UUID associated with @a fs. Allocate
1970  @a *uuid in @a pool. */
1971 svn_error_t *
1973  const char **uuid,
1974  apr_pool_t *pool);
1975 
1976 
1977 /** If not @c NULL, associate @a *uuid with @a fs. Otherwise (if @a
1978  * uuid is @c NULL), generate a new UUID for @a fs. Use @a pool for
1979  * any scratch work.
1980  */
1981 svn_error_t *
1983  const char *uuid,
1984  apr_pool_t *pool);
1985 
1986 
1987 /* Non-historical properties. */
1988 
1989 /* [[Yes, do tell.]] */
1990 
1991 
1992 
1993 /** @defgroup svn_fs_locks Filesystem locks
1994  * @{
1995  * @since New in 1.2. */
1996 
1997 /** A lock represents one user's exclusive right to modify a path in a
1998  * filesystem. In order to create or destroy a lock, a username must
1999  * be associated with the filesystem's access context (see
2000  * #svn_fs_access_t).
2001  *
2002  * When a lock is created, a 'lock-token' is returned. The lock-token
2003  * is a unique URI that represents the lock (treated as an opaque
2004  * string by the client), and is required to make further use of the
2005  * lock (including removal of the lock.) A lock-token can also be
2006  * queried to return a svn_lock_t structure that describes the details
2007  * of the lock. lock-tokens must not contain any newline character,
2008  * mainly due to the serialization for tokens for pre-commit hook.
2009  *
2010  * Locks are not secret; anyone can view existing locks in a
2011  * filesystem. Locks are not omnipotent: they can broken and stolen
2012  * by people who don't "own" the lock. (Though admins can tailor a
2013  * custom break/steal policy via libsvn_repos pre-lock hook script.)
2014  *
2015  * Locks can be created with an optional expiration date. If a lock
2016  * has an expiration date, then the act of fetching/reading it might
2017  * cause it to automatically expire, returning either nothing or an
2018  * expiration error (depending on the API).
2019  */
2020 
2021 
2022 /** Lock @a path in @a fs, and set @a *lock to a lock
2023  * representing the new lock, allocated in @a pool.
2024  *
2025  * @warning You may prefer to use svn_repos_fs_lock() instead,
2026  * which see.
2027  *
2028  * @a fs must have a username associated with it (see
2029  * #svn_fs_access_t), else return #SVN_ERR_FS_NO_USER. Set the
2030  * 'owner' field in the new lock to the fs username.
2031  *
2032  * @a comment is optional: it's either an xml-escapable UTF8 string
2033  * which describes the lock, or it is @c NULL.
2034  *
2035  * @a is_dav_comment describes whether the comment was created by a
2036  * generic DAV client; only mod_dav_svn's autoversioning feature needs
2037  * to use it. If in doubt, pass 0.
2038  *
2039  * If path is already locked, then return #SVN_ERR_FS_PATH_ALREADY_LOCKED,
2040  * unless @a steal_lock is TRUE, in which case "steal" the existing
2041  * lock, even if the FS access-context's username does not match the
2042  * current lock's owner: delete the existing lock on @a path, and
2043  * create a new one.
2044  *
2045  * @a token is a lock token such as can be generated using
2046  * svn_fs_generate_lock_token() (indicating that the caller wants to
2047  * dictate the lock token used), or it is @c NULL (indicating that the
2048  * caller wishes to have a new token generated by this function). If
2049  * @a token is not @c NULL, and represents an existing lock, then @a
2050  * path must match the path associated with that existing lock.
2051  *
2052  * If @a expiration_date is zero, then create a non-expiring lock.
2053  * Else, the lock will expire at @a expiration_date.
2054  *
2055  * If @a current_rev is a valid revnum, then do an out-of-dateness
2056  * check. If the revnum is less than the last-changed-revision of @a
2057  * path (or if @a path doesn't exist in HEAD), return
2058  * #SVN_ERR_FS_OUT_OF_DATE.
2059  *
2060  * @note At this time, only files can be locked.
2061  */
2062 svn_error_t *
2063 svn_fs_lock(svn_lock_t **lock,
2064  svn_fs_t *fs,
2065  const char *path,
2066  const char *token,
2067  const char *comment,
2068  svn_boolean_t is_dav_comment,
2069  apr_time_t expiration_date,
2070  svn_revnum_t current_rev,
2071  svn_boolean_t steal_lock,
2072  apr_pool_t *pool);
2073 
2074 
2075 /** Generate a unique lock-token using @a fs. Return in @a *token,
2076  * allocated in @a pool.
2077  *
2078  * This can be used in to populate lock->token before calling
2079  * svn_fs_attach_lock().
2080  */
2081 svn_error_t *
2082 svn_fs_generate_lock_token(const char **token,
2083  svn_fs_t *fs,
2084  apr_pool_t *pool);
2085 
2086 
2087 /** Remove the lock on @a path represented by @a token in @a fs.
2088  *
2089  * If @a token doesn't point to a lock, return #SVN_ERR_FS_BAD_LOCK_TOKEN.
2090  * If @a token points to an expired lock, return #SVN_ERR_FS_LOCK_EXPIRED.
2091  * If @a fs has no username associated with it, return #SVN_ERR_FS_NO_USER
2092  * unless @a break_lock is specified.
2093  *
2094  * If @a token points to a lock, but the username of @a fs's access
2095  * context doesn't match the lock's owner, return
2096  * #SVN_ERR_FS_LOCK_OWNER_MISMATCH. If @a break_lock is TRUE, however, don't
2097  * return error; allow the lock to be "broken" in any case. In the latter
2098  * case, @a token shall be @c NULL.
2099  *
2100  * Use @a pool for temporary allocations.
2101  */
2102 svn_error_t *
2104  const char *path,
2105  const char *token,
2106  svn_boolean_t break_lock,
2107  apr_pool_t *pool);
2108 
2109 
2110 /** If @a path is locked in @a fs, set @a *lock to an svn_lock_t which
2111  * represents the lock, allocated in @a pool.
2112  *
2113  * If @a path is not locked, set @a *lock to NULL.
2114  */
2115 svn_error_t *
2117  svn_fs_t *fs,
2118  const char *path,
2119  apr_pool_t *pool);
2120 
2121 
2122 /** The type of a lock discovery callback function. @a baton is the
2123  * value specified in the call to svn_fs_get_locks(); the filesystem
2124  * passes it through to the callback. @a lock is a lock structure.
2125  * @a pool is a temporary subpool for use by the callback
2126  * implementation -- it is cleared after invocation of the callback.
2127  */
2128 typedef svn_error_t *(*svn_fs_get_locks_callback_t)(void *baton,
2129  svn_lock_t *lock,
2130  apr_pool_t *pool);
2131 
2132 
2133 /** Report locks on or below @a path in @a fs using the @a
2134  * get_locks_func / @a get_locks_baton. Use @a pool for necessary
2135  * allocations.
2136  *
2137  * @a depth limits the reported locks to those associated with paths
2138  * within the specified depth of @a path, and must be one of the
2139  * following values: #svn_depth_empty, #svn_depth_files,
2140  * #svn_depth_immediates, or #svn_depth_infinity.
2141  *
2142  * If the @a get_locks_func callback implementation returns an error,
2143  * lock iteration will terminate and that error will be returned by
2144  * this function.
2145  *
2146  * @note Over the course of this function's invocation, locks might be
2147  * added, removed, or modified by concurrent processes. Callers need
2148  * to anticipate and gracefully handle the transience of this
2149  * information.
2150  *
2151  * @since New in 1.7.
2152  */
2153 svn_error_t *
2155  const char *path,
2156  svn_depth_t depth,
2157  svn_fs_get_locks_callback_t get_locks_func,
2158  void *get_locks_baton,
2159  apr_pool_t *pool);
2160 
2161 /** Similar to svn_fs_get_locks2(), but with @a depth always passed as
2162  * svn_depth_infinity, and with the following known problem (which is
2163  * not present in svn_fs_get_locks2()):
2164  *
2165  * @note On Berkeley-DB-backed filesystems in Subversion 1.6 and
2166  * prior, the @a get_locks_func callback will be invoked from within a
2167  * Berkeley-DB transaction trail. Implementors of the callback are,
2168  * as a result, forbidden from calling any svn_fs API functions which
2169  * might themselves attempt to start a new Berkeley DB transaction
2170  * (which is most of this svn_fs API). Yes, this is a nasty
2171  * implementation detail to have to be aware of.
2172  *
2173  * @deprecated Provided for backward compatibility with the 1.6 API.
2174  */
2176 svn_error_t *
2178  const char *path,
2179  svn_fs_get_locks_callback_t get_locks_func,
2180  void *get_locks_baton,
2181  apr_pool_t *pool);
2182 
2183 /** @} */
2184 
2185 /**
2186  * Append a textual list of all available FS modules to the stringbuf
2187  * @a output.
2188  *
2189  * @since New in 1.2.
2190  */
2191 svn_error_t *
2193  apr_pool_t *pool);
2194 
2195 
2196 /** The kind of action being taken by 'pack'. */
2198 {
2199  /** packing of the shard has commenced */
2201 
2202  /** packing of the shard is completed */
2204 
2205  /** packing of the shard revprops has commenced
2206  @since New in 1.7. */
2208 
2209  /** packing of the shard revprops has completed
2210  @since New in 1.7. */
2212 
2214 
2215 /** The type of a pack notification function. @a shard is the shard being
2216  * acted upon; @a action is the type of action being performed. @a baton is
2217  * the corresponding baton for the notification function, and @a pool can
2218  * be used for temporary allocations, but will be cleared between invocations.
2219  */
2220 typedef svn_error_t *(*svn_fs_pack_notify_t)(void *baton,
2221  apr_int64_t shard,
2223  apr_pool_t *pool);
2224 
2225 /**
2226  * Possibly update the filesystem located in the directory @a path
2227  * to use disk space more efficiently.
2228  *
2229  * @since New in 1.6.
2230  */
2231 svn_error_t *
2232 svn_fs_pack(const char *db_path,
2233  svn_fs_pack_notify_t notify_func,
2234  void *notify_baton,
2235  svn_cancel_func_t cancel_func,
2236  void *cancel_baton,
2237  apr_pool_t *pool);
2238 
2239 
2240 /** @} */
2241 
2242 
2243 #ifdef __cplusplus
2244 }
2245 #endif /* __cplusplus */
2246 
2247 #endif /* SVN_FS_H */
svn_error_t * svn_fs_get_mergeinfo(svn_mergeinfo_catalog_t *catalog, svn_fs_root_t *root, const apr_array_header_t *paths, svn_mergeinfo_inheritance_t inherit, svn_boolean_t include_descendants, apr_pool_t *pool)
Retrieve mergeinfo for multiple nodes.
ignore all previous change items for path (internal-use only)
Definition: svn_fs.h:1084
svn_error_t * svn_fs_set_berkeley_errcall(svn_fs_t *fs, void(*handler)(const char *errpfx, char *msg))
Register an error handling function for Berkeley DB error messages.
Counted-length strings for Subversion, plus some C string goodies.
svn_error_t * svn_fs_txn_proplist(apr_hash_t **table_p, svn_fs_txn_t *txn, apr_pool_t *pool)
Set *table_p to the entire property list of transaction txn, as an APR hash table allocated in pool...
Delta-parsing.
svn_error_t * svn_fs_begin_txn(svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
Same as svn_fs_begin_txn2(), but with flags set to 0.
svn_error_t * svn_fs_delete_fs(const char *path, apr_pool_t *pool)
Delete the filesystem at path.
svn_error_t * svn_fs_set_access(svn_fs_t *fs, svn_fs_access_t *access_ctx)
Associate access_ctx with an open fs.
svn_depth_t
The concept of depth for directories.
Definition: svn_types.h:397
svn_error_t * svn_fs_is_file(svn_boolean_t *is_file, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *is_file to TRUE iff path in root is a file.
svn_error_t * svn_fs_get_access(svn_fs_access_t **access_ctx, svn_fs_t *fs)
Set *access_ctx to the current fs access context, or NULL if there is no current fs access context...
svn_error_t * svn_fs_paths_changed2(apr_hash_t **changed_paths2_p, svn_fs_root_t *root, apr_pool_t *pool)
Determine what has changed under a root.
svn_checksum_kind_t
Various types of checksums.
Definition: svn_checksum.h:45
svn_error_t * svn_fs_history_prev(svn_fs_history_t **prev_history_p, svn_fs_history_t *history, svn_boolean_t cross_copies, apr_pool_t *pool)
Set *prev_history_p to an opaque node history object which represents the previous (or "next oldest")...
svn_error_t * svn_fs_change_txn_props(svn_fs_txn_t *txn, const apr_array_header_t *props, apr_pool_t *pool)
Change, add, and/or delete transaction property values in transaction txn.
svn_error_t * svn_fs_open(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config, apr_pool_t *pool)
Open a Subversion filesystem located in the directory path, and return a pointer to it in *fs_p...
The type of a Subversion directory entry.
Definition: svn_fs.h:1549
const char * svn_fs_txn_root_name(svn_fs_root_t *root, apr_pool_t *pool)
If root is the root of a transaction, return the name of the transaction, allocated in pool; otherwis...
svn_error_t *(* svn_fs_get_locks_callback_t)(void *baton, svn_lock_t *lock, apr_pool_t *pool)
The type of a lock discovery callback function.
Definition: svn_fs.h:2128
svn_error_t * svn_fs_node_created_rev(svn_revnum_t *revision, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *revision to the revision in which path under root was created.
svn_fs_path_change_kind_t change_kind
kind of change
Definition: svn_fs.h:1101
svn_error_t * svn_fs_open_berkeley(svn_fs_t *fs, const char *path)
svn_error_t * svn_fs_node_id(const svn_fs_id_t **id_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Get the id of a node.
svn_error_t * svn_fs_lock(svn_lock_t **lock, svn_fs_t *fs, const char *path, const char *token, const char *comment, svn_boolean_t is_dav_comment, apr_time_t expiration_date, svn_revnum_t current_rev, svn_boolean_t steal_lock, apr_pool_t *pool)
A lock represents one user's exclusive right to modify a path in a filesystem.
General file I/O for Subversion.
Subversion checksum routines.
path removed in txn
Definition: svn_fs.h:1078
svn_boolean_t svn_fs_is_revision_root(svn_fs_root_t *root)
Return TRUE iff root is a revision root.
svn_error_t * svn_fs_set_uuid(svn_fs_t *fs, const char *uuid, apr_pool_t *pool)
If not NULL, associate *uuid with fs.
const svn_fs_id_t * id
The node revision ID it names.
Definition: svn_fs.h:1556
svn_error_t * svn_fs_paths_changed(apr_hash_t **changed_paths_p, svn_fs_root_t *root, apr_pool_t *pool)
Same as svn_fs_paths_changed2(), only with svn_fs_path_change_t * values in the hash (and thus no kin...
svn_error_t * svn_fs_revision_prop(svn_string_t **value_p, svn_fs_t *fs, svn_revnum_t rev, const char *propname, apr_pool_t *pool)
Set *value_p to the value of the property named propname on revision rev in the filesystem fs...
svn_revnum_t svn_fs_revision_root_revision(svn_fs_root_t *root)
If root is the root of a revision, return the revision number.
path added in txn
Definition: svn_fs.h:1075
svn_error_t * svn_fs_print_modules(svn_stringbuf_t *output, apr_pool_t *pool)
Append a textual list of all available FS modules to the stringbuf output.
void svn_fs_close_root(svn_fs_root_t *root)
Free the root directory root; this only needs to be used if you want to free the memory associated wi...
svn_error_t * svn_fs_txn_name(const char **name_p, svn_fs_txn_t *txn, apr_pool_t *pool)
Set *name_p to the name of the transaction txn, as a NULL-terminated string.
svn_boolean_t text_mod
were there text mods?
Definition: svn_fs.h:1104
svn_error_t * svn_fs_make_file(svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Create a new file named path in root.
svn_error_t * svn_fs_begin_txn2(svn_fs_txn_t **txn_p, svn_fs_t *fs, svn_revnum_t rev, apr_uint32_t flags, apr_pool_t *pool)
Begin a new transaction on the filesystem fs, based on existing revision rev.
svn_error_t * svn_fs_initialize(apr_pool_t *pool)
Callers should invoke this function to initialize global state in the FS library before creating FS o...
svn_error_t * svn_fs_access_add_lock_token2(svn_fs_access_t *access_ctx, const char *path, const char *token)
Push a lock-token token associated with path path into the context access_ctx.
svn_boolean_t prop_mod
were there property mods?
Definition: svn_fs.h:1142
svn_mergeinfo_inheritance_t
The three ways to request mergeinfo affecting a given path.
svn_revnum_t svn_fs_txn_root_base_revision(svn_fs_root_t *root)
If root is the root of a transaction, return the number of the revision on which is was based when cr...
svn_error_t * svn_fs_berkeley_recover(const char *path, apr_pool_t *pool)
svn_error_t * svn_fs_revision_link(svn_fs_root_t *from_root, svn_fs_root_t *to_root, const char *path, apr_pool_t *pool)
Like svn_fs_copy(), but doesn't record copy history, and preserves the PATH.
svn_error_t * svn_fs_node_history(svn_fs_history_t **history_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *history_p to an opaque node history object which represents path under root. ...
svn_error_t * svn_fs_history_location(const char **path, svn_revnum_t *revision, svn_fs_history_t *history, apr_pool_t *pool)
Set *path and *revision to the path and revision, respectively, of the history object.
svn_fs_t * svn_fs_new(apr_hash_t *fs_config, apr_pool_t *pool)
A lock object, for client & server to share.
Definition: svn_types.h:1073
svn_fs_path_change2_t * svn_fs_path_change2_create(const svn_fs_id_t *node_rev_id, svn_fs_path_change_kind_t change_kind, apr_pool_t *pool)
Allocate an svn_fs_path_change2_t structure in pool, initialize and return it.
A simple counted string.
Definition: svn_string.h:96
svn_error_t * svn_fs_open_txn(svn_fs_txn_t **txn, svn_fs_t *fs, const char *name, apr_pool_t *pool)
Open the transaction named name in the filesystem fs.
svn_node_kind_t
The various types of nodes in the Subversion filesystem.
Definition: svn_types.h:202
svn_boolean_t prop_mod
were there property mods?
Definition: svn_fs.h:1107
svn_error_t * svn_fs_copy(svn_fs_root_t *from_root, const char *from_path, svn_fs_root_t *to_root, const char *to_path, apr_pool_t *pool)
Create a copy of from_path in from_root named to_path in to_root.
svn_error_t * svn_fs_txn_prop(svn_string_t **value_p, svn_fs_txn_t *txn, const char *propname, apr_pool_t *pool)
Set *value_p to the value of the property named propname on transaction txn.
svn_error_t * svn_fs_merge(const char **conflict_p, svn_fs_root_t *source_root, const char *source_path, svn_fs_root_t *target_root, const char *target_path, svn_fs_root_t *ancestor_root, const char *ancestor_path, apr_pool_t *pool)
Merge changes between two nodes into a third node.
svn_error_t * svn_fs_contents_changed(svn_boolean_t *changed_p, svn_fs_root_t *root1, const char *path1, svn_fs_root_t *root2, const char *path2, apr_pool_t *pool)
Check if the contents of two root/path combos have changed.
svn_error_t * svn_fs_change_rev_prop2(svn_fs_t *fs, svn_revnum_t rev, const char *name, const svn_string_t *const *old_value_p, const svn_string_t *value, apr_pool_t *pool)
Change a revision's property's value, or add/delete a property.
svn_error_t * svn_fs_change_rev_prop(svn_fs_t *fs, svn_revnum_t rev, const char *name, const svn_string_t *value, apr_pool_t *pool)
Similar to svn_fs_change_rev_prop2(), but with old_value_p passed as NULL.
svn_boolean_t svn_fs_check_related(const svn_fs_id_t *id1, const svn_fs_id_t *id2)
Return TRUE if node revisions id1 and id2 are related (part of the same node), else return FALSE...
svn_error_t * svn_fs_berkeley_logfiles(apr_array_header_t **logfiles, const char *path, svn_boolean_t only_unused, apr_pool_t *pool)
Set *logfiles to an array of const char * log file names of Berkeley DB-based Subversion filesystem...
svn_error_t * svn_fs_list_transactions(apr_array_header_t **names_p, svn_fs_t *fs, apr_pool_t *pool)
Set *names_p to an array of const char * ids which are the names of all the currently active transact...
Subversion error object.
Definition: svn_types.h:90
svn_error_t * svn_fs_is_dir(svn_boolean_t *is_dir, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *is_dir to TRUE iff path in root is a directory.
svn_boolean_t copyfrom_known
Copyfrom revision and path; this is only valid if copyfrom_known is true.
Definition: svn_fs.h:1115
struct svn_txdelta_stream_t svn_txdelta_stream_t
A delta stream — this is the hat from which we pull a series of svn_txdelta_window_t objects...
Definition: svn_delta.h:304
apr_int64_t svn_filesize_t
The size of a file in the Subversion FS.
Definition: svn_types.h:353
struct svn_fs_dirent_t svn_fs_dirent_t
The type of a Subversion directory entry.
svn_error_t * svn_fs_txn_root(svn_fs_root_t **root_p, svn_fs_txn_t *txn, apr_pool_t *pool)
Set *root_p to the root directory of txn.
struct svn_fs_access_t svn_fs_access_t
An opaque object representing temporary user data.
Definition: svn_fs.h:483
void svn_fs_set_warning_func(svn_fs_t *fs, svn_fs_warning_callback_t warning, void *warning_baton)
Provide a callback function, warning, that fs should use to report (non-fatal) errors.
svn_error_t * svn_fs_commit_txn(const char **conflict_p, svn_revnum_t *new_rev, svn_fs_txn_t *txn, apr_pool_t *pool)
Commit txn.
packing of the shard revprops has completed
Definition: svn_fs.h:2211
svn_fs_path_change_kind_t change_kind
kind of change
Definition: svn_fs.h:1136
svn_error_t * svn_fs_apply_text(svn_stream_t **contents_p, svn_fs_root_t *root, const char *path, const char *result_checksum, apr_pool_t *pool)
Write data directly to the file path in root.
const svn_version_t * svn_fs_version(void)
Get libsvn_fs version information.
int svn_fs_compare_ids(const svn_fs_id_t *a, const svn_fs_id_t *b)
Return -1, 0, or 1 if node revisions a and b are respectively unrelated, equivalent, or otherwise related (part of the same node).
svn_error_t * svn_fs_get_uuid(svn_fs_t *fs, const char **uuid, apr_pool_t *pool)
Populate *uuid with the UUID associated with fs.
svn_error_t *(* svn_txdelta_window_handler_t)(svn_txdelta_window_t *window, void *baton)
A typedef for functions that consume a series of delta windows, for use in caller-pushes interfaces...
Definition: svn_delta.h:264
svn_error_t * svn_fs_props_changed(svn_boolean_t *changed_p, svn_fs_root_t *root1, const char *path1, svn_fs_root_t *root2, const char *path2, apr_pool_t *pool)
Determine if the properties of two path/root combinations are different.
svn_error_t * svn_fs_check_path(svn_node_kind_t *kind_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *kind_p to the type of node present at path under root.
svn_fs_pack_notify_action_t
The kind of action being taken by 'pack'.
Definition: svn_fs.h:2197
svn_error_t * svn_fs_file_md5_checksum(unsigned char digest[], svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Same as svn_fs_file_checksum(), only always put the MD5 checksum of file path into digest...
svn_error_t * svn_fs_change_txn_prop(svn_fs_txn_t *txn, const char *name, const svn_string_t *value, apr_pool_t *pool)
Change a transactions txn's property's value, or add/delete a property.
svn_revnum_t svn_fs_txn_base_revision(svn_fs_txn_t *txn)
Return txn's base revision.
svn_error_t * svn_fs_create(svn_fs_t **fs_p, const char *path, apr_hash_t *fs_config, apr_pool_t *pool)
Create a new, empty Subversion filesystem, stored in the directory path, and return a pointer to it i...
struct svn_fs_t svn_fs_t
An object representing a Subversion filesystem.
Definition: svn_fs.h:66
svn_error_t * svn_fs_youngest_rev(svn_revnum_t *youngest_p, svn_fs_t *fs, apr_pool_t *pool)
Set *youngest_p to the number of the youngest revision in filesystem fs.
svn_fs_path_change_kind_t
The kind of change that occurred on the path.
Definition: svn_fs.h:1069
const char * svn_fs_path(svn_fs_t *fs, apr_pool_t *pool)
Return the path to fs's repository, allocated in pool.
svn_fs_id_t * svn_fs_parse_id(const char *data, apr_size_t len, apr_pool_t *pool)
path removed and re-added in txn
Definition: svn_fs.h:1081
svn_string_t * svn_fs_unparse_id(const svn_fs_id_t *id, apr_pool_t *pool)
Return a Subversion string containing the unparsed form of the node revision id id.
Version information.
Definition: svn_version.h:150
svn_error_t * svn_fs_get_locks2(svn_fs_t *fs, const char *path, svn_depth_t depth, svn_fs_get_locks_callback_t get_locks_func, void *get_locks_baton, apr_pool_t *pool)
Report locks on or below path in fs using the get_locks_func / get_locks_baton.
Change descriptor.
Definition: svn_fs.h:1095
svn_error_t * svn_fs_file_length(svn_filesize_t *length_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *length_p to the length of the file path in root, in bytes.
svn_error_t * svn_fs_access_get_username(const char **username, svn_fs_access_t *access_ctx)
Accessors for the access context:
packing of the shard revprops has commenced
Definition: svn_fs.h:2207
struct svn_stream_t svn_stream_t
An abstract stream of bytes–either incoming or outgoing or both.
Definition: svn_io.h:743
struct svn_fs_history_t svn_fs_history_t
An opaque node history object.
Definition: svn_fs.h:1211
packing of the shard is completed
Definition: svn_fs.h:2203
Subversion's data types.
svn_error_t * svn_fs_node_prop(svn_string_t **value_p, svn_fs_root_t *root, const char *path, const char *propname, apr_pool_t *pool)
Set *value_p to the value of the property named propname of path in root.
svn_error_t * svn_fs_recover(const char *path, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Perform any necessary non-catastrophic recovery on the Subversion filesystem located at path...
svn_error_t * svn_fs_closest_copy(svn_fs_root_t **root_p, const char **path_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *root_p and *path_p to the revision root and path of the destination of the most recent copy even...
A generic checksum representation.
Definition: svn_checksum.h:59
svn_error_t * svn_fs_change_node_prop(svn_fs_root_t *root, const char *path, const char *name, const svn_string_t *value, apr_pool_t *pool)
Change a node's property's value, or add/delete a property.
svn_error_t * svn_fs_deltify_revision(svn_fs_t *fs, svn_revnum_t revision, apr_pool_t *pool)
Provide filesystem fs the opportunity to compress storage relating to associated with revision in fil...
svn_error_t * svn_fs_make_dir(svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Create a new directory named path in root.
svn_error_t * svn_fs_create_berkeley(svn_fs_t *fs, const char *path)
svn_error_t * svn_fs_hotcopy(const char *src_path, const char *dest_path, svn_boolean_t clean, apr_pool_t *pool)
Copy a possibly live Subversion filesystem from src_path to dest_path.
#define SVN_DEPRECATED
Macro used to mark deprecated functions.
Definition: svn_types.h:58
svn_error_t * svn_fs_revision_proplist(apr_hash_t **table_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
Set *table_p to the entire property list of revision rev in filesystem fs, as an APR hash table alloc...
svn_error_t * svn_fs_copied_from(svn_revnum_t *rev_p, const char **path_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Discover a node's copy ancestry, if any.
svn_error_t * svn_fs_pack(const char *db_path, svn_fs_pack_notify_t notify_func, void *notify_baton, svn_cancel_func_t cancel_func, void *cancel_baton, apr_pool_t *pool)
Possibly update the filesystem located in the directory path to use disk space more efficiently...
svn_error_t * svn_fs_file_contents(svn_stream_t **contents, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *contents to a readable generic stream that will yield the contents of the file path in root...
svn_boolean_t svn_fs_is_txn_root(svn_fs_root_t *root)
Return TRUE iff root is a transaction root.
const char * name
The name of this directory entry.
Definition: svn_fs.h:1553
svn_error_t * svn_fs_node_proplist(apr_hash_t **table_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *table_p to the entire property list of path in root, as an APR hash table allocated in pool...
svn_error_t * svn_fs_delete(svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Delete the node named path in root.
svn_error_t * svn_fs_delete_berkeley(const char *path, apr_pool_t *pool)
svn_error_t * svn_fs_hotcopy_berkeley(const char *src_path, const char *dest_path, svn_boolean_t clean_logs, apr_pool_t *pool)
svn_error_t * svn_fs_generate_lock_token(const char **token, svn_fs_t *fs, apr_pool_t *pool)
Generate a unique lock-token using fs.
svn_error_t * svn_fs_purge_txn(svn_fs_t *fs, const char *txn_id, apr_pool_t *pool)
Cleanup the dead transaction in fs whose ID is txn_id.
svn_error_t *(* svn_cancel_func_t)(void *cancel_baton)
A user defined callback that subversion will call with a user defined baton to see if the current ope...
Definition: svn_types.h:1050
long int svn_revnum_t
About Special Files in Subversion.
Definition: svn_types.h:307
svn_error_t * svn_fs_get_locks(svn_fs_t *fs, const char *path, svn_fs_get_locks_callback_t get_locks_func, void *get_locks_baton, apr_pool_t *pool)
Similar to svn_fs_get_locks2(), but with depth always passed as svn_depth_infinity, and with the following known problem (which is not present in svn_fs_get_locks2()):
struct svn_fs_txn_t svn_fs_txn_t
The type of a Subversion transaction object.
Definition: svn_fs.h:739
svn_error_t * svn_fs_revision_root(svn_fs_root_t **root_p, svn_fs_t *fs, svn_revnum_t rev, apr_pool_t *pool)
Set *root_p to the root directory of revision rev in filesystem fs.
svn_error_t * svn_fs_create_access(svn_fs_access_t **access_ctx, const char *username, apr_pool_t *pool)
Set *access_ctx to a new svn_fs_access_t object representing username, allocated in pool...
struct svn_fs_root_t svn_fs_root_t
The Filesystem Root object.
Definition: svn_fs.h:968
struct svn_fs_path_change_t svn_fs_path_change_t
Similar to svn_fs_path_change2_t, but without kind and copyfrom information.
svn_error_t * svn_fs_node_created_path(const char **created_path, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *created_path to the path at which path under root was created.
svn_boolean_t text_mod
were there text mods?
Definition: svn_fs.h:1139
svn_error_t * svn_fs_get_lock(svn_lock_t **lock, svn_fs_t *fs, const char *path, apr_pool_t *pool)
If path is locked in fs, set *lock to an svn_lock_t which represents the lock, allocated in pool...
svn_node_kind_t node_kind
what node kind is the path? (Note: it is legal for this to be svn_node_unknown.)
Definition: svn_fs.h:1111
packing of the shard has commenced
Definition: svn_fs.h:2200
svn_error_t * svn_fs_upgrade(const char *path, apr_pool_t *pool)
Upgrade the Subversion filesystem located in the directory path to the latest version supported by th...
const svn_fs_id_t * node_rev_id
node revision id of changed path
Definition: svn_fs.h:1098
svn_error_t *(* svn_fs_pack_notify_t)(void *baton, apr_int64_t shard, svn_fs_pack_notify_action_t action, apr_pool_t *pool)
The type of a pack notification function.
Definition: svn_fs.h:2220
struct svn_fs_path_change2_t svn_fs_path_change2_t
Change descriptor.
int svn_boolean_t
YABT: Yet Another Boolean Type.
Definition: svn_types.h:370
const svn_fs_id_t * node_rev_id
node revision id of changed path
Definition: svn_fs.h:1133
svn_error_t * svn_fs_apply_textdelta(svn_txdelta_window_handler_t *contents_p, void **contents_baton_p, svn_fs_root_t *root, const char *path, const char *base_checksum, const char *result_checksum, apr_pool_t *pool)
Apply a text delta to the file path in root.
const char * svn_fs_berkeley_path(svn_fs_t *fs, apr_pool_t *pool)
svn_error_t * svn_fs_node_origin_rev(svn_revnum_t *revision, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *revision to the revision in which the line of history represented by path under root originated...
mergeinfo handling and processing
path modified in txn
Definition: svn_fs.h:1072
svn_error_t * svn_fs_abort_txn(svn_fs_txn_t *txn, apr_pool_t *pool)
Abort the transaction txn.
svn_error_t * svn_fs_get_file_delta_stream(svn_txdelta_stream_t **stream_p, svn_fs_root_t *source_root, const char *source_path, svn_fs_root_t *target_root, const char *target_path, apr_pool_t *pool)
Set *stream_p to a pointer to a delta stream that will turn the contents of the file source into the ...
struct svn_fs_id_t svn_fs_id_t
An object representing a node-revision id.
Definition: svn_fs.h:598
svn_node_kind_t kind
The node kind.
Definition: svn_fs.h:1559
svn_error_t * svn_fs_access_add_lock_token(svn_fs_access_t *access_ctx, const char *token)
Same as svn_fs_access_add_lock_token2(), but with path set to value 1.
svn_error_t * svn_fs_type(const char **fs_type, const char *path, apr_pool_t *pool)
Return, in *fs_type, a string identifying the back-end type of the Subversion filesystem located in p...
A buffered string, capable of appending without an allocation and copy for each append.
Definition: svn_string.h:104
Similar to svn_fs_path_change2_t, but without kind and copyfrom information.
Definition: svn_fs.h:1130
svn_fs_t * svn_fs_root_fs(svn_fs_root_t *root)
Return the filesystem to which root belongs.
void(* svn_fs_warning_callback_t)(void *baton, svn_error_t *err)
The type of a warning callback function.
Definition: svn_fs.h:152
svn_error_t * svn_fs_file_checksum(svn_checksum_t **checksum, svn_checksum_kind_t kind, svn_fs_root_t *root, const char *path, svn_boolean_t force, apr_pool_t *pool)
Set *checksum to the checksum of type kind for the file path.
svn_error_t * svn_fs_dir_entries(apr_hash_t **entries_p, svn_fs_root_t *root, const char *path, apr_pool_t *pool)
Set *entries_p to a newly allocated APR hash table containing the entries of the directory at path in...
svn_error_t * svn_fs_unlock(svn_fs_t *fs, const char *path, const char *token, svn_boolean_t break_lock, apr_pool_t *pool)
Remove the lock on path represented by token in fs.