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

[PATCH]svn_wc__find_wc_root

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Wed, 24 Jun 2009 19:37:13 +0800

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)
+ {
+ 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);
+ }
+ 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 13:37:38 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.