You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2012/03/05 10:25:33 UTC
svn commit: r1296975 [3/12] - in /subversion/branches/revprop-packing: ./
build/ build/ac-macros/ build/generator/ build/generator/templates/
build/win32/ notes/ notes/api-errata/1.7/
subversion/bindings/javahl/native/ subversion/bindings/javahl/tests/...
Modified: subversion/branches/revprop-packing/subversion/libsvn_auth_kwallet/kwallet.cpp
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_auth_kwallet/kwallet.cpp?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_auth_kwallet/kwallet.cpp (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_auth_kwallet/kwallet.cpp Mon Mar 5 09:25:25 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. */
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/add.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/add.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/add.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/add.c Mon Mar 5 09:25:25 2012
@@ -47,6 +47,7 @@
#include "private/svn_client_private.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "private/svn_magic.h"
#include "svn_private_config.h"
@@ -896,6 +897,9 @@ mkdir_urls(const apr_array_header_t *url
ctx, pool));
/* Fetch RA commit editor */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ NULL, pool)));
SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
commit_revprops,
commit_callback,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/checkout.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/checkout.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/checkout.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/checkout.c Mon Mar 5 09:25:25 2012
@@ -73,7 +73,6 @@ svn_client__checkout_internal(svn_revnum
const char *local_abspath,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- const svn_client__ra_session_from_path_results *ra_cache,
svn_depth_t depth,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
@@ -88,6 +87,10 @@ svn_client__checkout_internal(svn_revnum
const char *session_url;
svn_node_kind_t kind;
const char *uuid, *repos_root;
+ apr_pool_t *session_pool = svn_pool_create(pool);
+ svn_ra_session_t *ra_session;
+ svn_revnum_t tmp_revnum;
+ const char *tmp_session_url;
/* Sanity check. Without these, the checkout is meaningless. */
SVN_ERR_ASSERT(local_abspath != NULL);
@@ -100,60 +103,19 @@ svn_client__checkout_internal(svn_revnum
&& (revision->kind != svn_opt_revision_head))
return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
- {
- svn_boolean_t have_repos_root_url;
- svn_boolean_t have_repos_uuid;
- svn_boolean_t have_session_url;
- svn_boolean_t have_revnum;
- svn_boolean_t have_kind;
-
- if ((have_repos_root_url = (ra_cache && ra_cache->repos_root_url)))
- repos_root = ra_cache->repos_root_url;
-
- if ((have_repos_uuid = (ra_cache && ra_cache->repos_uuid)))
- uuid = ra_cache->repos_uuid;
-
- if ((have_session_url = (ra_cache && ra_cache->ra_session_url)))
- session_url = ra_cache->ra_session_url;
-
- if ((have_revnum = (ra_cache && SVN_IS_VALID_REVNUM(ra_cache->ra_revnum))))
- revnum = ra_cache->ra_revnum;
-
- if ((have_kind = (ra_cache && ra_cache->kind != svn_node_unknown)))
- kind = ra_cache->kind;
-
- if (! have_repos_root_url || ! have_repos_uuid || ! have_session_url ||
- ! have_revnum || ! have_kind)
- {
- apr_pool_t *session_pool = svn_pool_create(pool);
- svn_ra_session_t *ra_session;
- svn_revnum_t tmp_revnum;
- const char *tmp_session_url;
-
- /* Get the RA connection. */
- SVN_ERR(svn_client__ra_session_from_path(&ra_session, &tmp_revnum,
- &tmp_session_url, url, NULL,
- peg_revision, revision, ctx,
- session_pool));
-
- if (! have_repos_root_url)
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
-
- if (! have_repos_uuid)
- SVN_ERR(svn_ra_get_uuid2(ra_session, &uuid, pool));
-
- if (! have_session_url)
- session_url = apr_pstrdup(pool, tmp_session_url);
-
- if (! have_revnum)
- revnum = tmp_revnum;
-
- if (! have_kind)
- SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
-
- svn_pool_destroy(session_pool);
- }
- }
+ /* Get the RA connection. */
+ SVN_ERR(svn_client__ra_session_from_path(&ra_session, &tmp_revnum,
+ &tmp_session_url, url, NULL,
+ peg_revision, revision, ctx,
+ session_pool));
+
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root, pool));
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &uuid, pool));
+ session_url = apr_pstrdup(pool, tmp_session_url);
+ revnum = tmp_revnum;
+ SVN_ERR(svn_ra_check_path(ra_session, "", revnum, &kind, pool));
+
+ svn_pool_destroy(session_pool);
if (kind == svn_node_none)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
@@ -253,7 +215,7 @@ svn_client_checkout3(svn_revnum_t *resul
SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool));
return svn_client__checkout_internal(result_rev, URL, local_abspath,
- peg_revision, revision, NULL, depth,
+ peg_revision, revision, depth,
ignore_externals,
allow_unver_obstructions, NULL,
ctx, pool);
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/client.h?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/client.h (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/client.h Mon Mar 5 09:25:25 2012
@@ -499,36 +499,6 @@ svn_client__update_internal(svn_revnum_t
svn_client_ctx_t *ctx,
apr_pool_t *pool);
-/* Structure holding the results of svn_client__ra_session_from_path()
- plus the repository root URL and UUID and the node kind for the
- input URL, REVISION and PEG_REVISION . See
- svn_client__ra_session_from_path() for the meaning of these fields.
- This structure is used by svn_client__checkout_internal() to save
- one or more round-trips if the client already gathered some of this
- information. Not all the fields need to be filled in. */
-typedef struct svn_client__ra_session_from_path_results
-{
- /* The repository root URL. A NULL value means the root URL is
- unknown.*/
- const char *repos_root_url;
-
- /* The repository UUID. A NULL value means the UUID is unknown. */
- const char *repos_uuid;
-
- /* The actual final resulting URL for the input URL. This may be
- different because of copy history. A NULL value means the
- resulting URL is unknown. */
- const char *ra_session_url;
-
- /* The actual final resulting revision for the input URL. An
- invalid revnum as determined by SVN_IS_VALID_REVNUM() means the
- revnum is unknown. */
- svn_revnum_t ra_revnum;
-
- /* An optional node kind for the URL. svn_node_unknown if unknown */
- svn_node_kind_t kind;
-} svn_client__ra_session_from_path_results;
-
/* Checkout into LOCAL_ABSPATH a working copy of URL at REVISION, and (if not
NULL) set RESULT_REV to the checked out revision.
@@ -565,7 +535,6 @@ svn_client__checkout_internal(svn_revnum
const char *local_abspath,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
- const svn_client__ra_session_from_path_results *ra_cache,
svn_depth_t depth,
svn_boolean_t ignore_externals,
svn_boolean_t allow_unver_obstructions,
@@ -1104,6 +1073,11 @@ svn_client__get_normalized_stream(svn_st
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Return a set of callbacks to use with the Ev2 shims. */
+svn_delta_shim_callbacks_t *
+svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
+ const char *anchor_abspath,
+ apr_pool_t *result_pool);
/* Return true if KIND is a revision kind that is dependent on the working
* copy. Otherwise, return false. */
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/commit.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/commit.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/commit.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/commit.c Mon Mar 5 09:25:25 2012
@@ -49,6 +49,7 @@
#include "client.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "private/svn_magic.h"
#include "svn_private_config.h"
@@ -645,6 +646,7 @@ get_ra_editor(svn_ra_session_t **ra_sess
apr_pool_t *pool)
{
apr_hash_t *commit_revprops;
+ const char *anchor_abspath;
/* Open an RA session to URL. */
SVN_ERR(svn_client__open_ra_session_internal(ra_session, NULL, base_url,
@@ -669,7 +671,28 @@ get_ra_editor(svn_ra_session_t **ra_sess
SVN_ERR(svn_client__ensure_revprop_table(&commit_revprops, revprop_table,
log_msg, ctx, pool));
+#ifdef ENABLE_EDITOR_SHIMS
+ /* We need this for the shims. */
+ if (base_dir_abspath)
+ {
+ const char *relpath;
+ const char *wcroot_abspath;
+
+ SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, ctx->wc_ctx,
+ base_dir_abspath, pool, pool));
+
+ SVN_ERR(svn_ra_get_path_relative_to_root(*ra_session, &relpath, base_url,
+ pool));
+ anchor_abspath = svn_dirent_join(wcroot_abspath, relpath, pool);
+ }
+ else
+#endif
+ anchor_abspath = NULL;
+
/* Fetch RA commit editor. */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(*ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ anchor_abspath, pool)));
SVN_ERR(svn_ra_get_commit_editor3(*ra_session, editor, edit_baton,
commit_revprops, commit_callback,
commit_baton, lock_tokens, keep_locks,
@@ -1256,7 +1279,7 @@ append_externals_as_explicit_targets(apr
rel_target = svn_dirent_skip_ancestor(base_abspath,
xinfo->local_abspath);
-
+
SVN_ERR_ASSERT(rel_target != NULL && *rel_target != '\0');
APR_ARRAY_PUSH(rel_targets, const char *) =
@@ -1492,7 +1515,7 @@ svn_client_commit6(const apr_array_heade
svn_boolean_t found_delete_half =
(apr_hash_get(committables->by_path, delete_op_root_abspath,
APR_HASH_KEY_STRING) != NULL);
-
+
if (!found_delete_half)
{
const char *delete_half_parent_abspath;
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/copy.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/copy.c Mon Mar 5 09:25:25 2012
@@ -44,6 +44,7 @@
#include "svn_private_config.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "private/svn_mergeinfo_private.h"
@@ -1089,6 +1090,9 @@ repos_to_repos_copy(const apr_array_head
message, ctx, pool));
/* Fetch RA commit editor. */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ NULL, pool)));
SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
commit_revprops,
commit_callback,
@@ -1401,6 +1405,9 @@ wc_to_repos_copy(const apr_array_header_
FALSE, FALSE, ctx, pool));
/* Fetch RA commit editor. */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ NULL, pool)));
SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
commit_revprops,
commit_callback,
@@ -1503,7 +1510,7 @@ repos_to_wc_copy_single(svn_client__copy
pair->src_original,
tmp_abspath,
&pair->src_peg_revision,
- &pair->src_op_revision, NULL,
+ &pair->src_op_revision,
svn_depth_infinity,
ignore_externals, FALSE,
&sleep_needed, ctx, pool);
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/delete.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/delete.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/delete.c Mon Mar 5 09:25:25 2012
@@ -39,6 +39,7 @@
#include "private/svn_client_private.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "svn_private_config.h"
@@ -187,6 +188,9 @@ single_repos_delete(svn_ra_session_t *ra
log_msg, ctx, pool));
/* Fetch RA commit editor */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ NULL, pool)));
SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
commit_revprops,
commit_callback,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/diff.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/diff.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/diff.c Mon Mar 5 09:25:25 2012
@@ -678,9 +678,9 @@ display_prop_diffs(const apr_array_heade
/* The last character in a property is often not a newline.
An eol character is appended to prevent the diff API to add a
- ' \ No newline at end of file' line. We add
+ ' \ No newline at end of file' line. We add
' \ No newline at end of property' manually if needed. */
- tmp = original_value ? original_value
+ tmp = original_value ? original_value
: svn_string_create_empty(iterpool);
orig = maybe_append_eol(tmp, NULL, iterpool);
@@ -1336,7 +1336,7 @@ static const svn_wc_diff_callbacks4_t di
diff_dir_opened,
diff_dir_added,
diff_dir_props_changed,
- diff_dir_closed
+ diff_dir_closed
};
/*-----------------------------------------------------------------*/
@@ -2010,7 +2010,7 @@ diff_repos_wc(const char *path_or_url1,
SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
SVN_RA_CAPABILITY_DEPTH, pool));
- SVN_ERR(svn_wc_get_diff_editor6(&diff_editor, &diff_edit_baton,
+ SVN_ERR(svn_wc__get_diff_editor(&diff_editor, &diff_edit_baton,
ctx->wc_ctx,
anchor_abspath,
target,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/externals.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/externals.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/externals.c Mon Mar 5 09:25:25 2012
@@ -277,7 +277,7 @@ switch_dir_external(const char *local_ab
/* ... Hello, new hotness. */
SVN_ERR(svn_client__checkout_internal(NULL, url, local_abspath, peg_revision,
- revision, NULL, svn_depth_infinity,
+ revision, svn_depth_infinity,
FALSE, FALSE, timestamp_sleep,
ctx, pool));
@@ -299,6 +299,9 @@ switch_dir_external(const char *local_ab
external_peg_rev,
external_rev,
pool));
+ /* Issue #4123: We don't need to keep the newly checked out external's
+ DB open. */
+ SVN_ERR(svn_wc__close_db(local_abspath, ctx->wc_ctx, pool));
}
return SVN_NO_ERROR;
@@ -604,11 +607,12 @@ handle_external_item_change(const struct
apr_pool_t *scratch_pool)
{
svn_ra_session_t *ra_session;
- svn_client__ra_session_from_path_results ra_cache = { 0 };
+ svn_revnum_t ra_revnum;
+ const char *ra_session_url;
+ const char *repos_root_url;
+ const char *repos_uuid;
const char *new_url;
- svn_node_kind_t kind;
-
- ra_cache.kind = svn_node_unknown;
+ svn_node_kind_t ext_kind;
SVN_ERR_ASSERT(eb->repos_root_url && parent_dir_url);
SVN_ERR_ASSERT(new_item != NULL);
@@ -628,34 +632,28 @@ handle_external_item_change(const struct
/* Determine if the external is a file or directory. */
/* Get the RA connection. */
SVN_ERR(svn_client__ra_session_from_path(&ra_session,
- &ra_cache.ra_revnum,
- &ra_cache.ra_session_url,
+ &ra_revnum,
+ &ra_session_url,
new_url, NULL,
&(new_item->peg_revision),
&(new_item->revision), eb->ctx,
scratch_pool));
- SVN_ERR(svn_ra_get_uuid2(ra_session, &ra_cache.repos_uuid,
- scratch_pool));
- SVN_ERR(svn_ra_get_repos_root2(ra_session, &ra_cache.repos_root_url,
- scratch_pool));
- SVN_ERR(svn_ra_check_path(ra_session, "", ra_cache.ra_revnum, &kind,
+ SVN_ERR(svn_ra_get_uuid2(ra_session, &repos_uuid, scratch_pool));
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url, scratch_pool));
+ SVN_ERR(svn_ra_check_path(ra_session, "", ra_revnum, &ext_kind,
scratch_pool));
- if (svn_node_none == kind)
+ if (svn_node_none == ext_kind)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
_("URL '%s' at revision %ld doesn't exist"),
- ra_cache.ra_session_url,
- ra_cache.ra_revnum);
+ ra_session_url, ra_revnum);
- if (svn_node_dir != kind && svn_node_file != kind)
+ if (svn_node_dir != ext_kind && svn_node_file != ext_kind)
return svn_error_createf(SVN_ERR_RA_ILLEGAL_URL, NULL,
_("URL '%s' at revision %ld is not a file "
"or a directory"),
- ra_cache.ra_session_url,
- ra_cache.ra_revnum);
-
- ra_cache.kind = kind;
+ ra_session_url, ra_revnum);
/* Not protecting against recursive externals. Detecting them in
@@ -682,7 +680,7 @@ handle_external_item_change(const struct
scratch_pool));
}
- switch (ra_cache.kind)
+ switch (ext_kind)
{
case svn_node_dir:
SVN_ERR(switch_dir_external(local_abspath, new_url,
@@ -693,20 +691,60 @@ handle_external_item_change(const struct
scratch_pool));
break;
case svn_node_file:
- if (strcmp(eb->repos_root_url, ra_cache.repos_root_url))
- return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
- _("Unsupported external: "
- "url of file external '%s' is not in repository '%s'"),
- new_url, eb->repos_root_url);
+ if (strcmp(eb->repos_root_url, repos_root_url))
+ {
+ const char *local_repos_root_url;
+ const char *local_repos_uuid;
+ const char *ext_repos_relpath;
+
+ /*
+ * The working copy library currently requires that all files
+ * in the working copy have the same repository root URL.
+ * The URL from the file external's definition differs from the
+ * one used by the working copy. As a workaround, replace the
+ * root URL portion of the file external's URL, after making
+ * sure both URLs point to the same repository. See issue #4087.
+ */
+
+ SVN_ERR(svn_wc__node_get_repos_info(&local_repos_root_url,
+ &local_repos_uuid,
+ eb->ctx->wc_ctx,
+ parent_dir_abspath,
+ scratch_pool, scratch_pool));
+ ext_repos_relpath = svn_uri_skip_ancestor(repos_root_url,
+ new_url, scratch_pool);
+ if (local_repos_uuid == NULL || local_repos_root_url == NULL ||
+ ext_repos_relpath == NULL ||
+ strcmp(local_repos_uuid, repos_uuid) != 0)
+ return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+ _("Unsupported external: URL of file external '%s' "
+ "is not in repository '%s'"),
+ new_url, eb->repos_root_url);
+
+ new_url = svn_path_url_add_component2(local_repos_root_url,
+ ext_repos_relpath,
+ scratch_pool);
+ SVN_ERR(svn_client__ra_session_from_path(&ra_session,
+ &ra_revnum,
+ &ra_session_url,
+ new_url,
+ NULL,
+ &(new_item->peg_revision),
+ &(new_item->revision),
+ eb->ctx, scratch_pool));
+ SVN_ERR(svn_ra_get_repos_root2(ra_session, &repos_root_url,
+ scratch_pool));
+ }
+
SVN_ERR(switch_file_external(local_abspath,
new_url,
&new_item->peg_revision,
&new_item->revision,
parent_dir_abspath,
ra_session,
- ra_cache.ra_session_url,
- ra_cache.ra_revnum,
- ra_cache.repos_root_url,
+ ra_session_url,
+ ra_revnum,
+ repos_root_url,
eb->timestamp_sleep, eb->ctx,
scratch_pool));
break;
@@ -743,10 +781,6 @@ wrap_external_error(const struct externa
return err;
}
-/* This implements the 'svn_hash_diff_func_t' interface.
- BATON is of type 'struct handle_externals_desc_change_baton *'.
- KEY is a 'const char *'.
-*/
static svn_error_t *
handle_externals_change(const struct external_change_baton_t *eb,
const char *local_abspath,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/merge.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/merge.c Mon Mar 5 09:25:25 2012
@@ -48,6 +48,7 @@
#include "svn_props.h"
#include "svn_time.h"
#include "svn_sorts.h"
+#include "svn_subst.h"
#include "svn_ra.h"
#include "client.h"
#include "mergeinfo.h"
@@ -1393,7 +1394,7 @@ check_moved_away(svn_boolean_t *moved_aw
{
const char *moved_to_abspath;
svn_error_t *err;
-
+
*moved_away = FALSE;
err = svn_wc__node_was_moved_away(&moved_to_abspath, NULL,
@@ -1423,7 +1424,7 @@ check_moved_here(svn_boolean_t *moved_he
{
const char *moved_from_abspath;
svn_error_t *err;
-
+
*moved_here = FALSE;
err = svn_wc__node_was_moved_here(&moved_from_abspath, NULL,
@@ -1995,10 +1996,14 @@ files_same_p(svn_boolean_t *same,
svn_opt_revision_t working_rev = { svn_opt_revision_working, { 0 } };
/* Compare the file content, translating 'mine' to 'normal' form. */
- SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx,
- mine_abspath, &working_rev,
- FALSE, TRUE, NULL, NULL,
- scratch_pool, scratch_pool));
+ if (svn_prop_get_value(working_props, SVN_PROP_SPECIAL) != NULL)
+ SVN_ERR(svn_subst_read_specialfile(&mine_stream, mine_abspath,
+ scratch_pool, scratch_pool));
+ else
+ SVN_ERR(svn_client__get_normalized_stream(&mine_stream, wc_ctx,
+ mine_abspath, &working_rev,
+ FALSE, TRUE, NULL, NULL,
+ scratch_pool, scratch_pool));
SVN_ERR(svn_stream_open_readonly(&older_stream, older_abspath,
scratch_pool, scratch_pool));
@@ -7540,7 +7545,7 @@ flag_subtrees_needing_mergeinfo(svn_bool
operational depth is empty or files, then the mere
existence of operative immediate children means we
must record non-inheritable mergeinfo.
-
+
### What about svn_depth_immediates? In that case
### the merge target needs only normal inheritable
### mergeinfo and the target's immediate children will
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/mergeinfo.c Mon Mar 5 09:25:25 2012
@@ -1147,7 +1147,7 @@ svn_client__elide_mergeinfo_catalog(svn_
const char *top;
const char *path_suffix;
svn_boolean_t elides = FALSE;
-
+
svn_pool_clear(iterpool);
/* Pop off any paths which are not ancestors of PATH. */
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/prop_commands.c Mon Mar 5 09:25:25 2012
@@ -41,6 +41,7 @@
#include "svn_private_config.h"
#include "private/svn_wc_private.h"
+#include "private/svn_ra_private.h"
#include "private/svn_client_private.h"
@@ -242,6 +243,9 @@ propset_on_url(const char *propname,
message, ctx, pool));
/* Fetch RA commit editor. */
+ SVN_ERR(svn_ra__register_editor_shim_callbacks(ra_session,
+ svn_client__get_shim_callbacks(ctx->wc_ctx,
+ NULL, pool)));
SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,
commit_revprops,
commit_callback,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/repos_diff.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/repos_diff.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/repos_diff.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/repos_diff.c Mon Mar 5 09:25:25 2012
@@ -1317,7 +1317,10 @@ fetch_kind_func(svn_kind_t *kind,
struct edit_baton *eb = baton;
svn_node_kind_t node_kind;
- SVN_ERR(svn_ra_check_path(eb->ra_session, path, eb->revision, &node_kind,
+ if (!SVN_IS_VALID_REVNUM(base_revision))
+ base_revision = eb->revision;
+
+ SVN_ERR(svn_ra_check_path(eb->ra_session, path, base_revision, &node_kind,
scratch_pool));
*kind = svn__kind_from_node_kind(node_kind, FALSE);
@@ -1335,12 +1338,15 @@ fetch_props_func(apr_hash_t **props,
struct edit_baton *eb = baton;
svn_node_kind_t node_kind;
- SVN_ERR(svn_ra_check_path(eb->ra_session, path, eb->revision, &node_kind,
+ if (!SVN_IS_VALID_REVNUM(base_revision))
+ base_revision = eb->revision;
+
+ SVN_ERR(svn_ra_check_path(eb->ra_session, path, base_revision, &node_kind,
scratch_pool));
if (node_kind == svn_node_file)
{
- SVN_ERR(svn_ra_get_file(eb->ra_session, path, eb->revision,
+ SVN_ERR(svn_ra_get_file(eb->ra_session, path, base_revision,
NULL, NULL, props, result_pool));
}
else if (node_kind == svn_node_dir)
@@ -1348,7 +1354,7 @@ fetch_props_func(apr_hash_t **props,
apr_array_header_t *tmp_props;
SVN_ERR(svn_ra_get_dir2(eb->ra_session, NULL, NULL, props, path,
- eb->revision, 0 /* Dirent fields */,
+ base_revision, 0 /* Dirent fields */,
result_pool));
tmp_props = svn_prop_hash_to_array(*props, result_pool);
SVN_ERR(svn_categorize_props(tmp_props, NULL, NULL, &tmp_props,
@@ -1375,11 +1381,14 @@ fetch_base_func(const char **filename,
svn_stream_t *fstream;
svn_error_t *err;
+ if (!SVN_IS_VALID_REVNUM(base_revision))
+ base_revision = eb->revision;
+
SVN_ERR(svn_stream_open_unique(&fstream, filename, NULL,
svn_io_file_del_on_pool_cleanup,
result_pool, scratch_pool));
- err = svn_ra_get_file(eb->ra_session, path, eb->revision,
+ err = svn_ra_get_file(eb->ra_session, path, base_revision,
fstream, NULL, NULL, scratch_pool);
if (err && err->apr_err == SVN_ERR_FS_NOT_FOUND)
{
@@ -1391,7 +1400,7 @@ fetch_base_func(const char **filename,
}
else if (err)
return svn_error_trace(err);
-
+
SVN_ERR(svn_stream_close(fstream));
return SVN_NO_ERROR;
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/status.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/status.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/status.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/status.c Mon Mar 5 09:25:25 2012
@@ -374,7 +374,7 @@ svn_client_status5(svn_revnum_t *result_
SVN_ERR(svn_ra_has_capability(ra_session, &server_supports_depth,
SVN_RA_CAPABILITY_DEPTH, pool));
- SVN_ERR(svn_wc_get_status_editor5(&editor, &edit_baton, &set_locks_baton,
+ SVN_ERR(svn_wc__get_status_editor(&editor, &edit_baton, &set_locks_baton,
&edit_revision, ctx->wc_ctx,
dir_abspath, target_basename,
depth, get_all,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/switch.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/switch.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/switch.c Mon Mar 5 09:25:25 2012
@@ -228,7 +228,7 @@ switch_internal(svn_revnum_t *result_rev
SVN_ERR(svn_ra_get_session_url(ra_session, &dfb.anchor_url, pool));
dfb.target_revision = revnum;
- SVN_ERR(svn_wc_get_switch_editor4(&switch_editor, &switch_edit_baton,
+ SVN_ERR(svn_wc__get_switch_editor(&switch_editor, &switch_edit_baton,
&revnum, ctx->wc_ctx, anchor_abspath,
target, switch_rev_url, use_commit_times,
depth,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/update.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/update.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/update.c Mon Mar 5 09:25:25 2012
@@ -370,7 +370,7 @@ update_internal(svn_revnum_t *result_rev
/* Fetch the update editor. If REVISION is invalid, that's okay;
the RA driver will call editor->set_target_revision later on. */
- SVN_ERR(svn_wc_get_update_editor4(&update_editor, &update_edit_baton,
+ SVN_ERR(svn_wc__get_update_editor(&update_editor, &update_edit_baton,
&revnum, ctx->wc_ctx, anchor_abspath,
target, use_commit_times, depth,
depth_is_sticky, allow_unver_obstructions,
Modified: subversion/branches/revprop-packing/subversion/libsvn_client/util.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_client/util.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_client/util.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_client/util.c Mon Mar 5 09:25:25 2012
@@ -240,3 +240,163 @@ svn_client__assert_homogeneous_target_ty
return SVN_NO_ERROR;
}
+
+struct shim_callbacks_baton
+{
+ svn_wc_context_t *wc_ctx;
+ const char *anchor_abspath;
+};
+
+static svn_error_t *
+rationalize_shim_path(const char **local_abspath,
+ struct shim_callbacks_baton *scb,
+ const char *path,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ if (svn_path_is_url(path))
+ {
+ /* This is a copyfrom URL */
+ const char *wcroot_abspath;
+ const char *wcroot_url;
+ const char *relpath;
+
+ SVN_ERR(svn_wc__get_wc_root(&wcroot_abspath, scb->wc_ctx,
+ scb->anchor_abspath,
+ scratch_pool, scratch_pool));
+ SVN_ERR(svn_wc__node_get_url(&wcroot_url, scb->wc_ctx, wcroot_abspath,
+ scratch_pool, scratch_pool));
+ relpath = svn_uri_skip_ancestor(wcroot_url, path, scratch_pool);
+ *local_abspath = svn_dirent_join(wcroot_abspath, relpath, result_pool);
+ }
+ else
+ *local_abspath = svn_dirent_join(scb->anchor_abspath, path, result_pool);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fetch_props_func(apr_hash_t **props,
+ void *baton,
+ const char *path,
+ svn_revnum_t base_revision,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct shim_callbacks_baton *scb = baton;
+ const char *local_abspath;
+
+ /* Early out: if we didn't get an anchor_abspath, it means we don't have a
+ working copy, and hence no method of fetching the requisite information. */
+ if (!scb->anchor_abspath)
+ {
+ *props = apr_hash_make(result_pool);
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
+ scratch_pool));
+
+ SVN_ERR(svn_wc_get_pristine_props(props, scb->wc_ctx, local_abspath,
+ result_pool, scratch_pool));
+
+ if (!*props)
+ *props = apr_hash_make(result_pool);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fetch_kind_func(svn_kind_t *kind,
+ void *baton,
+ const char *path,
+ svn_revnum_t base_revision,
+ apr_pool_t *scratch_pool)
+{
+ struct shim_callbacks_baton *scb = baton;
+ svn_node_kind_t node_kind;
+ const char *local_abspath;
+
+ /* Early out: if we didn't get an anchor_abspath, it means we don't have a
+ working copy, and hence no method of fetching the requisite information. */
+ if (!scb->anchor_abspath)
+ {
+ *kind = svn_kind_unknown;
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
+ scratch_pool));
+
+ SVN_ERR(svn_wc_read_kind(&node_kind, scb->wc_ctx, local_abspath, FALSE,
+ scratch_pool));
+ *kind = svn__kind_from_node_kind(node_kind, FALSE);
+
+ return SVN_NO_ERROR;
+}
+
+static svn_error_t *
+fetch_base_func(const char **filename,
+ void *baton,
+ const char *path,
+ svn_revnum_t base_revision,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ struct shim_callbacks_baton *scb = baton;
+ const char *local_abspath;
+ svn_stream_t *pristine_stream;
+ svn_stream_t *temp_stream;
+ svn_error_t *err;
+
+ /* Early out: if we didn't get an anchor_abspath, it means we don't have a
+ working copy, and hence no method of fetching the requisite information. */
+ if (!scb->anchor_abspath)
+ {
+ *filename = NULL;
+ return SVN_NO_ERROR;
+ }
+
+ SVN_ERR(rationalize_shim_path(&local_abspath, scb, path, scratch_pool,
+ scratch_pool));
+
+ err = svn_wc_get_pristine_contents2(&pristine_stream, scb->wc_ctx,
+ local_abspath, scratch_pool,
+ scratch_pool);
+ if (err && err->apr_err == SVN_ERR_WC_PATH_NOT_FOUND)
+ {
+ svn_error_clear(err);
+ *filename = NULL;
+ return SVN_NO_ERROR;
+ }
+ else if (err)
+ return svn_error_trace(err);
+
+ SVN_ERR(svn_stream_open_unique(&temp_stream, filename, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ result_pool, scratch_pool));
+ SVN_ERR(svn_stream_copy3(pristine_stream, temp_stream, NULL, NULL,
+ scratch_pool));
+
+ return SVN_NO_ERROR;
+}
+
+svn_delta_shim_callbacks_t *
+svn_client__get_shim_callbacks(svn_wc_context_t *wc_ctx,
+ const char *anchor_abspath,
+ apr_pool_t *result_pool)
+{
+ svn_delta_shim_callbacks_t *callbacks =
+ svn_delta_shim_callbacks_default(result_pool);
+ struct shim_callbacks_baton *scb = apr_pcalloc(result_pool, sizeof(*scb));
+
+ scb->wc_ctx = wc_ctx;
+ scb->anchor_abspath = apr_pstrdup(result_pool, anchor_abspath);
+
+ callbacks->fetch_props_func = fetch_props_func;
+ callbacks->fetch_kind_func = fetch_kind_func;
+ callbacks->fetch_base_func = fetch_base_func;
+ callbacks->fetch_baton = scb;
+
+ return callbacks;
+}
Modified: subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c
URL: http://svn.apache.org/viewvc/subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c?rev=1296975&r1=1296974&r2=1296975&view=diff
==============================================================================
--- subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c (original)
+++ subversion/branches/revprop-packing/subversion/libsvn_delta/compat.c Mon Mar 5 09:25:25 2012
@@ -85,8 +85,8 @@ svn_compat_wrap_file_rev_handler(svn_fil
/* The following code maps the calls to a traditional delta editor to an
* Editorv2 editor. It does this by keeping track of a lot of state, and
* then communicating that state to Ev2 upon closure of the file or dir (or
- * edit). Note that Ev2 calls add_symlink() and set_target() are not present
- * in the delta editor paradigm, so we never call them.
+ * edit). Note that Ev2 calls add_symlink() and alter_symlink() are not
+ * present in the delta editor paradigm, so we never call them.
*
* The general idea here is that we have to see *all* the actions on a node's
* parent before we can process that node, which means we need to buffer a
@@ -129,9 +129,14 @@ struct extra_baton
struct ev2_edit_baton
{
svn_editor_t *editor;
+
apr_hash_t *paths;
+ apr_array_header_t *path_order;
+ int paths_processed;
+
apr_pool_t *edit_pool;
struct extra_baton *exb;
+ svn_boolean_t closed;
svn_boolean_t *found_abs_paths; /* Did we strip an incoming '/' from the
paths? */
@@ -189,6 +194,7 @@ struct prop_args
const char *name;
svn_revnum_t base_revision;
const svn_string_t *value;
+ svn_kind_t kind;
};
struct copy_args
@@ -201,7 +207,6 @@ struct path_checksum_args
{
const char *path;
svn_revnum_t base_revision;
- svn_checksum_t *checksum;
};
static svn_error_t *
@@ -220,10 +225,12 @@ add_action(struct ev2_edit_baton *eb,
if (action_list == NULL)
{
+ const char *path_dup = apr_pstrdup(eb->edit_pool, path);
+
action_list = apr_array_make(eb->edit_pool, 1,
sizeof(struct path_action *));
- apr_hash_set(eb->paths, apr_pstrdup(eb->edit_pool, path),
- APR_HASH_KEY_STRING, action_list);
+ apr_hash_set(eb->paths, path_dup, APR_HASH_KEY_STRING, action_list);
+ APR_ARRAY_PUSH(eb->path_order, const char *) = path_dup;
}
APR_ARRAY_PUSH(action_list, struct path_action *) = p_action;
@@ -231,6 +238,42 @@ add_action(struct ev2_edit_baton *eb,
return SVN_NO_ERROR;
}
+/* Find all the paths which are immediate children of PATH and return their
+ basenames in a list. */
+static apr_array_header_t *
+get_children(struct ev2_edit_baton *eb,
+ const char *path,
+ apr_pool_t *pool)
+{
+ apr_array_header_t *children = apr_array_make(pool, 1, sizeof(const char *));
+ apr_hash_index_t *hi;
+
+ for (hi = apr_hash_first(pool, eb->paths); hi; hi = apr_hash_next(hi))
+ {
+ const char *p = svn__apr_hash_index_key(hi);
+ const char *child;
+
+ /* Sanitize our paths. */
+ if (*p == '/')
+ p++;
+
+ /* Find potential children. */
+ child = svn_relpath_skip_ancestor(path, p);
+ if (!child || !*child)
+ continue;
+
+ /* If we have a path separator, it's a deep child, so just ignore it.
+ ### Is there an API we should be using for this? */
+ if (strchr(child, '/') != NULL)
+ continue;
+
+ APR_ARRAY_PUSH(children, const char *) = child;
+ }
+
+ return children;
+}
+
+
static svn_error_t *
process_actions(void *edit_baton,
const char *path,
@@ -244,13 +287,13 @@ process_actions(void *edit_baton,
svn_boolean_t need_copy = FALSE;
const char *copyfrom_path;
svn_revnum_t copyfrom_rev;
- apr_array_header_t *children;
+ apr_array_header_t *children = NULL;
svn_stream_t *contents = NULL;
svn_checksum_t *checksum = NULL;
svn_revnum_t delete_revnum = SVN_INVALID_REVNUM;
svn_revnum_t props_base_revision = SVN_INVALID_REVNUM;
svn_revnum_t text_base_revision = SVN_INVALID_REVNUM;
- svn_kind_t kind;
+ svn_kind_t kind = svn_kind_unknown;
int i;
if (*path == '/')
@@ -272,6 +315,8 @@ process_actions(void *edit_baton,
{
const struct prop_args *p_args = action->args;
+ kind = p_args->kind;
+
if (!SVN_IS_VALID_REVNUM(props_base_revision))
props_base_revision = p_args->base_revision;
else
@@ -283,6 +328,12 @@ process_actions(void *edit_baton,
the modifications to it. */
if (need_delete && need_add)
props = apr_hash_make(scratch_pool);
+ else if (need_copy)
+ SVN_ERR(eb->fetch_props_func(&props,
+ eb->fetch_props_baton,
+ copyfrom_path,
+ copyfrom_rev,
+ scratch_pool, scratch_pool));
else
SVN_ERR(eb->fetch_props_func(&props,
eb->fetch_props_baton,
@@ -310,8 +361,7 @@ process_actions(void *edit_baton,
if (kind == svn_kind_dir)
{
- children = apr_array_make(scratch_pool, 1,
- sizeof(const char *));
+ children = get_children(eb, path, scratch_pool);
}
else
{
@@ -327,9 +377,13 @@ process_actions(void *edit_baton,
{
struct path_checksum_args *pca = action->args;
+ /* We can only set text on files. */
+ kind = svn_kind_file;
+
+ SVN_ERR(svn_io_file_checksum2(&checksum, pca->path,
+ svn_checksum_sha1, scratch_pool));
SVN_ERR(svn_stream_open_readonly(&contents, pca->path,
scratch_pool, scratch_pool));
- checksum = pca->checksum;
if (!SVN_IS_VALID_REVNUM(text_base_revision))
text_base_revision = pca->base_revision;
@@ -375,10 +429,14 @@ process_actions(void *edit_baton,
{
/* If we're only doing a delete, do it here. */
SVN_ERR(svn_editor_delete(eb->editor, path, delete_revnum));
+ return SVN_NO_ERROR;
}
if (need_add)
{
+ if (props == NULL)
+ props = apr_hash_make(scratch_pool);
+
if (kind == svn_kind_dir)
{
SVN_ERR(svn_editor_add_directory(eb->editor, path, children,
@@ -399,19 +457,29 @@ process_actions(void *edit_baton,
delete_revnum));
}
- if (props)
+ if (props || contents)
{
- /* We fetched and modified the props in some way. Apply 'em now that
- we have the new set. */
- SVN_ERR(svn_editor_set_props(eb->editor, path, props_base_revision,
- props, contents == NULL));
- }
+ /* We fetched and modified the props or content in some way. Apply 'em
+ now. */
+ svn_revnum_t base_revision;
+
+ if (SVN_IS_VALID_REVNUM(props_base_revision)
+ && SVN_IS_VALID_REVNUM(text_base_revision))
+ SVN_ERR_ASSERT(props_base_revision == text_base_revision);
+
+ if (SVN_IS_VALID_REVNUM(props_base_revision))
+ base_revision = props_base_revision;
+ else if (SVN_IS_VALID_REVNUM(text_base_revision))
+ base_revision = text_base_revision;
+ else
+ base_revision = SVN_INVALID_REVNUM;
- if (contents)
- {
- /* If we have an content for this node, set it now. */
- SVN_ERR(svn_editor_set_text(eb->editor, path, text_base_revision,
- checksum, contents));
+ if (kind == svn_kind_dir)
+ SVN_ERR(svn_editor_alter_directory(eb->editor, path, base_revision,
+ props));
+ else
+ SVN_ERR(svn_editor_alter_file(eb->editor, path, base_revision, props,
+ checksum, contents));
}
return SVN_NO_ERROR;
@@ -422,29 +490,21 @@ run_ev2_actions(void *edit_baton,
apr_pool_t *scratch_pool)
{
struct ev2_edit_baton *eb = edit_baton;
- apr_array_header_t *sorted_hash;
apr_pool_t *iterpool;
- int i;
-
- /* Sort the paths touched by this edit.
- * Ev2 doesn't really have any particular need for depth-first-ness, but
- * we want to ensure all parent directories are handled before children in
- * the case of adds (which does introduce an element of depth-first-ness). */
- sorted_hash = svn_sort__hash(eb->paths, svn_sort_compare_items_as_paths,
- scratch_pool);
iterpool = svn_pool_create(scratch_pool);
- for (i = 0; i < sorted_hash->nelts; i++)
- {
- svn_sort__item_t *item = &APR_ARRAY_IDX(sorted_hash, i, svn_sort__item_t);
- apr_array_header_t *actions = item->value;
- const char *path = item->key;
+
+ /* Possibly pick up where we left off. Ocassionally, we do some of these
+ as part of close_edit() and then some more as part of abort_edit() */
+ for (; eb->paths_processed < eb->path_order->nelts; ++eb->paths_processed)
+ {
+ const char *path = APR_ARRAY_IDX(eb->path_order, eb->paths_processed,
+ const char *);
+ apr_array_header_t *actions = apr_hash_get(eb->paths, path,
+ APR_HASH_KEY_STRING);
svn_pool_clear(iterpool);
SVN_ERR(process_actions(edit_baton, path, actions, iterpool));
-
- /* Remove this item from the hash. */
- apr_hash_set(eb->paths, path, APR_HASH_KEY_STRING, NULL);
}
svn_pool_destroy(iterpool);
@@ -589,6 +649,7 @@ ev2_change_dir_prop(void *dir_baton,
p_args->name = apr_pstrdup(db->eb->edit_pool, name);
p_args->value = value ? svn_string_dup(value, db->eb->edit_pool) : NULL;
p_args->base_revision = db->base_revision;
+ p_args->kind = svn_kind_dir;
SVN_ERR(add_action(db->eb, db->path, ACTION_PROPSET, p_args));
@@ -609,7 +670,7 @@ ev2_absent_directory(const char *path,
{
struct ev2_dir_baton *pb = parent_baton;
svn_kind_t *kind = apr_palloc(pb->eb->edit_pool, sizeof(*kind));
-
+
*kind = svn_kind_dir;
SVN_ERR(add_action(pb->eb, path, ACTION_ADD_ABSENT, kind));
@@ -705,6 +766,8 @@ struct handler_baton
svn_txdelta_window_handler_t apply_handler;
void *apply_baton;
+ svn_stream_t *source;
+
apr_pool_t *pool;
};
@@ -718,6 +781,8 @@ window_handler(svn_txdelta_window_t *win
if (window != NULL && !err)
return SVN_NO_ERROR;
+ SVN_ERR(svn_stream_close(hb->source));
+
svn_pool_destroy(hb->pool);
return svn_error_trace(err);
@@ -734,7 +799,6 @@ ev2_apply_textdelta(void *file_baton,
struct ev2_file_baton *fb = file_baton;
apr_pool_t *handler_pool = svn_pool_create(fb->eb->edit_pool);
struct handler_baton *hb = apr_pcalloc(handler_pool, sizeof(*hb));
- svn_stream_t *source;
svn_stream_t *target;
struct path_checksum_args *pca = apr_pcalloc(fb->eb->edit_pool,
sizeof(*pca));
@@ -742,27 +806,22 @@ ev2_apply_textdelta(void *file_baton,
pca->base_revision = fb->base_revision;
if (! fb->delta_base)
- source = svn_stream_empty(handler_pool);
+ hb->source = svn_stream_empty(handler_pool);
else
- SVN_ERR(svn_stream_open_readonly(&source, fb->delta_base, handler_pool,
+ SVN_ERR(svn_stream_open_readonly(&hb->source, fb->delta_base, handler_pool,
result_pool));
SVN_ERR(svn_stream_open_unique(&target, &pca->path, NULL,
svn_io_file_del_on_pool_cleanup,
fb->eb->edit_pool, result_pool));
- /* Wrap our target with a checksum'ing stream. */
- target = svn_stream_checksummed2(target, NULL, &pca->checksum,
- svn_checksum_sha1, TRUE,
- fb->eb->edit_pool);
-
- svn_txdelta_apply(source, target,
+ svn_txdelta_apply(hb->source, target,
NULL, NULL,
handler_pool,
&hb->apply_handler, &hb->apply_baton);
hb->pool = handler_pool;
-
+
*handler_baton = hb;
*handler = window_handler;
@@ -792,6 +851,7 @@ ev2_change_file_prop(void *file_baton,
p_args->name = apr_pstrdup(fb->eb->edit_pool, name);
p_args->value = value ? svn_string_dup(value, fb->eb->edit_pool) : NULL;
p_args->base_revision = fb->base_revision;
+ p_args->kind = svn_kind_file;
SVN_ERR(add_action(fb->eb, fb->path, ACTION_PROPSET, p_args));
@@ -813,7 +873,7 @@ ev2_absent_file(const char *path,
{
struct ev2_dir_baton *pb = parent_baton;
svn_kind_t *kind = apr_palloc(pb->eb->edit_pool, sizeof(*kind));
-
+
*kind = svn_kind_file;
SVN_ERR(add_action(pb->eb, path, ACTION_ADD_ABSENT, kind));
@@ -827,6 +887,7 @@ ev2_close_edit(void *edit_baton,
struct ev2_edit_baton *eb = edit_baton;
SVN_ERR(run_ev2_actions(edit_baton, scratch_pool));
+ eb->closed = TRUE;
return svn_error_trace(svn_editor_complete(eb->editor));
}
@@ -837,7 +898,10 @@ ev2_abort_edit(void *edit_baton,
struct ev2_edit_baton *eb = edit_baton;
SVN_ERR(run_ev2_actions(edit_baton, scratch_pool));
- return svn_error_trace(svn_editor_abort(eb->editor));
+ if (!eb->closed)
+ return svn_error_trace(svn_editor_abort(eb->editor));
+ else
+ return SVN_NO_ERROR;
}
/* Return a svn_delta_editor_t * in DEDITOR, with an accompanying baton in
@@ -859,7 +923,7 @@ ev2_abort_edit(void *edit_baton,
* - EXB: An 'extra baton' which is used to communicate between the shims.
* Its callbacks should be invoked at the appropriate time by this
* shim.
- */
+ */
static svn_error_t *
delta_from_editor(const svn_delta_editor_t **deditor,
void **dedit_baton,
@@ -897,6 +961,7 @@ delta_from_editor(const svn_delta_editor
eb->editor = editor;
eb->paths = apr_hash_make(pool);
+ eb->path_order = apr_array_make(pool, 1, sizeof(const char *));
eb->edit_pool = pool;
eb->found_abs_paths = found_abs_paths;
*eb->found_abs_paths = FALSE;
@@ -1055,19 +1120,15 @@ build(struct editor_baton *eb,
apr_hash_t *current_props;
apr_array_header_t *propdiffs;
- /* Only fetch the kind if operating on something other than the root,
- as we already know the kind on the root. */
- if (operation->path)
- {
- if (kind == svn_kind_unknown)
- SVN_ERR(eb->fetch_kind_func(&operation->kind, eb->fetch_kind_baton,
- relpath, rev, scratch_pool));
- else
- operation->kind = kind;
- }
+ operation->kind = kind;
if (operation->operation == OP_REPLACE)
current_props = apr_hash_make(scratch_pool);
+ else if (operation->copyfrom_url)
+ SVN_ERR(eb->fetch_props_func(¤t_props, eb->fetch_props_baton,
+ operation->copyfrom_url,
+ operation->copyfrom_revision,
+ scratch_pool, scratch_pool));
else
SVN_ERR(eb->fetch_props_func(¤t_props, eb->fetch_props_baton,
relpath, rev, scratch_pool,
@@ -1081,7 +1142,7 @@ build(struct editor_baton *eb,
actual structures, not pointers to them. */
svn_prop_t *prop = &APR_ARRAY_IDX(propdiffs, i, svn_prop_t);
if (!prop->value)
- APR_ARRAY_PUSH(operation->prop_dels, const char *) =
+ APR_ARRAY_PUSH(operation->prop_dels, const char *) =
apr_pstrdup(eb->edit_pool, prop->name);
else
apr_hash_set(operation->prop_mods,
@@ -1285,68 +1346,89 @@ add_absent_cb(void *baton,
return SVN_NO_ERROR;
}
-/* This implements svn_editor_cb_set_props_t */
+/* This implements svn_editor_cb_alter_directory_t */
static svn_error_t *
-set_props_cb(void *baton,
- const char *relpath,
- svn_revnum_t revision,
- apr_hash_t *props,
- svn_boolean_t complete,
- apr_pool_t *scratch_pool)
+alter_directory_cb(void *baton,
+ const char *relpath,
+ svn_revnum_t revision,
+ apr_hash_t *props,
+ apr_pool_t *scratch_pool)
{
struct editor_baton *eb = baton;
- SVN_ERR(build(eb, ACTION_PROPSET, relpath, svn_kind_unknown,
+ /* ### should we verify the kind is truly a directory? */
+
+ SVN_ERR(build(eb, ACTION_PROPSET, relpath, svn_kind_dir,
NULL, SVN_INVALID_REVNUM,
props, NULL, NULL, revision, scratch_pool));
return SVN_NO_ERROR;
}
-/* This implements svn_editor_cb_set_text_t */
+/* This implements svn_editor_cb_alter_file_t */
static svn_error_t *
-set_text_cb(void *baton,
- const char *relpath,
- svn_revnum_t revision,
- const svn_checksum_t *checksum,
- svn_stream_t *contents,
- apr_pool_t *scratch_pool)
+alter_file_cb(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)
{
struct editor_baton *eb = baton;
const char *tmp_filename;
svn_stream_t *tmp_stream;
svn_checksum_t *md5_checksum;
- /* We may need to re-checksum these contents */
- if (!(checksum && checksum->kind == svn_checksum_md5))
- contents = svn_stream_checksummed2(contents, &md5_checksum, NULL,
- svn_checksum_md5, TRUE, scratch_pool);
- else
- md5_checksum = (svn_checksum_t *)checksum;
+ /* ### should we verify the kind is truly a file? */
- /* Spool the contents to a tempfile, and provide that to the driver. */
- SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_filename, NULL,
- svn_io_file_del_on_pool_cleanup,
- eb->edit_pool, scratch_pool));
- SVN_ERR(svn_stream_copy3(contents, tmp_stream, NULL, NULL, scratch_pool));
+ if (contents)
+ {
+ /* We may need to re-checksum these contents */
+ if (!(checksum && checksum->kind == svn_checksum_md5))
+ contents = svn_stream_checksummed2(contents, &md5_checksum, NULL,
+ svn_checksum_md5, TRUE,
+ scratch_pool);
+ else
+ md5_checksum = (svn_checksum_t *)checksum;
- SVN_ERR(build(eb, ACTION_PUT, relpath, svn_kind_file,
- NULL, SVN_INVALID_REVNUM,
- NULL, tmp_filename, md5_checksum, revision, scratch_pool));
+ /* Spool the contents to a tempfile, and provide that to the driver. */
+ SVN_ERR(svn_stream_open_unique(&tmp_stream, &tmp_filename, NULL,
+ svn_io_file_del_on_pool_cleanup,
+ eb->edit_pool, scratch_pool));
+ SVN_ERR(svn_stream_copy3(contents, tmp_stream, NULL, NULL,
+ scratch_pool));
+
+ SVN_ERR(build(eb, ACTION_PUT, relpath, svn_kind_file,
+ NULL, SVN_INVALID_REVNUM,
+ NULL, tmp_filename, md5_checksum, revision, scratch_pool));
+ }
+
+ if (props)
+ {
+ SVN_ERR(build(eb, ACTION_PROPSET, relpath, svn_kind_file,
+ NULL, SVN_INVALID_REVNUM,
+ props, NULL, NULL, revision, scratch_pool));
+ }
return SVN_NO_ERROR;
}
-/* This implements svn_editor_cb_set_target_t */
+/* This implements svn_editor_cb_alter_symlink_t */
static svn_error_t *
-set_target_cb(void *baton,
- const char *relpath,
- svn_revnum_t revision,
- const char *target,
- apr_pool_t *scratch_pool)
+alter_symlink_cb(void *baton,
+ const char *relpath,
+ svn_revnum_t revision,
+ apr_hash_t *props,
+ const char *target,
+ apr_pool_t *scratch_pool)
{
struct editor_baton *eb = baton;
+ /* ### should we verify the kind is truly a symlink? */
+
+ /* ### do something */
+
return SVN_NO_ERROR;
}
@@ -1489,7 +1571,8 @@ drive_tree(struct operation *op,
{
/* Open or create our baton. */
if (op->operation == OP_OPEN || op->operation == OP_PROPSET)
- SVN_ERR(editor->open_directory(path, parent_op->baton, op->base_revision,
+ SVN_ERR(editor->open_directory(path, parent_op->baton,
+ op->base_revision,
scratch_pool, &op->baton));
else if (op->operation == OP_ADD || op->operation == OP_REPLACE)
@@ -1529,7 +1612,7 @@ drive_tree(struct operation *op,
I don't know that that's a valid assumption... */
void *file_baton = NULL;
-
+
/* Open or create our baton. */
if (op->operation == OP_OPEN || op->operation == OP_PROPSET)
SVN_ERR(editor->open_file(path, parent_op->baton, op->base_revision,
@@ -1604,7 +1687,7 @@ drive_root(struct operation *root,
svn_pool_clear(iterpool);
SVN_ERR(drive_tree(child, root, editor, make_abs_paths, iterpool));
}
-
+
/* We need to close the root directory, but leave it to our caller to call
close_ or abort_edit(). */
SVN_ERR(editor->close_directory(root->baton, scratch_pool));
@@ -1767,9 +1850,9 @@ editor_from_delta(svn_editor_t **editor_
add_file_cb,
add_symlink_cb,
add_absent_cb,
- set_props_cb,
- set_text_cb,
- set_target_cb,
+ alter_directory_cb,
+ alter_file_cb,
+ alter_symlink_cb,
delete_cb,
copy_cb,
move_cb,
@@ -1865,6 +1948,10 @@ svn_editor__insert_shims(const svn_delta
unlock_func_t unlock_func;
void *unlock_baton;
+ SVN_ERR_ASSERT(shim_callbacks->fetch_kind_func != NULL);
+ SVN_ERR_ASSERT(shim_callbacks->fetch_props_func != NULL);
+ SVN_ERR_ASSERT(shim_callbacks->fetch_base_func != NULL);
+
SVN_ERR(editor_from_delta(&editor, &exb, &unlock_func, &unlock_baton,
deditor_in, dedit_baton_in,
found_abs_paths, NULL, NULL,