1251881Speter/*
2251881Speter * adm_files.h :  handles locations inside the wc adm area
3251881Speter *                (This should be the only code that actually knows
4251881Speter *                *where* things are in .svn/.  If you can't get to
5251881Speter *                something via these interfaces, something's wrong.)
6251881Speter *
7251881Speter * ====================================================================
8251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
9251881Speter *    or more contributor license agreements.  See the NOTICE file
10251881Speter *    distributed with this work for additional information
11251881Speter *    regarding copyright ownership.  The ASF licenses this file
12251881Speter *    to you under the Apache License, Version 2.0 (the
13251881Speter *    "License"); you may not use this file except in compliance
14251881Speter *    with the License.  You may obtain a copy of the License at
15251881Speter *
16251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
17251881Speter *
18251881Speter *    Unless required by applicable law or agreed to in writing,
19251881Speter *    software distributed under the License is distributed on an
20251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
21251881Speter *    KIND, either express or implied.  See the License for the
22251881Speter *    specific language governing permissions and limitations
23251881Speter *    under the License.
24251881Speter * ====================================================================
25251881Speter */
26251881Speter
27251881Speter
28251881Speter#ifndef SVN_LIBSVN_WC_ADM_FILES_H
29251881Speter#define SVN_LIBSVN_WC_ADM_FILES_H
30251881Speter
31251881Speter#include <apr_pools.h>
32251881Speter#include "svn_types.h"
33251881Speter
34251881Speter#include "props.h"
35251881Speter#include "wc_db.h"
36251881Speter
37251881Speter#ifdef __cplusplus
38251881Speterextern "C" {
39251881Speter#endif /* __cplusplus */
40251881Speter
41251881Speter
42251881Speter
43251881Speter/* Return a path to CHILD in the administrative area of PATH. If CHILD is
44251881Speter   NULL, then the path to the admin area is returned. The result is
45251881Speter   allocated in RESULT_POOL. */
46251881Speterconst char *svn_wc__adm_child(const char *path,
47251881Speter                              const char *child,
48251881Speter                              apr_pool_t *result_pool);
49251881Speter
50251881Speter/* Return TRUE if the administrative area exists for this directory. */
51251881Spetersvn_boolean_t svn_wc__adm_area_exists(const char *adm_abspath,
52251881Speter                                      apr_pool_t *pool);
53251881Speter
54251881Speter
55251881Speter/* Set *CONTENTS to a readonly stream on the pristine text of the working
56251881Speter * version of the file LOCAL_ABSPATH in DB.  If the file is locally copied
57251881Speter * or moved to this path, this means the pristine text of the copy source,
58251881Speter * even if the file replaces a previously existing base node at this path.
59251881Speter *
60251881Speter * Set *CONTENTS to NULL if there is no pristine text because the file is
61251881Speter * locally added (even if it replaces an existing base node).  Return an
62251881Speter * error if there is no pristine text for any other reason.
63251881Speter *
64251881Speter * If SIZE is not NULL, set *SIZE to the length of the pristine stream in
65251881Speter * BYTES or to SVN_INVALID_FILESIZE if no pristine is available for this
66251881Speter * file.
67251881Speter *
68251881Speter * For more detail, see the description of svn_wc_get_pristine_contents2().
69251881Speter */
70251881Spetersvn_error_t *
71251881Spetersvn_wc__get_pristine_contents(svn_stream_t **contents,
72251881Speter                              svn_filesize_t *size,
73251881Speter                              svn_wc__db_t *db,
74251881Speter                              const char *local_abspath,
75251881Speter                              apr_pool_t *result_pool,
76251881Speter                              apr_pool_t *scratch_pool);
77251881Speter
78251881Speter/* Set *RESULT_ABSPATH to the absolute path to a readable file containing
79251881Speter   the WC-1 "normal text-base" of LOCAL_ABSPATH in DB.
80251881Speter
81251881Speter   "Normal text-base" means the same as in svn_wc__text_base_path().
82251881Speter   ### May want to check the callers' exact requirements and replace this
83251881Speter       definition with something easier to comprehend.
84251881Speter
85251881Speter   What the callers want:
86251881Speter     A path to a file that will remain available and unchanged as long as
87251881Speter     the caller wants it - such as for the lifetime of RESULT_POOL.
88251881Speter
89251881Speter   What the current implementation provides:
90251881Speter     A path to the file in the pristine store.  This file will be removed or
91251881Speter     replaced the next time this or another Subversion client updates the WC.
92251881Speter
93251881Speter   If the node LOCAL_ABSPATH has no such pristine text, return an error of
94251881Speter   type SVN_ERR_WC_PATH_UNEXPECTED_STATUS.
95251881Speter
96251881Speter   Allocate *RESULT_PATH in RESULT_POOL.  */
97251881Spetersvn_error_t *
98251881Spetersvn_wc__text_base_path_to_read(const char **result_abspath,
99251881Speter                               svn_wc__db_t *db,
100251881Speter                               const char *local_abspath,
101251881Speter                               apr_pool_t *result_pool,
102251881Speter                               apr_pool_t *scratch_pool);
103251881Speter
104251881Speter
105251881Speter/*** Opening all kinds of adm files ***/
106251881Speter
107251881Speter/* Open `PATH/<adminstrative_subdir>/FNAME'. */
108251881Spetersvn_error_t *svn_wc__open_adm_stream(svn_stream_t **stream,
109251881Speter                                     const char *dir_abspath,
110251881Speter                                     const char *fname,
111251881Speter                                     apr_pool_t *result_pool,
112251881Speter                                     apr_pool_t *scratch_pool);
113251881Speter
114251881Speter
115251881Speter/* Blow away the admistrative directory associated with DIR_ABSPATH.
116251881Speter   For single-db this doesn't perform actual work unless the wcroot is passed.
117251881Speter */
118251881Spetersvn_error_t *svn_wc__adm_destroy(svn_wc__db_t *db,
119251881Speter                                 const char *dir_abspath,
120251881Speter                                 svn_cancel_func_t cancel_func,
121251881Speter                                 void *cancel_baton,
122251881Speter                                 apr_pool_t *scratch_pool);
123251881Speter
124251881Speter
125251881Speter/* Cleanup the temporary storage area of the administrative
126251881Speter   directory (assuming temp and admin areas exist). */
127251881Spetersvn_error_t *
128251881Spetersvn_wc__adm_cleanup_tmp_area(svn_wc__db_t *db,
129251881Speter                             const char *adm_abspath,
130251881Speter                             apr_pool_t *scratch_pool);
131251881Speter
132251881Speter
133251881Speter#ifdef __cplusplus
134251881Speter}
135251881Speter#endif /* __cplusplus */
136251881Speter
137251881Speter#endif /* SVN_LIBSVN_WC_ADM_FILES_H */
138