[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: Wed, 24 Jun 2009 13:06:43 +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, find its strictly working copy root path @a **wc_root_path
> + 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)

It's just a matter of personal taste, but I'd put a space here:

     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);

Does this compile? 'pool' is not declared.
Maybe you should do this allocation in scratch_pool?

The rest looks great!

Stefan

> + }
> + 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
> working copy root path. If path is not a versioned directory,
> The error SVN_ERR_WC_NOT_DIRECTORY will be returned.
> * 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
> ]]]
>
> 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-24 14:07:49 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.