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

Re: [PATCH]Issue #1776 (v2) - Create parent directories with 'svn mkdir'

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2005-03-22 00:54:22 CET

"S.Ramaswamy" <ramaswamy@collab.net> writes:

> +/* Set 'existing_url' to the portion of 'url' that exists, and 'new_path'
> + to the non-existent portion of the 'url'*/
> +static svn_error_t *
> +svn_client__url_paths (const char **existing_url,
> + const char **new_path,
> + const char *url,
> + svn_client_ctx_t *ctx,
> + apr_pool_t *pool)
> +{
> + svn_ra_session_t *ra_session;
> + svn_node_kind_t kind;
> + const char *dir;
> + const char *base;
> + const char *pcommon;
> + apr_array_header_t *new_paths;
> + apr_array_header_t *temp_paths = apr_array_make (pool, 2,
> + sizeof(const char*));
> + apr_pool_t *subpool;
>
> + subpool = svn_pool_create (pool);
> + APR_ARRAY_PUSH (temp_paths, const char *) = url;
> +
> + do
> + {
> + svn_pool_clear (subpool);
> + if (ctx->cancel_func)
> + SVN_ERR (ctx->cancel_func (ctx->cancel_baton));
> +
> + SVN_ERR (svn_client__open_ra_session (&ra_session, url, NULL,
> + NULL, NULL, FALSE, TRUE,
> + ctx, subpool));
> + SVN_ERR (svn_ra_check_path (ra_session, "", SVN_INVALID_REVNUM,
> + &kind, subpool));
> + if (kind == svn_node_none)
> + {
> + svn_path_split (url, &dir, &base, pool);
> + url = dir;
> + }
> + } while (kind == svn_node_none);
> +
> + if (kind == svn_node_dir)
> + {
> + *existing_url = apr_pstrdup (pool, url);
> + if (url == APR_ARRAY_IDX (temp_paths, 0, const char*))
> + {
> + *new_path = NULL;
> + }
> + else
> + {
> + APR_ARRAY_PUSH (temp_paths, const char *) = *existing_url;
> + SVN_ERR (svn_path_condense_targets (&pcommon, &new_paths,
> + temp_paths, FALSE, pool));
> + *new_path = APR_ARRAY_IDX (new_paths, 0, const char *);
> + }
> + }
> + svn_pool_destroy (subpool);
> +
> + return SVN_NO_ERROR;
> +}

Calling svn_path_condense_targets still looks like a mistake. I still
think you should reuse the import code if possible, moving it into a
common function. The import code builds an apr_array_t rather which
looks to be better than your new_path, since you end up having to
decompose it.

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Mar 22 00:55:32 2005

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.