2 * log.h : interfaces for running .svn/log files.
4 * ====================================================================
5 * Copyright (c) 2000-2007 CollabNet. All rights reserved.
7 * This software is licensed as described in the file COPYING, which
8 * you should have received as part of this distribution. The terms
9 * are also available at http://subversion.tigris.org/license-1.html.
10 * If newer versions of this license are posted there, you may use a
11 * newer version instead, at your option.
13 * This software consists of voluntary contributions made by many
14 * individuals. For exact contribution history, see the revision
15 * history and logs, available at http://subversion.tigris.org/.
16 * ====================================================================
20 #ifndef SVN_LIBSVN_WC_LOG_H
21 #define SVN_LIBSVN_WC_LOG_H
23 #include <apr_pools.h>
25 #include "svn_types.h"
26 #include "svn_error.h"
31 #endif /* __cplusplus */
35 /* Return the path to use for logfile number LOG_NUMBER. The returned
36 string will be allocated from POOL.
38 For log number 0, this will just be SVN_WC__ADM_LOG to maintain
39 compatibility with 1.0.x. Higher numbers have the digits of the
40 number appended to SVN_WC__ADM_LOG so that they look like "log.1",
42 const char *svn_wc__logfile_path(int log_number
,
47 /* The svn_wc__loggy_* functions in this section take path arguments
48 with the same base as with which the adm_access was opened.
52 /* Extend **LOG_ACCUM with log instructions to append the contents
55 This command fails to be idempotent or atomic: there's no way to
56 tell if you should re-run this! This function is deprecated; new
57 uses should not be added, and the single current use (constructing
58 human-readable non-parsed property conflict files) should be
59 rewritten. See Issue #3015.
62 svn_wc__loggy_append(svn_stringbuf_t
**log_accum
,
63 svn_wc_adm_access_t
*adm_access
,
64 const char *src
, const char *dst
,
68 /* Extend **LOG_ACCUM with log instructions to mark PATH as committed
72 svn_wc__loggy_committed(svn_stringbuf_t
**log_accum
,
73 svn_wc_adm_access_t
*adm_access
,
74 const char *path
, svn_revnum_t revnum
,
78 /* Extend **LOG_ACCUM with log instructions to copy the file SRC_PATH to
79 DST_PATH, if it exists. If it doesn't and REMOVE_DST_IF_NO_SRC is TRUE
80 the file at DST_PATH will be deleted if any.
82 Sets *DST_MODIFIED, if either the copy or the remove have been carried out.
85 typedef enum svn_wc__copy_t
87 /* Normal copy, no translation */
88 svn_wc__copy_normal
= 0,
90 /* Copy, translate using file properties */
91 svn_wc__copy_translate
,
93 /* Copy, translate using only the svn:special property, if any */
94 svn_wc__copy_translate_special_only
,
96 /* Copy, detranslate using file properties */
97 svn_wc__copy_detranslate
101 svn_wc__loggy_copy(svn_stringbuf_t
**log_accum
,
102 svn_boolean_t
*dst_modified
,
103 svn_wc_adm_access_t
*adm_access
,
104 svn_wc__copy_t copy_type
,
105 const char *src_path
, const char *dst_path
,
106 svn_boolean_t remove_dst_if_no_src
,
110 /* Extend **LOG_ACCUM with log instructions to generate a translated
111 file from SRC to DST with translation settings from VERSIONED
112 and flags specified in FLAGS.
115 svn_wc__loggy_translated_file(svn_stringbuf_t
**log_accum
,
116 svn_wc_adm_access_t
*adm_access
,
119 const char *versioned
,
122 /* Extend **LOG_ACCUM with log instructions to delete the entry
123 associated with PATH from the entries file.
126 svn_wc__loggy_delete_entry(svn_stringbuf_t
**log_accum
,
127 svn_wc_adm_access_t
*adm_access
,
132 /* Extend **LOG_ACCUM with log instructions to delete lock related
133 fields from the entry belonging to PATH.
136 svn_wc__loggy_delete_lock(svn_stringbuf_t
**log_accum
,
137 svn_wc_adm_access_t
*adm_access
,
141 /* Extend **LOG_ACCUM with log instructions to delete changelist
142 from the entry belonging to PATH.
145 svn_wc__loggy_delete_changelist(svn_stringbuf_t
**log_accum
,
146 svn_wc_adm_access_t
*adm_access
,
150 /* Extend **LOG_ACCUM with commands to modify the entry associated with NAME
151 according to the flags specified in MODIFY_FLAGS, based on the values
154 The flags in MODIFY_FLAGS are to be taken from the svn_wc__entry_modify
155 parameter by the same name.
158 svn_wc__loggy_entry_modify(svn_stringbuf_t
**log_accum
,
159 svn_wc_adm_access_t
*adm_access
,
161 svn_wc_entry_t
*entry
,
162 apr_uint64_t modify_flags
,
165 /* Extend **LOG_ACCUM with log instructions to modify wcprop PROPNAME
166 for PATH, setting it to PROPVAL.
169 svn_wc__loggy_modify_wcprop(svn_stringbuf_t
**log_accum
,
170 svn_wc_adm_access_t
*adm_access
,
172 const char *propname
,
177 /* Extend **LOG_ACCUM with log instructions to move the file SRC_PATH to
178 DST_PATH, if it exists. If it doesn't and REMOVE_DST_IF_NO_SRC is TRUE
179 the file at DST_PATH will be deleted if any.
181 Sets *DST_MODIFIED, if either the copy or the remove have been carried out.
184 svn_wc__loggy_move(svn_stringbuf_t
**log_accum
,
185 svn_boolean_t
*dst_modified
,
186 svn_wc_adm_access_t
*adm_access
,
187 const char *src_path
, const char *dst_path
,
188 svn_boolean_t remove_dst_if_no_src
,
193 /* Extend **LOG_ACCUM with log instructions to set permissions of PATH
194 to 'executable' if it has the 'executable' property set.
197 svn_wc__loggy_maybe_set_executable(svn_stringbuf_t
**log_accum
,
198 svn_wc_adm_access_t
*adm_access
,
202 /* Extend **LOG_ACCUM with log instructions to set permissions of PATH
203 to 'readonly' if it has the 'needs-lock' property set and there is
204 no lock for the file in the working copy.
207 svn_wc__loggy_maybe_set_readonly(svn_stringbuf_t
**log_accum
,
208 svn_wc_adm_access_t
*adm_access
,
213 /* Extend **LOG_ACCUM with log instructions to set the timestamp of PATH
214 in the entry field with name TIME_PROP.
216 Use SVN_WC__ENTRY_ATTR_* values for TIME_PROP.
219 svn_wc__loggy_set_entry_timestamp_from_wc(svn_stringbuf_t
**log_accum
,
220 svn_wc_adm_access_t
*adm_access
,
222 const char *time_prop
,
226 /* Extend **LOG_ACCUM with log instructions to set the file size of PATH
227 in the entries' WORKING_SIZE field.
230 svn_wc__loggy_set_entry_working_size_from_wc(svn_stringbuf_t
**log_accum
,
231 svn_wc_adm_access_t
*adm_access
,
236 /* Extend **LOG_ACCUM with log instructions to set permissions of PATH
240 svn_wc__loggy_set_readonly(svn_stringbuf_t
**log_accum
,
241 svn_wc_adm_access_t
*adm_access
,
245 /* Extend **LOG_ACCUM with log instructions to set the timestamp of PATH.
249 svn_wc__loggy_set_timestamp(svn_stringbuf_t
**log_accum
,
250 svn_wc_adm_access_t
*adm_access
,
255 /* Extend **LOG_ACCUM with log instructions to remove the file
256 BASE_NAME, if it exists.
259 svn_wc__loggy_remove(svn_stringbuf_t
**log_accum
,
260 svn_wc_adm_access_t
*adm_access
,
264 /* Extend **LOG_ACCUM with instructions to cause the working copy of ADM_ACCESS
265 to be upgraded to FORMAT. */
267 svn_wc__loggy_upgrade_format(svn_stringbuf_t
**log_accum
,
268 svn_wc_adm_access_t
*adm_access
,
273 /* Create a log file with LOG_NUMBER. Write LOG_CONTENT to it and close-
274 and-sync afterwards. ADM_ACCESS must point to a locked working copy.
277 Helper to eliminate code duplication. */
279 svn_wc__write_log(svn_wc_adm_access_t
*adm_access
,
280 int log_number
, svn_stringbuf_t
*log_content
,
284 /* Process the instructions in the log file for ADM_ACCESS.
285 DIFF3_CMD is the external differ used by the 'SVN_WC__LOG_MERGE'
286 log entry. It is always safe to pass null for this.
288 If the log fails on its first command, return the error
289 SVN_ERR_WC_BAD_ADM_LOG_START. If it fails on some subsequent
290 command, return SVN_ERR_WC_BAD_ADM_LOG. */
291 svn_error_t
*svn_wc__run_log(svn_wc_adm_access_t
*adm_access
,
292 const char *diff3_cmd
,
295 /* Similar to svn_wc__run_log except that it is assumed that the log
296 file has been run before and so some of the log commands may
297 already have been processed. */
298 svn_error_t
*svn_wc__rerun_log(svn_wc_adm_access_t
*adm_access
,
299 const char *diff3_cmd
,
305 #endif /* __cplusplus */
307 #endif /* SVN_LIBSVN_WC_LOG_H */