1251881Speter/* 2251881Speter * translate.h : eol and keyword translation 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_TRANSLATE_H 26251881Speter#define SVN_LIBSVN_WC_TRANSLATE_H 27251881Speter 28251881Speter#include <apr_pools.h> 29251881Speter#include "svn_types.h" 30251881Speter#include "svn_subst.h" 31251881Speter 32251881Speter#ifdef __cplusplus 33251881Speterextern "C" { 34251881Speter#endif /* __cplusplus */ 35251881Speter 36251881Speter 37251881Speter/* Newline and keyword translation properties */ 38251881Speter 39251881Speter/* If EOL is not-NULL query the SVN_PROP_EOL_STYLE property on file 40251881Speter LOCAL_ABSPATH in DB. If STYLE is non-null, set *STYLE to LOCAL_ABSPATH's 41251881Speter eol style. Set *EOL to 42251881Speter 43251881Speter - NULL for svn_subst_eol_style_none, or 44251881Speter 45251881Speter - a null-terminated C string containing the native eol marker 46251881Speter for this platform, for svn_subst_eol_style_native, or 47251881Speter 48251881Speter - a null-terminated C string containing the eol marker indicated 49251881Speter by the property value, for svn_subst_eol_style_fixed. 50251881Speter 51251881Speter If STYLE is null on entry, ignore it. If *EOL is non-null on exit, 52251881Speter it is a static string not allocated in POOL. 53251881Speter 54251881Speter If KEYWORDS is not NULL Expand keywords for the file at LOCAL_ABSPATH 55251881Speter in DB, by parsing a whitespace-delimited list of keywords. If any keywords 56251881Speter are found in the list, allocate *KEYWORDS from RESULT_POOL and populate it 57251881Speter with mappings from (const char *) keywords to their (svn_string_t *) 58251881Speter values (also allocated in RESULT_POOL). 59251881Speter 60251881Speter If a keyword is in the list, but no corresponding value is 61251881Speter available, do not create a hash entry for it. If no keywords are 62251881Speter found in the list, or if there is no list, set *KEYWORDS to NULL. 63251881Speter 64251881Speter If SPECIAL is not NULL determine if the svn:special flag is set on 65251881Speter LOCAL_ABSPATH in DB. If so, set SPECIAL to TRUE, if not, set it to FALSE. 66251881Speter 67251881Speter If PROPS is not NULL, use PROPS instead of the properties on LOCAL_ABSPATH. 68251881Speter 69251881Speter If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH 70251881Speter from the working copy identified by WRI_ABSPATH. Falling back to file 71251881Speter external information if the file is not present as versioned node. 72251881Speter 73251881Speter If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of 74251881Speter calculating their intended values. 75251881Speter 76251881Speter Use SCRATCH_POOL for temporary allocation, RESULT_POOL for allocating 77251881Speter *STYLE and *EOL. 78251881Speter*/ 79251881Spetersvn_error_t * 80251881Spetersvn_wc__get_translate_info(svn_subst_eol_style_t *style, 81251881Speter const char **eol, 82251881Speter apr_hash_t **keywords, 83251881Speter svn_boolean_t *special, 84251881Speter svn_wc__db_t *db, 85251881Speter const char *local_abspath, 86251881Speter apr_hash_t *props, 87251881Speter svn_boolean_t for_normalization, 88251881Speter apr_pool_t *result_pool, 89251881Speter apr_pool_t *scratch_pool); 90251881Speter 91251881Speter/* Reverse parser. Given a real EOL string ("\n", "\r", or "\r\n"), 92251881Speter return an encoded *VALUE ("LF", "CR", "CRLF") that one might see in 93251881Speter the property value. */ 94251881Spetervoid svn_wc__eol_value_from_string(const char **value, 95251881Speter const char *eol); 96251881Speter 97251881Speter/* Expand keywords for the file at LOCAL_ABSPATH in DB, by parsing a 98251881Speter whitespace-delimited list of keywords KEYWORD_LIST. If any keywords 99251881Speter are found in the list, allocate *KEYWORDS from RESULT_POOL and populate 100251881Speter it with mappings from (const char *) keywords to their (svn_string_t *) 101251881Speter values (also allocated in RESULT_POOL). 102251881Speter 103251881Speter If a keyword is in the list, but no corresponding value is 104251881Speter available, do not create a hash entry for it. If no keywords are 105251881Speter found in the list, or if there is no list, set *KEYWORDS to NULL. 106251881Speter ### THIS LOOKS WRONG -- it creates a hash entry for every recognized kw 107251881Speter and expands each missing value as an empty string or "-1" or similar. 108251881Speter 109251881Speter Use LOCAL_ABSPATH to expand keyword values. 110251881Speter 111251881Speter If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH 112251881Speter from the working copy identified by WRI_ABSPATH. Falling back to file 113251881Speter external information if the file is not present as versioned node. 114251881Speter ### THIS IS NOT IMPLEMENTED -- WRI_ABSPATH is ignored 115251881Speter 116251881Speter If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of 117251881Speter calculating their intended values. 118251881Speter ### This would be better done by a separate API, since in this case 119251881Speter only the KEYWORD_LIST input parameter is needed. (And there is no 120251881Speter need to print "-1" as the revision value.) 121251881Speter 122251881Speter Use SCRATCH_POOL for any temporary allocations. 123251881Speter*/ 124251881Spetersvn_error_t * 125251881Spetersvn_wc__expand_keywords(apr_hash_t **keywords, 126251881Speter svn_wc__db_t *db, 127251881Speter const char *local_abspath, 128251881Speter const char *wri_abspath, 129251881Speter const char *keyword_list, 130251881Speter svn_boolean_t for_normalization, 131251881Speter apr_pool_t *result_pool, 132251881Speter apr_pool_t *scratch_pool); 133251881Speter 134251881Speter/* Sync the write and execute bit for LOCAL_ABSPATH with what is currently 135251881Speter indicated by the properties in the database: 136251881Speter 137251881Speter * If the SVN_PROP_NEEDS_LOCK property is present and there is no 138251881Speter lock token for the file in the working copy, set LOCAL_ABSPATH to 139251881Speter read-only. 140251881Speter * If the SVN_PROP_EXECUTABLE property is present at all, then set 141251881Speter LOCAL_ABSPATH executable. 142251881Speter 143251881Speter If DID_SET is non-null, then liberally set *DID_SET to TRUE if we might 144251881Speter have change the permissions on LOCAL_ABSPATH. (A TRUE value in *DID_SET 145251881Speter does not guarantee that we changed the permissions, simply that more 146251881Speter investigation is warrented.) 147251881Speter 148251881Speter This function looks at the current values of the above properties, 149251881Speter including any scheduled-but-not-yet-committed changes. 150251881Speter 151251881Speter If LOCAL_ABSPATH is a directory, this function is a no-op. 152251881Speter 153251881Speter Use SCRATCH_POOL for any temporary allocations. 154251881Speter */ 155251881Spetersvn_error_t * 156251881Spetersvn_wc__sync_flags_with_props(svn_boolean_t *did_set, 157251881Speter svn_wc__db_t *db, 158251881Speter const char *local_abspath, 159251881Speter apr_pool_t *scratch_pool); 160251881Speter 161251881Speter/* Internal version of svn_wc_translated_stream2(), which see. */ 162251881Spetersvn_error_t * 163251881Spetersvn_wc__internal_translated_stream(svn_stream_t **stream, 164251881Speter svn_wc__db_t *db, 165251881Speter const char *local_abspath, 166251881Speter const char *versioned_abspath, 167251881Speter apr_uint32_t flags, 168251881Speter apr_pool_t *result_pool, 169251881Speter apr_pool_t *scratch_pool); 170251881Speter 171251881Speter/* Like svn_wc_translated_file2(), except the working copy database 172251881Speter * is used directly and the function assumes abspaths. */ 173251881Spetersvn_error_t * 174251881Spetersvn_wc__internal_translated_file(const char **xlated_abspath, 175251881Speter const char *src_abspath, 176251881Speter svn_wc__db_t *db, 177251881Speter const char *versioned_abspath, 178251881Speter apr_uint32_t flags, 179251881Speter svn_cancel_func_t cancel_func, 180251881Speter void *cancel_baton, 181251881Speter apr_pool_t *result_pool, 182251881Speter apr_pool_t *scratch_pool); 183251881Speter 184251881Speter 185251881Speter#ifdef __cplusplus 186251881Speter} 187251881Speter#endif /* __cplusplus */ 188251881Speter 189251881Speter#endif /* SVN_LIBSVN_WC_TRANSLATE_H */ 190