1251881Speter/*
2251881Speter * entries.h :  manipulating entries
3251881Speter *
4251881Speter * ====================================================================
5251881Speter *    Licensed to the Apache Software Foundation (ASF) under one
6251881Speter *    or more contributor license agreements.  See the NOTICE file
7251881Speter *    distributed with this work for additional information
8251881Speter *    regarding copyright ownership.  The ASF licenses this file
9251881Speter *    to you under the Apache License, Version 2.0 (the
10251881Speter *    "License"); you may not use this file except in compliance
11251881Speter *    with the License.  You may obtain a copy of the License at
12251881Speter *
13251881Speter *      http://www.apache.org/licenses/LICENSE-2.0
14251881Speter *
15251881Speter *    Unless required by applicable law or agreed to in writing,
16251881Speter *    software distributed under the License is distributed on an
17251881Speter *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18251881Speter *    KIND, either express or implied.  See the License for the
19251881Speter *    specific language governing permissions and limitations
20251881Speter *    under the License.
21251881Speter * ====================================================================
22251881Speter */
23251881Speter
24251881Speter
25251881Speter#ifndef SVN_LIBSVN_WC_ENTRIES_H
26251881Speter#define SVN_LIBSVN_WC_ENTRIES_H
27251881Speter
28251881Speter#include <apr_pools.h>
29251881Speter
30251881Speter#include "svn_types.h"
31251881Speter
32251881Speter#include "wc_db.h"
33251881Speter#include "private/svn_sqlite.h"
34251881Speter
35251881Speter
36251881Speter#ifdef __cplusplus
37251881Speterextern "C" {
38251881Speter#endif /* __cplusplus */
39251881Speter
40251881Speter/** Get an ENTRY for the given LOCAL_ABSPATH.
41251881Speter *
42251881Speter * This API does not require an access baton, just a wc_db handle (DB).
43251881Speter * The requested entry MUST be present and version-controlled when
44251881Speter * ALLOW_UNVERSIONED is FALSE; otherwise, SVN_ERR_WC_PATH_NOT_FOUND is
45251881Speter * returned. When ALLOW_UNVERSIONED is TRUE, and the node is not under
46251881Speter * version control, *ENTRY will be set to NULL (this is easier for callers
47251881Speter * to handle, than detecting the error and clearing it).
48251881Speter *
49251881Speter * If you know the entry is a FILE or DIR, then specify that in KIND. If you
50251881Speter * are unsure, then specify 'svn_node_unknown' for KIND. This value will be
51251881Speter * used to optimize the access to the entry, so it is best to know the kind.
52251881Speter * If you specify FILE/DIR, and the entry is *something else*, then
53251881Speter * SVN_ERR_NODE_UNEXPECTED_KIND will be returned.
54251881Speter *
55251881Speter * If KIND == UNKNOWN, and you request the parent stub, and the node turns
56251881Speter * out to NOT be a directory, then SVN_ERR_NODE_UNEXPECTED_KIND is returned.
57251881Speter *
58251881Speter * NOTE: if SVN_ERR_NODE_UNEXPECTED_KIND is returned, then the ENTRY *IS*
59251881Speter * valid and may be examined. For any other error, ENTRY *IS NOT* valid.
60251881Speter *
61251881Speter * NOTE: if an access baton is available, then it will be examined for
62251881Speter * cached entries (and this routine may even cache them for you). It is
63251881Speter * not required, however, to do any access baton management for this API.
64251881Speter *
65251881Speter * ENTRY will be allocated in RESULT_POOL, and all temporary allocations
66251881Speter * will be performed in SCRATCH_POOL.
67251881Speter */
68251881Spetersvn_error_t *
69251881Spetersvn_wc__get_entry(const svn_wc_entry_t **entry,
70251881Speter                  svn_wc__db_t *db,
71251881Speter                  const char *local_abspath,
72251881Speter                  svn_boolean_t allow_unversioned,
73251881Speter                  svn_node_kind_t kind,
74251881Speter                  apr_pool_t *result_pool,
75251881Speter                  apr_pool_t *scratch_pool);
76251881Speter
77251881Speter/* Is ENTRY in a 'hidden' state in the sense of the 'show_hidden'
78251881Speter * switches on svn_wc_entries_read(), svn_wc_walk_entries*(), etc.? */
79251881Spetersvn_error_t *
80251881Spetersvn_wc__entry_is_hidden(svn_boolean_t *hidden, const svn_wc_entry_t *entry);
81251881Speter
82251881Speter
83251881Speter/* The checksums of one pre-1.7 text-base file.  If the text-base file
84251881Speter * exists, both checksums are filled in, otherwise both fields are NULL. */
85251881Spetertypedef struct svn_wc__text_base_file_info_t
86251881Speter{
87251881Speter  svn_checksum_t *sha1_checksum;
88251881Speter  svn_checksum_t *md5_checksum;
89251881Speter} svn_wc__text_base_file_info_t;
90251881Speter
91251881Speter/* The text-base checksums of the normal base and/or the revert-base of one
92251881Speter * pre-1.7 versioned text file. */
93251881Spetertypedef struct svn_wc__text_base_info_t
94251881Speter{
95251881Speter  svn_wc__text_base_file_info_t normal_base;
96251881Speter  svn_wc__text_base_file_info_t revert_base;
97251881Speter} svn_wc__text_base_info_t;
98251881Speter
99251881Speter/* For internal use by upgrade.c to write entries in the wc-ng format.
100251881Speter   Return in DIR_BATON the baton to be passed as PARENT_BATON when
101251881Speter   upgrading child directories. Pass a NULL PARENT_BATON when upgrading
102251881Speter   the root directory.
103251881Speter
104251881Speter   TEXT_BASES_INFO is a hash of information about all the text bases found
105251881Speter   in this directory's admin area, keyed on (const char *) name of the
106251881Speter   versioned file, with (svn_wc__text_base_info_t *) values. */
107251881Spetersvn_error_t *
108251881Spetersvn_wc__write_upgraded_entries(void **dir_baton,
109251881Speter                               void *parent_baton,
110251881Speter                               svn_wc__db_t *db,
111251881Speter                               svn_sqlite__db_t *sdb,
112251881Speter                               apr_int64_t repos_id,
113251881Speter                               apr_int64_t wc_id,
114251881Speter                               const char *dir_abspath,
115251881Speter                               const char *new_root_abspath,
116251881Speter                               apr_hash_t *entries,
117251881Speter                               apr_hash_t *text_bases_info,
118251881Speter                               apr_pool_t *result_pool,
119251881Speter                               apr_pool_t *scratch_pool);
120251881Speter
121251881Speter/* Parse a file external specification in the NULL terminated STR and
122251881Speter   place the path in PATH_RESULT, the peg revision in PEG_REV_RESULT
123251881Speter   and revision number in REV_RESULT.  STR may be NULL, in which case
124251881Speter   PATH_RESULT will be set to NULL and both PEG_REV_RESULT and
125251881Speter   REV_RESULT set to svn_opt_revision_unspecified.
126251881Speter
127251881Speter   The format that is read is the same as a working-copy path with a
128251881Speter   peg revision; see svn_opt_parse_path(). */
129251881Spetersvn_error_t *
130251881Spetersvn_wc__unserialize_file_external(const char **path_result,
131251881Speter                                  svn_opt_revision_t *peg_rev_result,
132251881Speter                                  svn_opt_revision_t *rev_result,
133251881Speter                                  const char *str,
134251881Speter                                  apr_pool_t *pool);
135251881Speter
136251881Speter/* Serialize into STR the file external path, peg revision number and
137251881Speter   the operative revision number into a format that
138251881Speter   unserialize_file_external() can parse.  The format is
139251881Speter     %{peg_rev}:%{rev}:%{path}
140251881Speter   where a rev will either be HEAD or the string revision number.  If
141251881Speter   PATH is NULL then STR will be set to NULL.  This method writes to a
142251881Speter   string instead of a svn_stringbuf_t so that the string can be
143251881Speter   protected by write_str(). */
144251881Spetersvn_error_t *
145251881Spetersvn_wc__serialize_file_external(const char **str,
146251881Speter                                const char *path,
147251881Speter                                const svn_opt_revision_t *peg_rev,
148251881Speter                                const svn_opt_revision_t *rev,
149251881Speter                                apr_pool_t *pool);
150251881Speter
151251881Speter/* Non-deprecated wrapper variant of svn_wc_entries_read used implement
152251881Speter   legacy API functions. See svn_wc_entries_read for a detailed description.
153251881Speter */
154251881Spetersvn_error_t *
155251881Spetersvn_wc__entries_read_internal(apr_hash_t **entries,
156251881Speter                              svn_wc_adm_access_t *adm_access,
157251881Speter                              svn_boolean_t show_hidden,
158251881Speter                              apr_pool_t *pool);
159251881Speter
160251881Speter#ifdef __cplusplus
161251881Speter}
162251881Speter#endif /* __cplusplus */
163251881Speter
164251881Speter#endif /* SVN_LIBSVN_WC_ENTRIES_H */
165