[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: Behaviour of 'svn lock' in a read-only workspace

From: Philip Martin <philip.martin_at_wandisco.com>
Date: Wed, 19 Mar 2014 00:23:47 +0000

Ben Reser <ben_at_reser.org> writes:

> Index: subversion/libsvn_client/locking_commands.c
> ===================================================================
> --- subversion/libsvn_client/locking_commands.c (revision 1579078)
> +++ subversion/libsvn_client/locking_commands.c (working copy)
> @@ -294,6 +294,12 @@ organize_lock_targets(const char **common_parent_u
> _("No common parent found, unable to operate "
> "on disjoint arguments"));
>
> + /* Make sure the working copy is writable before modifying the
> + * repository otherwise we'll have a lock token with no place to put it
> + * or won't be able to remove the local lock token. */
> + SVN_ERR(svn_wc__acquire_write_lock(NULL, wc_ctx, common_dirent, FALSE,
> + result_pool, scratch_pool));
> +
> /* Get the URL for each target (which also serves to verify that
> the dirent targets are sane). */
> target_urls = apr_array_make(scratch_pool, rel_targets->nelts,
> @@ -504,6 +510,9 @@ svn_client_lock(const apr_array_header_t *targets,
> SVN_ERR(svn_ra_lock(ra_session, path_revs, comment,
> steal_lock, store_locks_callback, &cb, pool));
>
> + if (base_dir)
> + SVN_ERR(svn_wc__release_write_lock(ctx->wc_ctx, base_dir, pool));
> +
> return SVN_NO_ERROR;
> }
>
> @@ -549,6 +558,9 @@ svn_client_unlock(const apr_array_header_t *target
> SVN_ERR(svn_ra_unlock(ra_session, path_tokens, break_lock,
> store_locks_callback, &cb, pool));
>
> + if (base_dir)
> + SVN_ERR(svn_wc__release_write_lock(ctx->wc_ctx, base_dir, pool));
> +
> return SVN_NO_ERROR;
> }
>

Is that is going to leave locks behind if an error occurs? We have
svn_wc__call_with_write_lock and SVN_WC__CALL_WITH_WRITE_LOCK that might
avoid that problem. However multiple working copy support, something
1.6 didn't have, makes it all more tricky.

-- 
Philip Martin | Subversion Committer
WANdisco // *Non-Stop Data*
Received on 2014-03-19 01:24:20 CET

This is an archived mail posted to the Subversion Dev mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.