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

Re: [PATCH]svn_wc__find_wc_root

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Fri, 26 Jun 2009 10:10:18 +0800

>That's a hard problem to solve with the current code. If you are
>planning to call your new function for every item in a commit then I
>suspect it will be very unpopular, particularly with projects (like
>tsvn?) that build up a big list of items to be committed rather then
>doing a recursive commit, as it will be very slow.
The following what I want to do:

Here targets are user submitted path list, and I want to group them
by wc root, that why I write function svn_wc__find_wc_root().
targets_on_wc stores wc_root->paths map.

for (i = 0; i < targets->nelts; i++)
    {
      wc_root_path = NULL;
      target = APR_ARRAY_IDX(targets, i, const char *);
      /* Here we call the svn_wc__find_wc_root() function to get wc
       * root path. */
      SVN_ERR(svn_wc__find_wc_root(&wc_root_path, target, pool));
      local_targets = apr_hash_get(targets_on_wc, wc_root_path,
                                   APR_HASH_KEY_STRING);

      if (local_targets)
        {
          APR_ARRAY_PUSH(local_targets, const char *) = target;
        }
          else
        {
          local_targets = apr_array_make(pool, 1, sizeof(const char *));
          APR_ARRAY_PUSH(local_targets, const char *) = target;
          apr_hash_set(targets_on_wc, wc_root_path, APR_HASH_KEY_STRING,
                       local_targets);
          APR_ARRAY_PUSH(wc_roots, const char *) = wc_root_path;
        }
    }

  Here I create one wc_access for each group and use them to harvest
  commit items and do commit. wc_access is the created wc_access list
  and rel_targets_on_wc stores access->rel_targets map.

  /* create one wc_access for every wc group */
  wc_access = apr_array_make(pool, 1, sizeof(base_dir_access));
  rel_targets_on_wc = apr_hash_make(pool);

  for (i = 0; i < wc_roots->nelts; i++)
    {
      wc_root_path = APR_ARRAY_IDX(wc_roots, i, const char *);
      local_targets = apr_hash_get(targets_on_wc, wc_root_path,
                                   APR_HASH_KEY_STRING);

      SVN_ERR(svn_client_create_wc_access(commit_info_p, wc_access,
                                          rel_targets_on_wc, local_targets,
                                          depth, ctx, pool));
    }

Then we can use these accesses to collect commit items and lock_tokens,
and then group them by uuid+url.

So before we do commit, for each repository we collect following
information:
typedef struct svn_commit_packet_t
{
  apr_hash_t *lock_tokens;
  apr_array_header_t *commit_items;

} svn_commit_packet_t;
Item in commit_items refer to wc_access created above.
For now we focus on one repository, so there would be only one
svn_commit_packet_t.

Then we can use the collect information to do commit.

>Essentially you build a single tree of
>URLs, to determine where to anchor the commit, but you build multiple
>trees of access batons.
Here I do not exactly understand what do you mean, can you explain it
more detailly?

Thank you very much. Suggestion from may give me great help:)

------------------
yellow.flying
2009-06-26

__________________________________________________
赶快注册雅虎超大容量免费邮箱?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2365561
Received on 2009-06-26 04:11:33 CEST

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.