00001 /**
00002 * @copyright
00003 * ====================================================================
00004 * Copyright (c) 2000-2004 CollabNet. All rights reserved.
00005 *
00006 * This software is licensed as described in the file COPYING, which
00007 * you should have received as part of this distribution. The terms
00008 * are also available at http://subversion.tigris.org/license-1.html.
00009 * If newer versions of this license are posted there, you may use a
00010 * newer version instead, at your option.
00011 *
00012 * This software consists of voluntary contributions made by many
00013 * individuals. For exact contribution history, see the revision
00014 * history and logs, available at http://subversion.tigris.org/.
00015 * ====================================================================
00016 * @endcopyright
00017 *
00018 * @file svn_props.h
00019 * @brief Subversion properties
00020 */
00021
00022 /* ==================================================================== */
00023
00024 #ifndef SVN_PROPS_H
00025 #define SVN_PROPS_H
00026
00027 #include <apr_pools.h>
00028 #include <apr_tables.h>
00029
00030 #include "svn_string.h"
00031
00032 #ifdef __cplusplus
00033 extern "C" {
00034 #endif /* __cplusplus */
00035
00036
00037
00038
00039 /** A general in-memory representation of a single property. Most of
00040 * the time, property lists will be stored completely in hashes. But
00041 * sometimes it's useful to have an "ordered" collection of
00042 * properties, in which case we use an array of these structures.
00043 *
00044 * Also: sometimes we want a list that represents a set of property
00045 * *changes*, and in this case, an @c apr_hash_t won't work -- there's no
00046 * way to represent a property deletion, because we can't store a @c NULL
00047 * value in a hash. So instead, we use these structures.
00048 */
00049 typedef struct svn_prop_t
00050 {
00051 const char *name; /**< Property name */
00052 const svn_string_t *value; /**< Property value */
00053 } svn_prop_t;
00054
00055
00056 /**
00057 * Subversion distinguishes among several kinds of properties,
00058 * particularly on the client-side. There is no "unknown" kind; if
00059 * there's nothing special about a property name, the default category
00060 * is @c svn_prop_regular_kind.
00061 */
00062 typedef enum svn_prop_kind
00063 {
00064 /** In .svn/entries, i.e., author, date, etc. */
00065 svn_prop_entry_kind,
00066
00067 /** Client-side only, stored by specific RA layer. */
00068 svn_prop_wc_kind,
00069
00070 /** Seen if user does "svn proplist"; note that this includes some "svn:"
00071 * props and all user props, i.e. ones stored in the repository fs.
00072 */
00073 svn_prop_regular_kind
00074 } svn_prop_kind_t;
00075
00076 /** Return the prop kind of a property named @a name, and (if @a prefix_len
00077 * is non-@c NULL) set @a *prefix_len to the length of the prefix of @a name
00078 * that was sufficient to distinguish its kind.
00079 */
00080 svn_prop_kind_t svn_property_kind (int *prefix_len,
00081 const char *prop_name);
00082
00083
00084 /** Return @c TRUE iff @a prop_name represents the name of a Subversion
00085 * property.
00086 */
00087 svn_boolean_t svn_prop_is_svn_prop (const char *prop_name);
00088
00089
00090 /** If @a propname requires that its value be stored as UTF8/LF in the
00091 * repository, then return @c TRUE. Else return @c FALSE. This is for
00092 * users of libsvn_client or libsvn_fs, since it their responsibility
00093 * to do this translation in both directions. (See
00094 * @c svn_subst_translate_string/@c svn_subst_detranslate_string for
00095 * help with this task.)
00096 */
00097 svn_boolean_t svn_prop_needs_translation (const char *propname);
00098
00099
00100 /** Given a @a proplist array of @c svn_prop_t structures, allocate
00101 * three new arrays in @a pool. Categorize each property and then
00102 * create new @c svn_prop_t structures in the proper lists. Each new
00103 * @c svn_prop_t structure's fields will point to the same data within
00104 * @a proplist's structures.
00105 *
00106 * Callers may pass NULL for each of the property lists in which they
00107 * are uninterested. If no props exist in a certain category, and the
00108 * property list argument for that category is non-NULL, then that
00109 * array will come back with <tt>->nelts == 0</tt>.
00110 *
00111 * ### Hmmm, maybe a better future interface is to return an array of
00112 * arrays, where the index into the array represents the index
00113 * into @c svn_prop_kind_t. That way we can add more prop kinds
00114 * in the future without changing this interface...
00115 */
00116 svn_error_t *svn_categorize_props (const apr_array_header_t *proplist,
00117 apr_array_header_t **entry_props,
00118 apr_array_header_t **wc_props,
00119 apr_array_header_t **regular_props,
00120 apr_pool_t *pool);
00121
00122
00123 /** Given two property hashes (<tt>const char *name</tt> -> <tt>const
00124 * svn_string_t *value</tt>), deduce the differences between them (from
00125 * @a source_props -> @c target_props). Return these changes as a series of
00126 * @c svn_prop_t structures stored in @a propdiffs, allocated from @a pool.
00127 *
00128 * For note, here's a quick little table describing the logic of this
00129 * routine:
00130 *
00131 *<pre> basehash localhash event
00132 * -------- --------- -----
00133 * value = foo value = NULL Deletion occurred.
00134 * value = foo value = bar Set occurred (modification)
00135 * value = NULL value = baz Set occurred (creation)</pre>
00136 */
00137 svn_error_t *svn_prop_diffs (apr_array_header_t **propdiffs,
00138 apr_hash_t *target_props,
00139 apr_hash_t *source_props,
00140 apr_pool_t *pool);
00141
00142
00143
00144 /* Defines for reserved ("svn:") property names. */
00145
00146 /** All Subversion property names start with this. */
00147 #define SVN_PROP_PREFIX "svn:"
00148
00149
00150 /** Visible properties
00151 *
00152 * These are regular properties that are attached to ordinary files
00153 * and dirs, and are visible (and tweakable) by svn client programs
00154 * and users. Adding these properties causes specific effects.
00155 *
00156 * NOTE: the values of these properties are always UTF8-encoded with
00157 * LF line-endings. It is the burden of svn library users to enforce
00158 * this. Use @c svn_prop_needs_translation() to discover if a
00159 * certain property needs translation, and you can use
00160 * @c svn_subst_translate_string()/@c svn_subst_detranslate_string()
00161 * to do the translation.
00162 *
00163 * @defgroup svn_prop_visible_props Visible properties
00164 * @{
00165 */
00166
00167 /** The mime-type of a given file. */
00168 #define SVN_PROP_MIME_TYPE SVN_PROP_PREFIX "mime-type"
00169
00170 /** The ignore patterns for a given directory. */
00171 #define SVN_PROP_IGNORE SVN_PROP_PREFIX "ignore"
00172
00173 /** The line ending style for a given file. */
00174 #define SVN_PROP_EOL_STYLE SVN_PROP_PREFIX "eol-style"
00175
00176 /** The "activated" keywords (for keyword substitution) for a given file. */
00177 #define SVN_PROP_KEYWORDS SVN_PROP_PREFIX "keywords"
00178
00179 /** Set to either TRUE or FALSE if we want a file to be executable or not. */
00180 #define SVN_PROP_EXECUTABLE SVN_PROP_PREFIX "executable"
00181
00182 /** The value to force the executable property to when set */
00183 #define SVN_PROP_EXECUTABLE_VALUE "*"
00184
00185 /** Set to TRUE ('*') if we want a file to be set to read-only when
00186 * not locked. FALSE is indicated by deleting the property. */
00187 #define SVN_PROP_NEEDS_LOCK SVN_PROP_PREFIX "needs-lock"
00188
00189 /** The value to force the needs-lock property to when set */
00190 #define SVN_PROP_NEEDS_LOCK_VALUE "*"
00191
00192 /** Set if the file should be treated as a special file. */
00193 #define SVN_PROP_SPECIAL SVN_PROP_PREFIX "special"
00194
00195 /** The value to force the special property to when set. */
00196 #define SVN_PROP_SPECIAL_VALUE "*"
00197
00198 /** Describes external items to check out into this directory.
00199 *
00200 * The format is a series of lines, such as:
00201 *
00202 *<pre> localdir1 http://url.for.external.source/etc/
00203 * localdir1/foo http://url.for.external.source/foo
00204 * localdir1/bar http://blah.blah.blah/repositories/theirproj
00205 * localdir1/bar/baz http://blorg.blorg.blorg/basement/code
00206 * localdir2 http://another.url/blah/blah/blah
00207 * localdir3 http://and.so.on/and/so/forth</pre>
00208 *
00209 * The subdir names on the left side are relative to the directory on
00210 * which this property is set.
00211 */
00212 #define SVN_PROP_EXTERNALS SVN_PROP_PREFIX "externals"
00213
00214 /** @} */
00215
00216 /** WC props are props that are invisible to users: they're generated
00217 * by an RA layer, and stored in secret parts of .svn/.
00218 *
00219 * @defgroup svn_prop_invisible_props Invisible properties
00220 * @{
00221 */
00222
00223 /** The propname *prefix* that makes a propname a "WC property".
00224 *
00225 * For example, ra_dav might store a versioned-resource url as a WC
00226 * prop like this:
00227 *
00228 *<pre> name = svn:wc:dav_url
00229 * val = http://www.lyra.org/repos/452348/e.289</pre>
00230 *
00231 * The client will try to protect WC props by warning users against
00232 * changing them. The client will also send them back to the RA layer
00233 * when committing.
00234 */
00235 #define SVN_PROP_WC_PREFIX SVN_PROP_PREFIX "wc:"
00236
00237 /** Another type of non-user-visible property. "Entry properties" are
00238 * stored as fields with the administrative 'entries' file.
00239 */
00240 #define SVN_PROP_ENTRY_PREFIX SVN_PROP_PREFIX "entry:"
00241
00242 /** The revision this entry was last committed to on. */
00243 #define SVN_PROP_ENTRY_COMMITTED_REV SVN_PROP_ENTRY_PREFIX "committed-rev"
00244
00245 /** The date this entry was last committed to on. */
00246 #define SVN_PROP_ENTRY_COMMITTED_DATE SVN_PROP_ENTRY_PREFIX "committed-date"
00247
00248 /** The author who last committed to this entry. */
00249 #define SVN_PROP_ENTRY_LAST_AUTHOR SVN_PROP_ENTRY_PREFIX "last-author"
00250
00251 /** The UUID of this entry's repository. */
00252 #define SVN_PROP_ENTRY_UUID SVN_PROP_ENTRY_PREFIX "uuid"
00253
00254 /** @since New in 1.2.
00255 * The lock token for this entry. */
00256 #define SVN_PROP_ENTRY_LOCK_TOKEN SVN_PROP_ENTRY_PREFIX "lock-token"
00257
00258 /** When custom, user-defined properties are passed over the wire, they will
00259 * have this prefix added to their name.
00260 */
00261 #define SVN_PROP_CUSTOM_PREFIX SVN_PROP_PREFIX "custom:"
00262
00263 /** @} */
00264
00265 /**
00266 * These are reserved properties attached to a "revision" object in
00267 * the repository filesystem. They can be queried by using
00268 * @c svn_fs_revision_prop(). They are invisible to svn clients.
00269 *
00270 * @defgroup svn_props_revision_props Revision properties
00271 * @{
00272 */
00273
00274 /** The fs revision property that stores a commit's author. */
00275 #define SVN_PROP_REVISION_AUTHOR SVN_PROP_PREFIX "author"
00276
00277 /** The fs revision property that stores a commit's log message. */
00278 #define SVN_PROP_REVISION_LOG SVN_PROP_PREFIX "log"
00279
00280 /** The fs revision property that stores a commit's date. */
00281 #define SVN_PROP_REVISION_DATE SVN_PROP_PREFIX "date"
00282
00283 /** The fs revision property that stores a commit's "original" date.
00284 *
00285 * The svn:date property must be monotonically increasing, along with
00286 * the revision number. In certain scenarios, this may pose a problem
00287 * when the revision represents a commit that occurred at a time which
00288 * does not fit within the sequencing required for svn:date. This can
00289 * happen, for instance, when the revision represents a commit to a
00290 * foreign version control system, or possibly when two Subversion
00291 * repositories are combined. This property can be used to record the
00292 * true, original date of the commit.
00293 */
00294 #define SVN_PROP_REVISION_ORIG_DATE SVN_PROP_PREFIX "original-date"
00295
00296 /** The presence of this fs revision property indicates that the
00297 * revision was automatically generated by the mod_dav_svn
00298 * autoversioning feature. The value is irrelevant.
00299 */
00300 #define SVN_PROP_REVISION_AUTOVERSIONED SVN_PROP_PREFIX "autoversioned"
00301
00302 /**
00303 * This is a list of all revision properties.
00304 */
00305 #define SVN_PROP_REVISION_ALL_PROPS SVN_PROP_REVISION_AUTHOR, \
00306 SVN_PROP_REVISION_LOG, \
00307 SVN_PROP_REVISION_DATE, \
00308 SVN_PROP_REVISION_AUTOVERSIONED, \
00309 SVN_PROP_REVISION_ORIG_DATE,
00310
00311 /** @} */
00312
00313
00314
00315 #ifdef __cplusplus
00316 }
00317 #endif /* __cplusplus */
00318
00319 #endif /* SVN_PROPS_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002