1/*
2 * props.h :  properties
3 *
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
12 *
13 *      http://www.apache.org/licenses/LICENSE-2.0
14 *
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
20 *    under the License.
21 * ====================================================================
22 */
23
24
25#ifndef SVN_LIBSVN_WC_PROPS_H
26#define SVN_LIBSVN_WC_PROPS_H
27
28#include <apr_pools.h>
29
30#include "svn_types.h"
31#include "svn_string.h"
32#include "svn_props.h"
33
34#include "wc_db.h"
35
36#ifdef __cplusplus
37extern "C" {
38#endif /* __cplusplus */
39
40/* Internal function for diffing props. See svn_wc_get_prop_diffs2(). */
41svn_error_t *
42svn_wc__internal_propdiff(apr_array_header_t **propchanges,
43                          apr_hash_t **original_props,
44                          svn_wc__db_t *db,
45                          const char *local_abspath,
46                          apr_pool_t *result_pool,
47                          apr_pool_t *scratch_pool);
48
49
50/* Internal function for fetching a property. See svn_wc_prop_get2(). */
51svn_error_t *
52svn_wc__internal_propget(const svn_string_t **value,
53                         svn_wc__db_t *db,
54                         const char *local_abspath,
55                         const char *name,
56                         apr_pool_t *result_pool,
57                         apr_pool_t *scratch_pool);
58
59/* Validate and canonicalize the PROPS like svn_wc_prop_set4() does;
60 * see that function for details of the SKIP_SOME_CHECKS option.
61 *
62 * The properties are checked against the node at LOCAL_ABSPATH (which
63 * need not be under version control) of kind KIND.  This text of this
64 * node may be read (if it is a file) in order to validate the
65 * svn:eol-style property.
66 *
67 * Only regular props are accepted; WC props and entry props raise an error
68 * (unlike svn_wc_prop_set4() which accepts WC props).
69 *
70 * Set *PREPARED_PROPS to the resulting canonicalized properties,
71 * allocating any new data in RESULT_POOL but making shallow copies of
72 * keys and unchanged values from PROPS.
73 */
74svn_error_t *
75svn_wc__canonicalize_props(apr_hash_t **prepared_props,
76                           const char *local_abspath,
77                           svn_node_kind_t node_kind,
78                           const apr_hash_t *props,
79                           svn_boolean_t skip_some_checks,
80                           apr_pool_t *result_pool,
81                           apr_pool_t *scratch_pool);
82
83
84/* Given LOCAL_ABSPATH/DB and an array of PROPCHANGES based on
85   SERVER_BASEPROPS, calculate what changes should be applied to the working
86   copy.
87
88   We return the new property collections to the caller, so the caller
89   can combine the property update with other operations.
90
91   If SERVER_BASEPROPS is NULL then use the pristine props as PROPCHANGES
92   base.
93
94   Return the new set of actual properties in *NEW_ACTUAL_PROPS.
95
96   Append any conflicts of the actual props to *CONFLICT_SKEL.  (First
97   allocate *CONFLICT_SKEL from RESULT_POOL if it is initially NULL.
98   CONFLICT_SKEL itself must not be NULL.)
99
100   If STATE is non-null, set *STATE to the state of the local properties
101   after the merge, one of:
102
103     svn_wc_notify_state_unchanged
104     svn_wc_notify_state_changed
105     svn_wc_notify_state_merged
106     svn_wc_notify_state_conflicted
107 */
108svn_error_t *
109svn_wc__merge_props(svn_skel_t **conflict_skel,
110                    svn_wc_notify_state_t *state,
111                    apr_hash_t **new_actual_props,
112                    svn_wc__db_t *db,
113                    const char *local_abspath,
114                    /*const*/ apr_hash_t *server_baseprops,
115                    /*const*/ apr_hash_t *pristine_props,
116                    /*const*/ apr_hash_t *actual_props,
117                    const apr_array_header_t *propchanges,
118                    apr_pool_t *result_pool,
119                    apr_pool_t *scratch_pool);
120
121
122/* Given PROPERTIES is array of @c svn_prop_t structures. Returns TRUE if any
123   of the PROPERTIES are the known "magic" ones that might require
124   changing the working file. */
125svn_boolean_t svn_wc__has_magic_property(const apr_array_header_t *properties);
126
127/* Set *MODIFIED_P TRUE if the props for LOCAL_ABSPATH have been modified. */
128svn_error_t *
129svn_wc__props_modified(svn_boolean_t *modified_p,
130                       svn_wc__db_t *db,
131                       const char *local_abspath,
132                       apr_pool_t *scratch_pool);
133
134/* Internal version of svn_wc_prop_list2().  */
135svn_error_t *
136svn_wc__get_actual_props(apr_hash_t **props,
137                         svn_wc__db_t *db,
138                         const char *local_abspath,
139                         apr_pool_t *result_pool,
140                         apr_pool_t *scratch_pool);
141
142/* Creates a property reject file at *TMP_PREJFILE_ABSPATH, with
143   either the property conflict data from DB (when PROP_CONFLICT_DATA
144   is NULL) or the information in PROP_CONFLICT_DATA if it isn't.
145 */
146svn_error_t *
147svn_wc__create_prejfile(const char **tmp_prejfile_abspath,
148                        svn_wc__db_t *db,
149                        const char *local_abspath,
150                        const svn_skel_t *prop_conflict_data,
151                        svn_cancel_func_t cancel_func,
152                        void *cancel_baton,
153                        apr_pool_t *result_pool,
154                        apr_pool_t *scratch_pool);
155
156#ifdef __cplusplus
157}
158#endif /* __cplusplus */
159
160#endif /* SVN_LIBSVN_WC_PROPS_H */
161