You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2012/04/23 14:33:03 UTC
svn commit: r1329209 [5/38] - in /subversion/branches/javahl-ra: ./ build/
build/ac-macros/ build/generator/ build/generator/templates/ build/win32/
contrib/client-side/emacs/ contrib/client-side/vim/
contrib/server-side/mod_dontdothat/ notes/ notes/ap...
Modified: subversion/branches/javahl-ra/subversion/include/svn_editor.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_editor.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_editor.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_editor.h Mon Apr 23 12:32:48 2012
@@ -87,7 +87,7 @@ extern "C" {
* receiver editing its tree to the target state defined by the driver.
*
*
- * HISTORY
+ * <h3>History</h3>
*
* Classically, Subversion had a notion of a "tree delta" which could be
* passed around as an independent entity. Theory implied this delta was an
@@ -117,6 +117,31 @@ extern "C" {
* the most common functionality (cancellation and debugging) have been
* integrated directly into this new editor system.
*
+ *
+ * <h3>Implementation Plan</h3>
+ * @note This section can be removed after Ev2 is fully implemented.
+ *
+ * The delta editor is pretty engrained throughout Subversion, so attempting
+ * to replace it in situ is somewhat akin to performing open heart surgery
+ * while the patient is running a marathon. However, a viable plan should
+ * make things a bit easier, and help parallelize the work.
+ *
+ * In short, the following items need to be done:
+ * -# Implement backward compatibility wrappers ("shims")
+ * -# Use shims to update editor consumers to Ev2
+ * -# Update editor producers to drive Ev2
+ * - This will largely involve rewriting the RA layers to accept and
+ * send Ev2 commands
+ * -# Optimize consumers and producers to leverage the features of Ev2
+ *
+ * The shims are largely self-contained, and as of this writing, are almost
+ * complete. They can be released without much ado. However, they do add
+ * <em>significant</em> performance regressions, which make releasing code
+ * which is half-delta-editor and half-Ev2 inadvisable. As such, the updating
+ * of producers and consumers to Ev2 will probably need to wait until 1.9,
+ * though it could be largely parallelized.
+ *
+ *
* @defgroup svn_editor The editor interface
* @{
*/
@@ -128,6 +153,15 @@ extern "C" {
* "should", "should not", "recommended", "may", and "optional" in this
* document are to be interpreted as described in RFC 2119.
*
+ * @note The editor objects are *not* reentrant. The receiver should not
+ * directly or indirectly invoke an editor API with the same object unless
+ * it has been marked as explicitly supporting reentrancy during a
+ * receiver's callback. This limitation extends to the cancellation
+ * callback, too. (This limitation is due to the scratch_pool shared by
+ * all callbacks, and cleared after each callback; a reentrant call could
+ * clear the outer call's pool). Note that the code itself is reentrant, so
+ * there is no problem using the APIs on different editor objects.
+ *
* \n
* <h3>Life-Cycle</h3>
*
@@ -151,12 +185,13 @@ extern "C" {
* svn_editor_setcb_add_file() \n
* svn_editor_setcb_add_symlink() \n
* svn_editor_setcb_add_absent() \n
- * svn_editor_setcb_set_props() \n
- * svn_editor_setcb_set_text() \n
- * svn_editor_setcb_set_target() \n
+ * svn_editor_setcb_alter_directory() \n
+ * svn_editor_setcb_alter_file() \n
+ * svn_editor_setcb_alter_symlink() \n
* svn_editor_setcb_delete() \n
* svn_editor_setcb_copy() \n
* svn_editor_setcb_move() \n
+ * svn_editor_setcb_rotate() \n
* svn_editor_setcb_complete() \n
* svn_editor_setcb_abort()
*
@@ -173,12 +208,13 @@ extern "C" {
* svn_editor_add_file() \n
* svn_editor_add_symlink() \n
* svn_editor_add_absent() \n
- * svn_editor_set_props() \n
- * svn_editor_set_text() \n
- * svn_editor_set_target() \n
+ * svn_editor_alter_directory() \n
+ * svn_editor_alter_file() \n
+ * svn_editor_alter_symlink() \n
* svn_editor_delete() \n
* svn_editor_copy() \n
- * svn_editor_move()
+ * svn_editor_move() \n
+ * svn_editor_rotate()
* \n\n
* Just before each callback invocation is carried out, the @a cancel_func
* that was passed to svn_editor_create() is invoked to poll any
@@ -214,36 +250,28 @@ extern "C" {
* follow for each child mentioned in the @a children argument of any
* svn_editor_add_directory() call.
*
- * - svn_editor_set_props()
- * - The @a complete argument must be TRUE if no more calls will follow on
- * the same path. @a complete must always be TRUE for directories.
- * - If @a complete is FALSE, and:
- * - if @a relpath is a file, this must (at some point) be followed by
- * an svn_editor_set_text() call on the same path.
- * - if @a relpath is a symlink, this must (at some point) be followed by
- * an svn_editor_set_target() call on the same path.
- *
- * - svn_editor_set_text() and svn_editor_set_target() must always occur
- * @b after an svn_editor_set_props() call on the same path, if any.
- *
- * In other words, if there are two calls coming in on the same path, the
- * first of them has to be svn_editor_set_props().
- *
- * - Other than the above two pairs of linked operations, a path should
- * never be referenced more than once by the add_* and set_* and the
- * delete operations (the "Once Rule"). The source path of a copy (and
+ * - For each node created with add_*, if its parent was created using
+ * svn_editor_add_directory(), then the new child node MUST have been
+ * mentioned in the @a children parameter of the parent's creation.
+ * This allows the parent directory to properly mark the child as
+ * "incomplete" until the child's add_* call arrives.
+ *
+ * - A path should never be referenced more than once by the add_*, alter_*,
+ * and delete operations (the "Once Rule"). The source path of a copy (and
* its children, if a directory) may be copied many times, and are
* otherwise subject to the Once Rule. The destination path of a copy
- * or move may have set_* operations applied, but not add_* or delete.
- * If the destination path of a copy or move is a directory, then its
- * children are subject to the Once Rule. The source path of a move
- * (and its child paths) may be referenced in add_*, or as the
- * destination of a copy (where these new, copied nodes are subject to
- * the Once Rule).
- *
- * - The ancestor of an added, copied-here, moved-here or modified node may
- * not be deleted. The ancestor may not be moved (instead: perform the
- * move, *then* the edits).
+ * or move may have alter_* operations applied, but not add_* or delete.
+ * If the destination path of a copy, move, or rotate is a directory,
+ * then its children are subject to the Once Rule. The source path of
+ * a move (and its child paths) may be referenced in add_*, or as the
+ * destination of a copy (where these new or copied nodes are subject
+ * to the Once Rule). Paths listed in a rotation are both sources and
+ * destinations, so they may not be referenced again in an add_* or a
+ * deletion; these paths may have alter_* operations applied.
+ *
+ * - The ancestor of an added, copied-here, moved-here, rotated, or
+ * modified node may not be deleted. The ancestor may not be moved
+ * (instead: perform the move, *then* the edits).
*
* - svn_editor_delete() must not be used to replace a path -- i.e.
* svn_editor_delete() must not be followed by an svn_editor_add_*() on
@@ -264,6 +292,10 @@ extern "C" {
* by a delete... that is fine. It is simply that svn_editor_move()
* should be used to describe a semantic move.
*
+ * - Paths mentioned in svn_editor_rotate() may have their properties
+ * and contents edited (via alter_* calls) by a previous or later call,
+ * but they may not be subject to a later move, rotate, or deletion.
+ *
* - One of svn_editor_complete() or svn_editor_abort() must be called
* exactly once, which must be the final call the driver invokes.
* Invoking svn_editor_complete() must imply that the set of changes has
@@ -271,18 +303,16 @@ extern "C" {
* svn_editor_abort() must imply that the transformation was not completed
* successfully.
*
- * - If any callback invocation returns with an error, the driver must
- * invoke svn_editor_abort() and stop transmitting operations.
+ * - If any callback invocation (besides svn_editor_complete()) returns
+ * with an error, the driver must invoke svn_editor_abort() and stop
+ * transmitting operations.
* \n\n
*
* <h3>Receiving Restrictions</h3>
- * All callbacks must complete their handling of a path before they
- * return, except for the following pairs, where a change must be completed
- * when receiving the second callback in each pair:
- * - svn_editor_set_props() (if @a complete is FALSE) and
- * svn_editor_set_text() (if the node is a file)
- * - svn_editor_set_props() (if @a complete is FALSE) and
- * svn_editor_set_target() (if the node is a symbolic link)
+ *
+ * All callbacks must complete their handling of a path before they return.
+ * Since future callbacks will never reference this path again (due to the
+ * Once Rule), the changes can and should be completed.
*
* This restriction is not recursive -- a directory's children may remain
* incomplete until later callback calls are received.
@@ -296,16 +326,34 @@ extern "C" {
* for these items are invoked.
* \n\n
*
+ * <h3>Timing and State</h3>
+ * The calls made by the driver to alter the state in the receiver are
+ * based on the receiver's *current* state, which includes all prior changes
+ * made during the edit.
+ *
+ * Example: copy A to B; set-props on A; copy A to C. The props on C
+ * should reflect the updated properties of A.
+ *
+ * Example: mv A@N to B; mv C@M to A. The second move cannot be marked as
+ * a "replacing" move since it is not replacing A. The node at A was moved
+ * away. The second operation is simply moving C to the now-empty path
+ * known as A.
+ *
* <h3>Paths</h3>
* Each driver/receiver implementation of this editor interface must
- * establish the expected root path for the paths sent and received via the
- * callbacks' @a relpath arguments.
+ * establish the expected root for all the paths sent and received via
+ * the callbacks' @a relpath arguments.
*
- * For example, during an "update", the driver has a working copy checked
- * out at a specific repository URL. The receiver sees the repository as a
- * whole. Here, the receiver could tell the driver which repository
- * URL the working copy refers to, and thus the driver could send
- * @a relpath arguments that are relative to the receiver's working copy.
+ * For example, during an "update", the driver is the repository, as a
+ * whole. The receiver may have just a portion of that repository. Here,
+ * the receiver could tell the driver which repository URL the working
+ * copy refers to, and thus the driver could send @a relpath arguments
+ * that are relative to the receiver's working copy.
+ *
+ * @note Because the source of a copy may be located *anywhere* in the
+ * repository, editor drives should typically use the repository root
+ * as the negotiated root. This allows the @a src_relpath argument in
+ * svn_editor_copy() to specify any possible source.
* \n\n
*
* <h3>Pool Usage</h3>
@@ -348,6 +396,13 @@ extern "C" {
*/
typedef struct svn_editor_t svn_editor_t;
+/** The kind of the checksum to be used throughout the #svn_editor_t APIs.
+ *
+ * @note ### This may change before Ev2 is official released, so just like
+ * everything else in this file, please don't rely upon it until then.
+ */
+#define SVN_EDITOR_CHECKSUM_KIND svn_checksum_sha1
+
/** These function types define the callback functions a tree delta consumer
* implements.
@@ -417,35 +472,36 @@ typedef svn_error_t *(*svn_editor_cb_add
svn_revnum_t replaces_rev,
apr_pool_t *scratch_pool);
-/** @see svn_editor_set_props(), svn_editor_t.
+/** @see svn_editor_alter_directory(), svn_editor_t.
* @since New in 1.8.
*/
-typedef svn_error_t *(*svn_editor_cb_set_props_t)(
+typedef svn_error_t *(*svn_editor_cb_alter_directory_t)(
void *baton,
const char *relpath,
svn_revnum_t revision,
apr_hash_t *props,
- svn_boolean_t complete,
apr_pool_t *scratch_pool);
-/** @see svn_editor_set_text(), svn_editor_t.
+/** @see svn_editor_alter_file(), svn_editor_t.
* @since New in 1.8.
*/
-typedef svn_error_t *(*svn_editor_cb_set_text_t)(
+typedef svn_error_t *(*svn_editor_cb_alter_file_t)(
void *baton,
const char *relpath,
svn_revnum_t revision,
+ apr_hash_t *props,
const svn_checksum_t *checksum,
svn_stream_t *contents,
apr_pool_t *scratch_pool);
-/** @see svn_editor_set_target(), svn_editor_t.
+/** @see svn_editor_alter_symlink(), svn_editor_t.
* @since New in 1.8.
*/
-typedef svn_error_t *(*svn_editor_cb_set_target_t)(
+typedef svn_error_t *(*svn_editor_cb_alter_symlink_t)(
void *baton,
const char *relpath,
svn_revnum_t revision,
+ apr_hash_t *props,
const char *target,
apr_pool_t *scratch_pool);
@@ -480,6 +536,15 @@ typedef svn_error_t *(*svn_editor_cb_mov
svn_revnum_t replaces_rev,
apr_pool_t *scratch_pool);
+/** @see svn_editor_rotate(), svn_editor_t.
+ * @since New in 1.8.
+ */
+typedef svn_error_t *(*svn_editor_cb_rotate_t)(
+ void *baton,
+ const apr_array_header_t *relpaths,
+ const apr_array_header_t *revisions,
+ apr_pool_t *scratch_pool);
+
/** @see svn_editor_complete(), svn_editor_t.
* @since New in 1.8.
*/
@@ -564,38 +629,38 @@ svn_editor_setcb_add_absent(svn_editor_t
svn_editor_cb_add_absent_t callback,
apr_pool_t *scratch_pool);
-/** Sets the #svn_editor_cb_set_props_t callback in @a editor
+/** Sets the #svn_editor_cb_alter_directory_t callback in @a editor
* to @a callback.
* @a scratch_pool is used for temporary allocations (if any).
* @see also svn_editor_setcb_many().
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_setcb_set_props(svn_editor_t *editor,
- svn_editor_cb_set_props_t callback,
- apr_pool_t *scratch_pool);
+svn_editor_setcb_alter_directory(svn_editor_t *editor,
+ svn_editor_cb_alter_directory_t callback,
+ apr_pool_t *scratch_pool);
-/** Sets the #svn_editor_cb_set_text_t callback in @a editor
+/** Sets the #svn_editor_cb_alter_file_t callback in @a editor
* to @a callback.
* @a scratch_pool is used for temporary allocations (if any).
* @see also svn_editor_setcb_many().
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_setcb_set_text(svn_editor_t *editor,
- svn_editor_cb_set_text_t callback,
- apr_pool_t *scratch_pool);
+svn_editor_setcb_alter_file(svn_editor_t *editor,
+ svn_editor_cb_alter_file_t callback,
+ apr_pool_t *scratch_pool);
-/** Sets the #svn_editor_cb_set_target_t callback in @a editor
+/** Sets the #svn_editor_cb_alter_symlink_t callback in @a editor
* to @a callback.
* @a scratch_pool is used for temporary allocations (if any).
* @see also svn_editor_setcb_many().
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_setcb_set_target(svn_editor_t *editor,
- svn_editor_cb_set_target_t callback,
- apr_pool_t *scratch_pool);
+svn_editor_setcb_alter_symlink(svn_editor_t *editor,
+ svn_editor_cb_alter_symlink_t callback,
+ apr_pool_t *scratch_pool);
/** Sets the #svn_editor_cb_delete_t callback in @a editor
* to @a callback.
@@ -630,6 +695,17 @@ svn_editor_setcb_move(svn_editor_t *edit
svn_editor_cb_move_t callback,
apr_pool_t *scratch_pool);
+/** Sets the #svn_editor_cb_rotate_t callback in @a editor
+ * to @a callback.
+ * @a scratch_pool is used for temporary allocations (if any).
+ * @see also svn_editor_setcb_many().
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_editor_setcb_rotate(svn_editor_t *editor,
+ svn_editor_cb_rotate_t callback,
+ apr_pool_t *scratch_pool);
+
/** Sets the #svn_editor_cb_complete_t callback in @a editor
* to @a callback.
* @a scratch_pool is used for temporary allocations (if any).
@@ -664,12 +740,13 @@ typedef struct svn_editor_cb_many_t
svn_editor_cb_add_file_t cb_add_file;
svn_editor_cb_add_symlink_t cb_add_symlink;
svn_editor_cb_add_absent_t cb_add_absent;
- svn_editor_cb_set_props_t cb_set_props;
- svn_editor_cb_set_text_t cb_set_text;
- svn_editor_cb_set_target_t cb_set_target;
+ svn_editor_cb_alter_directory_t cb_alter_directory;
+ svn_editor_cb_alter_file_t cb_alter_file;
+ svn_editor_cb_alter_symlink_t cb_alter_symlink;
svn_editor_cb_delete_t cb_delete;
svn_editor_cb_copy_t cb_copy;
svn_editor_cb_move_t cb_move;
+ svn_editor_cb_rotate_t cb_rotate;
svn_editor_cb_complete_t cb_complete;
svn_editor_cb_abort_t cb_abort;
@@ -706,7 +783,9 @@ svn_editor_setcb_many(svn_editor_t *edit
*
* A complete listing of the immediate children of @a relpath that will be
* added subsequently is given in @a children. @a children is an array of
- * const char*s, each giving the basename of an immediate child.
+ * const char*s, each giving the basename of an immediate child. It is an
+ * error to pass NULL for @a children; use an empty array to indicate
+ * the new directory will have no children.
*
* For all restrictions on driving the editor, see #svn_editor_t.
*/
@@ -723,17 +802,18 @@ svn_editor_add_directory(svn_editor_t *e
* is expected to exist.
*
* The file's contents are specified in @a contents which has a checksum
- * matching @a checksum.
+ * matching @a checksum. Both values must be non-NULL.
*
* Set the properties of the new file to @a props, which is an
* apr_hash_t holding key-value pairs. Each key is a const char* of a
* property name, each value is a const svn_string_t*. If no properties are
- * being set on the new file, @a props must be NULL.
+ * being set on the new file, @a props must be the empty hash. It is an
+ * error to pass NULL for @a props.
*
* If this add is expected to replace a previously existing file, symlink or
* directory at @a relpath, the revision number of the node to be replaced
* must be given in @a replaces_rev. Otherwise, @a replaces_rev must be
- * SVN_INVALID_REVNUM. Note: it is not allowed to call a "delete" followed
+ * #SVN_INVALID_REVNUM. Note: it is not allowed to call a "delete" followed
* by an "add" on the same path. Instead, an "add" with @a replaces_rev set
* accordingly MUST be used.
*
@@ -784,65 +864,83 @@ svn_editor_add_absent(svn_editor_t *edit
svn_kind_t kind,
svn_revnum_t replaces_rev);
-/** Drive @a editor's #svn_editor_cb_set_props_t callback.
+/** Drive @a editor's #svn_editor_cb_alter_directory_t callback.
*
- * Set or change properties on the existing node at @a relpath. This
- * function sends *all* properties, both existing and changes.
- * ### TODO @todo What is REVISION for?
- * ### HKW: This is puzzling to me as well...
- * ###
- * ### what about "entry props"? will these still be handled via
- * ### the general prop function?
+ * Alter the properties of the directory at @a relpath.
*
- * For a description of @a props, see svn_editor_add_file().
+ * @a revision specifies the expected revision of the directory and is
+ * used to catch attempts at altering out-of-date directories. If the
+ * directory does not have a corresponding revision in the repository
+ * (e.g. it has not yet been committed), then @a revision should be
+ * #SVN_INVALID_REVNUM.
*
- * @a complete must be FALSE if and only if
- * - @a relpath is a file and an svn_editor_set_text() call will follow on
- * the same path, or
- * - @a relpath is a symbolic link and an svn_editor_set_target() call will
- * follow on the same path.
+ * For a description of @a props, see svn_editor_add_file().
*
* For all restrictions on driving the editor, see #svn_editor_t.
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_set_props(svn_editor_t *editor,
- const char *relpath,
- svn_revnum_t revision,
- apr_hash_t *props,
- svn_boolean_t complete);
+svn_editor_alter_directory(svn_editor_t *editor,
+ const char *relpath,
+ svn_revnum_t revision,
+ apr_hash_t *props);
-/** Drive @a editor's #svn_editor_cb_set_text_t callback.
+/** Drive @a editor's #svn_editor_cb_alter_file_t callback.
+ *
+ * Alter the properties and/or the contents of the file at @a relpath
+ * with @a revision as its expected revision. See svn_editor_alter_directory()
+ * for more information about @a revision.
*
- * Set/change the text content of a file at @a relpath to @a contents
- * with checksum @a checksum.
- * ### TODO @todo Does this send the *complete* content, always?
- * ### TODO @todo What is REVISION for?
+ * If @a props is non-NULL, then the properties will be applied.
+ *
+ * If @a contents is non-NULL, then the stream will be copied to
+ * the file, and its checksum must match @a checksum (which must also
+ * be non-NULL). If @a contents is NULL, then @a checksum must also
+ * be NULL, and no change will be applied to the file's contents.
+ *
+ * The properties and/or the contents must be changed. It is an error to
+ * pass NULL for @a props, @a checksum, and @a contents.
+ *
+ * For a description of @a checksum, and @a contents see
+ * svn_editor_add_file(). This functions allows @a props to be NULL, but
+ * the parameter is otherwise described by svn_editor_add_file().
*
* For all restrictions on driving the editor, see #svn_editor_t.
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_set_text(svn_editor_t *editor,
- const char *relpath,
- svn_revnum_t revision,
- const svn_checksum_t *checksum,
- svn_stream_t *contents);
+svn_editor_alter_file(svn_editor_t *editor,
+ const char *relpath,
+ svn_revnum_t revision,
+ apr_hash_t *props,
+ const svn_checksum_t *checksum,
+ svn_stream_t *contents);
-/** Drive @a editor's #svn_editor_cb_set_target_t callback.
+/** Drive @a editor's #svn_editor_cb_alter_symlink_t callback.
+ *
+ * Alter the properties and/or the target of the symlink at @a relpath
+ * with @a revision as its expected revision. See svn_editor_alter_directory()
+ * for more information about @a revision.
+ *
+ * If @a props is non-NULL, then the properties will be applied.
+ *
+ * If @a target is non-NULL, then the symlink's target will be updated.
+ *
+ * The properties and/or the target must be changed. It is an error to
+ * pass NULL for @a props and @a target.
*
- * Set/change the link target that a symbolic link at @a relpath points at
- * to @a target.
- * ### TODO @todo What is REVISION for?
+ * This functions allows @a props to be NULL, but the parameter is
+ * otherwise described by svn_editor_add_file().
*
* For all restrictions on driving the editor, see #svn_editor_t.
* @since New in 1.8.
*/
svn_error_t *
-svn_editor_set_target(svn_editor_t *editor,
- const char *relpath,
- svn_revnum_t revision,
- const char *target);
+svn_editor_alter_symlink(svn_editor_t *editor,
+ const char *relpath,
+ svn_revnum_t revision,
+ apr_hash_t *props,
+ const char *target);
/** Drive @a editor's #svn_editor_cb_delete_t callback.
*
@@ -864,6 +962,11 @@ svn_editor_delete(svn_editor_t *editor,
*
* For a description of @a replaces_rev, see svn_editor_add_file().
*
+ * @note See the general instructions on paths for this API. Since the
+ * @a src_relpath argument must generally be able to reference any node
+ * in the repository, the implication is that the editor's root must be
+ * the repository root.
+ *
* For all restrictions on driving the editor, see #svn_editor_t.
* @since New in 1.8.
*/
@@ -880,19 +983,8 @@ svn_editor_copy(svn_editor_t *editor,
*
* For a description of @a replaces_rev, see svn_editor_add_file().
*
- * ### stsp: How would I describe a merge of revision range rA-rB,
- * ### within which a file foo.c was delete in rN, re-created in rM,
- * ### and then renamed to bar.c in rX?
- * ### Would the following be valid?
- * ### svn_editor_add_file(ed, "foo.c", props, rN);
- * ### svn_editor_move(ed, "foo.c", rM, "bar.c", rN);
- * ###
- * ### gstein: An editor is used to make changes to a tree rather than
- * ### model *how* the tree changed. If the receiver's tree is at
- * ### revision N-1, then the operations would be:
- * ### svn_editor_delete(ed, "foo.c", N-1);
- * ### svn_editor_copy(ed, "foo.c", M, "bar.c", SVN_INVALID_REVNUM);
- * ### That edits the tree to the appropriate state.
+ * ### what happens if one side of this move is not "within" the receiver's
+ * ### set of paths?
*
* For all restrictions on driving the editor, see #svn_editor_t.
* @since New in 1.8.
@@ -904,6 +996,36 @@ svn_editor_move(svn_editor_t *editor,
const char *dst_relpath,
svn_revnum_t replaces_rev);
+/** Drive @a editor's #svn_editor_cb_rotate_t callback.
+ *
+ * Perform a rotation among multiple nodes in the target tree.
+ *
+ * The @a relpaths and @a revisions arrays (pair-wise) specify nodes in the
+ * tree which are located at a path and expected to be at a specific
+ * revision. These nodes are simultaneously moved in a rotation pattern.
+ * For example, the node at index 0 of @a relpaths and @a revisions will
+ * be moved to the relpath specified at index 1 of @a relpaths. The node
+ * at index 1 will be moved to the location at index 2. The node at index
+ * N-1 will be moved to the relpath specifed at index 0.
+ *
+ * The simplest form of this operation is to swap nodes A and B. One may
+ * think to move A to a temporary location T, then move B to A, then move
+ * T to B. However, this last move violations the Once Rule by moving T
+ * (which had already by edited by the move from A). In order to keep the
+ * restrictions against multiple moves of a single node, the rotation
+ * operation is needed for certain types of tree edits.
+ *
+ * ### what happens if one of the paths of the rotation is not "within" the
+ * ### receiver's set of paths?
+ *
+ * For all restrictions on driving the editor, see #svn_editor_t.
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_editor_rotate(svn_editor_t *editor,
+ const apr_array_header_t *relpaths,
+ const apr_array_header_t *revisions);
+
/** Drive @a editor's #svn_editor_cb_complete_t callback.
*
* Send word that the edit has been completed successfully.
Modified: subversion/branches/javahl-ra/subversion/include/svn_error.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_error.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_error.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_error.h Mon Apr 23 12:32:48 2012
@@ -479,11 +479,16 @@ svn_error_t *svn_error_purge_tracing(svn
*
* @since New in 1.6.
*/
+#ifdef __clang_analyzer__
+#include <assert.h>
+#define SVN_ERR_ASSERT(expr) assert((expr))
+#else
#define SVN_ERR_ASSERT(expr) \
do { \
if (!(expr)) \
SVN_ERR(svn_error__malfunction(TRUE, __FILE__, __LINE__, #expr)); \
} while (0)
+#endif
/** Similar to SVN_ERR_ASSERT(), but without the option of returning
* an error to the calling function.
Modified: subversion/branches/javahl-ra/subversion/include/svn_error_codes.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_error_codes.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_error_codes.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_error_codes.h Mon Apr 23 12:32:48 2012
@@ -224,6 +224,11 @@ SVN_ERROR_START
SVN_ERR_BAD_CATEGORY_START + 14,
"Invalid changelist name")
+ /** @since New in 1.8. */
+ SVN_ERRDEF(SVN_ERR_BAD_ATOMIC,
+ SVN_ERR_BAD_CATEGORY_START + 15,
+ "Invalid atomic")
+
/* xml errors */
SVN_ERRDEF(SVN_ERR_XML_ATTRIB_NOT_FOUND,
Modified: subversion/branches/javahl-ra/subversion/include/svn_fs.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_fs.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_fs.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_fs.h Mon Apr 23 12:32:48 2012
@@ -39,6 +39,7 @@
#include "svn_io.h"
#include "svn_mergeinfo.h"
#include "svn_checksum.h"
+#include "svn_editor.h"
#ifdef __cplusplus
@@ -85,6 +86,12 @@ typedef struct svn_fs_t svn_fs_t;
*/
#define SVN_FS_CONFIG_FSFS_CACHE_FULLTEXTS "fsfs-cache-fulltexts"
+/** Enable / disable revprop caching for a FSFS repository.
+ *
+ * @since New in 1.8.
+ */
+#define SVN_FS_CONFIG_FSFS_CACHE_REVPROPS "fsfs-cache-revprops"
+
/* See also svn_fs_type(). */
/** @since New in 1.1. */
#define SVN_FS_CONFIG_FS_TYPE "fs-type"
@@ -250,6 +257,10 @@ svn_fs_upgrade(const char *path,
* to the Subversion filesystem located in the directory @a path.
* Use @a pool for necessary allocations.
*
+ * @a start and @a end may be #SVN_INVALID_REVNUM, in which case
+ * svn_repos_verify_fs2()'s semantics apply. When @c r0 is being
+ * verified, global invariants may be verified as well.
+ *
* @note You probably don't want to use this directly. Take a look at
* svn_repos_verify_fs2() instead, which does non-backend-specific
* verifications as well.
@@ -260,7 +271,9 @@ svn_error_t *
svn_fs_verify(const char *path,
svn_cancel_func_t cancel_func,
void *cancel_baton,
- apr_pool_t *pool);
+ svn_revnum_t start,
+ svn_revnum_t end,
+ apr_pool_t *scratch_pool);
/**
* Return, in @a *fs_type, a string identifying the back-end type of
@@ -309,8 +322,31 @@ svn_fs_delete_fs(const char *path,
* means deleting copied, unused logfiles for a Berkeley DB source
* filesystem.
*
+ * If @a incremental is TRUE, make an effort to not re-copy information
+ * already present in the destination. If incremental hotcopy is not
+ * implemented, raise SVN_ERR_UNSUPPORTED_FEATURE.
+ *
+ * Use @a scratch_pool for temporary allocations.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_fs_hotcopy2(const char *src_path,
+ const char *dest_path,
+ svn_boolean_t clean,
+ svn_boolean_t incremental,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *scratch_pool);
+
+/**
+ * Like svn_fs_hotcopy2(), but without the @a incremental parameter
+ * and without cancellation support.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API.
* @since New in 1.1.
*/
+SVN_DEPRECATED
svn_error_t *
svn_fs_hotcopy(const char *src_path,
const char *dest_path,
@@ -772,6 +808,11 @@ typedef struct svn_fs_txn_t svn_fs_txn_t
* if a caller tries to edit a locked item without having rights to the lock.
*/
#define SVN_FS_TXN_CHECK_LOCKS 0x00002
+
+/** Do not auto-commit the txn when its associated editor is marked
+ * as completed.
+ */
+#define SVN_FS_TXN_NO_AUTOCOMMIT 0x00004
/** @} */
/**
@@ -970,6 +1011,38 @@ svn_fs_change_txn_props(svn_fs_txn_t *tx
/** @} */
+/** Editors
+ *
+ * ### docco
+ *
+ * @defgroup svn_fs_editor Transaction editors
+ * @{
+ */
+
+svn_error_t *
+svn_fs_editor_create(svn_editor_t **editor,
+ const char **txn_name,
+ svn_fs_t *fs,
+ svn_revnum_t revision,
+ apr_uint32_t flags,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+
+svn_error_t *
+svn_fs_editor_create_for(svn_editor_t **editor,
+ svn_fs_t *fs,
+ const char *txn_name,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
+/** @} */
+
+
/** Roots.
*
* An #svn_fs_root_t object represents the root directory of some
Modified: subversion/branches/javahl-ra/subversion/include/svn_io.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_io.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_io.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_io.h Mon Apr 23 12:32:48 2012
@@ -682,6 +682,39 @@ svn_io_file_lock2(const char *lock_file,
svn_boolean_t exclusive,
svn_boolean_t nonblocking,
apr_pool_t *pool);
+
+/**
+ * Lock the file @a lockfile_handle. If @a exclusive is TRUE,
+ * obtain exclusive lock, otherwise obtain shared lock.
+ *
+ * If @a nonblocking is TRUE, do not wait for the lock if it
+ * is not available: throw an error instead.
+ *
+ * Lock will be automatically released when @a pool is cleared or destroyed.
+ * You may also explicitly call @ref svn_io_unlock_open_file.
+ * Use @a pool for memory allocations. @a pool must be the pool that
+ * @a lockfile_handle has been created in or one of its sub-pools.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_io_lock_open_file(apr_file_t *lockfile_handle,
+ svn_boolean_t exclusive,
+ svn_boolean_t nonblocking,
+ apr_pool_t *pool);
+
+/**
+ * Unlock the file @a lockfile_handle.
+ *
+ * Use @a pool for memory allocations. @a pool must be the pool that
+ * @a lockfile_handle has been created in or one of its sub-pools.
+ *
+ * @since New in 1.8.
+ */
+svn_error_t *
+svn_io_unlock_open_file(apr_file_t *lockfile_handle,
+ apr_pool_t *pool);
+
/**
* Flush any unwritten data from @a file to disk. Use @a pool for
* memory allocations.
@@ -989,6 +1022,16 @@ svn_stream_t *
svn_stream_from_string(const svn_string_t *str,
apr_pool_t *pool);
+/** Return a generic stream which implements buffered reads and writes.
+ * The stream will preferentially store data in-memory, but may use
+ * disk storage as backup if the amount of data is large.
+ * Allocate the stream in @a result_pool
+ *
+ * @since New in 1.8.
+ */
+svn_stream_t *
+svn_stream_buffered(apr_pool_t *result_pool);
+
/** Return a stream that decompresses all data read and compresses all
* data written. The stream @a stream is used to read and write all
* compressed data. All compression data structures are allocated on
@@ -1521,10 +1564,35 @@ svn_io_dir_walk(const char *dirname,
* Otherwise, the invoked program runs with an empty environment and @a cmd
* must be an absolute path.
*
+ * If @a inherit is FALSE and @a env is not NULL, the invoked program
+ * inherits the environment defined by @a env, instead of an empty
+ * environment or the caller's environment.
+ *
* @note On some platforms, failure to execute @a cmd in the child process
* will result in error output being written to @a errfile, if non-NULL, and
* a non-zero exit status being returned to the parent process.
*
+ * @since New in 1.8.
+ */
+svn_error_t *svn_io_start_cmd3(apr_proc_t *cmd_proc,
+ const char *path,
+ const char *cmd,
+ const char *const *args,
+ const char *const *env,
+ svn_boolean_t inherit,
+ svn_boolean_t infile_pipe,
+ apr_file_t *infile,
+ svn_boolean_t outfile_pipe,
+ apr_file_t *outfile,
+ svn_boolean_t errfile_pipe,
+ apr_file_t *errfile,
+ apr_pool_t *pool);
+
+
+/**
+ * Similar to svn_io_start_cmd3() but with @a env always set to NULL.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API
* @since New in 1.7.
*/
svn_error_t *svn_io_start_cmd2(apr_proc_t *cmd_proc,
Modified: subversion/branches/javahl-ra/subversion/include/svn_mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_mergeinfo.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_mergeinfo.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_mergeinfo.h Mon Apr 23 12:32:48 2012
@@ -166,9 +166,10 @@ svn_mergeinfo_parse(svn_mergeinfo_t *mer
apr_pool_t *pool);
/** Calculate the delta between two mergeinfos, @a mergefrom and @a mergeto
- * (which may be @c NULL), and place the result in @a *deleted and @a
- * *added (neither output argument may be @c NULL), both allocated in @a
- * result_pool.
+ * (either or both of which may be @c NULL meaning an empty mergeinfo).
+ * Place the result in @a *deleted and @a *added (neither output argument
+ * may be @c NULL), both allocated in @a result_pool. The resulting
+ * @a *deleted and @a *added will not be null.
*
* @a consider_inheritance determines how the rangelists in the two
* hashes are compared for equality. If @a consider_inheritance is FALSE,
Modified: subversion/branches/javahl-ra/subversion/include/svn_pools.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_pools.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_pools.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_pools.h Mon Apr 23 12:32:48 2012
@@ -30,7 +30,7 @@
#ifndef SVN_POOLS_H
#define SVN_POOLS_H
-#include <apr_pools.h>
+#include "svn_types.h"
#ifdef __cplusplus
extern "C" {
@@ -86,6 +86,23 @@ svn_pool_create_ex_debug(pool, allocator
*/
#define svn_pool_destroy apr_pool_destroy
+/** Return a new allocator. This function limits the unused memory in the
+ * new allocator to @ref SVN_ALLOCATOR_RECOMMENDED_MAX_FREE and ensures
+ * proper synchronization if the allocator is used by multiple threads.
+ *
+ * If your application uses multiple threads, creating a separate allocator
+ * for each of these threads may not be feasible. Set the @a thread_safe
+ * parameter to @c TRUE in that case. Pools will still not thread-safe, i.e.
+ * access to them may require explicit serialization. Set the parameter to
+ * @c FALSE, otherwise, to maximize performance.
+ *
+ * To access the owner pool, which can also serve as the root pool for your
+ * sub-pools, call @c apr_allocator_get_owner().
+ *
+ * @since: New in 1.8
+ */
+apr_allocator_t *
+svn_pool_create_allocator(svn_boolean_t thread_safe);
#ifdef __cplusplus
}
Modified: subversion/branches/javahl-ra/subversion/include/svn_props.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_props.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_props.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_props.h Mon Apr 23 12:32:48 2012
@@ -150,10 +150,20 @@ typedef enum svn_prop_kind
svn_prop_regular_kind
} svn_prop_kind_t;
+/** Return the property kind of a property named @a prop_name.
+ *
+ * @since New in 1.8
+ */
+svn_prop_kind_t
+svn_property_kind2(const char *prop_name);
+
/** Return the prop kind of a property named @a prop_name, and
* (if @a prefix_len is non-@c NULL) set @a *prefix_len to the length of
* the prefix of @a prop_name that was sufficient to distinguish its kind.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_prop_kind_t
svn_property_kind(int *prefix_len,
const char *prop_name);
Modified: subversion/branches/javahl-ra/subversion/include/svn_ra.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_ra.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_ra.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_ra.h Mon Apr 23 12:32:48 2012
@@ -1406,8 +1406,9 @@ svn_ra_do_diff(svn_ra_session_t *session
*
* If @a discover_changed_paths, then each call to @a receiver passes a
* <tt>const apr_hash_t *</tt> for the receiver's @a changed_paths argument;
- * the hash's keys are all the paths committed in that revision.
- * Otherwise, each call to receiver passes NULL for @a changed_paths.
+ * the hash's keys are all the paths committed in that revision, the hash's
+ * values are <tt>const svn_log_changed_path2_t *</tt> for each committed
+ * path. Otherwise, each call to receiver passes NULL for @a changed_paths.
*
* If @a strict_node_history is set, copy history will not be traversed
* (if any exists) when harvesting the revision logs for each path.
Modified: subversion/branches/javahl-ra/subversion/include/svn_ra_svn.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_ra_svn.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_ra_svn.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_ra_svn.h Mon Apr 23 12:32:48 2012
@@ -157,6 +157,15 @@ typedef struct svn_ra_svn_item_t
typedef svn_error_t *(*svn_ra_svn_edit_callback)(void *baton);
+/**
+ * Set the shim callbacks to be used by @a conn to @a shim_callbacks.
+ *
+ * @note This is a private API, external consumers should not use it.
+ */
+svn_error_t *
+svn_ra_svn__set_shim_callbacks(svn_ra_svn_conn_t *conn,
+ svn_delta_shim_callbacks_t *shim_callbacks);
+
/** Initialize a connection structure for the given socket or
* input/output files.
*
Modified: subversion/branches/javahl-ra/subversion/include/svn_repos.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_repos.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_repos.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_repos.h Mon Apr 23 12:32:48 2012
@@ -516,8 +516,30 @@ svn_repos_fs(svn_repos_t *repos);
* source filesystem as part of the copy operation; currently, this
* means deleting copied, unused logfiles for a Berkeley DB source
* repository.
+ *
+ * If @a incremental is TRUE, make an effort to not re-copy information
+ * already present in the destination. If incremental hotcopy is not
+ * implemented by the filesystem backend, raise SVN_ERR_UNSUPPORTED_FEATURE.
+ *
+ * @since New in 1.8.
*/
svn_error_t *
+svn_repos_hotcopy2(const char *src_path,
+ const char *dst_path,
+ svn_boolean_t clean_logs,
+ svn_boolean_t incremental,
+ svn_cancel_func_t cancel_func,
+ void *cancel_baton,
+ apr_pool_t *pool);
+
+/**
+ * Like svn_repos_hotcopy2(), but without the @a incremental parameter
+ * and without cancellation support.
+ *
+ * @deprecated Provided for backward compatibility with the 1.6 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
svn_repos_hotcopy(const char *src_path,
const char *dst_path,
svn_boolean_t clean_logs,
@@ -742,6 +764,17 @@ const char *
svn_repos_post_unlock_hook(svn_repos_t *repos,
apr_pool_t *pool);
+/** Set the environment that @a repos's hooks will inherit to @a hooks_env,
+ * a hash table where keys and values represent names and values of environment
+ * variables. @a hooks_env must live at least as long as @a repos.
+ *
+ * If this function is not called, hooks will run in an empty environment.
+ *
+ * @since New in 1.8. */
+void
+svn_repos_hooks_setenv(svn_repos_t *repos,
+ apr_hash_t *hooks_env);
+
/** @} */
/* ---------------------------------------------------------------*/
@@ -1747,6 +1780,8 @@ svn_repos_get_logs(svn_repos_t *repos,
* set @a *catalog to a catalog of this mergeinfo. @a *catalog will
* never be @c NULL but may be empty.
*
+ * The paths in @a paths, and the keys of @a catalog, start with '/'.
+ *
* @a inherit indicates whether explicit, explicit or inherited, or
* only inherited mergeinfo for @a paths is fetched.
*
@@ -1936,7 +1971,11 @@ svn_repos_fs_begin_txn_for_commit(svn_fs
*
* ### Someday: before a txn is created, some kind of read-hook could
* be called here.
+ *
+ * @note This function was never fully implemented, nor used. Ignore it.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_repos_fs_begin_txn_for_update(svn_fs_txn_t **txn_p,
svn_repos_t *repos,
@@ -1945,6 +1984,8 @@ svn_repos_fs_begin_txn_for_update(svn_fs
apr_pool_t *pool);
+/** @} */
+
/** @defgroup svn_repos_fs_locks Repository lock wrappers
* @{
*/
@@ -2991,6 +3032,13 @@ svn_repos_authz_read(svn_authz_t **authz
* to TRUE if at least one path is accessible with the @a
* required_access.
*
+ * For compatibility with 1.6, and earlier, @a repos_name can be NULL
+ * in which case it is equivalent to a @a repos_name of "".
+ *
+ * @note Presently, @a repos_name must byte-for-byte match the repos_name
+ * specified in the authz file; it is treated as an opaque string, and not
+ * as a dirent.
+ *
* @since New in 1.3.
*/
svn_error_t *
Modified: subversion/branches/javahl-ra/subversion/include/svn_sorts.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_sorts.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_sorts.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_sorts.h Mon Apr 23 12:32:48 2012
@@ -112,9 +112,9 @@ svn_sort_compare_revisions(const void *a
/**
- * Compare two @c const char * paths, returning an integer greater
- * than, equal to, or less than 0, using the same comparison rules as
- * are used by svn_path_compare_paths().
+ * Compare two @c const char * paths, @a *a and @a *b, returning an
+ * integer greater than, equal to, or less than 0, using the same
+ * comparison rules as are used by svn_path_compare_paths().
*
* This function is compatible for use with qsort().
*
@@ -125,13 +125,13 @@ svn_sort_compare_paths(const void *a,
const void *b);
/**
- * Compare two @c svn_merge_range_t *'s, returning an integer greater
- * than, equal to, or less than 0 if the first range is greater than,
- * equal to, or less than, the second range.
+ * Compare two @c svn_merge_range_t *'s, @a *a and @a *b, returning an
+ * integer greater than, equal to, or less than 0 if the first range is
+ * greater than, equal to, or less than, the second range.
*
* Both @c svn_merge_range_t *'s must describe forward merge ranges.
*
- * If @a a and @a b intersect then the range with the lower start revision
+ * If @a *a and @a *b intersect then the range with the lower start revision
* is considered the lesser range. If the ranges' start revisions are
* equal then the range with the lower end revision is considered the
* lesser range.
Modified: subversion/branches/javahl-ra/subversion/include/svn_string.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_string.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_string.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_string.h Mon Apr 23 12:32:48 2012
@@ -200,7 +200,7 @@ svn_stringbuf_create(const char *cstring
svn_stringbuf_t *
svn_stringbuf_ncreate(const char *bytes, apr_size_t size, apr_pool_t *pool);
-/** Create a truely empty string object (length and blocksize are 0)
+/** Create a new, empty bytestring.
* @since New in 1.8.
*/
svn_stringbuf_t *
@@ -209,8 +209,8 @@ svn_stringbuf_create_empty(apr_pool_t *p
/** Create a new empty bytestring with at least @a minimum_size bytes of
* space available in the memory block.
*
- * The allocated string buffer will be one byte larger than @a minimum_size
- * to account for a final '\\0'.
+ * The allocated string buffer will be at least one byte larger than
+ * @a minimum_size to account for a final '\\0'.
*
* @since New in 1.6.
*/
@@ -235,10 +235,16 @@ svn_stringbuf_t *
svn_stringbuf_createv(apr_pool_t *pool, const char *fmt, va_list ap)
__attribute__((format(printf, 2, 0)));
-/** Make sure that the string @a str has at least @a minimum_size bytes of
- * space available in the memory block.
+/** Make sure that the stringbuf @a str has at least @a minimum_size
+ * bytes of space available in the memory block.
+ *
+ * The allocated string buffer will be at least one byte larger than
+ * @a minimum_size to account for a final '\\0'.
*
- * (@a minimum_size should include space for the terminating NULL character.)
+ * @note: Before Subversion 1.8 this function did not ensure space for
+ * one byte more than @a minimum_size. If compatibility with pre-1.8
+ * behaviour is required callers must assume space for only
+ * @a minimum_size-1 data bytes plus a final '\\0'.
*/
void
svn_stringbuf_ensure(svn_stringbuf_t *str, apr_size_t minimum_size);
@@ -383,6 +389,20 @@ svn_boolean_t
svn_cstring_match_list(const char *str, const apr_array_header_t *list);
/**
+ * Get the next token from @a *str interpreting any char from @a sep as a
+ * token separator. Separators at the beginning of @a str will be skipped.
+ * Returns a pointer to the beginning of the first token in @a *str or NULL
+ * if no token is left. Modifies @a str such that the next call will return
+ * the next token.
+ *
+ * Note that the content of @a *str may be modified by this function.
+ *
+ * @since New in 1.8.
+ */
+char *
+svn_cstring_tokenize(const char *sep, char **str);
+
+/**
* Return the number of line breaks in @a msg, allowing any kind of newline
* termination (CR, LF, CRLF, or LFCR), even inconsistent.
*
Modified: subversion/branches/javahl-ra/subversion/include/svn_utf.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_utf.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_utf.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_utf.h Mon Apr 23 12:32:48 2012
@@ -49,12 +49,28 @@ extern "C" {
* Initialize the UTF-8 encoding/decoding routines.
* Allocate cached translation handles in a subpool of @a pool.
*
+ * If @a assume_native_utf8 is TRUE, the native character set is
+ * assumed to be UTF-8, i.e. conversion is a no-op. This is useful
+ * in contexts where the native character set is ASCII but UTF-8
+ * should be used regardless (e.g. for mod_dav_svn which runs within
+ * httpd and always uses the "C" locale).
+ *
* @note It is optional to call this function, but if it is used, no other
* svn function may be in use in other threads during the call of this
* function or when @a pool is cleared or destroyed.
* Initializing the UTF-8 routines will improve performance.
*
- * @since New in 1.1.
+ * @since New in 1.8.
+ */
+void
+svn_utf_initialize2(apr_pool_t *pool,
+ svn_boolean_t assume_native_utf8);
+
+/**
+ * Like svn_utf_initialize but without the ability to force the
+ * native encoding to UTF-8.
+ *
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
void
svn_utf_initialize(apr_pool_t *pool);
Modified: subversion/branches/javahl-ra/subversion/include/svn_wc.h
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/include/svn_wc.h?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/include/svn_wc.h (original)
+++ subversion/branches/javahl-ra/subversion/include/svn_wc.h Mon Apr 23 12:32:48 2012
@@ -1354,7 +1354,9 @@ typedef struct svn_wc_notify_t {
* In all other cases, it is @c NULL. @since New in 1.5 */
const char *changelist_name;
- /** When @c action is #svn_wc_notify_merge_begin, and both the
+ /** When @c action is #svn_wc_notify_merge_begin or
+ * #svn_wc_notify_foreign_merge_begin or
+ * #svn_wc_notify_merge_record_info_begin, and both the
* left and right sides of the merge are from the same URL. In all
* other cases, it is @c NULL. @since New in 1.5 */
svn_merge_range_t *merge_range;
@@ -3057,7 +3059,7 @@ svn_wc_entry_dup(const svn_wc_entry_t *e
*/
typedef struct svn_wc_info_t
{
- /** The schedule of this item
+ /** The schedule of this item
* ### Do we still need schedule? */
svn_wc_schedule_t schedule;
@@ -3655,7 +3657,7 @@ typedef struct svn_wc_status3_t
* This will be NULL for moved-here nodes that are just part of a subtree
* that was moved along (and are not themselves a root of a different move
* operation).
- *
+ *
* @since New in 1.8. */
const char *moved_from_abspath;
@@ -4047,6 +4049,10 @@ svn_wc_walk_status(svn_wc_context_t *wc_
apr_pool_t *scratch_pool);
/**
+ * DEPRECATED -- please use APIs from svn_client.h
+ *
+ * ---
+ *
* Set @a *editor and @a *edit_baton to an editor that generates
* #svn_wc_status3_t structures and sends them through @a status_func /
* @a status_baton. @a anchor_abspath is a working copy directory
@@ -4108,7 +4114,9 @@ svn_wc_walk_status(svn_wc_context_t *wc_
* in a subpool of @a result_pool.
*
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_wc_get_status_editor5(const svn_delta_editor_t **editor,
void **edit_baton,
@@ -5485,6 +5493,10 @@ typedef svn_error_t *(*svn_wc_dirents_fu
/**
+ * DEPRECATED -- please use APIs from svn_client.h
+ *
+ * ---
+ *
* Set @a *editor and @a *edit_baton to an editor and baton for updating a
* working copy.
*
@@ -5558,7 +5570,9 @@ typedef svn_error_t *(*svn_wc_dirents_fu
* before returning the editor to allow using the primary ra session for this.
*
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_wc_get_update_editor4(const svn_delta_editor_t **editor,
void **edit_baton,
@@ -5689,6 +5703,10 @@ svn_wc_get_update_editor(svn_revnum_t *t
apr_pool_t *pool);
/**
+ * DEPRECATED -- please use APIs from svn_client.h
+ *
+ * ---
+ *
* A variant of svn_wc_get_update_editor4().
*
* Set @a *editor and @a *edit_baton to an editor and baton for "switching"
@@ -5699,7 +5717,9 @@ svn_wc_get_update_editor(svn_revnum_t *t
* All other parameters behave as for svn_wc_get_update_editor4().
*
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_wc_get_switch_editor4(const svn_delta_editor_t **editor,
void **edit_baton,
@@ -6136,6 +6156,10 @@ svn_wc_canonicalize_svn_prop(const svn_s
*/
/**
+ * DEPRECATED -- please use APIs from svn_client.h
+ *
+ * ---
+ *
* Return an @a editor/@a edit_baton for diffing a working copy against the
* repository. The editor is allocated in @a result_pool; temporary
* calculations are performed in @a scratch_pool.
@@ -6189,7 +6213,9 @@ svn_wc_canonicalize_svn_prop(const svn_s
* editor.
*
* @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.7 API.
*/
+SVN_DEPRECATED
svn_error_t *
svn_wc_get_diff_editor6(const svn_delta_editor_t **editor,
void **edit_baton,
Modified: subversion/branches/javahl-ra/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_auth_gnome_keyring/gnome_keyring.c Mon Apr 23 12:32:48 2012
@@ -230,10 +230,60 @@ unlock_gnome_keyring(const char *keyring
return TRUE;
}
-/* Implementation of password_get_t that retrieves the password
+
+/* There is a race here: this ensures keyring is unlocked just now,
+ but will it still be unlocked when we use it? */
+static svn_error_t *
+ensure_gnome_keyring_is_unlocked(svn_boolean_t non_interactive,
+ apr_hash_t *parameters,
+ apr_pool_t *scratch_pool)
+{
+ const char *default_keyring = get_default_keyring_name(scratch_pool);
+
+ if (! non_interactive)
+ {
+ svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
+ apr_hash_get(parameters,
+ SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
+ APR_HASH_KEY_STRING);
+ void *unlock_prompt_baton =
+ apr_hash_get(parameters,
+ SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
+ APR_HASH_KEY_STRING);
+
+ char *keyring_password;
+
+ if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
+ {
+ SVN_ERR((*unlock_prompt_func)(&keyring_password,
+ default_keyring,
+ unlock_prompt_baton,
+ scratch_pool));
+
+ /* If keyring is locked give up and try the next provider. */
+ if (! unlock_gnome_keyring(default_keyring, keyring_password,
+ scratch_pool))
+ return SVN_NO_ERROR;
+ }
+ }
+ else
+ {
+ if (check_keyring_is_locked(default_keyring))
+ {
+ return svn_error_create(SVN_ERR_AUTHN_CREDS_UNAVAILABLE, NULL,
+ _("GNOME Keyring is locked and "
+ "we are non-interactive"));
+ }
+ }
+
+ return SVN_NO_ERROR;
+}
+
+/* Implementation of svn_auth__password_get_t that retrieves the password
from GNOME Keyring. */
-static svn_boolean_t
-password_get_gnome_keyring(const char **password,
+static svn_error_t *
+password_get_gnome_keyring(svn_boolean_t *done,
+ const char **password,
apr_hash_t *creds,
const char *realmstring,
const char *username,
@@ -244,13 +294,10 @@ password_get_gnome_keyring(const char **
char *default_keyring = NULL;
GnomeKeyringResult result;
GList *items;
- svn_boolean_t ret = FALSE;
- if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
- return FALSE;
+ *done = FALSE;
- if (! gnome_keyring_is_available())
- return FALSE;
+ SVN_ERR(ensure_gnome_keyring_is_unlocked(non_interactive, parameters, pool));
default_keyring = get_default_keyring_name(pool);
@@ -278,7 +325,7 @@ password_get_gnome_keyring(const char **
if (len > 0)
{
*password = apr_pstrmemdup(pool, item->password, len);
- ret = TRUE;
+ *done = TRUE;
}
}
gnome_keyring_network_password_list_free(items);
@@ -294,13 +341,14 @@ password_get_gnome_keyring(const char **
free(default_keyring);
- return ret;
+ return SVN_NO_ERROR;
}
-/* Implementation of password_set_t that stores the password in
+/* Implementation of svn_auth__password_set_t that stores the password in
GNOME Keyring. */
-static svn_boolean_t
-password_set_gnome_keyring(apr_hash_t *creds,
+static svn_error_t *
+password_set_gnome_keyring(svn_boolean_t *done,
+ apr_hash_t *creds,
const char *realmstring,
const char *username,
const char *password,
@@ -312,11 +360,9 @@ password_set_gnome_keyring(apr_hash_t *c
GnomeKeyringResult result;
guint32 item_id;
- if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
- return FALSE;
+ *done = FALSE;
- if (! gnome_keyring_is_available())
- return FALSE;
+ SVN_ERR(ensure_gnome_keyring_is_unlocked(non_interactive, parameters, pool));
default_keyring = get_default_keyring_name(pool);
@@ -344,7 +390,8 @@ password_set_gnome_keyring(apr_hash_t *c
free(default_keyring);
- return result == GNOME_KEYRING_RESULT_OK;
+ *done = (result == GNOME_KEYRING_RESULT_OK);
+ return SVN_NO_ERROR;
}
/* Get cached encrypted credentials from the simple provider's cache. */
@@ -356,50 +403,12 @@ simple_gnome_keyring_first_creds(void **
const char *realmstring,
apr_pool_t *pool)
{
- svn_boolean_t non_interactive = apr_hash_get(parameters,
- SVN_AUTH_PARAM_NON_INTERACTIVE,
- APR_HASH_KEY_STRING) != NULL;
- const char *default_keyring = get_default_keyring_name(pool);
- if (! non_interactive)
- {
- svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
- apr_hash_get(parameters,
- SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
- APR_HASH_KEY_STRING);
- void *unlock_prompt_baton =
- apr_hash_get(parameters, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
- APR_HASH_KEY_STRING);
-
- char *keyring_password;
-
- if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
- {
- SVN_ERR((*unlock_prompt_func)(&keyring_password,
- default_keyring,
- unlock_prompt_baton,
- pool));
-
- /* If keyring is locked give up and try the next provider. */
- if (! unlock_gnome_keyring(default_keyring, keyring_password, pool))
- return SVN_NO_ERROR;
- }
- }
- else
- {
- if (check_keyring_is_locked(default_keyring))
- {
- return svn_error_create(SVN_ERR_AUTHN_CREDS_UNAVAILABLE, NULL,
- _("GNOME Keyring is locked and "
- "we are non-interactive"));
- }
- }
- return svn_auth__simple_first_creds_helper
- (credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- password_get_gnome_keyring,
- SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_creds_cache_get(credentials,
+ iter_baton, provider_baton,
+ parameters, realmstring,
+ password_get_gnome_keyring,
+ SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the simple provider's cache. */
@@ -411,50 +420,12 @@ simple_gnome_keyring_save_creds(svn_bool
const char *realmstring,
apr_pool_t *pool)
{
- svn_boolean_t non_interactive = apr_hash_get(parameters,
- SVN_AUTH_PARAM_NON_INTERACTIVE,
- APR_HASH_KEY_STRING) != NULL;
- const char *default_keyring = get_default_keyring_name(pool);
- if (! non_interactive)
- {
- svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
- apr_hash_get(parameters,
- SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
- APR_HASH_KEY_STRING);
- void *unlock_prompt_baton =
- apr_hash_get(parameters, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
- APR_HASH_KEY_STRING);
-
- char *keyring_password;
-
- if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
- {
- SVN_ERR((*unlock_prompt_func)(&keyring_password,
- default_keyring,
- unlock_prompt_baton,
- pool));
-
- /* If keyring is locked give up and try the next provider. */
- if (! unlock_gnome_keyring(default_keyring, keyring_password, pool))
- return SVN_NO_ERROR;
- }
- }
- else
- {
- if (check_keyring_is_locked(default_keyring))
- {
- return svn_error_create(SVN_ERR_AUTHN_CREDS_NOT_SAVED, NULL,
- _("GNOME Keyring is locked and "
- "we are non-interactive"));
- }
- }
- return svn_auth__simple_save_creds_helper
- (saved, credentials,
- provider_baton, parameters,
- realmstring,
- password_set_gnome_keyring,
- SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_creds_cache_set(saved, credentials,
+ provider_baton, parameters,
+ realmstring,
+ password_set_gnome_keyring,
+ SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
+ pool);
}
static void
@@ -518,50 +489,10 @@ ssl_client_cert_pw_gnome_keyring_first_c
const char *realmstring,
apr_pool_t *pool)
{
- svn_boolean_t non_interactive = apr_hash_get(parameters,
- SVN_AUTH_PARAM_NON_INTERACTIVE,
- APR_HASH_KEY_STRING) != NULL;
- const char *default_keyring = get_default_keyring_name(pool);
- if (! non_interactive)
- {
- svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
- apr_hash_get(parameters,
- SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
- APR_HASH_KEY_STRING);
- void *unlock_prompt_baton =
- apr_hash_get(parameters, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
- APR_HASH_KEY_STRING);
-
- char *keyring_password;
-
- if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
- {
- SVN_ERR((*unlock_prompt_func)(&keyring_password,
- default_keyring,
- unlock_prompt_baton,
- pool));
-
- /* If keyring is locked give up and try the next provider. */
- if (! unlock_gnome_keyring(default_keyring, keyring_password, pool))
- return SVN_NO_ERROR;
- }
- }
- else
- {
- if (check_keyring_is_locked(default_keyring))
- {
- return svn_error_create(SVN_ERR_AUTHN_CREDS_UNAVAILABLE, NULL,
- _("GNOME Keyring is locked and "
- "we are non-interactive"));
- }
- }
- return svn_auth__ssl_client_cert_pw_file_first_creds_helper
- (credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- password_get_gnome_keyring,
- SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
- pool);
+ return svn_auth__ssl_client_cert_pw_cache_get(
+ credentials, iter_baton, provider_baton, parameters, realmstring,
+ password_get_gnome_keyring, SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the ssl client cert password provider's
@@ -574,50 +505,10 @@ ssl_client_cert_pw_gnome_keyring_save_cr
const char *realmstring,
apr_pool_t *pool)
{
- svn_boolean_t non_interactive = apr_hash_get(parameters,
- SVN_AUTH_PARAM_NON_INTERACTIVE,
- APR_HASH_KEY_STRING) != NULL;
- const char *default_keyring = get_default_keyring_name(pool);
- if (! non_interactive)
- {
- svn_auth_gnome_keyring_unlock_prompt_func_t unlock_prompt_func =
- apr_hash_get(parameters,
- SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_FUNC,
- APR_HASH_KEY_STRING);
- void *unlock_prompt_baton =
- apr_hash_get(parameters, SVN_AUTH_PARAM_GNOME_KEYRING_UNLOCK_PROMPT_BATON,
- APR_HASH_KEY_STRING);
-
- char *keyring_password;
-
- if (unlock_prompt_func && check_keyring_is_locked(default_keyring))
- {
- SVN_ERR((*unlock_prompt_func)(&keyring_password,
- default_keyring,
- unlock_prompt_baton,
- pool));
-
- /* If keyring is locked give up and try the next provider. */
- if (! unlock_gnome_keyring(default_keyring, keyring_password, pool))
- return SVN_NO_ERROR;
- }
- }
- else
- {
- if (check_keyring_is_locked(default_keyring))
- {
- return svn_error_create(SVN_ERR_AUTHN_CREDS_NOT_SAVED, NULL,
- _("GNOME Keyring is locked and "
- "we are non-interactive"));
- }
- }
- return svn_auth__ssl_client_cert_pw_file_save_creds_helper
- (saved, credentials,
- provider_baton, parameters,
- realmstring,
- password_set_gnome_keyring,
- SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
- pool);
+ return svn_auth__ssl_client_cert_pw_cache_set(
+ saved, credentials, provider_baton, parameters, realmstring,
+ password_set_gnome_keyring, SVN_AUTH__GNOME_KEYRING_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t gnome_keyring_ssl_client_cert_pw_provider = {
Modified: subversion/branches/javahl-ra/subversion/libsvn_auth_kwallet/kwallet.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/javahl-ra/subversion/libsvn_auth_kwallet/kwallet.cpp?rev=1329209&r1=1329208&r2=1329209&view=diff
==============================================================================
--- subversion/branches/javahl-ra/subversion/libsvn_auth_kwallet/kwallet.cpp (original)
+++ subversion/branches/javahl-ra/subversion/libsvn_auth_kwallet/kwallet.cpp Mon Apr 23 12:32:48 2012
@@ -181,8 +181,9 @@ kwallet_terminate(void *data)
/* Implementation of svn_auth__password_get_t that retrieves
the password from KWallet. */
-static svn_boolean_t
-kwallet_password_get(const char **password,
+static svn_error_t *
+kwallet_password_get(svn_boolean_t *done,
+ const char **password,
apr_hash_t *creds,
const char *realmstring,
const char *username,
@@ -190,14 +191,22 @@ kwallet_password_get(const char **passwo
svn_boolean_t non_interactive,
apr_pool_t *pool)
{
- if (non_interactive)
+ QString wallet_name = get_wallet_name(parameters);
+
+ *done = FALSE;
+
+ if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
{
- return FALSE;
+ return SVN_NO_ERROR;
}
- if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
+ if (non_interactive)
{
- return FALSE;
+ if (!KWallet::Wallet::isOpen(wallet_name))
+ return SVN_NO_ERROR;
+
+ /* There is a race here: the wallet was open just now, but will
+ it still be open when we come to use it below? */
}
QCoreApplication *app;
@@ -216,8 +225,6 @@ kwallet_password_get(const char **passwo
ki18n("Version control system"),
KCmdLineArgs::CmdLineArgKDE);
KComponentData component_data(KCmdLineArgs::aboutData());
- svn_boolean_t ret = FALSE;
- QString wallet_name = get_wallet_name(parameters);
QString folder = QString::fromUtf8("Subversion");
QString key =
QString::fromUtf8(username) + "@" + QString::fromUtf8(realmstring);
@@ -238,7 +245,7 @@ kwallet_password_get(const char **passwo
*password = apr_pstrmemdup(pool,
q_password.toUtf8().data(),
q_password.size());
- ret = TRUE;
+ *done = TRUE;
}
}
}
@@ -246,13 +253,14 @@ kwallet_password_get(const char **passwo
apr_pool_cleanup_register(pool, parameters, kwallet_terminate, NULL);
- return ret;
+ return SVN_NO_ERROR;
}
/* Implementation of svn_auth__password_set_t that stores
the password in KWallet. */
-static svn_boolean_t
-kwallet_password_set(apr_hash_t *creds,
+static svn_error_t *
+kwallet_password_set(svn_boolean_t *done,
+ apr_hash_t *creds,
const char *realmstring,
const char *username,
const char *password,
@@ -260,14 +268,22 @@ kwallet_password_set(apr_hash_t *creds,
svn_boolean_t non_interactive,
apr_pool_t *pool)
{
- if (non_interactive)
+ QString wallet_name = get_wallet_name(parameters);
+
+ *done = FALSE;
+
+ if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
{
- return FALSE;
+ return SVN_NO_ERROR;
}
- if (! dbus_bus_get(DBUS_BUS_SESSION, NULL))
+ if (non_interactive)
{
- return FALSE;
+ if (!KWallet::Wallet::isOpen(wallet_name))
+ return SVN_NO_ERROR;
+
+ /* There is a race here: the wallet was open just now, but will
+ it still be open when we come to use it below? */
}
QCoreApplication *app;
@@ -286,9 +302,7 @@ kwallet_password_set(apr_hash_t *creds,
ki18n("Version control system"),
KCmdLineArgs::CmdLineArgKDE);
KComponentData component_data(KCmdLineArgs::aboutData());
- svn_boolean_t ret = FALSE;
QString q_password = QString::fromUtf8(password);
- QString wallet_name = get_wallet_name(parameters);
QString folder = QString::fromUtf8("Subversion");
KWallet::Wallet *wallet = get_wallet(wallet_name, parameters);
if (wallet)
@@ -307,14 +321,14 @@ kwallet_password_set(apr_hash_t *creds,
+ QString::fromUtf8(realmstring);
if (wallet->writePassword(key, q_password) == 0)
{
- ret = TRUE;
+ *done = TRUE;
}
}
}
apr_pool_cleanup_register(pool, parameters, kwallet_terminate, NULL);
- return ret;
+ return SVN_NO_ERROR;
}
/* Get cached encrypted credentials from the simple provider's cache. */
@@ -326,14 +340,14 @@ kwallet_simple_first_creds(void **creden
const char *realmstring,
apr_pool_t *pool)
{
- return svn_auth__simple_first_creds_helper(credentials,
- iter_baton,
- provider_baton,
- parameters,
- realmstring,
- kwallet_password_get,
- SVN_AUTH__KWALLET_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_creds_cache_get(credentials,
+ iter_baton,
+ provider_baton,
+ parameters,
+ realmstring,
+ kwallet_password_get,
+ SVN_AUTH__KWALLET_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the simple provider's cache. */
@@ -345,13 +359,13 @@ kwallet_simple_save_creds(svn_boolean_t
const char *realmstring,
apr_pool_t *pool)
{
- return svn_auth__simple_save_creds_helper(saved, credentials,
- provider_baton,
- parameters,
- realmstring,
- kwallet_password_set,
- SVN_AUTH__KWALLET_PASSWORD_TYPE,
- pool);
+ return svn_auth__simple_creds_cache_set(saved, credentials,
+ provider_baton,
+ parameters,
+ realmstring,
+ kwallet_password_set,
+ SVN_AUTH__KWALLET_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t kwallet_simple_provider = {
@@ -391,13 +405,12 @@ kwallet_ssl_client_cert_pw_first_creds(v
const char *realmstring,
apr_pool_t *pool)
{
- return svn_auth__ssl_client_cert_pw_file_first_creds_helper
- (credentials,
- iter_baton, provider_baton,
- parameters, realmstring,
- kwallet_password_get,
- SVN_AUTH__KWALLET_PASSWORD_TYPE,
- pool);
+ return svn_auth__ssl_client_cert_pw_cache_get(credentials,
+ iter_baton, provider_baton,
+ parameters, realmstring,
+ kwallet_password_get,
+ SVN_AUTH__KWALLET_PASSWORD_TYPE,
+ pool);
}
/* Save encrypted credentials to the ssl client cert password provider's
@@ -410,13 +423,12 @@ kwallet_ssl_client_cert_pw_save_creds(sv
const char *realmstring,
apr_pool_t *pool)
{
- return svn_auth__ssl_client_cert_pw_file_save_creds_helper
- (saved, credentials,
- provider_baton, parameters,
- realmstring,
- kwallet_password_set,
- SVN_AUTH__KWALLET_PASSWORD_TYPE,
- pool);
+ return svn_auth__ssl_client_cert_pw_cache_set(saved, credentials,
+ provider_baton, parameters,
+ realmstring,
+ kwallet_password_set,
+ SVN_AUTH__KWALLET_PASSWORD_TYPE,
+ pool);
}
static const svn_auth_provider_t kwallet_ssl_client_cert_pw_provider = {