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 apr_array of the type below.
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;
00052 const svn_string_t *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 an @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 argment 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() above to discover if a
00159 * certain property needs translation, and you can use
00160 * @c svn_subst_translate_string()/@c svn_subst_[de]translate_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 /** Describes external items to check out into this directory.
00186 *
00187 * The format is a series of lines, such as:
00188 *
00189 *<pre> localdir1 http://url.for.external.source/etc/
00190 * localdir1/foo http://url.for.external.source/foo
00191 * localdir1/bar http://blah.blah.blah/repositories/theirproj
00192 * localdir1/bar/baz http://blorg.blorg.blorg/basement/code
00193 * localdir2 http://another.url/blah/blah/blah
00194 * localdir3 http://and.so.on/and/so/forth</pre>
00195 *
00196 * The subdir names on the left side are relative to the directory on
00197 * which this property is set.
00198 */
00199 #define SVN_PROP_EXTERNALS SVN_PROP_PREFIX "externals"
00200
00201 /** @} */
00202
00203 /** WC props are props that are invisible to users: they're generated
00204 * by an RA layer, and stored in secret parts of .svn/.
00205 *
00206 * @defgroup svn_prop_invisible_props Invisible properties
00207 * @{
00208 */
00209
00210 /** The propname *prefix* that makes a propname a "WC property".
00211 *
00212 * For example, ra_dav might store a versioned-resource url as a WC
00213 * prop like this:
00214 *
00215 *<pre> name = svn:wc:dav_url
00216 * val = http://www.lyra.org/repos/452348/e.289</pre>
00217 *
00218 * The client will try to protect WC props by warning users against
00219 * changing them. The client will also send them back to the RA layer
00220 * when committing.
00221 */
00222 #define SVN_PROP_WC_PREFIX SVN_PROP_PREFIX "wc:"
00223
00224 /** Another type of non-user-visible property. "Entry properties" are
00225 * stored as fields with the administrative 'entries' file.
00226 */
00227 #define SVN_PROP_ENTRY_PREFIX SVN_PROP_PREFIX "entry:"
00228
00229 /** The revision this entry was last committed to on. */
00230 #define SVN_PROP_ENTRY_COMMITTED_REV SVN_PROP_ENTRY_PREFIX "committed-rev"
00231
00232 /** The date this entry was last committed to on. */
00233 #define SVN_PROP_ENTRY_COMMITTED_DATE SVN_PROP_ENTRY_PREFIX "committed-date"
00234
00235 /** The author who last committed to this entry. */
00236 #define SVN_PROP_ENTRY_LAST_AUTHOR SVN_PROP_ENTRY_PREFIX "last-author"
00237
00238 /** The UUID of this entry's repository. */
00239 #define SVN_PROP_ENTRY_UUID SVN_PROP_ENTRY_PREFIX "uuid"
00240
00241 /** When custom, user-defined properties are passed over the wire, they will
00242 * have this prefix added to their name.
00243 */
00244 #define SVN_PROP_CUSTOM_PREFIX SVN_PROP_PREFIX "custom:"
00245
00246 /** @} */
00247
00248 /**
00249 * These are reserved properties attached to a "revision" object in
00250 * the repository filesystem. They can be queried by using
00251 * @c svn_fs_revision_prop(). They are invisible to svn clients.
00252 *
00253 * @defgroup svn_props_revision_props Revision properties
00254 * @{
00255 */
00256
00257 /** The fs revision property that stores a commit's author. */
00258 #define SVN_PROP_REVISION_AUTHOR SVN_PROP_PREFIX "author"
00259
00260 /** The fs revision property that stores a commit's log message. */
00261 #define SVN_PROP_REVISION_LOG SVN_PROP_PREFIX "log"
00262
00263 /** The fs revision property that stores a commit's date. */
00264 #define SVN_PROP_REVISION_DATE SVN_PROP_PREFIX "date"
00265
00266 /** The fs revision property that stores a commit's "original" date.
00267 *
00268 * The svn:date property must be monotonically increasing, along with
00269 * the revision number. In certain scenarios, this may pose a problem
00270 * when the revision represents a commit that occurred at a time which
00271 * does not fit within the sequencing required for svn:date. This can
00272 * happen, for instance, when the revision represents a commit to a
00273 * foreign version control system, or possibly when two Subversion
00274 * repositories are combined. This property can be used to record the
00275 * true, original date of the commit.
00276 */
00277 #define SVN_PROP_REVISION_ORIG_DATE SVN_PROP_PREFIX "original-date"
00278
00279 /*
00280 * This is a list of all revision properties.
00281 */
00282 #define SVN_PROP_REVISION_ALL_PROPS SVN_PROP_REVISION_AUTHOR, \
00283 SVN_PROP_REVISION_LOG, \
00284 SVN_PROP_REVISION_DATE, \
00285 SVN_PROP_REVISION_ORIG_DATE,
00286
00287 /** @} */
00288
00289
00290
00291 #ifdef __cplusplus
00292 }
00293 #endif /* __cplusplus */
00294
00295 #endif /* SVN_PROPS_H */
1.2.14 written by Dimitri van Heesch,
© 1997-2002