2 * translate.h : eol and keyword translation
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
25 #ifndef SVN_LIBSVN_WC_TRANSLATE_H
26 #define SVN_LIBSVN_WC_TRANSLATE_H
28 #include <apr_pools.h>
29 #include "svn_types.h"
30 #include "svn_subst.h"
34 #endif /* __cplusplus */
37 /* Newline and keyword translation properties */
39 /* If EOL is not-NULL query the SVN_PROP_EOL_STYLE property on file
40 LOCAL_ABSPATH in DB. If STYLE is non-null, set *STYLE to LOCAL_ABSPATH's
41 eol style. Set *EOL to
43 - NULL for svn_subst_eol_style_none, or
45 - a null-terminated C string containing the native eol marker
46 for this platform, for svn_subst_eol_style_native, or
48 - a null-terminated C string containing the eol marker indicated
49 by the property value, for svn_subst_eol_style_fixed.
51 If STYLE is null on entry, ignore it. If *EOL is non-null on exit,
52 it is a static string not allocated in POOL.
54 If KEYWORDS is not NULL Expand keywords for the file at LOCAL_ABSPATH
55 in DB, by parsing a whitespace-delimited list of keywords. If any keywords
56 are found in the list, allocate *KEYWORDS from RESULT_POOL and populate it
57 with mappings from (const char *) keywords to their (svn_string_t *)
58 values (also allocated in RESULT_POOL).
60 If a keyword is in the list, but no corresponding value is
61 available, do not create a hash entry for it. If no keywords are
62 found in the list, or if there is no list, set *KEYWORDS to NULL.
64 If SPECIAL is not NULL determine if the svn:special flag is set on
65 LOCAL_ABSPATH in DB. If so, set SPECIAL to TRUE, if not, set it to FALSE.
67 If PROPS is not NULL, use PROPS instead of the properties on LOCAL_ABSPATH.
69 If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH
70 from the working copy identified by WRI_ABSPATH. Falling back to file
71 external information if the file is not present as versioned node.
73 If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of
74 calculating their intended values.
76 Use SCRATCH_POOL for temporary allocation, RESULT_POOL for allocating
80 svn_wc__get_translate_info(svn_subst_eol_style_t *style,
82 apr_hash_t **keywords,
83 svn_boolean_t *special,
85 const char *local_abspath,
87 svn_boolean_t for_normalization,
88 apr_pool_t *result_pool,
89 apr_pool_t *scratch_pool);
91 /* Reverse parser. Given a real EOL string ("\n", "\r", or "\r\n"),
92 return an encoded *VALUE ("LF", "CR", "CRLF") that one might see in
93 the property value. */
94 void svn_wc__eol_value_from_string(const char **value,
97 /* Expand keywords for the file at LOCAL_ABSPATH in DB, by parsing a
98 whitespace-delimited list of keywords KEYWORD_LIST. If any keywords
99 are found in the list, allocate *KEYWORDS from RESULT_POOL and populate
100 it with mappings from (const char *) keywords to their (svn_string_t *)
101 values (also allocated in RESULT_POOL).
103 If a keyword is in the list, but no corresponding value is
104 available, do not create a hash entry for it. If no keywords are
105 found in the list, or if there is no list, set *KEYWORDS to NULL.
106 ### THIS LOOKS WRONG -- it creates a hash entry for every recognized kw
107 and expands each missing value as an empty string or "-1" or similar.
109 Use LOCAL_ABSPATH to expand keyword values.
111 If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH
112 from the working copy identified by WRI_ABSPATH. Falling back to file
113 external information if the file is not present as versioned node.
114 ### THIS IS NOT IMPLEMENTED -- WRI_ABSPATH is ignored
116 If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of
117 calculating their intended values.
118 ### This would be better done by a separate API, since in this case
119 only the KEYWORD_LIST input parameter is needed. (And there is no
120 need to print "-1" as the revision value.)
122 Use SCRATCH_POOL for any temporary allocations.
125 svn_wc__expand_keywords(apr_hash_t **keywords,
127 const char *local_abspath,
128 const char *wri_abspath,
129 const char *keyword_list,
130 svn_boolean_t for_normalization,
131 apr_pool_t *result_pool,
132 apr_pool_t *scratch_pool);
134 /* Sync the write and execute bit for LOCAL_ABSPATH with what is currently
135 indicated by the properties in the database:
137 * If the SVN_PROP_NEEDS_LOCK property is present and there is no
138 lock token for the file in the working copy, set LOCAL_ABSPATH to
140 * If the SVN_PROP_EXECUTABLE property is present at all, then set
141 LOCAL_ABSPATH executable.
143 If DID_SET is non-null, then liberally set *DID_SET to TRUE if we might
144 have change the permissions on LOCAL_ABSPATH. (A TRUE value in *DID_SET
145 does not guarantee that we changed the permissions, simply that more
146 investigation is warrented.)
148 This function looks at the current values of the above properties,
149 including any scheduled-but-not-yet-committed changes.
151 If LOCAL_ABSPATH is a directory, this function is a no-op.
153 Use SCRATCH_POOL for any temporary allocations.
156 svn_wc__sync_flags_with_props(svn_boolean_t *did_set,
158 const char *local_abspath,
159 apr_pool_t *scratch_pool);
161 /* Internal version of svn_wc_translated_stream2(), which see. */
163 svn_wc__internal_translated_stream(svn_stream_t **stream,
165 const char *local_abspath,
166 const char *versioned_abspath,
168 apr_pool_t *result_pool,
169 apr_pool_t *scratch_pool);
171 /* Like svn_wc_translated_file2(), except the working copy database
172 * is used directly and the function assumes abspaths. */
174 svn_wc__internal_translated_file(const char **xlated_abspath,
175 const char *src_abspath,
177 const char *versioned_abspath,
179 svn_cancel_func_t cancel_func,
181 apr_pool_t *result_pool,
182 apr_pool_t *scratch_pool);
187 #endif /* __cplusplus */
189 #endif /* SVN_LIBSVN_WC_TRANSLATE_H */