]> CyberLeo.Net >> Repos - FreeBSD/releng/10.2.git/blob - contrib/subversion/subversion/libsvn_wc/adm_files.h
- Copy stable/10@285827 to releng/10.2 in preparation for 10.2-RC1
[FreeBSD/releng/10.2.git] / contrib / subversion / subversion / libsvn_wc / adm_files.h
1 /*
2  * adm_files.h :  handles locations inside the wc adm area
3  *                (This should be the only code that actually knows
4  *                *where* things are in .svn/.  If you can't get to
5  *                something via these interfaces, something's wrong.)
6  *
7  * ====================================================================
8  *    Licensed to the Apache Software Foundation (ASF) under one
9  *    or more contributor license agreements.  See the NOTICE file
10  *    distributed with this work for additional information
11  *    regarding copyright ownership.  The ASF licenses this file
12  *    to you under the Apache License, Version 2.0 (the
13  *    "License"); you may not use this file except in compliance
14  *    with the License.  You may obtain a copy of the License at
15  *
16  *      http://www.apache.org/licenses/LICENSE-2.0
17  *
18  *    Unless required by applicable law or agreed to in writing,
19  *    software distributed under the License is distributed on an
20  *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21  *    KIND, either express or implied.  See the License for the
22  *    specific language governing permissions and limitations
23  *    under the License.
24  * ====================================================================
25  */
26
27 \f
28 #ifndef SVN_LIBSVN_WC_ADM_FILES_H
29 #define SVN_LIBSVN_WC_ADM_FILES_H
30
31 #include <apr_pools.h>
32 #include "svn_types.h"
33
34 #include "props.h"
35 #include "wc_db.h"
36
37 #ifdef __cplusplus
38 extern "C" {
39 #endif /* __cplusplus */
40
41 \f
42
43 /* Return a path to CHILD in the administrative area of PATH. If CHILD is
44    NULL, then the path to the admin area is returned. The result is
45    allocated in RESULT_POOL. */
46 const char *svn_wc__adm_child(const char *path,
47                               const char *child,
48                               apr_pool_t *result_pool);
49
50 /* Return TRUE if the administrative area exists for this directory. */
51 svn_boolean_t svn_wc__adm_area_exists(const char *adm_abspath,
52                                       apr_pool_t *pool);
53
54
55 /* Set *CONTENTS to a readonly stream on the pristine text of the working
56  * version of the file LOCAL_ABSPATH in DB.  If the file is locally copied
57  * or moved to this path, this means the pristine text of the copy source,
58  * even if the file replaces a previously existing base node at this path.
59  *
60  * Set *CONTENTS to NULL if there is no pristine text because the file is
61  * locally added (even if it replaces an existing base node).  Return an
62  * error if there is no pristine text for any other reason.
63  *
64  * If SIZE is not NULL, set *SIZE to the length of the pristine stream in
65  * BYTES or to SVN_INVALID_FILESIZE if no pristine is available for this
66  * file.
67  *
68  * For more detail, see the description of svn_wc_get_pristine_contents2().
69  */
70 svn_error_t *
71 svn_wc__get_pristine_contents(svn_stream_t **contents,
72                               svn_filesize_t *size,
73                               svn_wc__db_t *db,
74                               const char *local_abspath,
75                               apr_pool_t *result_pool,
76                               apr_pool_t *scratch_pool);
77
78 /* Set *RESULT_ABSPATH to the absolute path to a readable file containing
79    the WC-1 "normal text-base" of LOCAL_ABSPATH in DB.
80
81    "Normal text-base" means the same as in svn_wc__text_base_path().
82    ### May want to check the callers' exact requirements and replace this
83        definition with something easier to comprehend.
84
85    What the callers want:
86      A path to a file that will remain available and unchanged as long as
87      the caller wants it - such as for the lifetime of RESULT_POOL.
88
89    What the current implementation provides:
90      A path to the file in the pristine store.  This file will be removed or
91      replaced the next time this or another Subversion client updates the WC.
92
93    If the node LOCAL_ABSPATH has no such pristine text, return an error of
94    type SVN_ERR_WC_PATH_UNEXPECTED_STATUS.
95
96    Allocate *RESULT_PATH in RESULT_POOL.  */
97 svn_error_t *
98 svn_wc__text_base_path_to_read(const char **result_abspath,
99                                svn_wc__db_t *db,
100                                const char *local_abspath,
101                                apr_pool_t *result_pool,
102                                apr_pool_t *scratch_pool);
103
104 \f
105 /*** Opening all kinds of adm files ***/
106
107 /* Open `PATH/<adminstrative_subdir>/FNAME'. */
108 svn_error_t *svn_wc__open_adm_stream(svn_stream_t **stream,
109                                      const char *dir_abspath,
110                                      const char *fname,
111                                      apr_pool_t *result_pool,
112                                      apr_pool_t *scratch_pool);
113
114
115 /* Open a writable stream to a temporary (normal or revert) text base,
116    associated with the versioned file LOCAL_ABSPATH in DB.  Set *STREAM to
117    the opened stream and *TEMP_BASE_ABSPATH to the path to the temporary
118    file.  The temporary file will have an arbitrary unique name, in contrast
119    to the deterministic name that svn_wc__text_base_deterministic_tmp_path()
120    returns.
121
122    Arrange that, on stream closure, *MD5_CHECKSUM and *SHA1_CHECKSUM will be
123    set to the MD-5 and SHA-1 checksums respectively of that file.
124    MD5_CHECKSUM and/or SHA1_CHECKSUM may be NULL if not wanted.
125
126    Allocate the new stream, path and checksums in RESULT_POOL.
127  */
128 svn_error_t *
129 svn_wc__open_writable_base(svn_stream_t **stream,
130                            const char **temp_base_abspath,
131                            svn_checksum_t **md5_checksum,
132                            svn_checksum_t **sha1_checksum,
133                            svn_wc__db_t *db,
134                            const char *wri_abspath,
135                            apr_pool_t *result_pool,
136                            apr_pool_t *scratch_pool);
137
138
139 /* Blow away the admistrative directory associated with DIR_ABSPATH.
140    For single-db this doesn't perform actual work unless the wcroot is passed.
141  */
142 svn_error_t *svn_wc__adm_destroy(svn_wc__db_t *db,
143                                  const char *dir_abspath,
144                                  svn_cancel_func_t cancel_func,
145                                  void *cancel_baton,
146                                  apr_pool_t *scratch_pool);
147
148
149 /* Cleanup the temporary storage area of the administrative
150    directory (assuming temp and admin areas exist). */
151 svn_error_t *
152 svn_wc__adm_cleanup_tmp_area(svn_wc__db_t *db,
153                              const char *adm_abspath,
154                              apr_pool_t *scratch_pool);
155
156
157 #ifdef __cplusplus
158 }
159 #endif /* __cplusplus */
160
161 #endif /* SVN_LIBSVN_WC_ADM_FILES_H */