00001 /** 00002 * @copyright 00003 * ==================================================================== 00004 * Copyright (c) 2000-2004, 2008 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 * @defgroup svn_props_support Properties management utilities 00038 * @{ 00039 */ 00040 00041 00042 00043 /** A general in-memory representation of a single property. Most of 00044 * the time, property lists will be stored completely in hashes. But 00045 * sometimes it's useful to have an "ordered" collection of 00046 * properties, in which case we use an array of these structures. 00047 * 00048 * Also: sometimes we want a list that represents a set of property 00049 * *changes*, and in this case, an @c apr_hash_t won't work -- there's no 00050 * way to represent a property deletion, because we can't store a @c NULL 00051 * value in a hash. So instead, we use these structures. 00052 */ 00053 typedef struct svn_prop_t 00054 { 00055 const char *name; /**< Property name */ 00056 const svn_string_t *value; /**< Property value */ 00057 } svn_prop_t; 00058 00059 00060 /** 00061 * Return a duplicate of @a prop, allocated in @a pool. No part of the new 00062 * structure will be shared with @a prop. 00063 * 00064 * @since New in 1.3. 00065 */ 00066 svn_prop_t * 00067 svn_prop_dup(const svn_prop_t *prop, 00068 apr_pool_t *pool); 00069 00070 00071 /** 00072 * Duplicate an @a array of svn_prop_t items using @a pool. 00073 * 00074 * @since New in 1.3. 00075 */ 00076 apr_array_header_t * 00077 svn_prop_array_dup(const apr_array_header_t *array, 00078 apr_pool_t *pool); 00079 00080 00081 /** 00082 * Given a hash (keys <tt>const char *</tt> and values <tt>const 00083 * svn_string_t</tt>) of properties, returns an array of svn_prop_t 00084 * items using @a pool. 00085 * 00086 * @since New in 1.5. 00087 */ 00088 apr_array_header_t * 00089 svn_prop_hash_to_array(apr_hash_t *hash, 00090 apr_pool_t *pool); 00091 00092 00093 /** 00094 * Subversion distinguishes among several kinds of properties, 00095 * particularly on the client-side. There is no "unknown" kind; if 00096 * there's nothing special about a property name, the default category 00097 * is @c svn_prop_regular_kind. 00098 */ 00099 typedef enum svn_prop_kind 00100 { 00101 /** In .svn/entries, i.e., author, date, etc. */ 00102 svn_prop_entry_kind, 00103 00104 /** Client-side only, stored by specific RA layer. */ 00105 svn_prop_wc_kind, 00106 00107 /** Seen if user does "svn proplist"; note that this includes some "svn:" 00108 * props and all user props, i.e. ones stored in the repository fs. 00109 */ 00110 svn_prop_regular_kind 00111 } svn_prop_kind_t; 00112 00113 /** Return the prop kind of a property named @a prop_name, and 00114 * (if @a prefix_len is non-@c NULL) set @a *prefix_len to the length of 00115 * the prefix of @a prop_name that was sufficient to distinguish its kind. 00116 */ 00117 svn_prop_kind_t 00118 svn_property_kind(int *prefix_len, 00119 const char *prop_name); 00120 00121 00122 /** Return @c TRUE iff @a prop_name represents the name of a Subversion 00123 * property. 00124 */ 00125 svn_boolean_t 00126 svn_prop_is_svn_prop(const char *prop_name); 00127 00128 00129 /** Return @c TRUE iff @a props has at least one property whose name 00130 * represents the name of a Subversion property. 00131 * 00132 * @since New in 1.5. 00133 */ 00134 svn_boolean_t 00135 svn_prop_has_svn_prop(const apr_hash_t *props, 00136 apr_pool_t *pool); 00137 00138 /** Return @c TRUE iff @a prop_name is a Subversion property whose 00139 * value is interpreted as a boolean. 00140 * 00141 * @since New in 1.5 00142 */ 00143 svn_boolean_t 00144 svn_prop_is_boolean(const char *prop_name); 00145 00146 /** If @a prop_name requires that its value be stored as UTF8/LF in the 00147 * repository, then return @c TRUE. Else return @c FALSE. This is for 00148 * users of libsvn_client or libsvn_fs, since it their responsibility 00149 * to do this translation in both directions. (See 00150 * svn_subst_translate_string()/svn_subst_detranslate_string() for 00151 * help with this task.) 00152 */ 00153 svn_boolean_t 00154 svn_prop_needs_translation(const char *prop_name); 00155 00156 00157 /** Given a @a proplist array of @c svn_prop_t structures, allocate 00158 * three new arrays in @a pool. Categorize each property and then 00159 * create new @c svn_prop_t structures in the proper lists. Each new 00160 * @c svn_prop_t structure's fields will point to the same data within 00161 * @a proplist's structures. 00162 * 00163 * Callers may pass NULL for each of the property lists in which they 00164 * are uninterested. If no props exist in a certain category, and the 00165 * property list argument for that category is non-NULL, then that 00166 * array will come back with <tt>->nelts == 0</tt>. 00167 * 00168 * ### Hmmm, maybe a better future interface is to return an array of 00169 * arrays, where the index into the array represents the index 00170 * into @c svn_prop_kind_t. That way we can add more prop kinds 00171 * in the future without changing this interface... 00172 */ 00173 svn_error_t * 00174 svn_categorize_props(const apr_array_header_t *proplist, 00175 apr_array_header_t **entry_props, 00176 apr_array_header_t **wc_props, 00177 apr_array_header_t **regular_props, 00178 apr_pool_t *pool); 00179 00180 00181 /** Given two property hashes (<tt>const char *name</tt> -> <tt>const 00182 * svn_string_t *value</tt>), deduce the differences between them (from 00183 * @a source_props -> @c target_props). Return these changes as a series of 00184 * @c svn_prop_t structures stored in @a propdiffs, allocated from @a pool. 00185 * 00186 * For note, here's a quick little table describing the logic of this 00187 * routine: 00188 * 00189 * @verbatim 00190 basehash localhash event 00191 -------- --------- ----- 00192 value = foo value = NULL Deletion occurred. 00193 value = foo value = bar Set occurred (modification) 00194 value = NULL value = baz Set occurred (creation) @endverbatim 00195 */ 00196 svn_error_t * 00197 svn_prop_diffs(apr_array_header_t **propdiffs, 00198 apr_hash_t *target_props, 00199 apr_hash_t *source_props, 00200 apr_pool_t *pool); 00201 00202 00203 /** 00204 * Return @c TRUE iff @a prop_name is a valid property name. 00205 * 00206 * For now, "valid" means the ASCII subset of an XML "Name". 00207 * XML "Name" is defined at http://www.w3.org/TR/REC-xml#sec-common-syn 00208 * 00209 * @since New in 1.5. 00210 */ 00211 svn_boolean_t 00212 svn_prop_name_is_valid(const char *prop_name); 00213 00214 00215 00216 /* Defines for reserved ("svn:") property names. */ 00217 00218 /** All Subversion property names start with this. */ 00219 #define SVN_PROP_PREFIX "svn:" 00220 00221 00222 /** Visible properties 00223 * 00224 * These are regular properties that are attached to ordinary files 00225 * and dirs, and are visible (and tweakable) by svn client programs 00226 * and users. Adding these properties causes specific effects. 00227 * 00228 * @note the values of these properties are always UTF8-encoded with 00229 * LF line-endings. It is the burden of svn library users to enforce 00230 * this. Use svn_prop_needs_translation() to discover if a 00231 * certain property needs translation, and you can use 00232 * svn_subst_translate_string()/svn_subst_detranslate_string() 00233 * to do the translation. 00234 * 00235 * @defgroup svn_prop_visible_props Visible properties 00236 * @{ 00237 */ 00238 00239 /* Properties whose values are interpreted as booleans (such as 00240 * svn:executable, svn:needs_lock, and svn:special) always fold their 00241 * value to this. 00242 * 00243 * @since New in 1.5. 00244 */ 00245 #define SVN_PROP_BOOLEAN_TRUE "*" 00246 00247 /** The mime-type of a given file. */ 00248 #define SVN_PROP_MIME_TYPE SVN_PROP_PREFIX "mime-type" 00249 00250 /** The ignore patterns for a given directory. */ 00251 #define SVN_PROP_IGNORE SVN_PROP_PREFIX "ignore" 00252 00253 /** The line ending style for a given file. */ 00254 #define SVN_PROP_EOL_STYLE SVN_PROP_PREFIX "eol-style" 00255 00256 /** The "activated" keywords (for keyword substitution) for a given file. */ 00257 #define SVN_PROP_KEYWORDS SVN_PROP_PREFIX "keywords" 00258 00259 /** Set to either TRUE or FALSE if we want a file to be executable or not. */ 00260 #define SVN_PROP_EXECUTABLE SVN_PROP_PREFIX "executable" 00261 00262 /** The value to force the executable property to when set. 00263 * 00264 * @deprecated Provided for backward compatibility with the 1.4 API. 00265 * Use @c SVN_PROP_BOOLEAN_TRUE instead. 00266 */ 00267 #define SVN_PROP_EXECUTABLE_VALUE SVN_PROP_BOOLEAN_TRUE 00268 00269 /** Set to TRUE ('*') if we want a file to be set to read-only when 00270 * not locked. FALSE is indicated by deleting the property. */ 00271 #define SVN_PROP_NEEDS_LOCK SVN_PROP_PREFIX "needs-lock" 00272 00273 /** The value to force the needs-lock property to when set. 00274 * 00275 * @deprecated Provided for backward compatibility with the 1.4 API. 00276 * Use @c SVN_PROP_BOOLEAN_TRUE instead. 00277 */ 00278 #define SVN_PROP_NEEDS_LOCK_VALUE SVN_PROP_BOOLEAN_TRUE 00279 00280 /** Set if the file should be treated as a special file. */ 00281 #define SVN_PROP_SPECIAL SVN_PROP_PREFIX "special" 00282 00283 /** The value to force the special property to when set. 00284 * 00285 * @deprecated Provided for backward compatibility with the 1.4 API. 00286 * Use @c SVN_PROP_BOOLEAN_TRUE instead. 00287 */ 00288 #define SVN_PROP_SPECIAL_VALUE SVN_PROP_BOOLEAN_TRUE 00289 00290 /** Describes external items to check out into this directory. 00291 * 00292 * The format is a series of lines, such as: 00293 * 00294 *@verbatim 00295 localdir1 http://url.for.external.source/etc/ 00296 localdir1/foo http://url.for.external.source/foo 00297 localdir1/bar http://blah.blah.blah/repositories/theirproj 00298 localdir1/bar/baz http://blorg.blorg.blorg/basement/code 00299 localdir2 http://another.url/blah/blah/blah 00300 localdir3 http://and.so.on/and/so/forth @endverbatim 00301 * 00302 * The subdir names on the left side are relative to the directory on 00303 * which this property is set. 00304 */ 00305 #define SVN_PROP_EXTERNALS SVN_PROP_PREFIX "externals" 00306 00307 /** Merge info property used to record a resource's merge history. 00308 * 00309 * The format is a series of lines containing merge paths and revision 00310 * ranges, such as: 00311 * 00312 * @verbatim 00313 /trunk: 1-6,9,37-38 00314 /trunk/foo: 10 @endverbatim 00315 */ 00316 #define SVN_PROP_MERGEINFO SVN_PROP_PREFIX "mergeinfo" 00317 00318 00319 /** Meta-data properties. 00320 * 00321 * ==================================================================== 00322 * They are documented here to avoid name reuse in other branches; 00323 * the "plain" subversion doesn't use them (yet?). 00324 * ==================================================================== 00325 * 00326 * The following properties are used for storing meta-data about 00327 * individual entries in the meta-data branches of subversion, 00328 * see issue #1256 or browseable at 00329 * http://svn.collab.net/viewvc/svn/branches/meta-data-versioning/ . 00330 * Furthermore @c svntar (http://svn.borg.ch/svntar/) and @c FSVS 00331 * (http://fsvs.tigris.org/) use these, too. 00332 * 00333 * Please note that these formats are very UNIX-centric currently; 00334 * a bit of discussion about Windows can be read at 00335 * http://article.gmane.org/gmane.comp.version-control.subversion.devel/103991 00336 * 00337 * @defgroup svn_prop_meta_data Meta-data properties 00338 * @{ */ 00339 00340 /** The files' last modification time. 00341 * This is stored as string in the form @c "2008-08-07T07:38:51.008782Z", to 00342 * be converted by the functions @c svn_time_to_cstring() and 00343 * @c svn_time_from_cstring(). */ 00344 #define SVN_PROP_TEXT_TIME SVN_PROP_PREFIX "text-time" 00345 00346 /** The files' owner. 00347 * Stored as numeric ID, optionally followed by whitespace and the string: 00348 * @c "1000 pmarek". Parsers @b should accept any number of whitespace, 00349 * and writers @b should put exactly a single space. */ 00350 #define SVN_PROP_OWNER SVN_PROP_PREFIX "owner" 00351 00352 /** The files' group. 00353 * The same format as for @c SVN_PROP_OWNER, the owner-property. */ 00354 #define SVN_PROP_GROUP SVN_PROP_PREFIX "group" 00355 00356 /** The files' unix-mode. 00357 * Stored in octal, with a leading @c 0; may have 5 digits if any of @c setuid, 00358 * @c setgid or @c sticky are set; an example is @c "0644". */ 00359 #define SVN_PROP_UNIX_MODE SVN_PROP_PREFIX "unix-mode" 00360 00361 /** @} */ /* Meta-data properties */ 00362 00363 00364 /** @} */ 00365 00366 /** WC props are props that are invisible to users: they're generated 00367 * by an RA layer, and stored in secret parts of .svn/. 00368 * 00369 * @defgroup svn_prop_invisible_props Invisible properties 00370 * @{ 00371 */ 00372 00373 /** The property name *prefix* that makes a property a "WC property". 00374 * 00375 * For example, WebDAV RA implementations might store a versioned-resource url as a WC 00376 * prop like this: 00377 * 00378 * @verbatim 00379 name = svn:wc:dav_url 00380 val = http://www.lyra.org/repos/452348/e.289 @endverbatim 00381 * 00382 * The client will try to protect WC props by warning users against 00383 * changing them. The client will also send them back to the RA layer 00384 * when committing. 00385 */ 00386 #define SVN_PROP_WC_PREFIX SVN_PROP_PREFIX "wc:" 00387 00388 /** Another type of non-user-visible property. "Entry properties" are 00389 * stored as fields with the administrative 'entries' file. 00390 */ 00391 #define SVN_PROP_ENTRY_PREFIX SVN_PROP_PREFIX "entry:" 00392 00393 /** The revision this entry was last committed to on. */ 00394 #define SVN_PROP_ENTRY_COMMITTED_REV SVN_PROP_ENTRY_PREFIX "committed-rev" 00395 00396 /** The date this entry was last committed to on. */ 00397 #define SVN_PROP_ENTRY_COMMITTED_DATE SVN_PROP_ENTRY_PREFIX "committed-date" 00398 00399 /** The author who last committed to this entry. */ 00400 #define SVN_PROP_ENTRY_LAST_AUTHOR SVN_PROP_ENTRY_PREFIX "last-author" 00401 00402 /** The UUID of this entry's repository. */ 00403 #define SVN_PROP_ENTRY_UUID SVN_PROP_ENTRY_PREFIX "uuid" 00404 00405 /** The lock token for this entry. 00406 * @since New in 1.2. */ 00407 #define SVN_PROP_ENTRY_LOCK_TOKEN SVN_PROP_ENTRY_PREFIX "lock-token" 00408 00409 /** When custom, user-defined properties are passed over the wire, they will 00410 * have this prefix added to their name. 00411 */ 00412 #define SVN_PROP_CUSTOM_PREFIX SVN_PROP_PREFIX "custom:" 00413 00414 /** @} */ 00415 00416 /** 00417 * These are reserved properties attached to a "revision" object in 00418 * the repository filesystem. They can be queried by using 00419 * svn_fs_revision_prop(). 00420 * 00421 * @defgroup svn_props_revision_props Revision properties 00422 * @{ 00423 */ 00424 00425 /** The fs revision property that stores a commit's author. */ 00426 #define SVN_PROP_REVISION_AUTHOR SVN_PROP_PREFIX "author" 00427 00428 /** The fs revision property that stores a commit's log message. */ 00429 #define SVN_PROP_REVISION_LOG SVN_PROP_PREFIX "log" 00430 00431 /** The fs revision property that stores a commit's date. */ 00432 #define SVN_PROP_REVISION_DATE SVN_PROP_PREFIX "date" 00433 00434 /** The fs revision property that stores a commit's "original" date. 00435 * 00436 * The svn:date property must be monotonically increasing, along with 00437 * the revision number. In certain scenarios, this may pose a problem 00438 * when the revision represents a commit that occurred at a time which 00439 * does not fit within the sequencing required for svn:date. This can 00440 * happen, for instance, when the revision represents a commit to a 00441 * foreign version control system, or possibly when two Subversion 00442 * repositories are combined. This property can be used to record the 00443 * TRUE, original date of the commit. 00444 */ 00445 #define SVN_PROP_REVISION_ORIG_DATE SVN_PROP_PREFIX "original-date" 00446 00447 /** The presence of this fs revision property indicates that the 00448 * revision was automatically generated by the mod_dav_svn 00449 * autoversioning feature. The value is irrelevant. 00450 */ 00451 #define SVN_PROP_REVISION_AUTOVERSIONED SVN_PROP_PREFIX "autoversioned" 00452 00453 00454 /* More reserved revision props in the 'svn:' namespace, used by the 00455 svnsync tool: */ 00456 00457 /** Prefix for all svnsync custom properties. */ 00458 #define SVNSYNC_PROP_PREFIX SVN_PROP_PREFIX "sync-" 00459 00460 /* The following revision properties are set on revision 0 of 00461 * destination repositories by svnsync: 00462 */ 00463 00464 /** Used to enforce mutually exclusive destination repository access. */ 00465 #define SVNSYNC_PROP_LOCK SVNSYNC_PROP_PREFIX "lock" 00466 00467 /** Identifies the repository's source URL. */ 00468 #define SVNSYNC_PROP_FROM_URL SVNSYNC_PROP_PREFIX "from-url" 00469 /** Identifies the repository's source UUID. */ 00470 #define SVNSYNC_PROP_FROM_UUID SVNSYNC_PROP_PREFIX "from-uuid" 00471 00472 /** Identifies the last completely mirrored revision. */ 00473 #define SVNSYNC_PROP_LAST_MERGED_REV SVNSYNC_PROP_PREFIX "last-merged-rev" 00474 00475 /** Identifies the revision currently being copied. */ 00476 #define SVNSYNC_PROP_CURRENTLY_COPYING SVNSYNC_PROP_PREFIX "currently-copying" 00477 00478 00479 /** 00480 * This is a list of all revision properties. 00481 */ 00482 #define SVN_PROP_REVISION_ALL_PROPS SVN_PROP_REVISION_AUTHOR, \ 00483 SVN_PROP_REVISION_LOG, \ 00484 SVN_PROP_REVISION_DATE, \ 00485 SVN_PROP_REVISION_AUTOVERSIONED, \ 00486 SVN_PROP_REVISION_ORIG_DATE, \ 00487 SVNSYNC_PROP_LOCK, \ 00488 SVNSYNC_PROP_FROM_URL, \ 00489 SVNSYNC_PROP_FROM_UUID, \ 00490 SVNSYNC_PROP_LAST_MERGED_REV, \ 00491 SVNSYNC_PROP_CURRENTLY_COPYING, 00492 00493 /** @} */ 00494 00495 /** @} */ 00496 00497 00498 00499 #ifdef __cplusplus 00500 } 00501 #endif /* __cplusplus */ 00502 00503 #endif /* SVN_PROPS_H */
1.3.9.1