[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: Stefan Sperling <stsp_at_elego.de>
Date: Thu, 25 Jun 2009 15:17:51 +0100

On Wed, Jun 24, 2009 at 07:37:13PM +0800, HuiHuang wrote:
> Hey Stefan,
>
> I have modified the function svn_wc__find_wc_root(). Now the patch is as following:
>
> Index: subversion/include/private/svn_wc_private.h
> ===================================================================
> --- subversion/include/private/svn_wc_private.h (version 38138)
> +++ subversion/include/private/svn_wc_private.h (working copy)
> @@ -219,6 +219,17 @@
> svn_wc_adm_access_t *adm_access,
> apr_pool_t *pool);
>
> +/** Given @a *path,

We usually just name pointer arguments by their name without the
star, so just @a path is OK.

Pointers to pointers are sometimes referred to as @a *path, depending
on what the docstring is trying to say.

> find its strictly working copy root path @a **wc_root_path

I think 'strictly' is not what we want here, right?
The code uses svn_wc_is_wc_root() which is not "strict", and
that's fine.

> + Allocate the result in @a result_pool.
> + Use @a scratch_pool for temporary allocations.
> + The error @c SVN_ERR_WC_NOT_DIRECTORY will be returned if
> + * @a path is not a versioned directory.*/
> +svn_error_t *
> +svn_wc__find_wc_root(const char **wc_root_path,
> + const char *path,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool);
> +
> #ifdef __cplusplus
> }
> #endif /* __cplusplus */
> Index: subversion/libsvn_wc/update_editor.c
> ===================================================================
> --- subversion/libsvn_wc/update_editor.c (version 38138)
> +++ subversion/libsvn_wc/update_editor.c (working copy)
> @@ -5324,6 +5324,44 @@
> }
>
>
> +svn_error_t *
> +svn_wc__find_wc_root(const char **wc_root_path, const char *path,
> + apr_pool_t *result_pool,
> + apr_pool_t *scratch_pool)
> +{
> + svn_wc_adm_access_t *adm_access;
> + svn_boolean_t wc_root;
> + apr_pool_t *iterpool;
> + iterpool = svn_pool_create(scratch_pool);
> +
> + while(1)
> + {
> + svn_pool_clear(iterpool);
> + SVN_ERR(svn_wc_adm_open3(&adm_access, NULL, path,
> + FALSE, /* Write lock */
> + 0, /* lock levels */
> + NULL, NULL, iterpool));
> +
> + /* Here, ADM_ACCESS refers to PATH. */
> + SVN_ERR(svn_wc_is_wc_root(&wc_root, path, adm_access,
> + iterpool));
> + svn_wc_adm_close2(adm_access, iterpool);
> +
> + if (wc_root)
> + {
> + *wc_root_path = apr_pstrdup(result_pool, path);
> + break;
> + }
> +
> + /* path point to its parent now*/
> + path = svn_dirent_dirname(path, pool);

This still throws an error on compilation:

subversion/libsvn_wc/update_editor.c:5357: error: ‘pool’ undeclared
(first use in this function)
subversion/libsvn_wc/update_editor.c:5357: error: (Each undeclared
identifier is reported only once
subversion/libsvn_wc/update_editor.c:5357: error: for each function it
appears in.)

> + }
> + svn_pool_destroy(iterpool);
> +
> + return SVN_NO_ERROR;
> +}
> +
> +
> svn_error_t*
> svn_wc__strictly_is_wc_root(svn_boolean_t *wc_root,
> const char *path,
>
> log message:
>
> [[[
>
> * subversion/include/private/svn_wc_private.h
> (svn_wc__find_wc_root): new API. Given a path, it return the

You should start new sentences with capital letters: "New API. ..."

> working copy root path. If path is not a versioned directory,
> The error SVN_ERR_WC_NOT_DIRECTORY will be returned.

It's not necessary to repeat details from the docstring in the
log message. But it does not hurt, either.

> * subversion/libsvn_wc/update_editor.c
> ((svn_wc__find_wc_root): new function. It is implement of
> API svn_wc__find_wc_root in svn_wc_private.h
> ]]]

Rest looks good.

Stefan
>
> Huihuang
>
> --------------
> yellow.flying
> 2009-06-24
>
> __________________________________________________
> 赶快注册雅虎超大容量免费邮箱?
> http://cn.mail.yahoo.com
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2364890
Received on 2009-06-25 16:18:22 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.