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

How remove adm_access locking in libsvn_client/externals.c?

From: Daniel Näslund <daniel_at_longitudo.com>
Date: Thu, 12 Nov 2009 20:05:09 +0100

Hi!

When trying to replace svn_wc_get_update_editor3() and
svn_wc_crawl_revisions4() in libsvn_client/update.c I ended up with
theese warnings for all externals_test using update:

  svn: warning: Working copy '/some/path' locked

When talking to Bert on IRC he said that the problems was probably due
to the new functions using absolute paths instead of relative. The
access batons are opened using relative paths in
libsvn_wc/update_editor.c. So I need to either transform the absolute
paths to relative to match the batons or remove the batons.

switch_file_external() needs an access baton with a write lock. It uses
svn_wc_adm_retrieve() to try and get one before doing the switch. Is
there a is_wc_locked() function available? If the wc isn't locked, how
would I retrieve a new lock with the new API?

switch_file_external():317
[[[
/* Try to get a access baton for the anchor using the input access
   baton. If this fails and returns SVN_ERR_WC_NOT_LOCKED, then try
   to get a new access baton to support inserting a file external
   into a directory external. */
err = svn_wc_adm_retrieve(&target_adm_access, adm_access, anchor, subpool);
if (err)
  {
    if (err->apr_err == SVN_ERR_WC_NOT_LOCKED)
      {
        const char *dest_wc_repos_root_url;
        svn_opt_revision_t peg_rev;

        svn_error_clear(err);
        close_adm_access = TRUE;
        SVN_ERR(svn_wc__adm_open_in_context(&target_adm_access, ctx->wc_ctx,
                                            anchor, TRUE, 1,
                                            ctx->cancel_func,
                                            ctx->cancel_baton, subpool));
]]]
handle_external_item_change():882 uses batons for locking when an
external is deleted and the wc is updated. It uses an
svn_wc_adm_open_in_context() call for checking if a dir is a wc? I found
svn_wc_check_wc2(). Can that serve the same purpose?

handle_external_item_change():882
[[[
/* Determine if a directory or file external is being removed.
   Try to handle the case when the user deletes the external by
   hand or it is missing. First try to open the directory for a
   directory external. If that doesn't work, get the access
   baton for the parent directory and remove the entry for the
   external. */
err = svn_wc__adm_open_in_context(&adm_access, ib->ctx->wc_ctx, path,
                                  TRUE, -1, ib->ctx->cancel_func,
                                  ib->ctx->cancel_baton, ib->iter_pool);
if (err)
  {
    const char *anchor;
    const char *target;
    svn_error_t *err2;

    SVN_ERR(svn_wc_get_actual_target2(&anchor, &target, ib->ctx->wc_ctx,
                                      path, ib->iter_pool,
                                      ib->iter_pool));

    err2 = svn_wc_adm_retrieve(&adm_access, ib->adm_access, anchor,
                               ib->iter_pool);
]]]

How can I replace those adm_access functions with locking functions
using wc_ctx? I've understood that internally the adm_access functions
really uses the new locks but I need to ditch the batons since they use
relative paths and that screws things up with when we start using
absolute paths for handling externals in get_update_editor() and
crawl_revisions().

/Daniel

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2417183
Received on 2009-11-12 20:05:33 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.