summaryrefslogtreecommitdiff
path: root/subversion/libsvn_wc/conflicts.h
blob: a0ded7f913c8f3add2318d60b7e021a2d8bcefb4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
/*
 * conflicts.h: declarations related to conflicts
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */

#ifndef SVN_WC_CONFLICTS_H
#define SVN_WC_CONFLICTS_H

#include <apr_pools.h>

#include "svn_types.h"
#include "svn_wc.h"

#include "wc_db.h"
#include "private/svn_skel.h"

#ifdef __cplusplus
extern "C" {
#endif /* __cplusplus */



#define SVN_WC__CONFLICT_OP_UPDATE "update"
#define SVN_WC__CONFLICT_OP_SWITCH "switch"
#define SVN_WC__CONFLICT_OP_MERGE "merge"
#define SVN_WC__CONFLICT_OP_PATCH "patch"

#define SVN_WC__CONFLICT_KIND_TEXT "text"
#define SVN_WC__CONFLICT_KIND_PROP "prop"
#define SVN_WC__CONFLICT_KIND_TREE "tree"
#define SVN_WC__CONFLICT_KIND_REJECT "reject"
#define SVN_WC__CONFLICT_KIND_OBSTRUCTED "obstructed"



/* Return a new conflict skel, allocated in RESULT_POOL. */
svn_skel_t *
svn_wc__conflict_skel_new(apr_pool_t *result_pool);


/* Set 'update' as the conflicting operation in CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   BASE_REVISION is the revision the node was at before the update.
   TARGET_REVISION is the revision being updated to.

   Do temporary allocations in SCRATCH_POOL. */
svn_error_t *
svn_wc__conflict_skel_set_op_update(svn_skel_t *conflict_skel,
                                    svn_revnum_t base_revision,
                                    svn_revnum_t target_revision,
                                    apr_pool_t *result_pool,
                                    apr_pool_t *scratch_pool);


/* Set 'switch' as the conflicting operation in CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   BASE_REVISION is the revision the node was at before the switch.
   TARGET_REVISION is the revision being switched to.
   REPOS_RELPATH is the path being switched to, relative to the
   repository root.

   Do temporary allocations in SCRATCH_POOL. */
svn_error_t *
svn_wc__conflict_skel_set_op_switch(svn_skel_t *conflict_skel,
                                    svn_revnum_t base_revision,
                                    svn_revnum_t target_revision,
                                    const char *repos_relpath,
                                    apr_pool_t *scratch_pool);


/* Set 'merge' as conflicting operation in CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   REPOS_UUID is the UUID of the repository accessed via REPOS_ROOT_URL.

   LEFT_REPOS_RELPATH and RIGHT_REPOS_RELPATH paths to the merge-left
   and merge-right merge sources, relative to REPOS_URL

   LEFT_REVISION is the merge-left revision.
   RIGHT_REVISION is the merge-right revision.

   Do temporary allocations in SCRATCH_POOL. */
svn_error_t *
svn_wc__conflict_skel_set_op_merge(svn_skel_t *conflict_skel,
                                   const char *repos_uuid,
                                   const char *repos_root_url,
                                   svn_revnum_t left_revision,
                                   const char *left_repos_relpath,
                                   svn_revnum_t right_revision,
                                   const char *right_repos_relpath,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);


/* Set 'patch' as the conflicting operation in CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   PATCH_SOURCE_LABEL is a string identifying the patch source in
   some way, for display purposes. It is usually the absolute path
   to the patch file, or a token such as "<stdin>" if the patch source
   is not a file.

   Do temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_set_op_patch(svn_skel_t *conflict_skel,
                                   const char *patch_source_label,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool);


/* Add a text conflict to CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   All checksums passed should be suitable for retreiving conflicted
   versions of the file from the pristine store.

   ORIGINAL_CHECKSUM is the checksum of the BASE version of the conflicted
   file (without local modifications).
   MINE_CHECKSUM is the checksum of the WORKING version of the conflicted
   file as of the time the conflicting operation was run (i.e. including
   local modifications).
   INCOMING_CHECKSUM is the checksum of the incoming file causing the
   conflict. ### is this needed for update? what about merge?

   It is an error (### which one?) if no conflicting operation has been
   set on CONFLICT_SKEL before calling this function.
   It is an error (### which one?) if CONFLICT_SKEL already contains
   a text conflict.

   Do temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_text_conflict(
  svn_skel_t *conflict_skel,
  const svn_checksum_t *original_checksum,
  const svn_checksum_t *mine_checksum,
  const svn_checksum_t *incoming_checksum,
  apr_pool_t *result_pool,
  apr_pool_t *scratch_pool);


/* Add a property conflict to SKEL.

   PROP_NAME is the name of the conflicted property.

   ORIGINAL_VALUE is the property's value at the BASE revision. MINE_VALUE
   is the property's value in WORKING (BASE + local modifications).
   INCOMING_VALUE is the incoming property value brought in by the
   operation. When merging, INCOMING_BASE_VALUE is the base value against
   which INCOMING_VALUE ws being applied. For updates, INCOMING_BASE_VALUE
   should be the same as ORIGINAL_VALUE.

   *_VALUE may be NULL, indicating no value was present.

   It is an error (### which one?) if no conflicting operation has been
   set on CONFLICT_SKEL before calling this function.
   It is an error (### which one?) if CONFLICT_SKEL already cotains
   a propery conflict for PROP_NAME.

   The conflict recorded in SKEL will be allocated from RESULT_POOL. Do
   temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_prop_conflict(
  svn_skel_t *skel,
  const char *prop_name,
  const svn_string_t *original_value,
  const svn_string_t *mine_value,
  const svn_string_t *incoming_value,
  const svn_string_t *incoming_base_value,
  apr_pool_t *result_pool,
  apr_pool_t *scratch_pool);


/* Add a tree conflict to CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   LOCAL_CHANGE is the local tree change made to the node.
   ORIGINAL_LOCAL_KIND is the kind of the local node in BASE.
   If ORIGINAL_LOCAL_KIND is svn_node_file, ORIGINAL_CHECKSUM is the checksum
   for the BASE of the file, for retrieval from the pristine store.

   MINE_LOCAL_KIND is the kind of the local node in WORKING at the
   time the conflict was flagged.
   If MINE_LOCAL_KIND is svn_node_file, ORIGINAL_CHECKSUM is the checksum
   of the WORKING version of the file at the time the conflict was flagged,
   for retrieval from the pristine store.

   INCOMING_KIND is the kind of the incoming node.
   If INCOMING_KIND is svn_node_file, INCOMING_CHECKSUM is the checksum
   of the INCOMING version of the file, for retrieval from the pristine store.

   It is an error (### which one?) if no conflicting operation has been
   set on CONFLICT_SKEL before calling this function.
   It is an error (### which one?) if CONFLICT_SKEL already contains
   a tree conflict.

   Do temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_tree_conflict(
  svn_skel_t *skel,
  svn_wc_conflict_reason_t local_change,
  svn_wc__db_kind_t original_local_kind,
  const svn_checksum_t *original_checksum,
  svn_wc__db_kind_t mine_local_kind,
  const svn_checksum_t *mine_checksum,
  svn_wc_conflict_action_t incoming_change,
  svn_wc__db_kind_t incoming_kind,
  const svn_checksum_t *incoming_checksum,
  apr_pool_t *result_pool,
  apr_pool_t *scratch_pool);


/* Add a reject conflict to CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   HUNK_ORIGINAL_OFFSET, HUNK_ORIGINAL_LENGTH, HUNK_MODIFIED_OFFSET,
   and HUNK_MODIFIED_LENGTH is hunk-header data identifying the hunk
   which was rejected.

   REJECT_DIFF_CHECKSUM is the checksum of the text of the rejected
   diff, for retrieval from the pristine store.

   It is an error (### which one?) if no conflicting operation has been
   set on CONFLICT_SKEL before calling this function.
   It is an error (### which one?) if CONFLICT_SKEL already contains
   a reject conflict for the hunk.

   Do temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_reject_conflict(
  svn_skel_t *conflict_skel,
  svn_linenum_t hunk_original_offset,
  svn_linenum_t hunk_original_length,
  svn_linenum_t hunk_modified_offset,
  svn_linenum_t hunk_modified_length,
  const svn_checksum_t *reject_diff_checksum,
  apr_pool_t *result_pool,
  apr_pool_t *scratch_pool);


/* Add an obstruction conflict to CONFLICT_SKEL.
   Allocate data stored in the skel in RESULT_POOL.

   It is an error (### which one?) if no conflicting operation has been
   set on CONFLICT_SKEL before calling this function.
   It is an error (### which one?) if CONFLICT_SKEL already contains
   an obstruction.

   Do temporary allocations in SCRATCH_POOL.
*/
svn_error_t *
svn_wc__conflict_skel_add_obstruction(svn_skel_t *conflict_skel,
                                      apr_pool_t *result_pool,
                                      apr_pool_t *scratch_pool);


/* Resolve text conflicts on the given node.  */
svn_error_t *
svn_wc__resolve_text_conflict(svn_wc__db_t *db,
                              const char *local_abspath,
                              apr_pool_t *scratch_pool);


#ifdef __cplusplus
}
#endif /* __cplusplus */

#endif /* SVN_WC_CONFLICTS_H */