~svn/ubuntu/raring/subversion/ppa

« back to all changes in this revision

Viewing changes to subversion/include/svn_wc.h

  • Committer: Bazaar Package Importer
  • Author(s): Adam Conrad
  • Date: 2005-12-05 01:26:14 UTC
  • mfrom: (1.1.2 upstream)
  • Revision ID: james.westby@ubuntu.com-20051205012614-qom4xfypgtsqc2xq
Tags: 1.2.3dfsg1-3ubuntu1
Merge with the final Debian release of 1.2.3dfsg1-3, bringing in
fixes to the clean target, better documentation of the libdb4.3
upgrade and build fixes to work with swig1.3_1.3.27.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/**
 
2
 * @copyright
 
3
 * ====================================================================
 
4
 * Copyright (c) 2000-2004 CollabNet.  All rights reserved.
 
5
 *
 
6
 * This software is licensed as described in the file COPYING, which
 
7
 * you should have received as part of this distribution.  The terms
 
8
 * are also available at http://subversion.tigris.org/license-1.html.
 
9
 * If newer versions of this license are posted there, you may use a
 
10
 * newer version instead, at your option.
 
11
 *
 
12
 * This software consists of voluntary contributions made by many
 
13
 * individuals.  For exact contribution history, see the revision
 
14
 * history and logs, available at http://subversion.tigris.org/.
 
15
 * ====================================================================
 
16
 * @endcopyright
 
17
 *
 
18
 * @file svn_wc.h
 
19
 * @brief The Subversion Working Copy Library
 
20
 *
 
21
 * Requires:  
 
22
 *            - A working copy
 
23
 * 
 
24
 * Provides: 
 
25
 *            - Ability to manipulate working copy's versioned data.
 
26
 *            - Ability to manipulate working copy's administrative files.
 
27
 *
 
28
 * Used By:   
 
29
 *            - Clients.
 
30
 */
 
31
 
 
32
#ifndef SVN_WC_H
 
33
#define SVN_WC_H
 
34
 
 
35
 
 
36
#include <apr.h>
 
37
#include <apr_pools.h>
 
38
#include <apr_tables.h>
 
39
#include <apr_hash.h>
 
40
 
 
41
#include "svn_types.h"
 
42
#include "svn_string.h"
 
43
#include "svn_delta.h"
 
44
#include "svn_error.h"
 
45
#include "svn_opt.h"
 
46
#include "svn_ra.h"    /* for svn_ra_reporter_t type */
 
47
 
 
48
#ifdef __cplusplus
 
49
extern "C" {
 
50
#endif /* __cplusplus */
 
51
 
 
52
 
 
53
/**
 
54
 * @since New in 1.1.
 
55
 *
 
56
 * Get libsvn_wc version information.
 
57
 */
 
58
const svn_version_t *svn_wc_version (void);
 
59
 
 
60
 
 
61
/* Locking/Opening/Closing */
 
62
 
 
63
/** Baton for access to a working copy administrative area.
 
64
 *
 
65
 * One day all such access will require a baton, we're not there yet.
 
66
 *
 
67
 * Access batons can be grouped into sets, by passing an existing open
 
68
 * baton when opening a new baton.  Given one baton in a set, other batons
 
69
 * may be retrieved.  This allows an entire hierarchy to be locked, and
 
70
 * then the set of batons can be passed around by passing a single baton.
 
71
 */
 
72
typedef struct svn_wc_adm_access_t svn_wc_adm_access_t;
 
73
 
 
74
 
 
75
/**
 
76
 * @since New in 1.2.
 
77
 *
 
78
 * Return, in @a *adm_access, a pointer to a new access baton for the working
 
79
 * copy administrative area associated with the directory @a path.  If
 
80
 * @a write_lock is true the baton will include a write lock, otherwise the
 
81
 * baton can only be used for read access.  If @a path refers to a directory
 
82
 * that is already write locked then the error @c SVN_ERR_WC_LOCKED will be
 
83
 * returned.  The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if
 
84
 * @a path is not a versioned directory.
 
85
 *
 
86
 * If @a associated is an open access baton then @a adm_access will be added 
 
87
 * to the set containing @a associated.  @a associated can be @c NULL, in 
 
88
 * which case @a adm_access is the start of a new set.
 
89
 *
 
90
 * @a depth specifies how much to lock.  Zero means just the specified
 
91
 * directory.  Any negative value means to lock the entire working copy
 
92
 * directory hierarchy under @a path.  A positive value indicates the number of
 
93
 * levels of directories to lock -- 1 means just immediate subdirectories, 2
 
94
 * means immediate subdirectories and their subdirectories, etc.  All the
 
95
 * access batons will become part of the set containing @a adm_access.  This
 
96
 * is an all-or-nothing option, if it is not possible to lock all the
 
97
 * requested directories then an error will be returned and @a adm_access will
 
98
 * be invalid, with the exception that subdirectories of @a path that are
 
99
 * missing from the physical filesystem will not be locked and will not cause
 
100
 * an error.  The error @c SVN_ERR_WC_LOCKED will be returned if a
 
101
 * subdirectory of @a path is already write locked.
 
102
 *
 
103
 * If @a cancel_func is non-null, call it with @a cancel_baton to determine
 
104
 * if the client has cancelled the operation.
 
105
 *
 
106
 * @a pool will be used to allocate memory for the baton and any subsequently
 
107
 * cached items.  If @a adm_access has not been closed when the pool is
 
108
 * cleared, it will be closed automatically at that point, and removed from
 
109
 * its set.  A baton closed in this way will not remove physical locks from
 
110
 * the working copy if cleanup is required.
 
111
 *
 
112
 * The first baton in a set, with @a associated passed as @c NULL, must have 
 
113
 * the longest lifetime of all the batons in the set.  This implies it must be
 
114
 * the root of the hierarchy.
 
115
 */
 
116
svn_error_t *svn_wc_adm_open3 (svn_wc_adm_access_t **adm_access,
 
117
                               svn_wc_adm_access_t *associated,
 
118
                               const char *path,
 
119
                               svn_boolean_t write_lock,
 
120
                               int depth,
 
121
                               svn_cancel_func_t cancel_func,
 
122
                               void *cancel_baton,
 
123
                               apr_pool_t *pool);
 
124
 
 
125
/**
 
126
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
127
 *
 
128
 * Similar to @c svn_wc_adm_open3(), but without cancellation support.
 
129
 */
 
130
svn_error_t *svn_wc_adm_open2 (svn_wc_adm_access_t **adm_access,
 
131
                               svn_wc_adm_access_t *associated,
 
132
                               const char *path,
 
133
                               svn_boolean_t write_lock,
 
134
                               int depth,
 
135
                               apr_pool_t *pool);
 
136
 
 
137
/**
 
138
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
139
 *
 
140
 * Similar to @c svn_wc_adm_open2(), but with @a tree_lock instead of
 
141
 * @a depth.  @a depth is set to -1 if @a tree_lock is @c TRUE, else 0.
 
142
 */
 
143
svn_error_t *svn_wc_adm_open (svn_wc_adm_access_t **adm_access,
 
144
                              svn_wc_adm_access_t *associated,
 
145
                              const char *path,
 
146
                              svn_boolean_t write_lock,
 
147
                              svn_boolean_t tree_lock,
 
148
                              apr_pool_t *pool);
 
149
 
 
150
/**
 
151
 * @since New in 1.2.
 
152
 *
 
153
 * Checks the working copy to determine the node type of @a path.  If 
 
154
 * @a path is a versioned directory then the behaviour is like that of
 
155
 * @c svn_wc_adm_open3, otherwise, if @a path is a file or does not
 
156
 * exist, then the behaviour is like that of @c svn_wc_adm_open3 with
 
157
 * @a path replaced by the parent directory of @a path.  If @a path is
 
158
 * an unversioned directory, the behaviour is also like that of
 
159
 * @c svn_wc_adm_open3 on the parent, except that if the open fails,
 
160
 * then the returned SVN_ERR_WC_NOT_DIRECTORY error refers to @a path,
 
161
 * not to @a path's parent.
 
162
 */
 
163
svn_error_t *svn_wc_adm_probe_open3 (svn_wc_adm_access_t **adm_access,
 
164
                                     svn_wc_adm_access_t *associated,
 
165
                                     const char *path,
 
166
                                     svn_boolean_t write_lock,
 
167
                                     int depth,
 
168
                                     svn_cancel_func_t cancel_func,
 
169
                                     void *cancel_baton,
 
170
                                     apr_pool_t *pool);
 
171
 
 
172
/**
 
173
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
174
 *
 
175
 * Similar to svn_wc_adm_probe_open3() without the cancel
 
176
 * functionality.
 
177
 */
 
178
svn_error_t *svn_wc_adm_probe_open2 (svn_wc_adm_access_t **adm_access,
 
179
                                     svn_wc_adm_access_t *associated,
 
180
                                     const char *path,
 
181
                                     svn_boolean_t write_lock,
 
182
                                     int depth,
 
183
                                     apr_pool_t *pool);
 
184
 
 
185
/**
 
186
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
187
 *
 
188
 * Similar to @c svn_wc_adm_probe_open2(), but with @a tree_lock instead of
 
189
 * @a depth.  @a depth is set to -1 if @a tree_lock is @c TRUE, else 0.
 
190
 */
 
191
svn_error_t *svn_wc_adm_probe_open (svn_wc_adm_access_t **adm_access,
 
192
                                    svn_wc_adm_access_t *associated,
 
193
                                    const char *path,
 
194
                                    svn_boolean_t write_lock,
 
195
                                    svn_boolean_t tree_lock,
 
196
                                    apr_pool_t *pool);
 
197
 
 
198
/**
 
199
 * @since New in 1.2.
 
200
 *
 
201
 * Open access batons for @a path and return in @a *anchor_access and
 
202
 * @a *target the anchor and target required to drive an editor.  Return
 
203
 * in @a *target_access the access baton for the target, which may be the
 
204
 * same as @a *anchor_access.  All the access batons will be in the
 
205
 * @a *anchor_access set.
 
206
 *
 
207
 * @a depth determines the depth used when opening @a path if @a path is a
 
208
 * versioned directory, @a depth is ignored otherwise.  If @a write_lock is
 
209
 * @c TRUE the access batons will hold write locks.
 
210
 *
 
211
 * If @a cancel_func is non-null, call it with @a cancel_baton to determine
 
212
 * if the client has cancelled the operation.
 
213
 *
 
214
 * This function is essentially a combination of svn_wc_adm_open3 and
 
215
 * svn_wc_get_actual_target, with the emphasis on reducing physical IO.
 
216
 */
 
217
svn_error_t *
 
218
svn_wc_adm_open_anchor (svn_wc_adm_access_t **anchor_access,
 
219
                        svn_wc_adm_access_t **target_access,
 
220
                        const char **target,
 
221
                        const char *path,
 
222
                        svn_boolean_t write_lock,
 
223
                        int depth,
 
224
                        svn_cancel_func_t cancel_func,
 
225
                        void *cancel_baton,
 
226
                        apr_pool_t *pool);
 
227
 
 
228
/** Return, in @a *adm_access, a pointer to an existing access baton associated
 
229
 * with @a path.  @a path must be a directory that is locked as part of the 
 
230
 * set containing the @a associated access baton.
 
231
 *
 
232
 * If the requested access baton is marked as missing in, or is simply
 
233
 * absent from, @a associated, return SVN_ERR_WC_NOT_LOCKED.
 
234
 *
 
235
 * @a pool is used only for local processing, it is not used for the batons.
 
236
 */
 
237
svn_error_t *svn_wc_adm_retrieve (svn_wc_adm_access_t **adm_access,
 
238
                                  svn_wc_adm_access_t *associated,
 
239
                                  const char *path,
 
240
                                  apr_pool_t *pool);
 
241
 
 
242
/** Checks the working copy to determine the node type of @a path.  If 
 
243
 * @a path is a versioned directory then the behaviour is like that of
 
244
 * @c svn_wc_adm_retrieve, otherwise, if @a path is a file, an unversioned
 
245
 * directory, or does not exist, then the behaviour is like that of
 
246
 * @c svn_wc_adm_retrieve with @a path replaced by the parent directory of
 
247
 * @a path.
 
248
 */
 
249
svn_error_t *svn_wc_adm_probe_retrieve (svn_wc_adm_access_t **adm_access,
 
250
                                        svn_wc_adm_access_t *associated,
 
251
                                        const char *path,
 
252
                                        apr_pool_t *pool);
 
253
 
 
254
/**
 
255
 * @since New in 1.2.
 
256
 *
 
257
 * Try various ways to obtain an access baton for @a path.
 
258
 *
 
259
 * First, try to obtain @a *adm_access via @c svn_wc_adm_probe_retrieve(),
 
260
 * but if this fails because @a associated can't give a baton for
 
261
 * @a path or @a path's parent, then try @c svn_wc_adm_probe_open3(),
 
262
 * this time passing @a write_lock and @a depth.  If there is
 
263
 * still no access because @a path is not a versioned directory, then
 
264
 * just set @a *adm_access to null and return success.  But if it is
 
265
 * because @a path is locked, then return the error @c SVN_ERR_WC_LOCKED,
 
266
 * and the effect on @a *adm_access is undefined.  (Or if the attempt
 
267
 * fails for any other reason, return the corresponding error, and the
 
268
 * effect on @a *adm_access is also undefined.)
 
269
 *
 
270
 * If @c svn_wc_adm_probe_open3() succeeds, then add @a *adm_access to
 
271
 * @a associated.
 
272
 *
 
273
 * If @a cancel_func is non-null, call it with @a cancel_baton to determine
 
274
 * if the client has cancelled the operation.
 
275
 *
 
276
 * Use @a pool only for local processing, not to allocate @a *adm_access.
 
277
 */
 
278
svn_error_t *svn_wc_adm_probe_try3 (svn_wc_adm_access_t **adm_access,
 
279
                                    svn_wc_adm_access_t *associated,
 
280
                                    const char *path,
 
281
                                    svn_boolean_t write_lock,
 
282
                                    int depth,
 
283
                                    svn_cancel_func_t cancel_func,
 
284
                                    void *cancel_baton,
 
285
                                    apr_pool_t *pool);
 
286
 
 
287
/**
 
288
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
289
 *
 
290
 * Similar to svn_wc_adm_probe_try3() without the cancel
 
291
 * functionality.
 
292
 */
 
293
svn_error_t *svn_wc_adm_probe_try2 (svn_wc_adm_access_t **adm_access,
 
294
                                    svn_wc_adm_access_t *associated,
 
295
                                    const char *path,
 
296
                                    svn_boolean_t write_lock,
 
297
                                    int depth,
 
298
                                    apr_pool_t *pool);
 
299
 
 
300
/**
 
301
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
302
 *
 
303
 * Similar to @c svn_wc_adm_probe_try2(), but with @a tree_lock instead of
 
304
 * @a depth.  @a depth is set to -1 if @a tree_lock is @c TRUE, else 0.
 
305
 */
 
306
svn_error_t *svn_wc_adm_probe_try (svn_wc_adm_access_t **adm_access,
 
307
                                   svn_wc_adm_access_t *associated,
 
308
                                   const char *path,
 
309
                                   svn_boolean_t write_lock,
 
310
                                   svn_boolean_t tree_lock,
 
311
                                   apr_pool_t *pool);
 
312
 
 
313
 
 
314
/** Give up the access baton @a adm_access, and its lock if any. This will
 
315
 * recursively close any batons in the same set that are direct
 
316
 * subdirectories of @a adm_access.  Any physical locks will be removed from
 
317
 * the working copy.  Lock removal is unconditional, there is no check to
 
318
 * determine if cleanup is required.
 
319
 */
 
320
svn_error_t *svn_wc_adm_close (svn_wc_adm_access_t *adm_access);
 
321
 
 
322
/** Return the path used to open the access baton @a adm_access */
 
323
const char *svn_wc_adm_access_path (svn_wc_adm_access_t *adm_access);
 
324
 
 
325
/** Return the pool used by access baton @a adm_access */
 
326
apr_pool_t *svn_wc_adm_access_pool (svn_wc_adm_access_t *adm_access);
 
327
 
 
328
/** Return @c TRUE is the access baton @a adm_access has a write lock,
 
329
 * @c FALSE otherwise. Compared to @c svn_wc_locked this is a cheap, fast
 
330
 * function that doesn't access the filesystem.
 
331
 */
 
332
svn_boolean_t svn_wc_adm_locked(svn_wc_adm_access_t *adm_access);
 
333
 
 
334
/** Set @a *locked to non-zero if @a path is locked, else set it to zero. */
 
335
svn_error_t *svn_wc_locked (svn_boolean_t *locked, 
 
336
                            const char *path,
 
337
                            apr_pool_t *pool);
 
338
 
 
339
 
 
340
 
 
341
/** Traversal information is information gathered by a working copy
 
342
 * crawl or update.  For example, the before and after values of the
 
343
 * svn:externals property are important after an update, and since
 
344
 * we're traversing the working tree anyway (a complete traversal
 
345
 * during the initial crawl, and a traversal of changed paths during
 
346
 * the checkout/update/switch), it makes sense to gather the
 
347
 * property's values then instead of making a second pass.
 
348
 */
 
349
typedef struct svn_wc_traversal_info_t svn_wc_traversal_info_t;
 
350
 
 
351
 
 
352
/** Return a new, empty traversal info object, allocated in @a pool. */
 
353
svn_wc_traversal_info_t *svn_wc_init_traversal_info (apr_pool_t *pool);
 
354
 
 
355
 
 
356
/** Set @a *externals_old and @a *externals_new to hash tables representing
 
357
 * changes to values of the svn:externals property on directories
 
358
 * traversed by @a traversal_info.
 
359
 *
 
360
 * @a traversal_info is obtained from @c svn_wc_init_traversal_info, but is
 
361
 * only useful after it has been passed through another function, such
 
362
 * as @c svn_wc_crawl_revisions, @c svn_wc_get_update_editor,
 
363
 * @c svn_wc_get_checkout_editor, @c svn_wc_get_switch_editor, etc.
 
364
 *
 
365
 * Each hash maps <tt>const char *</tt> directory names onto 
 
366
 * <tt>const char *</tt> values of the externals property for that directory.  
 
367
 * The dir names are full paths -- that is, anchor plus target, not target 
 
368
 * alone. The values are not parsed, they are simply copied raw, and are
 
369
 * never null: directories that acquired or lost the property are
 
370
 * simply omitted from the appropriate table.  Directories whose value
 
371
 * of the property did not change show the same value in each hash.
 
372
 *
 
373
 * The hashes, keys, and values have the same lifetime as @a traversal_info.
 
374
 */
 
375
void svn_wc_edited_externals (apr_hash_t **externals_old,
 
376
                              apr_hash_t **externals_new,
 
377
                              svn_wc_traversal_info_t *traversal_info);
 
378
 
 
379
 
 
380
/** One external item.  This usually represents one line from an
 
381
 * svn:externals description but with the path and URL
 
382
 * canonicalized.
 
383
 */
 
384
typedef struct svn_wc_external_item_t
 
385
{
 
386
  /** The name of the subdirectory into which this external should be
 
387
      checked out.  This is relative to the parent directory that
 
388
      holds this external item.  (Note that these structs are often
 
389
      stored in hash tables with the target dirs as keys, so this
 
390
      field will often be redundant.) */
 
391
  const char *target_dir;
 
392
 
 
393
  /** Where to check out from. */
 
394
  const char *url;
 
395
 
 
396
  /** What revision to check out.  The only valid kinds for this are
 
397
      svn_opt_revision_number, svn_opt_revision_date, and
 
398
      svn_opt_revision_head. */
 
399
  svn_opt_revision_t revision;
 
400
 
 
401
} svn_wc_external_item_t;
 
402
 
 
403
 
 
404
/**
 
405
 * @since New in 1.1.
 
406
 *
 
407
 * If @a externals_p is non-null, set @a *externals_p to an array of
 
408
 * @a svn_wc_external_item_t * objects based on @a desc.
 
409
 *
 
410
 * If the format of @a desc is invalid, don't touch @a *externals_p and
 
411
 * return @c SVN_ERR_CLIENT_INVALID_EXTERNALS_DESCRIPTION.  Thus, if
 
412
 * you just want to check the validity of an externals description,
 
413
 * and don't care about the parsed result, pass null for @a externals_p.
 
414
 *
 
415
 * The format of @a desc is the same as for values of the directory
 
416
 * property @c SVN_PROP_EXTERNALS, which see.
 
417
 *
 
418
 * Allocate the table, keys, and values in @a pool.
 
419
 *
 
420
 * Use @a parent_directory only in constructing error strings.
 
421
 */
 
422
svn_error_t *
 
423
svn_wc_parse_externals_description2 (apr_array_header_t **externals_p,
 
424
                                     const char *parent_directory,
 
425
                                     const char *desc,
 
426
                                     apr_pool_t *pool);
 
427
 
 
428
 
 
429
/**
 
430
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
431
 *
 
432
 * Similar to svn_wc_parse_externals_description2, but returns the
 
433
 * parsed externals in a hash instead of an array.  This function
 
434
 * should not be used, as storing the externals in a hash causes their
 
435
 * order of evaluation to be not easily identifiable.
 
436
 */
 
437
svn_error_t *
 
438
svn_wc_parse_externals_description (apr_hash_t **externals_p,
 
439
                                    const char *parent_directory,
 
440
                                    const char *desc,
 
441
                                    apr_pool_t *pool);
 
442
 
 
443
 
 
444
 
 
445
/* Notification/callback handling. */
 
446
 
 
447
/**
 
448
 * @defgroup svn_wc_notifications notification callback handling
 
449
 * @{
 
450
 *
 
451
 * In many cases, the WC library will scan a working copy and make
 
452
 * changes. The caller usually wants to know when each of these changes
 
453
 * has been made, so that it can display some kind of notification to
 
454
 * the user.
 
455
 *
 
456
 * These notifications have a standard callback function type, which
 
457
 * takes the path of the file that was affected, and a caller-
 
458
 * supplied baton.
 
459
 *
 
460
 * Note that the callback is a 'void' return -- this is a simple
 
461
 * reporting mechanism, rather than an opportunity for the caller to
 
462
 * alter the operation of the WC library.
 
463
 *
 
464
 * Note also that some of the actions are used across several
 
465
 * different Subversion commands.  For example, the update actions are
 
466
 * also used for checkouts, switches, and merges.
 
467
 */
 
468
 
 
469
/** The type of action occurring. */
 
470
typedef enum svn_wc_notify_action_t
 
471
{
 
472
  /** Adding a path to revision control. */
 
473
  svn_wc_notify_add = 0,
 
474
 
 
475
  /** Copying a versioned path. */
 
476
  svn_wc_notify_copy,
 
477
  
 
478
  /** Deleting a versioned path. */
 
479
  svn_wc_notify_delete,
 
480
 
 
481
  /** Restoring a missing path from the pristine text-base. */
 
482
  svn_wc_notify_restore,
 
483
  
 
484
  /** Reverting a modified path. */
 
485
  svn_wc_notify_revert,
 
486
 
 
487
  /** A revert operation has failed. */
 
488
  svn_wc_notify_failed_revert,
 
489
 
 
490
  /** Resolving a conflict. */
 
491
  svn_wc_notify_resolved,
 
492
 
 
493
  /** Skipping a path. */
 
494
  svn_wc_notify_skip,
 
495
 
 
496
  /** Got a delete in an update. */
 
497
  svn_wc_notify_update_delete,
 
498
 
 
499
  /** Got an add in an update. */
 
500
  svn_wc_notify_update_add,
 
501
 
 
502
  /** Got any other action in an update. */
 
503
  svn_wc_notify_update_update,
 
504
 
 
505
  /** The last notification in an update (including updates of externals). */
 
506
  svn_wc_notify_update_completed,
 
507
 
 
508
  /** Updating an external module. */
 
509
  svn_wc_notify_update_external,
 
510
 
 
511
  /** The last notification in a status (including status on externals). */
 
512
  svn_wc_notify_status_completed,
 
513
 
 
514
  /** Running status on an external module. */
 
515
  svn_wc_notify_status_external,
 
516
 
 
517
  /** Committing a modification. */
 
518
  svn_wc_notify_commit_modified,
 
519
  
 
520
  /** Committing an addition. */
 
521
  svn_wc_notify_commit_added,
 
522
 
 
523
  /** Committing a deletion. */
 
524
  svn_wc_notify_commit_deleted,
 
525
 
 
526
  /** Committing a replacement. */
 
527
  svn_wc_notify_commit_replaced,
 
528
 
 
529
  /** Transmitting post-fix text-delta data for a file. */
 
530
  svn_wc_notify_commit_postfix_txdelta,
 
531
 
 
532
  /** Processed a single revision's blame. */
 
533
  svn_wc_notify_blame_revision,
 
534
 
 
535
  /** @since New in 1.2.  Locking a path. */
 
536
  svn_wc_notify_locked,
 
537
 
 
538
  /** @since New in 1.2.  Unlocking a path. */
 
539
  svn_wc_notify_unlocked,
 
540
 
 
541
  /** @since New in 1.2.  Failed to lock a path. */
 
542
  svn_wc_notify_failed_lock,
 
543
 
 
544
  /** @since New in 1.2.  Failed to unlock a path. */
 
545
  svn_wc_notify_failed_unlock
 
546
} svn_wc_notify_action_t;
 
547
 
 
548
 
 
549
/** The type of notification that is occurring. */
 
550
typedef enum svn_wc_notify_state_t
 
551
{
 
552
  svn_wc_notify_state_inapplicable = 0,
 
553
 
 
554
  /** Notifier doesn't know or isn't saying. */
 
555
  svn_wc_notify_state_unknown,
 
556
 
 
557
  /** The state did not change. */
 
558
  svn_wc_notify_state_unchanged,
 
559
 
 
560
  /** The item wasn't present. */
 
561
  svn_wc_notify_state_missing,
 
562
 
 
563
  /** An unversioned item obstructed work. */
 
564
  svn_wc_notify_state_obstructed,
 
565
 
 
566
  /** Pristine state was modified. */
 
567
  svn_wc_notify_state_changed,
 
568
 
 
569
  /** Modified state had mods merged in. */
 
570
  svn_wc_notify_state_merged,
 
571
 
 
572
  /** Modified state got conflicting mods. */
 
573
  svn_wc_notify_state_conflicted
 
574
 
 
575
} svn_wc_notify_state_t;
 
576
 
 
577
/** @since New in 1.2.
 
578
 *
 
579
 * What happened to a lock during an operation.
 
580
 *
 
581
 */
 
582
typedef enum svn_wc_notify_lock_state_t {
 
583
  svn_wc_notify_lock_state_inapplicable = 0,
 
584
  svn_wc_notify_lock_state_unknown,
 
585
  /** The lock wasn't changed. */
 
586
  svn_wc_notify_lock_state_unchanged,
 
587
  /** The item was locked. */
 
588
  svn_wc_notify_lock_state_locked,
 
589
  /** The item was unlocked. */
 
590
  svn_wc_notify_lock_state_unlocked
 
591
} svn_wc_notify_lock_state_t;
 
592
 
 
593
/** @since New in 1.2.
 
594
 *
 
595
 * Structure used in the @c svn_wc_notify_func2_t function.
 
596
 *
 
597
 * @c path is either absolute or relative to the current working directory
 
598
 * (i.e., not relative to an anchor).  @c action describes what happened
 
599
 * to @c path.
 
600
 *
 
601
 * @c kind, @c content_state, @c prop_state and @c lock_state are from
 
602
 * after @c action, not before.  @c lock_state reflects the addition
 
603
 * or removal of a lock token in the working copy.
 
604
 *
 
605
 * If @c mime_type is non-null, it indicates the mime-type of @c path.
 
606
 * It is always @c NULL for directories.
 
607
 *
 
608
 * If @c action is @c svn_wc_notify_update_completed, @c revision is the
 
609
 * target revision of the update, or @c SVN_INVALID_REVNUM if not
 
610
 * available.  If @c action is @c svn_wc_notify_blame_revision, @c
 
611
 * revision is the processed revision.  In all other cases, @c
 
612
 * revision is @c SVN_INVALID_REVNUM.
 
613
 *
 
614
 * For an @c action of svn_wc_notify_locked, @c lock is the lock
 
615
 * structure received from the repository.  For other actions, it is
 
616
 * @c NULL.
 
617
 *
 
618
 * @c err is @c NULL, except when @c action is @c
 
619
 * svn_wc_notify_failed_lock or @c svn_wc_notify_failed_unlock, in
 
620
 * which case it points to an error describing the reason for the failure.
 
621
 *
 
622
 * Note that if @c action is @c svn_wc_notify_update, then @c path has 
 
623
 * already been installed, so it is legitimate for an implementation of
 
624
 * @c svn_wc_notify_func2_t to examine @c path in the working copy.
 
625
 *
 
626
 * @note The purpose of the @c kind, @c mime_type, @c content_state, and
 
627
 * @c prop_state fields is to provide "for free" information that an
 
628
 * implementation is likely to want, and which it would otherwise be
 
629
 * forced to deduce via expensive operations such as reading entries
 
630
 * and properties.  However, if the caller does not have this
 
631
 * information, it will simply pass the corresponding `*_unknown'
 
632
 * values, and it is up to the implementation how to handle that
 
633
 * (i.e., whether to attempt deduction, or just to punt and
 
634
 * give a less informative notification).
 
635
 *
 
636
 * @note Callers of notification functions should use @c svn_wc_create_notify
 
637
 * to create structures of this type to allow for extensibility. */
 
638
typedef struct svn_wc_notify_t {
 
639
  const char *path;
 
640
  svn_wc_notify_action_t action;
 
641
  svn_node_kind_t kind;
 
642
  const char *mime_type;
 
643
  const svn_lock_t *lock;
 
644
  svn_error_t *err;
 
645
  svn_wc_notify_state_t content_state;
 
646
  svn_wc_notify_state_t prop_state;
 
647
  svn_wc_notify_lock_state_t lock_state;
 
648
  svn_revnum_t revision;
 
649
  /* NOTE: Add new fields at the end to preserve binary compatibility.
 
650
     Also, if you add fields here, you have to update svn_wc_create_notify
 
651
     and svn_wc_dup_notify. */
 
652
} svn_wc_notify_t;
 
653
 
 
654
/** @since New in 1.2.
 
655
 *
 
656
 * Allocate an @c svn_wc_notify_t structure in @a pool, initialize and return
 
657
 * it.
 
658
 *
 
659
 * Set the @c path field of the created struct to @a path, and @c action to
 
660
 * @a action.  Set all other fields to their @c _unknown, @c NULL or
 
661
 * invalid value, respectively.
 
662
 */
 
663
svn_wc_notify_t *
 
664
svn_wc_create_notify (const char *path, svn_wc_notify_action_t action,
 
665
                      apr_pool_t *pool);
 
666
 
 
667
/** @since New in 1.2.
 
668
 *
 
669
 * Return a deep copy of @a notify, allocated in @a pool.
 
670
 */
 
671
svn_wc_notify_t *
 
672
svn_wc_dup_notify (const svn_wc_notify_t *notify, apr_pool_t *pool);
 
673
 
 
674
/** @since New in 1.2.
 
675
 *
 
676
 * Notify the world that @a notify->action has happened to @a notify->path.
 
677
 *
 
678
 * Recommendation: callers of @c svn_wc_notify_func2_t should avoid
 
679
 * invoking it multiple times on the same path within a given
 
680
 * operation, and implementations should not bother checking for such
 
681
 * duplicate calls.  For example, in an update, the caller should not
 
682
 * invoke the notify func on receiving a prop change and then again
 
683
 * on receiving a text change.  Instead, wait until all changes have
 
684
 * been received, and then invoke the notify func once (from within
 
685
 * an @c svn_delta_editor_t's @c close_file(), for example), passing 
 
686
 * the appropriate @a notify->content_state and @a notify->prop_state flags.
 
687
 */
 
688
typedef void (*svn_wc_notify_func2_t) (void *baton,
 
689
                                       const svn_wc_notify_t *notify,
 
690
                                       apr_pool_t *pool);
 
691
 
 
692
/** @deprecated Provided for backward compatibility with the 1.1 API.
 
693
 *
 
694
 * Similar to @c svn_wc_notify_func2_t, but takes the information as arguments
 
695
 * instead of struct fields. */
 
696
typedef void (*svn_wc_notify_func_t) (void *baton,
 
697
                                      const char *path,
 
698
                                      svn_wc_notify_action_t action,
 
699
                                      svn_node_kind_t kind,
 
700
                                      const char *mime_type,
 
701
                                      svn_wc_notify_state_t content_state,
 
702
                                      svn_wc_notify_state_t prop_state,
 
703
                                      svn_revnum_t revision);
 
704
 
 
705
/** @} */
 
706
 
 
707
 
 
708
 
 
709
/**
 
710
 * @since New in 1.2.
 
711
 *
 
712
 * A callback vtable invoked by our diff-editors, as they receive
 
713
 * diffs from the server.  'svn diff' and 'svn merge' both implement
 
714
 * their own versions of this table.
 
715
 */
 
716
typedef struct svn_wc_diff_callbacks2_t
 
717
{
 
718
  /** A file @a path has changed.  If tmpfile2 is non-null, the
 
719
   * contents have changed and those changes can be seen by comparing
 
720
   * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2 of 
 
721
   * the file, respectively.
 
722
   *
 
723
   * If known, the @c svn:mime-type value of each file is passed into
 
724
   * @a mimetype1 and @a mimetype2;  either or both of the values can
 
725
   * be NULL.  The implementor can use this information to decide if
 
726
   * (or how) to generate differences.
 
727
   *
 
728
   * @a propchanges is an array of (@c svn_prop_t) structures. If it has
 
729
   * any elements, the original list of properties is provided in
 
730
   * @a originalprops, which is a hash of @c svn_string_t values, keyed on the
 
731
   * property name.
 
732
   * 
 
733
   * @a adm_access will be an access baton for the directory containing 
 
734
   * @a path, or @c NULL if the diff editor is not using access batons.
 
735
   *
 
736
   * If @a contentstate is non-null, set @a *contentstate to the state of
 
737
   * the file contents after the operation has been performed.  The same
 
738
   * applies for @a propstate regarding the property changes.  (In
 
739
   * practice, this is only useful with merge, not diff; diff callbacks
 
740
   * will probably set @a *contentstate and @a *propstate to
 
741
   * @c svn_wc_notify_state_unknown, since they do not change the state and
 
742
   * therefore do not bother to know the state after the operation.)
 
743
   */
 
744
  svn_error_t *(*file_changed) (svn_wc_adm_access_t *adm_access,
 
745
                                svn_wc_notify_state_t *contentstate,
 
746
                                svn_wc_notify_state_t *propstate,
 
747
                                const char *path,
 
748
                                const char *tmpfile1,
 
749
                                const char *tmpfile2,
 
750
                                svn_revnum_t rev1,
 
751
                                svn_revnum_t rev2,
 
752
                                const char *mimetype1,
 
753
                                const char *mimetype2,
 
754
                                const apr_array_header_t *propchanges,
 
755
                                apr_hash_t *originalprops,
 
756
                                void *diff_baton);
 
757
 
 
758
  /** A file @a path was added.  The contents can be seen by comparing
 
759
   * @a tmpfile1 and @a tmpfile2, which represent @a rev1 and @a rev2
 
760
   * of the file, respectively.  (If either file is empty, the rev
 
761
   * will be 0.)
 
762
   *
 
763
   * If known, the @c svn:mime-type value of each file is passed into
 
764
   * @a mimetype1 and @a mimetype2;  either or both of the values can
 
765
   * be NULL.  The implementor can use this information to decide if
 
766
   * (or how) to generate differences.
 
767
   *
 
768
   * @a propchanges is an array of (@c svn_prop_t) structures.  If it contains
 
769
   * any elements, the original list of properties is provided in
 
770
   * @a originalprops, which is a hash of @c svn_string_t values, keyed on the
 
771
   * property name.
 
772
   * 
 
773
   * @a adm_access will be an access baton for the directory containing 
 
774
   * @a path, or @c NULL if the diff editor is not using access batons.
 
775
   *
 
776
   * If @a contentstate is non-null, set @a *contentstate to the state of the
 
777
   * file contents after the operation has been performed.  The same
 
778
   * applies for @a propstate regarding the property changes.  (In practice,
 
779
   * this is only useful with merge, not diff; diff callbacks will
 
780
   * probably set @a *contentstate and *propstate to
 
781
   * @c svn_wc_notify_state_unknown, since they do not change the state
 
782
   * and therefore do not bother to know the state after the operation.)
 
783
   *
 
784
   */
 
785
  svn_error_t *(*file_added) (svn_wc_adm_access_t *adm_access,
 
786
                              svn_wc_notify_state_t *contentstate,
 
787
                              svn_wc_notify_state_t *propstate,
 
788
                              const char *path,
 
789
                              const char *tmpfile1,
 
790
                              const char *tmpfile2,
 
791
                              svn_revnum_t rev1,
 
792
                              svn_revnum_t rev2,
 
793
                              const char *mimetype1,
 
794
                              const char *mimetype2,
 
795
                              const apr_array_header_t *propchanges,
 
796
                              apr_hash_t *originalprops,
 
797
                              void *diff_baton);
 
798
  
 
799
  /** A file @a path was deleted.  The [loss of] contents can be seen by
 
800
   * comparing @a tmpfile1 and @a tmpfile2.  @a originalprops provides
 
801
   * the properties of the file.
 
802
   *
 
803
   * If known, the @c svn:mime-type value of each file is passed into
 
804
   * @a mimetype1 and @a mimetype2;  either or both of the values can
 
805
   * be NULL.  The implementor can use this information to decide if
 
806
   * (or how) to generate differences.
 
807
   *
 
808
   * @a adm_access will be an access baton for the directory containing 
 
809
   * @a path, or @c NULL if the diff editor is not using access batons.
 
810
   *
 
811
   * If @a state is non-null, set @a *state to the state of the item
 
812
   * after the delete operation has been performed.  (In practice,
 
813
   * this is only useful with merge, not diff; diff callbacks will
 
814
   * probably set @a *state to @c svn_wc_notify_state_unknown, since 
 
815
   * they do not change the state and therefore do not bother to know 
 
816
   * the state after the operation.)
 
817
   */
 
818
  svn_error_t *(*file_deleted) (svn_wc_adm_access_t *adm_access,
 
819
                                svn_wc_notify_state_t *state,
 
820
                                const char *path,
 
821
                                const char *tmpfile1,
 
822
                                const char *tmpfile2,
 
823
                                const char *mimetype1,
 
824
                                const char *mimetype2,
 
825
                                apr_hash_t *originalprops,
 
826
                                void *diff_baton);
 
827
  
 
828
  /** A directory @a path was added.  @a rev is the revision that the
 
829
   * directory came from.
 
830
   *
 
831
   * @a adm_access will be an access baton for the directory containing 
 
832
   * @a path, or @c NULL if the diff editor is not using access batons.
 
833
   */
 
834
  svn_error_t *(*dir_added) (svn_wc_adm_access_t *adm_access,
 
835
                             svn_wc_notify_state_t *state,
 
836
                             const char *path,
 
837
                             svn_revnum_t rev,
 
838
                             void *diff_baton);
 
839
  
 
840
  /** A directory @a path was deleted.
 
841
   *
 
842
   * @a adm_access will be an access baton for the directory containing 
 
843
   * @a path, or @c NULL if the diff editor is not using access batons.
 
844
   *
 
845
   * If @a state is non-null, set @a *state to the state of the item
 
846
   * after the delete operation has been performed.  (In practice,
 
847
   * this is only useful with merge, not diff; diff callbacks will
 
848
   * probably set @a *state to @c svn_wc_notify_state_unknown, since 
 
849
   * they do not change the state and therefore do not bother to know 
 
850
   * the state after the operation.)
 
851
   */
 
852
  svn_error_t *(*dir_deleted) (svn_wc_adm_access_t *adm_access,
 
853
                               svn_wc_notify_state_t *state,
 
854
                               const char *path,
 
855
                               void *diff_baton);
 
856
  
 
857
  /** A list of property changes (@a propchanges) was applied to the
 
858
   * directory @a path.
 
859
   *
 
860
   * The array is a list of (@c svn_prop_t) structures. 
 
861
   *
 
862
   * The original list of properties is provided in @a original_props,
 
863
   * which is a hash of @c svn_string_t values, keyed on the property
 
864
   * name.
 
865
   *
 
866
   * @a adm_access will be an access baton for the directory containing 
 
867
   * @a path, or @c NULL if the diff editor is not using access batons.
 
868
   *
 
869
   * If @a state is non-null, set @a *state to the state of the properties
 
870
   * after the operation has been performed.  (In practice, this is only 
 
871
   * useful with merge, not diff; diff callbacks will probably set @a *state 
 
872
   * to @c svn_wc_notify_state_unknown, since they do not change the state 
 
873
   * and therefore do not bother to know the state after the operation.)
 
874
   */
 
875
  svn_error_t *(*dir_props_changed) (svn_wc_adm_access_t *adm_access,
 
876
                                     svn_wc_notify_state_t *state,
 
877
                                     const char *path,
 
878
                                     const apr_array_header_t *propchanges,
 
879
                                     apr_hash_t *original_props,
 
880
                                     void *diff_baton);
 
881
 
 
882
} svn_wc_diff_callbacks2_t;
 
883
 
 
884
/**
 
885
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
886
 *
 
887
 * Similar to @c svn_wc_callbakcs2_t, but with file additions/content
 
888
 * changes and property changes split into different functions.
 
889
 */
 
890
typedef struct svn_wc_diff_callbacks_t
 
891
{
 
892
  /** Similar to @c file_changed in @c svn_wc_diff_callbacks2_t, but without
 
893
   * property change information.  @a tmpfile2 is never NULL. @a state applies
 
894
   * to the file contents. */
 
895
  svn_error_t *(*file_changed) (svn_wc_adm_access_t *adm_access,
 
896
                                svn_wc_notify_state_t *state,
 
897
                                const char *path,
 
898
                                const char *tmpfile1,
 
899
                                const char *tmpfile2,
 
900
                                svn_revnum_t rev1,
 
901
                                svn_revnum_t rev2,
 
902
                                const char *mimetype1,
 
903
                                const char *mimetype2,
 
904
                                void *diff_baton);
 
905
 
 
906
  /** Similar to @c file_added in @c svn_wc_diff_callbacks2_t, but without
 
907
   * property change information.  @a *state applies to the file contents. */
 
908
  svn_error_t *(*file_added) (svn_wc_adm_access_t *adm_access,
 
909
                              svn_wc_notify_state_t *state,
 
910
                              const char *path,
 
911
                              const char *tmpfile1,
 
912
                              const char *tmpfile2,
 
913
                              svn_revnum_t rev1,
 
914
                              svn_revnum_t rev2,
 
915
                              const char *mimetype1,
 
916
                              const char *mimetype2,
 
917
                              void *diff_baton);
 
918
  
 
919
  /** Similar to @c file_deleted in @c svn_wc_diff_callbacks2_t, but without
 
920
   * the properties. */
 
921
  svn_error_t *(*file_deleted) (svn_wc_adm_access_t *adm_access,
 
922
                                svn_wc_notify_state_t *state,
 
923
                                const char *path,
 
924
                                const char *tmpfile1,
 
925
                                const char *tmpfile2,
 
926
                                const char *mimetype1,
 
927
                                const char *mimetype2,
 
928
                                void *diff_baton);
 
929
  
 
930
  /** The same as @c dir_added in @c svn_wc_diff_callbacks2_t. */
 
931
  svn_error_t *(*dir_added) (svn_wc_adm_access_t *adm_access,
 
932
                             svn_wc_notify_state_t *state,
 
933
                             const char *path,
 
934
                             svn_revnum_t rev,
 
935
                             void *diff_baton);
 
936
  
 
937
  /** The same as @c dir_deleted in @c svn_diff_callbacks2_t. */
 
938
  svn_error_t *(*dir_deleted) (svn_wc_adm_access_t *adm_access,
 
939
                               svn_wc_notify_state_t *state,
 
940
                               const char *path,
 
941
                               void *diff_baton);
 
942
  
 
943
  /** Similar to @c dir_props_changed in @c svn_diff_callbacks2_t, but this
 
944
   * function is called for files as well as directories. */
 
945
  svn_error_t *(*props_changed) (svn_wc_adm_access_t *adm_access,
 
946
                                 svn_wc_notify_state_t *state,
 
947
                                 const char *path,
 
948
                                 const apr_array_header_t *propchanges,
 
949
                                 apr_hash_t *original_props,
 
950
                                 void *diff_baton);
 
951
 
 
952
} svn_wc_diff_callbacks_t;
 
953
 
 
954
 
 
955
/* Asking questions about a working copy. */
 
956
 
 
957
/** Set @a *wc_format to @a path's working copy format version number if 
 
958
 * @a path is a valid working copy directory, else set it to 0.  
 
959
 * Return error @c APR_ENOENT if @a path does not exist at all.
 
960
 */
 
961
svn_error_t *svn_wc_check_wc (const char *path,
 
962
                              int *wc_format,
 
963
                              apr_pool_t *pool);
 
964
 
 
965
 
 
966
/** Set @a *has_binary_prop to @c TRUE iff @a path has been marked 
 
967
 * with a property indicating that it is non-text (in other words, binary).
 
968
 * @a adm_access is an access baton set that contains @a path.
 
969
 */
 
970
svn_error_t *svn_wc_has_binary_prop (svn_boolean_t *has_binary_prop,
 
971
                                     const char *path,
 
972
                                     svn_wc_adm_access_t *adm_access,
 
973
                                     apr_pool_t *pool);
 
974
 
 
975
 
 
976
/* Detecting modification. */
 
977
 
 
978
/** Set @a *modified_p to non-zero if @a filename's text is modified
 
979
 * with regard to the base revision, else set @a *modified_p to zero.
 
980
 * @a filename is a path to the file, not just a basename. @a adm_access
 
981
 * must be an access baton for @a filename.
 
982
 *
 
983
 * If @a force_comparison is @c TRUE, this function will not allow
 
984
 * early return mechanisms that avoid actual content comparison.
 
985
 * Instead, if there is a text base, a full byte-by-byte comparison
 
986
 * will be done, and the entry checksum verified as well.  (This means
 
987
 * that if the text base is much longer than the working file, every
 
988
 * byte of the text base will still be examined.)
 
989
 *
 
990
 * If @a filename does not exist, consider it unmodified.  If it exists
 
991
 * but is not under revision control (not even scheduled for
 
992
 * addition), return the error @c SVN_ERR_ENTRY_NOT_FOUND.  */
 
993
svn_error_t *svn_wc_text_modified_p (svn_boolean_t *modified_p,
 
994
                                     const char *filename,
 
995
                                     svn_boolean_t force_comparison,
 
996
                                     svn_wc_adm_access_t *adm_access,
 
997
                                     apr_pool_t *pool);
 
998
 
 
999
 
 
1000
/** Set @a *modified_p to non-zero if @a path's properties are modified
 
1001
 * with regard to the base revision, else set @a modified_p to zero. 
 
1002
 * @a adm_access must be an access baton for @a path.
 
1003
 */
 
1004
svn_error_t *svn_wc_props_modified_p (svn_boolean_t *modified_p,
 
1005
                                      const char *path,
 
1006
                                      svn_wc_adm_access_t *adm_access,
 
1007
                                      apr_pool_t *pool);
 
1008
 
 
1009
 
 
1010
 
 
1011
 
 
1012
/** Administrative subdir.
 
1013
 *
 
1014
 * Ideally, this would be completely private to wc internals (in fact,
 
1015
 * it used to be that @c adm_subdir() in adm_files.c was the only function
 
1016
 * who knew the adm subdir's name).  However, import wants to protect
 
1017
 * against importing administrative subdirs, so now the name is a
 
1018
 * matter of public record.
 
1019
 */
 
1020
#define SVN_WC_ADM_DIR_NAME   ".svn"
 
1021
 
 
1022
 
 
1023
 
 
1024
/* Entries and status. */
 
1025
 
 
1026
/** The schedule states an entry can be in. */
 
1027
typedef enum svn_wc_schedule_t
 
1028
{
 
1029
  /** Nothing special here */
 
1030
  svn_wc_schedule_normal,
 
1031
 
 
1032
  /** Slated for addition */
 
1033
  svn_wc_schedule_add,
 
1034
 
 
1035
  /** Slated for deletion */
 
1036
  svn_wc_schedule_delete,
 
1037
 
 
1038
  /** Slated for replacement (delete + add) */
 
1039
  svn_wc_schedule_replace
 
1040
 
 
1041
} svn_wc_schedule_t;
 
1042
 
 
1043
 
 
1044
/** A working copy entry -- that is, revision control information about
 
1045
 * one versioned entity.
 
1046
 */
 
1047
typedef struct svn_wc_entry_t
 
1048
{
 
1049
  /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see
 
1050
     if you need to extend that as well. */
 
1051
 
 
1052
  /* General Attributes */
 
1053
 
 
1054
  /** entry's name */
 
1055
  const char *name;
 
1056
 
 
1057
  /** base revision */
 
1058
  svn_revnum_t revision;
 
1059
 
 
1060
  /** url in repository */
 
1061
  const char *url;
 
1062
 
 
1063
  /** canonical repository URL */
 
1064
  const char *repos;
 
1065
 
 
1066
  /** repository uuid */
 
1067
  const char *uuid;
 
1068
 
 
1069
  /** node kind (file, dir, ...) */
 
1070
  svn_node_kind_t kind;
 
1071
 
 
1072
  /* State information */
 
1073
 
 
1074
  /** scheduling (add, delete, replace ...) */
 
1075
  svn_wc_schedule_t schedule;
 
1076
 
 
1077
  /** in a copied state */
 
1078
  svn_boolean_t copied;
 
1079
 
 
1080
  /** deleted, but parent rev lags behind */
 
1081
  svn_boolean_t deleted;
 
1082
 
 
1083
  /** absent -- we know an entry of this name exists, but that's all
 
1084
      (usually this happens because of authz restrictions)  */
 
1085
  svn_boolean_t absent;
 
1086
 
 
1087
  /** for THIS_DIR entry, implies whole entries file is incomplete */
 
1088
  svn_boolean_t incomplete;
 
1089
 
 
1090
  /** copyfrom location */
 
1091
  const char *copyfrom_url;
 
1092
 
 
1093
  /** copyfrom revision */
 
1094
  svn_revnum_t copyfrom_rev;
 
1095
 
 
1096
  /** old version of conflicted file */
 
1097
  const char *conflict_old;
 
1098
 
 
1099
  /** new version of conflicted file */
 
1100
  const char *conflict_new;
 
1101
 
 
1102
  /** working version of conflicted file */
 
1103
  const char *conflict_wrk;
 
1104
 
 
1105
  /** property reject file */
 
1106
  const char *prejfile;
 
1107
 
 
1108
  /** last up-to-date time for text contents (0 means no information available)
 
1109
   */
 
1110
  apr_time_t text_time;
 
1111
 
 
1112
  /** last up-to-date time for properties (0 means no information available) */
 
1113
  apr_time_t prop_time;
 
1114
 
 
1115
  /** base64-encoded checksum for the untranslated text base file,
 
1116
   * can be @c NULL for backwards compatibility.
 
1117
   */
 
1118
  const char *checksum;
 
1119
 
 
1120
  /* "Entry props" */
 
1121
 
 
1122
  /** last revision this was changed */
 
1123
  svn_revnum_t cmt_rev;
 
1124
 
 
1125
  /** last date this was changed */
 
1126
  apr_time_t cmt_date;
 
1127
 
 
1128
  /** last commit author of this item */
 
1129
  const char *cmt_author;
 
1130
 
 
1131
  /** @since New in 1.2
 
1132
   *  lock token or NULL if path not locked in this WC */
 
1133
  const char *lock_token;
 
1134
  /** @since New in 1.2
 
1135
   *  lock owner, or NULL if not locked in this WC */
 
1136
  const char *lock_owner;
 
1137
  /** @since New in 1.2
 
1138
   *  lock comment or NULL if not locked in this WC or no comment */
 
1139
  const char *lock_comment;
 
1140
  /** @since New in 1.2
 
1141
   *  Lock creation date or 0 if not locked in this WC */
 
1142
  apr_time_t lock_creation_date;
 
1143
 
 
1144
  /* IMPORTANT: If you extend this structure, check svn_wc_entry_dup to see
 
1145
     if you need to extend that as well. */
 
1146
} svn_wc_entry_t;
 
1147
 
 
1148
 
 
1149
/** How an entries file's owner dir is named in the entries file. */
 
1150
#define SVN_WC_ENTRY_THIS_DIR  ""
 
1151
 
 
1152
 
 
1153
/** Set @a *entry to an entry for @a path, allocated in the access baton 
 
1154
 * pool.  If @a show_hidden is true, return the entry even if it's in 
 
1155
 * 'deleted' or 'absent' state.  If @a path is not under revision
 
1156
 * control, or if entry is hidden, not scheduled for re-addition,
 
1157
 * and @a show_hidden is @c FALSE, then set @a *entry to @c NULL.
 
1158
 *
 
1159
 * @a *entry should not be modified, since doing so modifies the entries 
 
1160
 * cache in @a adm_access without changing the entries file on disk.
 
1161
 *
 
1162
 * If @a path is not a directory then @a adm_access must be an access baton 
 
1163
 * for the parent directory of @a path.  To avoid needing to know whether 
 
1164
 * @a path is a directory or not, if @a path is a directory @a adm_access 
 
1165
 * can still be an access baton for the parent of @a path so long as the 
 
1166
 * access baton for @a path itself is in the same access baton set.
 
1167
 *
 
1168
 * Note that it is possible for @a path to be absent from disk but still
 
1169
 * under revision control; and conversely, it is possible for @a path to
 
1170
 * be present, but not under revision control.
 
1171
 *
 
1172
 * Use @a pool only for local processing.
 
1173
 */
 
1174
svn_error_t *svn_wc_entry (const svn_wc_entry_t **entry,
 
1175
                           const char *path,
 
1176
                           svn_wc_adm_access_t *adm_access,
 
1177
                           svn_boolean_t show_hidden,
 
1178
                           apr_pool_t *pool);
 
1179
 
 
1180
 
 
1181
/** Parse the `entries' file for @a adm_access and return a hash @a entries, 
 
1182
 * whose keys are (<tt>const char *</tt>) entry names and values are 
 
1183
 * (<tt>svn_wc_entry_t *</tt>).  The hash @a entries, and its keys and
 
1184
 * values, are allocated from the pool used to open the @a adm_access
 
1185
 * baton (that's how the entries caching works).  @a pool is used for
 
1186
 * transient allocations.
 
1187
 *  
 
1188
 * Entries that are in a 'deleted' or 'absent' state (and not
 
1189
 * scheduled for re-addition) are not returned in the hash, unless
 
1190
 * @a show_hidden is true.
 
1191
 *
 
1192
 * Important note: the @a entries hash is the entries cache in @a adm_access 
 
1193
 * and so usually the hash itself, the keys and the values should be treated 
 
1194
 * as read-only.  If any of these are modified then it is the caller's
 
1195
 * responsibility to ensure that the entries file on disk is updated.  Treat
 
1196
 * the hash values as type (<tt>const svn_wc_entry_t *</tt>) if you wish to 
 
1197
 * avoid accidental modification.  Modifying the schedule member is a
 
1198
 * particularly bad idea, as the entries writing process relies on having
 
1199
 * access to the original schedule.  Use a duplicate entry to modify the
 
1200
 * schedule.
 
1201
 *
 
1202
 * Important note: only the entry structures representing files and
 
1203
 * @c SVN_WC_ENTRY_THIS_DIR contain complete information.  The entry
 
1204
 * structures representing subdirs have only the `kind' and `state'
 
1205
 * fields filled in.  If you want info on a subdir, you must use this
 
1206
 * routine to open its @a path and read the @c SVN_WC_ENTRY_THIS_DIR 
 
1207
 * structure, or call @c svn_wc_entry on its @a path.
 
1208
 */
 
1209
svn_error_t *svn_wc_entries_read (apr_hash_t **entries,
 
1210
                                  svn_wc_adm_access_t *adm_access,
 
1211
                                  svn_boolean_t show_hidden,
 
1212
                                  apr_pool_t *pool);
 
1213
 
 
1214
 
 
1215
/** Return a duplicate of @a entry, allocated in @a pool.  No part of the new
 
1216
 * entry will be shared with @a entry.
 
1217
 */
 
1218
svn_wc_entry_t *svn_wc_entry_dup (const svn_wc_entry_t *entry,
 
1219
                                  apr_pool_t *pool);
 
1220
 
 
1221
 
 
1222
/** Given a @a dir_path under version control, decide if one of its
 
1223
 * entries (@a entry) is in state of conflict; return the answers in
 
1224
 * @a text_conflicted_p and @a prop_conflicted_p.  
 
1225
 *
 
1226
 * (If the entry mentions that a .rej or .prej exist, but they are
 
1227
 * both removed, assume the conflict has been resolved by the user.)
 
1228
 */
 
1229
svn_error_t *svn_wc_conflicted_p (svn_boolean_t *text_conflicted_p,
 
1230
                                  svn_boolean_t *prop_conflicted_p,
 
1231
                                  const char *dir_path,
 
1232
                                  const svn_wc_entry_t *entry,
 
1233
                                  apr_pool_t *pool);
 
1234
 
 
1235
/** Set @a *url and @a *rev to the ancestor URL and revision for @a path,
 
1236
 * allocating in @a pool.  @a adm_access must be an access baton for @a path. 
 
1237
 *
 
1238
 * If @a url or @a rev is null, then ignore it (just don't return the
 
1239
 * corresponding information).
 
1240
 */
 
1241
svn_error_t *svn_wc_get_ancestry (char **url,
 
1242
                                  svn_revnum_t *rev,
 
1243
                                  const char *path,
 
1244
                                  svn_wc_adm_access_t *adm_access,
 
1245
                                  apr_pool_t *pool);
 
1246
 
 
1247
 
 
1248
/** A callback vtable invoked by the generic entry-walker function. */
 
1249
typedef struct svn_wc_entry_callbacks_t
 
1250
{
 
1251
  /** An @a entry was found at @a path. */
 
1252
  svn_error_t *(*found_entry) (const char *path,
 
1253
                               const svn_wc_entry_t *entry,
 
1254
                               void *walk_baton,
 
1255
                               apr_pool_t *pool);
 
1256
 
 
1257
  /* ### add more callbacks as new callers need them. */
 
1258
 
 
1259
} svn_wc_entry_callbacks_t;
 
1260
 
 
1261
 
 
1262
/**
 
1263
 * @since New in 1.2.
 
1264
 *
 
1265
 * A generic entry-walker.
 
1266
 *
 
1267
 * Do a recursive depth-first entry-walk beginning on @a path, which can
 
1268
 * be a file or dir.  Call callbacks in @a walk_callbacks, passing
 
1269
 * @a walk_baton to each.  Use @a pool for looping, recursion, and to
 
1270
 * allocate all entries returned.  @a adm_access must be an access baton
 
1271
 * for @a path.
 
1272
 *
 
1273
 * If @a cancel_func is non-null, call it with @a cancel_baton to determine
 
1274
 * if the client has cancelled the operation.
 
1275
 *
 
1276
 * Like our other entries interfaces, entries that are in a 'deleted'
 
1277
 * or 'absent' state (and not scheduled for re-addition) are not
 
1278
 * discovered, unless @a show_hidden is true.
 
1279
 *
 
1280
 * When a new directory is entered, @c SVN_WC_ENTRY_THIS_DIR will always
 
1281
 * be returned first.
 
1282
 *
 
1283
 * Note:  callers should be aware that each directory will be
 
1284
 * returned *twice*:  first as an entry within its parent, and
 
1285
 * subsequently as the '.' entry within itself.  The two calls can be
 
1286
 * distinguished by looking for @c SVN_WC_ENTRY_THIS_DIR in the 'name'
 
1287
 * field of the entry.
 
1288
 */
 
1289
svn_error_t *svn_wc_walk_entries2 (const char *path,
 
1290
                                   svn_wc_adm_access_t *adm_access,
 
1291
                                   const svn_wc_entry_callbacks_t 
 
1292
                                                      *walk_callbacks,
 
1293
                                   void *walk_baton,
 
1294
                                   svn_boolean_t show_hidden,
 
1295
                                   svn_cancel_func_t cancel_func,
 
1296
                                   void *cancel_baton,
 
1297
                                   apr_pool_t *pool);
 
1298
 
 
1299
/**
 
1300
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
1301
 *
 
1302
 * Similar to svn_wc_walk_entries2(), but without cancellation support.
 
1303
 */
 
1304
svn_error_t *svn_wc_walk_entries (const char *path,
 
1305
                                  svn_wc_adm_access_t *adm_access,
 
1306
                                  const svn_wc_entry_callbacks_t 
 
1307
                                                     *walk_callbacks,
 
1308
                                  void *walk_baton,
 
1309
                                  svn_boolean_t show_hidden,
 
1310
                                  apr_pool_t *pool);
 
1311
 
 
1312
 
 
1313
/** Mark missing @a path as 'deleted' in its @a parent's list of entries.
 
1314
 *
 
1315
 * Return @c SVN_ERR_WC_PATH_FOUND if @a path isn't actually missing.
 
1316
 */
 
1317
svn_error_t *svn_wc_mark_missing_deleted (const char *path,
 
1318
                                          svn_wc_adm_access_t *parent,
 
1319
                                          apr_pool_t *pool);
 
1320
                       
 
1321
 
 
1322
 
 
1323
/** Ensure that an administrative area exists for @a path, so that @a
 
1324
 * path is a working copy subdir based on @a url at @a revision, and
 
1325
 * with repository UUID @a uuid.  @a uuid may be @c NULL.
 
1326
 *
 
1327
 * If the administrative area does not exist, then create it and
 
1328
 * initialize it to an unlocked state.
 
1329
 *
 
1330
 * If the administrative area already exists then the given @a url
 
1331
 * must match the URL in the administrative area or an error will be
 
1332
 * returned. The given @a revision must also match except for the
 
1333
 * special case of adding a directory that has a name matching one
 
1334
 * scheduled for deletion, in which case @a revision must be zero.
 
1335
 *
 
1336
 * Do not ensure existence of @a path itself; if @a path does not
 
1337
 * exist, return error.
 
1338
 */
 
1339
svn_error_t *svn_wc_ensure_adm (const char *path,
 
1340
                                const char *uuid,
 
1341
                                const char *url,
 
1342
                                svn_revnum_t revision,
 
1343
                                apr_pool_t *pool);
 
1344
 
 
1345
 
 
1346
 
 
1347
/** 
 
1348
 * @defgroup svn_wc_status working copy status.
 
1349
 * @{
 
1350
 *
 
1351
 * We have two functions for getting working copy status: one function
 
1352
 * for getting the status of exactly one thing, and another for
 
1353
 * getting the statuses of (potentially) multiple things.
 
1354
 * 
 
1355
 * The WebDAV concept of "depth" may be useful in understanding the
 
1356
 * motivation behind this.  Suppose we're getting the status of
 
1357
 * directory D.  The three depth levels would mean
 
1358
 * 
 
1359
 *    depth 0:         D itself (just the named directory)
 
1360
 *    depth 1:         D and its immediate children (D + its entries)
 
1361
 *    depth Infinity:  D and all its descendants (full recursion)
 
1362
 * 
 
1363
 * To offer all three levels, we could have one unified function,
 
1364
 * taking a `depth' parameter.  Unfortunately, because this function
 
1365
 * would have to handle multiple return values as well as the single
 
1366
 * return value case, getting the status of just one entity would
 
1367
 * become cumbersome: you'd have to roll through a hash to find one
 
1368
 * lone status.
 
1369
 * 
 
1370
 * So we have @c svn_wc_status() for depth 0, and 
 
1371
 * @c svn_wc_get_status_editor() for depths 1 and 2, since the latter
 
1372
 * two involve multiple return values.
 
1373
 *
 
1374
 * NOTE:  The status structures may contain a @c NULL ->entry field.
 
1375
 * This indicates an item that is not versioned in the working copy.
 
1376
 */
 
1377
 
 
1378
enum svn_wc_status_kind
 
1379
{
 
1380
    /** does not exist */
 
1381
    svn_wc_status_none = 1,
 
1382
 
 
1383
    /** is not a versioned thing in this wc */
 
1384
    svn_wc_status_unversioned,
 
1385
 
 
1386
    /** exists, but uninteresting. */
 
1387
    svn_wc_status_normal,
 
1388
 
 
1389
    /** is scheduled for addition */
 
1390
    svn_wc_status_added,
 
1391
 
 
1392
    /** under v.c., but is missing */
 
1393
    svn_wc_status_missing,
 
1394
 
 
1395
    /** scheduled for deletion */
 
1396
    svn_wc_status_deleted,
 
1397
 
 
1398
    /** was deleted and then re-added */
 
1399
    svn_wc_status_replaced,
 
1400
 
 
1401
    /** text or props have been modified */
 
1402
    svn_wc_status_modified,
 
1403
 
 
1404
    /** local mods received repos mods */
 
1405
    svn_wc_status_merged,
 
1406
 
 
1407
    /** local mods received conflicting repos mods */
 
1408
    svn_wc_status_conflicted,
 
1409
 
 
1410
    /** a resource marked as ignored */
 
1411
    svn_wc_status_ignored,
 
1412
 
 
1413
    /** an unversioned resource is in the way of the versioned resource */
 
1414
    svn_wc_status_obstructed,
 
1415
 
 
1416
    /** an unversioned path populated by an svn:external property */
 
1417
    svn_wc_status_external,
 
1418
 
 
1419
    /** a directory doesn't contain a complete entries list  */
 
1420
    svn_wc_status_incomplete
 
1421
};
 
1422
 
 
1423
/** @since New in 1.2. 
 
1424
 *
 
1425
 * Structure for holding the "status" of a working copy item. 
 
1426
 *
 
1427
 * The item's entry data is in @a entry, augmented and possibly shadowed
 
1428
 * by the other fields.  @a entry is @c NULL if this item is not under
 
1429
 * version control.
 
1430
 *
 
1431
 * @note Fields may be added to the end of this structure in future
 
1432
 * versions.  Therefore, users shouldn't allocate structures of this
 
1433
 * type, to preserve binary compatibility.
 
1434
 */
 
1435
typedef struct svn_wc_status2_t
 
1436
{
 
1437
  /** Can be @c NULL if not under version control. */
 
1438
  svn_wc_entry_t *entry;
 
1439
  
 
1440
  /** The status of the entries text. */
 
1441
  enum svn_wc_status_kind text_status;
 
1442
 
 
1443
  /** The status of the entries properties. */
 
1444
  enum svn_wc_status_kind prop_status;
 
1445
 
 
1446
  /** a directory can be 'locked' if a working copy update was interrupted. */
 
1447
  svn_boolean_t locked;
 
1448
 
 
1449
  /** a file or directory can be 'copied' if it's scheduled for 
 
1450
   * addition-with-history (or part of a subtree that is scheduled as such.).
 
1451
   */
 
1452
  svn_boolean_t copied;
 
1453
 
 
1454
  /** a file or directory can be 'switched' if the switch command has been 
 
1455
   * used.
 
1456
   */
 
1457
  svn_boolean_t switched;
 
1458
 
 
1459
  /** The entry's text status in the repository. */
 
1460
  enum svn_wc_status_kind repos_text_status;
 
1461
 
 
1462
  /** The entry's property status in the repository. */
 
1463
  enum svn_wc_status_kind repos_prop_status;
 
1464
 
 
1465
  /** The entry's lock in the repository, if any. */
 
1466
  svn_lock_t *repos_lock;
 
1467
 
 
1468
} svn_wc_status2_t;
 
1469
 
 
1470
 
 
1471
 
 
1472
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1473
 *
 
1474
 *  Same as svn_wc_status2_t, but without the svn_lock_t 'repos_lock' field.
 
1475
 */
 
1476
typedef struct svn_wc_status_t
 
1477
{
 
1478
  /** Can be @c NULL if not under version control. */
 
1479
  svn_wc_entry_t *entry;
 
1480
  
 
1481
  /** The status of the entries text. */
 
1482
  enum svn_wc_status_kind text_status;
 
1483
 
 
1484
  /** The status of the entries properties. */
 
1485
  enum svn_wc_status_kind prop_status;
 
1486
 
 
1487
  /** a directory can be 'locked' if a working copy update was interrupted. */
 
1488
  svn_boolean_t locked;
 
1489
 
 
1490
  /** a file or directory can be 'copied' if it's scheduled for 
 
1491
   * addition-with-history (or part of a subtree that is scheduled as such.).
 
1492
   */
 
1493
  svn_boolean_t copied;
 
1494
 
 
1495
  /** a file or directory can be 'switched' if the switch command has been 
 
1496
   * used.
 
1497
   */
 
1498
  svn_boolean_t switched;
 
1499
 
 
1500
  /** The entry's text status in the repository. */
 
1501
  enum svn_wc_status_kind repos_text_status;
 
1502
 
 
1503
  /** The entry's property status in the repository. */
 
1504
  enum svn_wc_status_kind repos_prop_status;
 
1505
 
 
1506
} svn_wc_status_t;
 
1507
 
 
1508
 
 
1509
 
 
1510
/** @since New in 1.2. 
 
1511
 *
 
1512
 * Return a deep copy of the @a orig_stat status structure, allocated
 
1513
 * in @a pool.
 
1514
 */
 
1515
svn_wc_status2_t *svn_wc_dup_status2 (svn_wc_status2_t *orig_stat,
 
1516
                                      apr_pool_t *pool);
 
1517
 
 
1518
 
 
1519
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1520
 *
 
1521
 * Same as svn_wc_dup_status2(), but for older svn_wc_status_t structures.
 
1522
 */
 
1523
svn_wc_status_t *svn_wc_dup_status (svn_wc_status_t *orig_stat,
 
1524
                                    apr_pool_t *pool);
 
1525
 
 
1526
 
 
1527
/** @since New in 1.2.
 
1528
 *
 
1529
 * Fill @a *status for @a path, allocating in @a pool, with the exception 
 
1530
 * of the @c repos_rev field, which is normally filled in by the caller.
 
1531
 * @a adm_access must be an access baton for @a path.
 
1532
 *
 
1533
 * Here are some things to note about the returned structure.  A quick
 
1534
 * examination of the @c status->text_status after a successful return of
 
1535
 * this function can reveal the following things:
 
1536
 *
 
1537
 *    - @c svn_wc_status_none : @a path is not versioned, and is either not
 
1538
 *                              present on disk, or is ignored by svn's
 
1539
 *                              default ignore regular expressions or the
 
1540
 *                              svn:ignore property setting for @a path's
 
1541
 *                              parent directory.
 
1542
 *
 
1543
 *    - @c svn_wc_status_missing : @a path is versioned, but is missing from
 
1544
 *                                 the working copy.
 
1545
 *
 
1546
 *    - @c svn_wc_status_unversioned : @a path is not versioned, but is
 
1547
 *                                     present on disk and not being
 
1548
 *                                     ignored (see above).  
 
1549
 *
 
1550
 * The other available results for the @c text_status field are more
 
1551
 * straightforward in their meanings.  See the comments on the
 
1552
 * @c svn_wc_status_kind structure for some hints.
 
1553
 */
 
1554
svn_error_t *svn_wc_status2 (svn_wc_status2_t **status, 
 
1555
                             const char *path, 
 
1556
                             svn_wc_adm_access_t *adm_access,
 
1557
                             apr_pool_t *pool);
 
1558
 
 
1559
 
 
1560
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1561
 *
 
1562
 *  Same as svn_wc_status2(), but for older svn_wc_status_t structures.
 
1563
 */
 
1564
svn_error_t *svn_wc_status (svn_wc_status_t **status, 
 
1565
                            const char *path, 
 
1566
                            svn_wc_adm_access_t *adm_access,
 
1567
                            apr_pool_t *pool);
 
1568
 
 
1569
 
 
1570
 
 
1571
 
 
1572
/** @since New in 1.2. 
 
1573
 * 
 
1574
 * A callback for reporting a @a status about @a path. 
 
1575
 *
 
1576
 * @a baton is a closure object; it should be provided by the
 
1577
 * implementation, and passed by the caller.
 
1578
 */
 
1579
typedef void (*svn_wc_status_func2_t) (void *baton,
 
1580
                                       const char *path,
 
1581
                                       svn_wc_status2_t *status);
 
1582
 
 
1583
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1584
 *
 
1585
 *  Same as svn_wc_status_func2_t(), but for older svn_wc_status_t structures.
 
1586
 */
 
1587
typedef void (*svn_wc_status_func_t) (void *baton,
 
1588
                                      const char *path,
 
1589
                                      svn_wc_status_t *status);
 
1590
 
 
1591
 
 
1592
/** @since New in 1.2.
 
1593
 *
 
1594
 * Set @a *editor and @a *edit_baton to an editor that generates @c
 
1595
 * svn_wc_status2_t structures and sends them through @a status_func /
 
1596
 * @a status_baton.  @a anchor is an access baton, with a tree lock,
 
1597
 * for the local path to the working copy which will be used as the
 
1598
 * root of our editor.  If @a target is not empty, it represents an
 
1599
 * entry in the @a anchor path which is the subject of the editor
 
1600
 * drive (otherwise, the @a anchor is the subject).
 
1601
 * 
 
1602
 * If @a set_locks_baton is non-@c NULL, it will be set to a baton that can
 
1603
 * be used in a call to the @c svn_wc_status_set_repos_locks function.
 
1604
 *
 
1605
 * Callers drive this editor to describe working copy out-of-dateness
 
1606
 * with respect to the repository.  If this information is not
 
1607
 * available or not desired, callers should simply call the
 
1608
 * close_edit() function of the @a editor vtable.
 
1609
 *
 
1610
 * If the editor driver calls @a editor's set_target_revision() vtable
 
1611
 * function, then when the edit drive is completed, @a *edit_revision
 
1612
 * will contain the revision delivered via that interface, and any
 
1613
 * status items reported during the drive will have their @c repos_rev
 
1614
 * field set to this same revision.
 
1615
 *
 
1616
 * @a config is a hash mapping @c SVN_CONFIG_CATEGORY's to @c
 
1617
 * svn_config_t's.
 
1618
 *
 
1619
 * Assuming the target is a directory, then:
 
1620
 * 
 
1621
 *   - If @a get_all is false, then only locally-modified entries will be
 
1622
 *     returned.  If true, then all entries will be returned.
 
1623
 *
 
1624
 *   - If @a recurse is false, status structures will be returned only
 
1625
 *     for the target and its immediate children.  Otherwise, this
 
1626
 *     operation is fully recursive.
 
1627
 *
 
1628
 * If @a no_ignore is set, statuses that would typically be ignored
 
1629
 * will instead be reported.
 
1630
 *
 
1631
 * If @a cancel_func is non-null, call it with @a cancel_baton while building 
 
1632
 * the @a statushash to determine if the client has cancelled the operation.
 
1633
 *
 
1634
 * If @a traversal_info is non-null, then record pre-update traversal
 
1635
 * state in it.  (Caller should obtain @a traversal_info from
 
1636
 * @c svn_wc_init_traversal_info.)
 
1637
 *
 
1638
 * Allocate the editor itself in @a pool, but the editor does temporary
 
1639
 * allocations in a subpool of @a pool.
 
1640
 */
 
1641
svn_error_t *svn_wc_get_status_editor2 (const svn_delta_editor_t **editor,
 
1642
                                        void **edit_baton,
 
1643
                                        void **set_locks_baton,
 
1644
                                        svn_revnum_t *edit_revision,
 
1645
                                        svn_wc_adm_access_t *anchor,
 
1646
                                        const char *target,
 
1647
                                        apr_hash_t *config,
 
1648
                                        svn_boolean_t recurse,
 
1649
                                        svn_boolean_t get_all,
 
1650
                                        svn_boolean_t no_ignore,
 
1651
                                        svn_wc_status_func2_t status_func,
 
1652
                                        void *status_baton,
 
1653
                                        svn_cancel_func_t cancel_func,
 
1654
                                        void *cancel_baton,
 
1655
                                        svn_wc_traversal_info_t *traversal_info,
 
1656
                                        apr_pool_t *pool);
 
1657
 
 
1658
 
 
1659
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1660
 *
 
1661
 * Same as svn_wc_get_status_editor2, but with @a set_locks_baton set
 
1662
 * to @c NULL, and taking a deprecated svn_wc_status_func_t argument. */
 
1663
svn_error_t *svn_wc_get_status_editor (const svn_delta_editor_t **editor,
 
1664
                                       void **edit_baton,
 
1665
                                       svn_revnum_t *edit_revision,
 
1666
                                       svn_wc_adm_access_t *anchor,
 
1667
                                       const char *target,
 
1668
                                       apr_hash_t *config,
 
1669
                                       svn_boolean_t recurse,
 
1670
                                       svn_boolean_t get_all,
 
1671
                                       svn_boolean_t no_ignore,
 
1672
                                       svn_wc_status_func_t status_func,
 
1673
                                       void *status_baton,
 
1674
                                       svn_cancel_func_t cancel_func,
 
1675
                                       void *cancel_baton,
 
1676
                                       svn_wc_traversal_info_t *traversal_info,
 
1677
                                       apr_pool_t *pool);
 
1678
 
 
1679
 
 
1680
/** @since New in 1.2.
 
1681
 *
 
1682
 * Associate @a locks, a hash table mapping <tt>const char*</tt>
 
1683
 * absolute repository paths to <tt>svn_lock_t</tt> objects, with a
 
1684
 * @a set_locks_baton returned by an earlier call to
 
1685
 * @c svn_wc_get_status_editor2.  @a repos_root is the repository root URL.
 
1686
 * Perform all allocations in @a pool.
 
1687
 *
 
1688
 * @note @a locks will not be copied, so it must be valid throughout the
 
1689
 * edit.  @a pool must also not be destroyed or cleared before the edit is
 
1690
 * finished.
 
1691
 */
 
1692
svn_error_t *
 
1693
svn_wc_status_set_repos_locks (void *set_locks_baton,
 
1694
                               apr_hash_t *locks,
 
1695
                               const char *repos_root,
 
1696
                               apr_pool_t *pool);
 
1697
 
 
1698
/** @} */
 
1699
 
 
1700
 
 
1701
/** @since New in 1.2.
 
1702
 *
 
1703
 * Copy @a src to @a dst_basename in @a dst_parent, and schedule 
 
1704
 * @a dst_basename for addition to the repository, remembering the copy 
 
1705
 * history.
 
1706
 *
 
1707
 * @a src must be a file or directory under version control; @a dst_parent
 
1708
 * must be a directory under version control in the same working copy;
 
1709
 * @a dst_basename will be the name of the copied item, and it must not
 
1710
 * exist already.
 
1711
 *
 
1712
 * If @a cancel_func is non-null, call it with @a cancel_baton at
 
1713
 * various points during the operation.  If it returns an error
 
1714
 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
 
1715
 *
 
1716
 * For each file or directory copied, @a notify_func will be called
 
1717
 * with its path and the @a notify_baton.  @a notify_func may be @c NULL 
 
1718
 * if you are not interested in this information.
 
1719
 *
 
1720
 * Important: this is a variant of @c svn_wc_add.  No changes will happen
 
1721
 * to the repository until a commit occurs.  This scheduling can be
 
1722
 * removed with @c svn_client_revert.
 
1723
 */
 
1724
svn_error_t *svn_wc_copy2 (const char *src,
 
1725
                           svn_wc_adm_access_t *dst_parent,
 
1726
                           const char *dst_basename,
 
1727
                           svn_cancel_func_t cancel_func,
 
1728
                           void *cancel_baton,
 
1729
                           svn_wc_notify_func2_t notify_func,
 
1730
                           void *notify_baton,
 
1731
                           apr_pool_t *pool);
 
1732
 
 
1733
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1734
 *
 
1735
 * Similar to @c svn_wc_copy2, but takes an @c svn_wc_notify_func_t instead.
 
1736
 */
 
1737
svn_error_t *svn_wc_copy (const char *src,
 
1738
                          svn_wc_adm_access_t *dst_parent,
 
1739
                          const char *dst_basename,
 
1740
                          svn_cancel_func_t cancel_func,
 
1741
                          void *cancel_baton,
 
1742
                          svn_wc_notify_func_t notify_func,
 
1743
                          void *notify_baton,
 
1744
                          apr_pool_t *pool);
 
1745
 
 
1746
/** @since New in 1.2.
 
1747
 *
 
1748
 * Schedule @a path for deletion, it will be deleted from the repository on
 
1749
 * the next commit.  If @a path refers to a directory, then a recursive
 
1750
 * deletion will occur.  @a adm_access must hold a write lock for the parent 
 
1751
 * of @a path.
 
1752
 *
 
1753
 * This function immediately deletes all files, modified and unmodified,
 
1754
 * versioned and unversioned from the working copy. It also immediately
 
1755
 * deletes unversioned directories and directories that are scheduled to be
 
1756
 * added.  Only versioned directories will remain in the working copy,
 
1757
 * these get deleted by the update following the commit.
 
1758
 *
 
1759
 * If @a cancel_func is non-null, call it with @a cancel_baton at
 
1760
 * various points during the operation.  If it returns an error
 
1761
 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
 
1762
 *
 
1763
 * For each path marked for deletion, @a notify_func will be called with
 
1764
 * the @a notify_baton and that path. The @a notify_func callback may be
 
1765
 * @c NULL if notification is not needed.
 
1766
 */
 
1767
svn_error_t *svn_wc_delete2 (const char *path,
 
1768
                             svn_wc_adm_access_t *adm_access,
 
1769
                             svn_cancel_func_t cancel_func,
 
1770
                             void *cancel_baton,
 
1771
                             svn_wc_notify_func2_t notify_func,
 
1772
                             void *notify_baton,
 
1773
                             apr_pool_t *pool);
 
1774
 
 
1775
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1776
 *
 
1777
 * Similar to @c svn_wc_delete2, but takes an @c svn_wc_notify_func_t instead.
 
1778
 */
 
1779
svn_error_t *svn_wc_delete (const char *path,
 
1780
                            svn_wc_adm_access_t *adm_access,
 
1781
                            svn_cancel_func_t cancel_func,
 
1782
                            void *cancel_baton,
 
1783
                            svn_wc_notify_func_t notify_func,
 
1784
                            void *notify_baton,
 
1785
                            apr_pool_t *pool);
 
1786
 
 
1787
 
 
1788
/** @since New in 1.2.
 
1789
 *
 
1790
 * Put @a path under version control by adding an entry in its parent,
 
1791
 * and, if @a path is a directory, adding an administrative area.  The
 
1792
 * new entry and anything under it is scheduled for addition to the
 
1793
 * repository.  @a parent_access should hold a write lock for the parent
 
1794
 * directory of @a path.  If @a path is a directory then an access baton 
 
1795
 * for @a path will be added to the set containing @a parent_access.
 
1796
 *
 
1797
 * If @a path does not exist, return @c SVN_ERR_WC_PATH_NOT_FOUND.
 
1798
 *
 
1799
 * If @a copyfrom_url is non-null, it and @a copyfrom_rev are used as
 
1800
 * `copyfrom' args.  This is for copy operations, where one wants
 
1801
 * to schedule @a path for addition with a particular history.
 
1802
 *
 
1803
 * If @a cancel_func is non-null, call it with @a cancel_baton at
 
1804
 * various points during the operation.  If it returns an error
 
1805
 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
 
1806
 *
 
1807
 * When the @a path has been added, then @a notify_func will be called
 
1808
 * (if it is not @c NULL) with the @a notify_baton and the path.
 
1809
 *
 
1810
 * Return @c SVN_ERR_WC_NODE_KIND_CHANGE if @a path is both an unversioned
 
1811
 * directory and a file that is scheduled for deletion or in state deleted.
 
1812
 *
 
1813
 *<pre> ### This function currently does double duty -- it is also
 
1814
 * ### responsible for "switching" a working copy directory over to a
 
1815
 * ### new copyfrom ancestry and scheduling it for addition.  Here is
 
1816
 * ### the old doc string from Ben, lightly edited to bring it
 
1817
 * ### up-to-date, explaining the true, secret life of this function:</pre>
 
1818
 *
 
1819
 * Given a @a path within a working copy of type KIND, follow this algorithm:
 
1820
 *
 
1821
 *    - if @a path is not under version control:
 
1822
 *       - Place it under version control and schedule for addition; 
 
1823
 *         if @a copyfrom_url is non-null, use it and @a copyfrom_rev as
 
1824
 *         'copyfrom' history
 
1825
 *
 
1826
 *    - if @a path is already under version control:
 
1827
 *          (This can only happen when a directory is copied, in which
 
1828
 *           case ancestry must have been supplied as well.)
 
1829
 *
 
1830
 *       -  Schedule the directory itself for addition with copyfrom history.
 
1831
 *       -  Mark all its children with a 'copied' flag
 
1832
 *       -  Rewrite all the URLs to what they will be after a commit.
 
1833
 *       -  ### TODO:  remove old wcprops too, see the '###'below
 
1834
 *
 
1835
 *<pre> ### I think possibly the "switchover" functionality should be
 
1836
 * ### broken out into a separate function, but its all intertwined in
 
1837
 * ### the code right now.  Ben, thoughts?  Hard?  Easy?  Mauve?</pre>
 
1838
 *
 
1839
 * ### Update: see "###" comment in svn_wc_add_repos_file()'s doc
 
1840
 * string about this.
 
1841
 */
 
1842
svn_error_t *svn_wc_add2 (const char *path,
 
1843
                          svn_wc_adm_access_t *parent_access,
 
1844
                          const char *copyfrom_url,
 
1845
                          svn_revnum_t copyfrom_rev,
 
1846
                          svn_cancel_func_t cancel_func,
 
1847
                          void *cancel_baton,
 
1848
                          svn_wc_notify_func2_t notify_func,
 
1849
                          void *notify_baton,
 
1850
                          apr_pool_t *pool);
 
1851
 
 
1852
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
1853
 *
 
1854
 * Similar to @c svn_wc_add2, but takes an @c svn_wc_notify_func_t instead.
 
1855
 */
 
1856
svn_error_t *svn_wc_add (const char *path,
 
1857
                         svn_wc_adm_access_t *parent_access,
 
1858
                         const char *copyfrom_url,
 
1859
                         svn_revnum_t copyfrom_rev,
 
1860
                         svn_cancel_func_t cancel_func,
 
1861
                         void *cancel_baton,
 
1862
                         svn_wc_notify_func_t notify_func,
 
1863
                         void *notify_baton,
 
1864
                         apr_pool_t *pool);
 
1865
 
 
1866
/** Add a file to a working copy at @a dst_path, obtaining the file's
 
1867
 * contents from @a new_text_path and its properties from @a new_props,
 
1868
 * which normally come from the repository file represented by the
 
1869
 * copyfrom args, see below.  The new file will be scheduled for
 
1870
 * addition with history.
 
1871
 *
 
1872
 * Automatically remove @a new_text_path upon successful completion.
 
1873
 *
 
1874
 * @a adm_access, or an access baton in its associated set, must
 
1875
 * contain a write lock for the parent of @a dst_path.
 
1876
 *
 
1877
 * If @a copyfrom_url is non-null, then @a copyfrom_rev must be a
 
1878
 * valid revision number, and together they are the copyfrom history
 
1879
 * for the new file.
 
1880
 *
 
1881
 * Use @a pool for temporary allocations.
 
1882
 *
 
1883
 * ### This function is very redundant with svn_wc_add().  Ideally,
 
1884
 * we'd merge them, so that svn_wc_add() would just take optional
 
1885
 * new_props and optional copyfrom information.  That way it could be
 
1886
 * used for both 'svn add somefilesittingonmydisk' and for adding
 
1887
 * files from repositories, with or without copyfrom history.
 
1888
 *
 
1889
 * The problem with this Ideal Plan is that svn_wc_add() also takes
 
1890
 * care of recursive URL-rewriting.  There's a whole comment in its
 
1891
 * doc string about how that's really weird, outside its core mission,
 
1892
 * etc, etc.  So another part of the Ideal Plan is that that
 
1893
 * functionality of svn_wc_add() would move into a separate function.
 
1894
 */
 
1895
svn_error_t *svn_wc_add_repos_file (const char *dst_path,
 
1896
                                    svn_wc_adm_access_t *adm_access,
 
1897
                                    const char *new_text_path,
 
1898
                                    apr_hash_t *new_props,
 
1899
                                    const char *copyfrom_url,
 
1900
                                    svn_revnum_t copyfrom_rev,
 
1901
                                    apr_pool_t *pool);
 
1902
 
 
1903
 
 
1904
/** Remove entry @a name in @a adm_access from revision control.  @a name 
 
1905
 * must be either a file or @c SVN_WC_ENTRY_THIS_DIR.  @a adm_access must 
 
1906
 * hold a write lock.
 
1907
 *
 
1908
 * If @a name is a file, all its info will be removed from @a adm_access's
 
1909
 * administrative directory.  If @a name is @c SVN_WC_ENTRY_THIS_DIR, then
 
1910
 * @a adm_access's entire administrative area will be deleted, along with
 
1911
 * *all* the administrative areas anywhere in the tree below @a adm_access.
 
1912
 *
 
1913
 * Normally, only administrative data is removed.  However, if
 
1914
 * @a destroy_wf is true, then all working file(s) and dirs are deleted
 
1915
 * from disk as well.  When called with @a destroy_wf, any locally
 
1916
 * modified files will *not* be deleted, and the special error
 
1917
 * @c SVN_ERR_WC_LEFT_LOCAL_MOD might be returned.  (Callers only need to
 
1918
 * check for this special return value if @a destroy_wf is true.)
 
1919
 *
 
1920
 * If @a instant_error is TRUE, then return @c
 
1921
 * SVN_ERR_WC_LEFT_LOCAL_MOD the instant a locally modified file is
 
1922
 * encountered.  Otherwise, leave locally modified files in place and
 
1923
 * return the error only after all the recursion is complete.
 
1924
 
 
1925
 * If @a cancel_func is non-null, call it with @a cancel_baton at
 
1926
 * various points during the removal.  If it returns an error
 
1927
 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
 
1928
 *
 
1929
 * WARNING:  This routine is exported for careful, measured use by
 
1930
 * libsvn_client.  Do *not* call this routine unless you really
 
1931
 * understand what the heck you're doing.
 
1932
 */
 
1933
svn_error_t *
 
1934
svn_wc_remove_from_revision_control (svn_wc_adm_access_t *adm_access,
 
1935
                                     const char *name,
 
1936
                                     svn_boolean_t destroy_wf,
 
1937
                                     svn_boolean_t instant_error,
 
1938
                                     svn_cancel_func_t cancel_func,
 
1939
                                     void *cancel_baton,
 
1940
                                     apr_pool_t *pool);
 
1941
 
 
1942
 
 
1943
/**
 
1944
 * @since New in 1.2.
 
1945
 *
 
1946
 * Assuming @a path is under version control and in a state of conflict, 
 
1947
 * then take @a path *out* of this state.  If @a resolve_text is true then 
 
1948
 * any text conflict is resolved, if @a resolve_props is true then any 
 
1949
 * property conflicts are resolved.  If @a recurse is true, then search
 
1950
 * recursively for conflicts to resolve.
 
1951
 *
 
1952
 * @a adm_access is an access baton, with a write lock, for @a path.
 
1953
 *
 
1954
 * Needless to say, this function doesn't touch conflict markers or
 
1955
 * anything of that sort -- only a human can semantically resolve a
 
1956
 * conflict.  Instead, this function simply marks a file as "having
 
1957
 * been resolved", clearing the way for a commit.  
 
1958
 *
 
1959
 * The implementation details are opaque, as our "conflicted" criteria
 
1960
 * might change over time.  (At the moment, this routine removes the
 
1961
 * three fulltext 'backup' files and any .prej file created in a conflict,
 
1962
 * and modifies @a path's entry.)
 
1963
 *
 
1964
 * If @a path is not under version control, return @c SVN_ERR_ENTRY_NOT_FOUND.  
 
1965
 * If @a path isn't in a state of conflict to begin with, do nothing, and
 
1966
 * return @c SVN_NO_ERROR.
 
1967
 *
 
1968
 * If @c path was successfully taken out of a state of conflict, report this
 
1969
 * information to @c notify_func (if non-@c NULL.)  If only text or only 
 
1970
 * property conflict resolution was requested, and it was successful, then 
 
1971
 * success gets reported.
 
1972
 */
 
1973
svn_error_t *svn_wc_resolved_conflict2 (const char *path,
 
1974
                                        svn_wc_adm_access_t *adm_access,
 
1975
                                        svn_boolean_t resolve_text,
 
1976
                                        svn_boolean_t resolve_props,
 
1977
                                        svn_boolean_t recurse,
 
1978
                                        svn_wc_notify_func2_t notify_func,
 
1979
                                        void *notify_baton,
 
1980
                                        svn_cancel_func_t cancel_func,
 
1981
                                        void *cancel_baton,
 
1982
                                        apr_pool_t *pool);
 
1983
 
 
1984
/**
 
1985
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
1986
 *
 
1987
 * Similar to svn_wc_resolved_conflict2(), but takes an
 
1988
 * svn_wc_notify_func_t and doesn't have cancellation support.
 
1989
 */
 
1990
svn_error_t *svn_wc_resolved_conflict (const char *path,
 
1991
                                       svn_wc_adm_access_t *adm_access,
 
1992
                                       svn_boolean_t resolve_text,
 
1993
                                       svn_boolean_t resolve_props,
 
1994
                                       svn_boolean_t recurse,
 
1995
                                       svn_wc_notify_func_t notify_func,
 
1996
                                       void *notify_baton,
 
1997
                                       apr_pool_t *pool);
 
1998
 
 
1999
 
 
2000
/* Commits. */
 
2001
 
 
2002
/** @since New in 1.2.
 
2003
 * Bump a successfully committed absolute @a path to @a new_revnum after a
 
2004
 * commit succeeds.  @a rev_date and @a rev_author are the (server-side)
 
2005
 * date and author of the new revision; one or both may be @c NULL.
 
2006
 * @a adm_access must hold a write lock appropriate for @a path.
 
2007
 *
 
2008
 * If non-null, @a wcprops is an array of <tt>svn_prop_t *</tt> changes to 
 
2009
 * wc properties; if an @c svn_prop_t->value is null, then that property is
 
2010
 * deleted.
 
2011
 *
 
2012
 * If @a remove_lock is @c TRUE, any entryprops related to a repository
 
2013
 * lock will be removed.
 
2014
 *
 
2015
 * If @a recurse is true and @a path is a directory, then bump every
 
2016
 * versioned object at or under @a path.  This is usually done for
 
2017
 * copied trees.
 
2018
 */
 
2019
svn_error_t *svn_wc_process_committed2 (const char *path,
 
2020
                                        svn_wc_adm_access_t *adm_access,
 
2021
                                        svn_boolean_t recurse,
 
2022
                                        svn_revnum_t new_revnum,
 
2023
                                        const char *rev_date,
 
2024
                                        const char *rev_author,
 
2025
                                        apr_array_header_t *wcprop_changes,
 
2026
                                        svn_boolean_t remove_lock,
 
2027
                                        apr_pool_t *pool);
 
2028
 
 
2029
 
 
2030
/** @deprecated Provided for backwards compability with the 1.1 API.
 
2031
 *
 
2032
 * Similar to @c svn_wc_process_committed2, but with @a remove_lock set to
 
2033
 * @a FALSE. */
 
2034
svn_error_t *svn_wc_process_committed (const char *path,
 
2035
                                       svn_wc_adm_access_t *adm_access,
 
2036
                                       svn_boolean_t recurse,
 
2037
                                       svn_revnum_t new_revnum,
 
2038
                                       const char *rev_date,
 
2039
                                       const char *rev_author,
 
2040
                                       apr_array_header_t *wcprop_changes,
 
2041
                                       apr_pool_t *pool);
 
2042
 
 
2043
 
 
2044
 
 
2045
 
 
2046
 
 
2047
/** @since New in 1.2.
 
2048
 *
 
2049
 * Do a depth-first crawl in a working copy, beginning at @a path.
 
2050
 *
 
2051
 * Communicate the `state' of the working copy's revisions to
 
2052
 * @a reporter/@a report_baton.  Obviously, if @a path is a file instead 
 
2053
 * of a directory, this depth-first crawl will be a short one.
 
2054
 *
 
2055
 * No locks are or logs are created, nor are any animals harmed in the
 
2056
 * process.  No cleanup is necessary.  @a adm_access must be an access 
 
2057
 * baton for the @a path hierarchy, it does not require a write lock.
 
2058
 *
 
2059
 * After all revisions are reported, @a reporter->finish_report() is
 
2060
 * called, which immediately causes the RA layer to update the working
 
2061
 * copy.  Thus the return value may very well reflect the result of
 
2062
 * the update!
 
2063
 *
 
2064
 * If @a restore_files is true, then unexpectedly missing working files
 
2065
 * will be restored from the administrative directory's cache. For each
 
2066
 * file restored, the @a notify_func function will be called with the
 
2067
 * @a notify_baton and the path of the restored file. @a notify_func may
 
2068
 * be @c NULL if this notification is not required.  If @a
 
2069
 * use_commit_times is true, then set restored files' timestamps to
 
2070
 * their last-commit-times.
 
2071
 *
 
2072
 * If @a traversal_info is non-null, then record pre-update traversal
 
2073
 * state in it.  (Caller should obtain @a traversal_info from
 
2074
 * @c svn_wc_init_traversal_info.)
 
2075
 */
 
2076
svn_error_t *
 
2077
svn_wc_crawl_revisions2 (const char *path,
 
2078
                         svn_wc_adm_access_t *adm_access,
 
2079
                         const svn_ra_reporter2_t *reporter,
 
2080
                         void *report_baton,
 
2081
                         svn_boolean_t restore_files,
 
2082
                         svn_boolean_t recurse,
 
2083
                         svn_boolean_t use_commit_times,
 
2084
                         svn_wc_notify_func2_t notify_func,
 
2085
                         void *notify_baton,
 
2086
                         svn_wc_traversal_info_t *traversal_info,
 
2087
                         apr_pool_t *pool);
 
2088
 
 
2089
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
2090
 *
 
2091
 * Similar to @c svn_wc_crawl_revisions2, but takes an svn_wc_notify_func_t
 
2092
 * and a @c svn_reporter_t instead.
 
2093
 */
 
2094
svn_error_t *
 
2095
svn_wc_crawl_revisions (const char *path,
 
2096
                        svn_wc_adm_access_t *adm_access,
 
2097
                        const svn_ra_reporter_t *reporter,
 
2098
                        void *report_baton,
 
2099
                        svn_boolean_t restore_files,
 
2100
                        svn_boolean_t recurse,
 
2101
                        svn_boolean_t use_commit_times,
 
2102
                        svn_wc_notify_func_t notify_func,
 
2103
                        void *notify_baton,
 
2104
                        svn_wc_traversal_info_t *traversal_info,
 
2105
                        apr_pool_t *pool);
 
2106
 
 
2107
 
 
2108
/* Updates. */
 
2109
 
 
2110
/** Set @a *wc_root to @c TRUE if @a path represents a "working copy root",
 
2111
 * @c FALSE otherwise.  Use @a pool for any intermediate allocations.
 
2112
 *
 
2113
 * If @a path is not found, return the error @c SVN_ERR_ENTRY_NOT_FOUND.
 
2114
 *
 
2115
 * NOTE: Due to the way in which "WC-root-ness" is calculated, passing
 
2116
 * a @a path of `.' to this function will always return @c TRUE.
 
2117
 */
 
2118
svn_error_t *svn_wc_is_wc_root (svn_boolean_t *wc_root,
 
2119
                                const char *path,
 
2120
                                svn_wc_adm_access_t *adm_access,
 
2121
                                apr_pool_t *pool);
 
2122
 
 
2123
 
 
2124
/** Conditionally split @a path into an @a anchor and @a target for the 
 
2125
 * purpose of updating and committing.
 
2126
 *
 
2127
 * @a anchor is the directory at which the update or commit editor
 
2128
 * should be rooted.
 
2129
 *
 
2130
 * @a target is the actual subject (relative to the @a anchor) of the
 
2131
 * update/commit, or "" if the @a anchor itself is the subject.
 
2132
 *
 
2133
 * Allocate @a anchor and @a target in @a pool.  
 
2134
 */
 
2135
svn_error_t *svn_wc_get_actual_target (const char *path,
 
2136
                                       const char **anchor,
 
2137
                                       const char **target,
 
2138
                                       apr_pool_t *pool);
 
2139
 
 
2140
 
 
2141
 
 
2142
/* Update and update-like functionality. */
 
2143
 
 
2144
/** @since New in 1.2.
 
2145
 *
 
2146
 * Set @a *editor and @a *edit_baton to an editor and baton for updating a
 
2147
 * working copy.
 
2148
 *
 
2149
 * If @a ti is non-null, record traversal info in @a ti, for use by
 
2150
 * post-traversal accessors such as @c svn_wc_edited_externals().
 
2151
 * 
 
2152
 * @a anchor is an access baton, with a write lock, for the local path to the
 
2153
 * working copy which will be used as the root of our editor.  Further
 
2154
 * locks will be acquired if the update creates new directories.  All
 
2155
 * locks, both those in @a anchor and newly acquired ones, will be released
 
2156
 * when the editor driver calls @c close_edit.
 
2157
 *
 
2158
 * @a target is the entry in @a anchor that will actually be updated, or 
 
2159
 * empty if all of @a anchor should be updated.
 
2160
 *
 
2161
 * The editor invokes @a notify_func with @a notify_baton as the update
 
2162
 * progresses, if @a notify_func is non-null.
 
2163
 *
 
2164
 * If @a cancel_func is non-null, the editor will invoke @a cancel_func with 
 
2165
 * @a cancel_baton as the update progresses to see if it should continue.
 
2166
 *
 
2167
 * If @a diff3_cmd is non-null, then use it as the diff3 command for
 
2168
 * any merging; otherwise, use the built-in merge code.
 
2169
 *
 
2170
 * @a target_revision is a pointer to a revision location which, after
 
2171
 * successful completion of the drive of this editor, will be
 
2172
 * populated with the revision to which the working copy was updated.
 
2173
 *
 
2174
 * If @a use_commit_times is TRUE, then all edited/added files will
 
2175
 * have their working timestamp set to the last-committed-time.  If
 
2176
 * FALSE, the working files will be touched with the 'now' time.
 
2177
 *
 
2178
 */
 
2179
svn_error_t *svn_wc_get_update_editor2 (svn_revnum_t *target_revision,
 
2180
                                        svn_wc_adm_access_t *anchor,
 
2181
                                        const char *target,
 
2182
                                        svn_boolean_t use_commit_times,
 
2183
                                        svn_boolean_t recurse,
 
2184
                                        svn_wc_notify_func2_t notify_func,
 
2185
                                        void *notify_baton,
 
2186
                                        svn_cancel_func_t cancel_func,
 
2187
                                        void *cancel_baton,
 
2188
                                        const char *diff3_cmd,
 
2189
                                        const svn_delta_editor_t **editor,
 
2190
                                        void **edit_baton,
 
2191
                                        svn_wc_traversal_info_t *ti,
 
2192
                                        apr_pool_t *pool);
 
2193
 
 
2194
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
2195
 *
 
2196
 * Similar to @c svn_wc_get_update_editor, but takes an svn_wc_notify_func_t
 
2197
 * instead.
 
2198
 */
 
2199
svn_error_t *svn_wc_get_update_editor (svn_revnum_t *target_revision,
 
2200
                                       svn_wc_adm_access_t *anchor,
 
2201
                                       const char *target,
 
2202
                                       svn_boolean_t use_commit_times,
 
2203
                                       svn_boolean_t recurse,
 
2204
                                       svn_wc_notify_func_t notify_func,
 
2205
                                       void *notify_baton,
 
2206
                                       svn_cancel_func_t cancel_func,
 
2207
                                       void *cancel_baton,
 
2208
                                       const char *diff3_cmd,
 
2209
                                       const svn_delta_editor_t **editor,
 
2210
                                       void **edit_baton,
 
2211
                                       svn_wc_traversal_info_t *ti,
 
2212
                                       apr_pool_t *pool);
 
2213
 
 
2214
/** @since New in 1.2.
 
2215
 *
 
2216
 * A variant of @c svn_wc_get_update_editor().
 
2217
 *
 
2218
 * Set @a *editor and @a *edit_baton to an editor and baton for "switching"
 
2219
 * a working copy to a new @a switch_url.  (Right now, this URL must be
 
2220
 * within the same repository that the working copy already comes
 
2221
 * from.)  @a switch_url must not be @c NULL.
 
2222
 *
 
2223
 * If @a ti is non-null, record traversal info in @a ti, for use by
 
2224
 * post-traversal accessors such as @c svn_wc_edited_externals().
 
2225
 * 
 
2226
 * @a anchor is an access baton, with a write lock, for the local path to the
 
2227
 * working copy which will be used as the root of our editor.  Further
 
2228
 * locks will be acquired if the switch creates new directories.  All
 
2229
 * locks, both those in @a anchor and newly acquired ones, will be released
 
2230
 * when the editor driver calls @c close_edit.
 
2231
 *
 
2232
 * @a target is the entry in @a anchor that will actually be updated, or 
 
2233
 * empty if all of @a anchor should be updated.
 
2234
 *
 
2235
 * The editor invokes @a notify_func with @a notify_baton as the switch
 
2236
 * progresses, if @a notify_func is non-null.
 
2237
 *
 
2238
 * If @a cancel_func is non-null, it will be called with @a cancel_baton as 
 
2239
 * the switch progresses to determine if it should continue.
 
2240
 *
 
2241
 * If @a diff3_cmd is non-null, then use it as the diff3 command for
 
2242
 * any merging; otherwise, use the built-in merge code.
 
2243
 *
 
2244
 * @a target_revision is a pointer to a revision location which, after
 
2245
 * successful completion of the drive of this editor, will be
 
2246
 * populated with the revision to which the working copy was updated.
 
2247
 *
 
2248
 * If @a use_commit_times is TRUE, then all edited/added files will
 
2249
 * have their working timestamp set to the last-committed-time.  If
 
2250
 * FALSE, the working files will be touched with the 'now' time.
 
2251
 *
 
2252
 */
 
2253
svn_error_t *svn_wc_get_switch_editor2 (svn_revnum_t *target_revision,
 
2254
                                        svn_wc_adm_access_t *anchor,
 
2255
                                        const char *target,
 
2256
                                        const char *switch_url,
 
2257
                                        svn_boolean_t use_commit_times,
 
2258
                                        svn_boolean_t recurse,
 
2259
                                        svn_wc_notify_func2_t notify_func,
 
2260
                                        void *notify_baton,
 
2261
                                        svn_cancel_func_t cancel_func,
 
2262
                                        void *cancel_baton,
 
2263
                                        const char *diff3_cmd,
 
2264
                                        const svn_delta_editor_t **editor,
 
2265
                                        void **edit_baton,
 
2266
                                        svn_wc_traversal_info_t *ti,
 
2267
                                        apr_pool_t *pool);
 
2268
 
 
2269
/** @deprecated Provided for backwards compatibility with the 1.2 API.
 
2270
 *
 
2271
 * Similar to @c svn_wc_get_switch_editor, but takes an @c svn_wc_notify_func_t
 
2272
 * instead.
 
2273
 */
 
2274
svn_error_t *svn_wc_get_switch_editor (svn_revnum_t *target_revision,
 
2275
                                       svn_wc_adm_access_t *anchor,
 
2276
                                       const char *target,
 
2277
                                       const char *switch_url,
 
2278
                                       svn_boolean_t use_commit_times,
 
2279
                                       svn_boolean_t recurse,
 
2280
                                       svn_wc_notify_func_t notify_func,
 
2281
                                       void *notify_baton,
 
2282
                                       svn_cancel_func_t cancel_func,
 
2283
                                       void *cancel_baton,
 
2284
                                       const char *diff3_cmd,
 
2285
                                       const svn_delta_editor_t **editor,
 
2286
                                       void **edit_baton,
 
2287
                                       svn_wc_traversal_info_t *ti,
 
2288
                                       apr_pool_t *pool);
 
2289
 
 
2290
 
 
2291
 
 
2292
/* A word about the implementation of working copy property storage:
 
2293
 *
 
2294
 * Since properties are key/val pairs, you'd think we store them in
 
2295
 * some sort of Berkeley DB-ish format, and even store pending changes
 
2296
 * to them that way too.
 
2297
 *
 
2298
 * However, we already have libsvn_subr/hashdump.c working, and it
 
2299
 * uses a human-readable format.  That will be very handy when we're
 
2300
 * debugging, and presumably we will not be dealing with any huge
 
2301
 * properties or property lists initially.  Therefore, we will
 
2302
 * continue to use hashdump as the internal mechanism for storing and
 
2303
 * reading from property lists, but note that the interface here is
 
2304
 * _not_ dependent on that.  We can swap in a DB-based implementation
 
2305
 * at any time and users of this library will never know the
 
2306
 * difference.
 
2307
 */
 
2308
 
 
2309
/** Set @a *props to a hash table mapping <tt>char *</tt> names onto
 
2310
 * <tt>svn_string_t *</tt> values for all the regular properties of 
 
2311
 * @a path.  Allocate the table, names, and values in @a pool.  If 
 
2312
 * the node has no properties, an empty hash is returned.  @a adm_access
 
2313
 * is an access baton set that contains @a path.
 
2314
 */
 
2315
svn_error_t *svn_wc_prop_list (apr_hash_t **props,
 
2316
                               const char *path,
 
2317
                               svn_wc_adm_access_t *adm_access,
 
2318
                               apr_pool_t *pool);
 
2319
 
 
2320
 
 
2321
/** Set @a *value to the value of property @a name for @a path, allocating
 
2322
 * @a *value in @a pool.  If no such prop, set @a *value to @c NULL.  
 
2323
 * @a name may be a regular or wc property; if it is an entry property, 
 
2324
 * return the error @c SVN_ERR_BAD_PROP_KIND.  @a adm_access is an access
 
2325
 * baton set that contains @a path.
 
2326
 */
 
2327
svn_error_t *svn_wc_prop_get (const svn_string_t **value,
 
2328
                              const char *name,
 
2329
                              const char *path,
 
2330
                              svn_wc_adm_access_t *adm_access,
 
2331
                              apr_pool_t *pool);
 
2332
 
 
2333
/** 
 
2334
 * @since New in 1.2.
 
2335
 * 
 
2336
 * Set property @a name to @a value for @a path, or if @a value is
 
2337
 * null, remove property @a name from @a path.  @a adm_access is an
 
2338
 * access baton with a write lock for @a path.
 
2339
 *
 
2340
 * If @a skip_checks is true, do no validity checking.  But if @a
 
2341
 * skip_checks is false, and @a name is not a valid property for @a
 
2342
 * path, return an error, either @c SVN_ERR_ILLEGAL_TARGET (if the
 
2343
 * property is not appropriate for @a path), or @c
 
2344
 * SVN_ERR_BAD_MIME_TYPE (if @a name is "svn:mime-type", but @a value
 
2345
 * is not a valid mime-type).
 
2346
 *
 
2347
 * @a name may be a wc property or a regular property; but if it is an
 
2348
 * entry property, return the error @c SVN_ERR_BAD_PROP_KIND, even if
 
2349
 * @a skip_checks is true.
 
2350
 *
 
2351
 * Use @a pool for temporary allocation.  
 
2352
 */
 
2353
svn_error_t *svn_wc_prop_set2 (const char *name,
 
2354
                               const svn_string_t *value,
 
2355
                               const char *path,
 
2356
                               svn_wc_adm_access_t *adm_access,
 
2357
                               svn_boolean_t skip_checks,
 
2358
                               apr_pool_t *pool);
 
2359
 
 
2360
 
 
2361
/**
 
2362
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
2363
 *
 
2364
 * Like svn_wc_prop_set2(), but with @a skip_checks always false.
 
2365
 */
 
2366
svn_error_t *svn_wc_prop_set (const char *name,
 
2367
                              const svn_string_t *value,
 
2368
                              const char *path,
 
2369
                              svn_wc_adm_access_t *adm_access,
 
2370
                              apr_pool_t *pool);
 
2371
 
 
2372
 
 
2373
/** Return true iff @a name is a 'normal' property name.  'Normal' is
 
2374
 * defined as a user-visible and user-tweakable property that shows up
 
2375
 * when you fetch a proplist.
 
2376
 *
 
2377
 * The function currently parses the namespace like so:
 
2378
 *
 
2379
 *   - 'svn:wc:'  ==>  a wcprop, stored/accessed separately via different API.
 
2380
 *
 
2381
 *   - 'svn:entry:' ==> an "entry" prop, shunted into the 'entries' file.
 
2382
 *
 
2383
 * If these patterns aren't found, then the property is assumed to be
 
2384
 * Normal.
 
2385
 */
 
2386
svn_boolean_t svn_wc_is_normal_prop (const char *name);
 
2387
 
 
2388
 
 
2389
 
 
2390
/** Return true iff @a name is a 'wc' property name. */
 
2391
svn_boolean_t svn_wc_is_wc_prop (const char *name);
 
2392
 
 
2393
/** Return true iff @a name is a 'entry' property name. */
 
2394
svn_boolean_t svn_wc_is_entry_prop (const char *name);
 
2395
 
 
2396
 
 
2397
 
 
2398
 
 
2399
/* Diffs */
 
2400
 
 
2401
 
 
2402
/**
 
2403
 * @since New in 1.2.
 
2404
 *
 
2405
 * Return an @a editor/@a edit_baton for diffing a working copy against the
 
2406
 * repository.
 
2407
 *
 
2408
 * @a anchor/@a target represent the base of the hierarchy to be compared.
 
2409
 *
 
2410
 * @a callbacks/@a callback_baton is the callback table to use when two
 
2411
 * files are to be compared.
 
2412
 *
 
2413
 * @a recurse determines whether to descend into subdirectories when @a target
 
2414
 * is a directory.  If @a recurse is @c TRUE then @a anchor should be part of 
 
2415
 * an access baton set for the @a target hierarchy.
 
2416
 *
 
2417
 * @a ignore_ancestry determines whether paths that have discontinuous node
 
2418
 * ancestry are treated as delete/add or as simple modifications.  If
 
2419
 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will
 
2420
 * result in the diff given as a full delete followed by an add.
 
2421
 *
 
2422
 * If @a use_text_base is true, then compare the repository against
 
2423
 * the working copy's text-base files, rather than the working files.
 
2424
 *
 
2425
 * Normally, the difference from repository->working_copy is shown.
 
2426
 * If @ reverse_order is true, then show working_copy->repository diffs.
 
2427
 *
 
2428
 * If @a cancel_func is non-null, it will be used along with @a cancel_baton 
 
2429
 * to periodically check if the client has canceled the operation.
 
2430
 */
 
2431
svn_error_t *svn_wc_get_diff_editor3 (svn_wc_adm_access_t *anchor,
 
2432
                                      const char *target,
 
2433
                                      const svn_wc_diff_callbacks2_t *callbacks,
 
2434
                                      void *callback_baton,
 
2435
                                      svn_boolean_t recurse,
 
2436
                                      svn_boolean_t ignore_ancestry,
 
2437
                                      svn_boolean_t use_text_base,
 
2438
                                      svn_boolean_t reverse_order,
 
2439
                                      svn_cancel_func_t cancel_func,
 
2440
                                      void *cancel_baton,
 
2441
                                      const svn_delta_editor_t **editor,
 
2442
                                      void **edit_baton,
 
2443
                                      apr_pool_t *pool);
 
2444
 
 
2445
 
 
2446
/**
 
2447
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
2448
 *
 
2449
 * Similar to @c svn_wc_get_diff_editor3(), but with an
 
2450
 * @c svn_wc_diff_callbacks_t instead of @c svn_wc_diff_callbacks2_t. */
 
2451
svn_error_t *svn_wc_get_diff_editor2 (svn_wc_adm_access_t *anchor,
 
2452
                                      const char *target,
 
2453
                                      const svn_wc_diff_callbacks_t *callbacks,
 
2454
                                      void *callback_baton,
 
2455
                                      svn_boolean_t recurse,
 
2456
                                      svn_boolean_t ignore_ancestry,
 
2457
                                      svn_boolean_t use_text_base,
 
2458
                                      svn_boolean_t reverse_order,
 
2459
                                      svn_cancel_func_t cancel_func,
 
2460
                                      void *cancel_baton,
 
2461
                                      const svn_delta_editor_t **editor,
 
2462
                                      void **edit_baton,
 
2463
                                      apr_pool_t *pool);
 
2464
 
 
2465
 
 
2466
/**
 
2467
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
2468
 *
 
2469
 * Similar to svn_wc_get_diff_editor2(), but with @a ignore_ancestry
 
2470
 * always set to @c FALSE.
 
2471
 */
 
2472
svn_error_t *svn_wc_get_diff_editor (svn_wc_adm_access_t *anchor,
 
2473
                                     const char *target,
 
2474
                                     const svn_wc_diff_callbacks_t *callbacks,
 
2475
                                     void *callback_baton,
 
2476
                                     svn_boolean_t recurse,
 
2477
                                     svn_boolean_t use_text_base,
 
2478
                                     svn_boolean_t reverse_order,
 
2479
                                     svn_cancel_func_t cancel_func,
 
2480
                                     void *cancel_baton,
 
2481
                                     const svn_delta_editor_t **editor,
 
2482
                                     void **edit_baton,
 
2483
                                     apr_pool_t *pool);
 
2484
 
 
2485
 
 
2486
/**
 
2487
 * @since New in 1.2.
 
2488
 *
 
2489
 * Compare working copy against the text-base.
 
2490
 *
 
2491
 * @a anchor/@a target represent the base of the hierarchy to be compared.
 
2492
 *
 
2493
 * @a callbacks/@a callback_baton is the callback table to use when two
 
2494
 * files are to be compared.
 
2495
 *
 
2496
 * @a recurse determines whether to descend into subdirectories when @a target
 
2497
 * is a directory.  If @a recurse is @c TRUE then @a anchor should be part of 
 
2498
 * an access baton set for the @a target hierarchy.
 
2499
 *
 
2500
 * @a ignore_ancestry determines whether paths that have discontinuous node
 
2501
 * ancestry are treated as delete/add or as simple modifications.  If
 
2502
 * @a ignore_ancestry is @c FALSE, then any discontinuous node ancestry will
 
2503
 * result in the diff given as a full delete followed by an add.
 
2504
 */
 
2505
svn_error_t *svn_wc_diff3 (svn_wc_adm_access_t *anchor,
 
2506
                           const char *target,
 
2507
                           const svn_wc_diff_callbacks2_t *callbacks,
 
2508
                           void *callback_baton,
 
2509
                           svn_boolean_t recurse,
 
2510
                           svn_boolean_t ignore_ancestry,
 
2511
                           apr_pool_t *pool);
 
2512
 
 
2513
/**
 
2514
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
2515
 *
 
2516
 * Similar to @c svn_wc_diff3, but with a @c svn_wc_diff_callbacks_t argument
 
2517
 * instead of @c svn_wc_diff_callbacks2_t. */
 
2518
svn_error_t *svn_wc_diff2 (svn_wc_adm_access_t *anchor,
 
2519
                           const char *target,
 
2520
                           const svn_wc_diff_callbacks_t *callbacks,
 
2521
                           void *callback_baton,
 
2522
                           svn_boolean_t recurse,
 
2523
                           svn_boolean_t ignore_ancestry,
 
2524
                           apr_pool_t *pool);
 
2525
 
 
2526
/**
 
2527
 * @deprecated Provided for backward compatibility with the 1.0 API.
 
2528
 *
 
2529
 * Similar to svn_wc_diff2(), but with @a ignore_ancestry always set
 
2530
 * to @c FALSE.
 
2531
 */
 
2532
svn_error_t *svn_wc_diff (svn_wc_adm_access_t *anchor,
 
2533
                          const char *target,
 
2534
                          const svn_wc_diff_callbacks_t *callbacks,
 
2535
                          void *callback_baton,
 
2536
                          svn_boolean_t recurse,
 
2537
                          apr_pool_t *pool);
 
2538
 
 
2539
 
 
2540
/** Given a @a path to a file or directory under version control, discover
 
2541
 * any local changes made to properties and/or the set of 'pristine'
 
2542
 * properties.  @a adm_access is an access baton set for @a path.
 
2543
 *
 
2544
 * If @a propchanges is non-@c NULL, return these changes as an array of
 
2545
 * @c svn_prop_t structures stored in @a *propchanges.  The structures and
 
2546
 * array will be allocated in @a pool.  If there are no local property
 
2547
 * modifications on @a path, then set @a *propchanges to @c NULL.
 
2548
 *
 
2549
 * If @a original_props is non-@c NULL, then set @a *original_props to
 
2550
 * hashtable (<tt>const char *name</tt> -> <tt>const svn_string_t *value</tt>)
 
2551
 * that represents the 'pristine' property list of @a path.  This hashtable is
 
2552
 * allocated in @a pool, and can be used to compare old and new values of
 
2553
 * properties.
 
2554
 */
 
2555
svn_error_t *svn_wc_get_prop_diffs (apr_array_header_t **propchanges,
 
2556
                                    apr_hash_t **original_props,
 
2557
                                    const char *path,
 
2558
                                    svn_wc_adm_access_t *adm_access,
 
2559
                                    apr_pool_t *pool);
 
2560
 
 
2561
 
 
2562
/** The outcome of a merge carried out (or tried as a dry-run) by 
 
2563
 * @c svn_wc_merge
 
2564
 */
 
2565
typedef enum svn_wc_merge_outcome_t
 
2566
{
 
2567
   /** The working copy is (or would be) unchanged.  The changes to be
 
2568
    * merged were already present in the working copy
 
2569
    */
 
2570
   svn_wc_merge_unchanged,
 
2571
 
 
2572
   /** The working copy has been (or would be) changed. */
 
2573
   svn_wc_merge_merged,
 
2574
 
 
2575
   /** The working copy has been (or would be) changed, but there was (or
 
2576
    * would be) a conflict
 
2577
    */
 
2578
   svn_wc_merge_conflict,
 
2579
 
 
2580
   /** No merge was performed, probably because the target file was
 
2581
    * either absent or not under version control.
 
2582
    */
 
2583
   svn_wc_merge_no_merge
 
2584
 
 
2585
} svn_wc_merge_outcome_t;
 
2586
 
 
2587
/** Given paths to three fulltexts, merge the differences between @a left
 
2588
 * and @a right into @a merge_target.  (It may help to know that @a left,
 
2589
 * @a right, and @a merge_target correspond to "OLDER", "YOURS", and "MINE",
 
2590
 * respectively, in the diff3 documentation.)  Use @a pool for any
 
2591
 * temporary allocation.
 
2592
 *
 
2593
 * @a adm_access is an access baton with a write lock for the directory
 
2594
 * containing @a merge_target.
 
2595
 *
 
2596
 * This function assumes that @a left and @a right are in repository-normal
 
2597
 * form (linefeeds, with keywords contracted); if necessary,
 
2598
 * @a merge_target is temporarily converted to this form to receive the
 
2599
 * changes, then translated back again.
 
2600
 *
 
2601
 * If @a merge_target is absent, or present but not under version
 
2602
 * control, then set @a *merge_outcome to svn_wc_merge_no_merge and
 
2603
 * return success without merging anything.  (The reasoning is that if
 
2604
 * the file is not versioned, then it is probably unrelated to the
 
2605
 * changes being considered, so they should not be merged into it.)
 
2606
 *
 
2607
 * @a dry_run determines whether the working copy is modified.  When it
 
2608
 * is @c FALSE the merge will cause @a merge_target to be modified, when it
 
2609
 * is @c TRUE the merge will be carried out to determine the result but
 
2610
 * @a merge_target will not be modified.
 
2611
 *
 
2612
 * If @a diff3_cmd is non-null, then use it as the diff3 command for
 
2613
 * any merging; otherwise, use the built-in merge code.
 
2614
 *
 
2615
 * The outcome of the merge is returned in @a *merge_outcome. If there is
 
2616
 * a conflict and @a dry_run is @c FALSE, then
 
2617
 *
 
2618
 *   * Put conflict markers around the conflicting regions in
 
2619
 *     @a merge_target, labeled with @a left_label, @a right_label, and
 
2620
 *     @a target_label.  (If any of these labels are @c NULL, default 
 
2621
 *     values will be used.)
 
2622
 * 
 
2623
 *   * Copy @a left, @a right, and the original @a merge_target to unique 
 
2624
 *     names in the same directory as @a merge_target, ending with the 
 
2625
 *     suffixes ".LEFT_LABEL", ".RIGHT_LABEL", and ".TARGET_LABEL"
 
2626
 *     respectively.
 
2627
 *
 
2628
 *   * Mark the entry for @a merge_target as "conflicted", and track the
 
2629
 *     above mentioned backup files in the entry as well.
 
2630
 *
 
2631
 * Binary case:
 
2632
 *
 
2633
 *  If @a merge_target is a binary file, then no merging is attempted,
 
2634
 *  the merge is deemed to be a conflict.  If @a dry_run is @c FALSE the
 
2635
 *  working @a merge_target is untouched, and copies of @a left and 
 
2636
 *  @a right are created next to it using @a left_label and @a right_label.
 
2637
 *  @a merge_target's entry is marked as "conflicted", and begins
 
2638
 *  tracking the two backup files.  If @a dry_run is @c TRUE no files are
 
2639
 *  changed.  The outcome of the merge is returned in @a *merge_outcome.
 
2640
 */
 
2641
svn_error_t *svn_wc_merge (const char *left,
 
2642
                           const char *right,
 
2643
                           const char *merge_target,
 
2644
                           svn_wc_adm_access_t *adm_access,
 
2645
                           const char *left_label,
 
2646
                           const char *right_label,
 
2647
                           const char *target_label,
 
2648
                           svn_boolean_t dry_run,
 
2649
                           enum svn_wc_merge_outcome_t *merge_outcome,
 
2650
                           const char *diff3_cmd,
 
2651
                           apr_pool_t *pool);
 
2652
 
 
2653
 
 
2654
/** Given a @a path under version control, merge an array of @a propchanges
 
2655
 * into the path's existing properties.  @a propchanges is an array of
 
2656
 * @c svn_prop_t objects.  @a adm_access is an access baton for the directory
 
2657
 * containing @a path.
 
2658
 *
 
2659
 * If @a base_merge is @c FALSE only the working properties will be changed,
 
2660
 * if it is @c TRUE both the base and working properties will be changed.
 
2661
 *
 
2662
 * If @a state is non-null, set @a *state to the state of the properties
 
2663
 * after the merge.
 
2664
 *
 
2665
 * If conflicts are found when merging working properties, they are
 
2666
 * described in a temporary .prej file (or appended to an already-existing
 
2667
 * .prej file), and the entry is marked "conflicted".  Base properties
 
2668
 * are changed unconditionally, if @a base_merge is @c TRUE, they never result
 
2669
 * in a conflict.
 
2670
 *
 
2671
 * If @a path is not under version control, return the error
 
2672
 * SVN_ERR_UNVERSIONED_RESOURCE and don't touch anyone's properties.
 
2673
 */
 
2674
svn_error_t *
 
2675
svn_wc_merge_prop_diffs (svn_wc_notify_state_t *state,
 
2676
                         const char *path,
 
2677
                         svn_wc_adm_access_t *adm_access,
 
2678
                         const apr_array_header_t *propchanges,
 
2679
                         svn_boolean_t base_merge,
 
2680
                         svn_boolean_t dry_run,
 
2681
                         apr_pool_t *pool);
 
2682
 
 
2683
 
 
2684
 
 
2685
/** Given a @a path to a wc file, return a @a pristine_path which points to a
 
2686
 * pristine version of the file.  This is needed so clients can do
 
2687
 * diffs.  If the WC has no text-base, return a @c NULL instead of a
 
2688
 * path.
 
2689
 */
 
2690
svn_error_t *svn_wc_get_pristine_copy_path (const char *path,
 
2691
                                            const char **pristine_path,
 
2692
                                            apr_pool_t *pool);
 
2693
 
 
2694
 
 
2695
/**
 
2696
 * @since New in 1.2.
 
2697
 *
 
2698
 * Recurse from @a path, cleaning up unfinished log business.  Perform
 
2699
 * necessary allocations in @a pool.  Any working copy locks under @a path 
 
2700
 * will be taken over and then cleared by this function.  If @a diff3_cmd
 
2701
 * is non-null, then use it as the diff3 command for any merging; otherwise,
 
2702
 * use the built-in merge code.
 
2703
 *
 
2704
 * WARNING: there is no mechanism that will protect locks that are still 
 
2705
 * being used.
 
2706
 *
 
2707
 * If @a cancel_func is non-null, invoke it with @a cancel_baton at
 
2708
 * various points during the operation.  If it returns an error
 
2709
 * (typically @c SVN_ERR_CANCELLED), return that error immediately.
 
2710
 */
 
2711
svn_error_t *
 
2712
svn_wc_cleanup2 (const char *path,
 
2713
                 const char *diff3_cmd,
 
2714
                 svn_cancel_func_t cancel_func,
 
2715
                 void *cancel_baton,
 
2716
                 apr_pool_t *pool);
 
2717
 
 
2718
/**
 
2719
 * @deprecated Provided for backward compatibility with the 1.1 API.
 
2720
 *
 
2721
 * Similar to svn_wc_cleanup2(). @a optional_adm_access is an historic
 
2722
 * relic and not used, it may be NULL.
 
2723
 */
 
2724
svn_error_t *
 
2725
svn_wc_cleanup (const char *path,
 
2726
                svn_wc_adm_access_t *optional_adm_access,
 
2727
                const char *diff3_cmd,
 
2728
                svn_cancel_func_t cancel_func,
 
2729
                void *cancel_baton,
 
2730
                apr_pool_t *pool);
 
2731
 
 
2732
 
 
2733
/** Relocation validation callback typedef.
 
2734
 *
 
2735
 * Called for each relocated file/directory.  @a uuid contains the
 
2736
 * expected repository UUID, @a url contains the tentative URL.
 
2737
 *
 
2738
 * @a baton is a closure object; it should be provided by the
 
2739
 * implementation, and passed by the caller.
 
2740
 */
 
2741
typedef svn_error_t *(*svn_wc_relocation_validator_t) (void *baton,
 
2742
                                                       const char *uuid,
 
2743
                                                       const char *url);
 
2744
 
 
2745
 
 
2746
/** Change repository references at @a path that begin with @a from
 
2747
 * to begin with @a to instead.  Perform necessary allocations in @a pool. 
 
2748
 * If @a recurse is true, do so.  @a validator (and its baton,
 
2749
 * @a validator_baton), will be called for each newly generated URL.
 
2750
 *
 
2751
 * @a adm_access is an access baton for the directory containing
 
2752
 * @a path.
 
2753
 */
 
2754
svn_error_t *
 
2755
svn_wc_relocate (const char *path,
 
2756
                 svn_wc_adm_access_t *adm_access,
 
2757
                 const char *from,
 
2758
                 const char *to,
 
2759
                 svn_boolean_t recurse,
 
2760
                 svn_wc_relocation_validator_t validator,
 
2761
                 void *validator_baton,
 
2762
                 apr_pool_t *pool);
 
2763
 
 
2764
 
 
2765
/** @since New in 1.2.
 
2766
 *
 
2767
 * Revert changes to @a path (perhaps in a @a recursive fashion).  Perform
 
2768
 * necessary allocations in @a pool.
 
2769
 *
 
2770
 * @a parent_access is an access baton for the directory containing @a path,
 
2771
 * unless @a path is a wc root, in which case @a parent_access refers to 
 
2772
 * @a path itself.
 
2773
 *
 
2774
 * If @a cancel_func is non-null, call it with @a cancel_baton at
 
2775
 * various points during the reversion process.  If it returns an
 
2776
 * error (typically @c SVN_ERR_CANCELLED), return that error
 
2777
 * immediately.
 
2778
 *
 
2779
 * If @a use_commit_times is TRUE, then all reverted working-files
 
2780
 * will have their timestamp set to the last-committed-time.  If
 
2781
 * FALSE, the reverted working-files will be touched with the 'now' time.
 
2782
 *
 
2783
 * For each item reverted, @a notify_func will be called with @a notify_baton
 
2784
 * and the path of the reverted item. @a notify_func may be @c NULL if this
 
2785
 * notification is not needed.
 
2786
 *
 
2787
 * If @a path is not under version control, return the error
 
2788
 * SVN_ERR_UNVERSIONED_RESOURCE.
 
2789
 */
 
2790
svn_error_t *
 
2791
svn_wc_revert2 (const char *path, 
 
2792
                svn_wc_adm_access_t *parent_access,
 
2793
                svn_boolean_t recursive, 
 
2794
                svn_boolean_t use_commit_times,
 
2795
                svn_cancel_func_t cancel_func,
 
2796
                void *cancel_baton,
 
2797
                svn_wc_notify_func2_t notify_func,
 
2798
                void *notify_baton,
 
2799
                apr_pool_t *pool);
 
2800
 
 
2801
/** @deprecated Provided for backwards compatibility with the 1.1 API.
 
2802
 *
 
2803
 * Similar to @c svn_wc_revert2, but takes an @c svn_wc_notify_func_t instead.
 
2804
 */
 
2805
svn_error_t *
 
2806
svn_wc_revert (const char *path, 
 
2807
               svn_wc_adm_access_t *parent_access,
 
2808
               svn_boolean_t recursive, 
 
2809
               svn_boolean_t use_commit_times,
 
2810
               svn_cancel_func_t cancel_func,
 
2811
               void *cancel_baton,
 
2812
               svn_wc_notify_func_t notify_func,
 
2813
               void *notify_baton,
 
2814
               apr_pool_t *pool);
 
2815
 
 
2816
 
 
2817
/* Tmp files */
 
2818
 
 
2819
/** Create a unique temporary file in administrative tmp/ area of
 
2820
 * directory @a path.  Return a handle in @a *fp.
 
2821
 *
 
2822
 * The flags will be <tt>APR_WRITE | APR_CREATE | APR_EXCL</tt> and
 
2823
 * optionally @c APR_DELONCLOSE (if the @a delete_on_close argument is 
 
2824
 * set @c TRUE).
 
2825
 *
 
2826
 * This means that as soon as @a fp is closed, the tmp file will vanish.
 
2827
 */
 
2828
svn_error_t *
 
2829
svn_wc_create_tmp_file (apr_file_t **fp,
 
2830
                        const char *path,
 
2831
                        svn_boolean_t delete_on_close,
 
2832
                        apr_pool_t *pool);
 
2833
 
 
2834
 
 
2835
 
 
2836
/* Eol conversion and keyword expansion. */
 
2837
 
 
2838
/** Set @a *xlated_p to a path to a possibly translated copy of versioned
 
2839
 * file @a vfile, or to @a vfile itself if no translation is necessary.
 
2840
 * That is, if @a vfile's properties indicate newline conversion or
 
2841
 * keyword expansion, point @a *xlated_p to a copy of @a vfile whose
 
2842
 * newlines are unconverted and keywords contracted, in whatever
 
2843
 * manner is indicated by @a vfile's properties; otherwise, set @a *xlated_p
 
2844
 * to @a vfile.
 
2845
 *
 
2846
 * If @a force_repair is set, the translated file will have any
 
2847
 * inconsistent line endings repaired.  This should only be used when
 
2848
 * the resultant file is being created for comparison against @a vfile's
 
2849
 * text base.
 
2850
 *
 
2851
 * Caller is responsible for detecting if they are different (pointer
 
2852
 * comparison is sufficient), and for removing @a *xlated_p if
 
2853
 * necessary.
 
2854
 *
 
2855
 * This function is generally used to get a file that can be compared
 
2856
 * meaningfully against @a vfile's text base.
 
2857
 *
 
2858
 * If @a *xlated_p is different from @a vfile, then choose @a *xlated_p's 
 
2859
 * name using @c svn_io_open_unique_file() with @c SVN_WC__TMP_EXT, and 
 
2860
 * allocate it in @a pool.  Also use @a pool for any temporary allocation.
 
2861
 *
 
2862
 * If an error is returned, the effect on @a *xlated_p is undefined.
 
2863
 */
 
2864
svn_error_t *svn_wc_translated_file (const char **xlated_p,
 
2865
                                     const char *vfile,
 
2866
                                     svn_wc_adm_access_t *adm_access,
 
2867
                                     svn_boolean_t force_repair,
 
2868
                                     apr_pool_t *pool);
 
2869
 
 
2870
 
 
2871
 
 
2872
/* Text/Prop Deltas Using an Editor */
 
2873
 
 
2874
 
 
2875
/** Send the local modifications for versioned file @a path (with
 
2876
 * matching @a file_baton) through @a editor, then close @a file_baton
 
2877
 * afterwards.  Use @a pool for any temporary allocation and
 
2878
 * @a adm_access as an access baton for @a path.
 
2879
 * 
 
2880
 * This process creates a copy of @a path with keywords and eol
 
2881
 * untranslated.  If @a tempfile is non-null, set @a *tempfile to the 
 
2882
 * path to this copy.  Do not clean up the copy; caller can do that.  
 
2883
 * (The purpose of handing back the tmp copy is that it is usually about 
 
2884
 * to become the new text base anyway, but the installation of the new
 
2885
 * text base is outside the scope of this function.)
 
2886
 *
 
2887
 * If @a fulltext, send the untranslated copy of @a path through @a editor 
 
2888
 * as full-text; else send it as svndiff against the current text base.
 
2889
 *
 
2890
 * If sending a diff, and the recorded checksum for @a path's text-base
 
2891
 * does not match the current actual checksum, then remove the tmp
 
2892
 * copy (and set @a *tempfile to null if appropriate), and return the
 
2893
 * error @c SVN_ERR_WC_CORRUPT_TEXT_BASE.
 
2894
 *
 
2895
 * Note: this is intended for use with both infix and postfix
 
2896
 * text-delta styled editor drivers.
 
2897
 */
 
2898
svn_error_t *svn_wc_transmit_text_deltas (const char *path,
 
2899
                                          svn_wc_adm_access_t *adm_access,
 
2900
                                          svn_boolean_t fulltext,
 
2901
                                          const svn_delta_editor_t *editor,
 
2902
                                          void *file_baton,
 
2903
                                          const char **tempfile,
 
2904
                                          apr_pool_t *pool);
 
2905
 
 
2906
 
 
2907
/** Given a @a path with its accompanying @a entry, transmit all local 
 
2908
 * property modifications using the appropriate @a editor method (in 
 
2909
 * conjunction with @a baton). @a adm_access is an access baton set
 
2910
 * that contains @a path.  Use @a pool for all allocations.
 
2911
 *
 
2912
 * If a temporary file remains after this function is finished, the
 
2913
 * path to that file is returned in @a *tempfile (so the caller can 
 
2914
 * clean this up if it wishes to do so).
 
2915
 */
 
2916
svn_error_t *svn_wc_transmit_prop_deltas (const char *path,
 
2917
                                          svn_wc_adm_access_t *adm_access,
 
2918
                                          const svn_wc_entry_t *entry,
 
2919
                                          const svn_delta_editor_t *editor,
 
2920
                                          void *baton,
 
2921
                                          const char **tempfile,
 
2922
                                          apr_pool_t *pool);
 
2923
 
 
2924
 
 
2925
/** Get the run-time configured list of ignore patterns from the 
 
2926
 * @c svn_config_t's in the @a config hash, and store them in @a *patterns.
 
2927
 * Allocate @a *patterns and its contents in @a pool.
 
2928
 */
 
2929
svn_error_t *svn_wc_get_default_ignores (apr_array_header_t **patterns,
 
2930
                                         apr_hash_t *config,
 
2931
                                         apr_pool_t *pool);
 
2932
 
 
2933
 
 
2934
/** Add @a lock to the working copy for @a path.  @a adm_access must contain
 
2935
 * a write lock for @a path.  If @a path is read-only, due to locking
 
2936
 * properties, make it writable.  Perform temporary allocations in @a
 
2937
 * pool. */
 
2938
svn_error_t *svn_wc_add_lock (const char *path, const svn_lock_t *lock,
 
2939
                              svn_wc_adm_access_t *adm_access,
 
2940
                              apr_pool_t *pool);
 
2941
 
 
2942
/** Remove any lock from @a path.  @a adm_access must contain a
 
2943
 * write-lock for @a path.  If @a path has a lock and the locking
 
2944
 * so specifies, make the file read-only.  Don't return an error if @a
 
2945
 * path didn't have a lock.  Perform temporary allocations in @a pool. */
 
2946
svn_error_t *svn_wc_remove_lock (const char *path,
 
2947
                                 svn_wc_adm_access_t *adm_access,
 
2948
                                 apr_pool_t *pool);
 
2949
 
 
2950
 
 
2951
#ifdef __cplusplus
 
2952
}
 
2953
#endif /* __cplusplus */
 
2954
 
 
2955
#endif  /* SVN_WC_H */