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

[PATCH]Make loggy_path able to deal with absolute path

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Wed, 12 Aug 2009 23:08:51 +0800

Log:
[[[
Make loggy_path able to deal with absolute path and tweak the callers..

* subversion/libsvn_wc/log.c
  (loggy_path): Add two arguments loggy_path and pool, and make it
  able to deal with absolute paths.

* trunk/subversion/libsvn_wc/log.h
   Tweak the comment at the top of the file.
]]]

Modified:
   trunk/subversion/libsvn_wc/log.h
   trunk/subversion/libsvn_wc/log.c

Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c (版本 38693)
+++ subversion/libsvn_wc/log.c (工作副本)
@@ -1727,17 +1727,24 @@
 /* Return the portion of PATH that is relative to the working copy directory
  * to which ADM_ACCESS belongs, or SVN_WC_ENTRY_THIS_DIR if PATH is that
  * directory. PATH must not be outside that directory. */
-static const char *
-loggy_path(const char *path,
- svn_wc_adm_access_t *adm_access)
+static svn_error_t *
+loggy_path(const char **loggy_path,
+ const char *path,
+ svn_wc_adm_access_t *adm_access,
+ apr_pool_t *pool)
 {
+ const char *adm_abspath;
+ const char *abspath;
   const char *adm_path = svn_wc_adm_access_path(adm_access);
- const char *local_path = svn_dirent_is_child(adm_path, path, NULL);
 
- if (! local_path && strcmp(path, adm_path) == 0)
- local_path = SVN_WC_ENTRY_THIS_DIR;
+ SVN_ERR(svn_dirent_get_absolute(&adm_abspath, adm_path, pool));
+ SVN_ERR(svn_dirent_get_absolute(&abspath, path, pool));
+ *loggy_path = svn_dirent_is_child(adm_abspath, abspath, NULL);
 
- return local_path;
+ if (! (*loggy_path) && strcmp(abspath, adm_abspath) == 0)
+ *loggy_path = SVN_WC_ENTRY_THIS_DIR;
+
+ return SVN_NO_ERROR;
 }
 
 svn_error_t *
@@ -1746,14 +1753,15 @@
                      const char *src, const char *dst,
                      apr_pool_t *pool)
 {
- svn_xml_make_open_tag(log_accum,
- pool,
- svn_xml_self_closing,
- SVN_WC__LOG_APPEND,
- SVN_WC__LOG_ATTR_NAME,
- loggy_path(src, adm_access),
- SVN_WC__LOG_ATTR_DEST,
- loggy_path(dst, adm_access),
+ const char *loggy_path1;
+ const char *loggy_path2;
+
+ SVN_ERR(loggy_path(&loggy_path1, src, adm_access, pool));
+ SVN_ERR(loggy_path(&loggy_path2, dst, adm_access, pool));
+ svn_xml_make_open_tag(log_accum, pool,
+ svn_xml_self_closing, SVN_WC__LOG_APPEND,
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
+ SVN_WC__LOG_ATTR_DEST, loggy_path2,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1766,9 +1774,12 @@
                         const char *path, svn_revnum_t revnum,
                         apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum, pool, svn_xml_self_closing,
                         SVN_WC__LOG_COMMITTED,
- SVN_WC__LOG_ATTR_NAME, loggy_path(path, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         SVN_WC__LOG_ATTR_REVISION,
                         apr_psprintf(pool, "%ld", revnum),
                         NULL);
@@ -1782,10 +1793,13 @@
                    const char *src_path, const char *dst_path,
                    apr_pool_t *pool)
 {
+ const char *loggy_path1;
+ const char *loggy_path2;
+
+ SVN_ERR(loggy_path(&loggy_path1, src_path, adm_access, pool));
+ SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_access, pool));
   return loggy_move_copy_internal(log_accum, FALSE, adm_access,
- loggy_path(src_path, adm_access),
- loggy_path(dst_path, adm_access),
- pool);
+ loggy_path1, loggy_path2, pool);
 }
 
 svn_error_t *
@@ -1796,12 +1810,19 @@
                               const char *versioned,
                               apr_pool_t *pool)
 {
+ const char *loggy_path1;
+ const char *loggy_path2;
+ const char *loggy_path3;
+
+ SVN_ERR(loggy_path(&loggy_path1, src, adm_access, pool));
+ SVN_ERR(loggy_path(&loggy_path2, dst, adm_access, pool));
+ SVN_ERR(loggy_path(&loggy_path3, versioned, adm_access, pool));
   svn_xml_make_open_tag
     (log_accum, pool, svn_xml_self_closing,
      SVN_WC__LOG_CP_AND_TRANSLATE,
- SVN_WC__LOG_ATTR_NAME, loggy_path(src, adm_access),
- SVN_WC__LOG_ATTR_DEST, loggy_path(dst, adm_access),
- SVN_WC__LOG_ATTR_ARG_2, loggy_path(versioned, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
+ SVN_WC__LOG_ATTR_DEST, loggy_path2,
+ SVN_WC__LOG_ATTR_ARG_2, loggy_path3,
      NULL);
 
   return SVN_NO_ERROR;
@@ -1813,9 +1834,12 @@
                            const char *path,
                            apr_pool_t *pool)
 {
+ const char * loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum, pool, svn_xml_self_closing,
                         SVN_WC__LOG_DELETE_ENTRY,
- SVN_WC__LOG_ATTR_NAME, loggy_path(path, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1827,9 +1851,12 @@
                           const char *path,
                           apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum, pool, svn_xml_self_closing,
                         SVN_WC__LOG_DELETE_LOCK,
- SVN_WC__LOG_ATTR_NAME, loggy_path(path, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1841,9 +1868,12 @@
                                 const char *path,
                                 apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum, pool, svn_xml_self_closing,
                         SVN_WC__LOG_DELETE_CHANGELIST,
- SVN_WC__LOG_ATTR_NAME, loggy_path(path, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1857,6 +1887,7 @@
                            apr_uint64_t modify_flags,
                            apr_pool_t *pool)
 {
+ const char *loggy_path1;
   apr_hash_t *prop_hash = apr_hash_make(pool);
   static const char *kind_str[] =
     { "none",
@@ -1987,8 +2018,9 @@
   if (apr_hash_count(prop_hash) == 0)
     return SVN_NO_ERROR;
 
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   apr_hash_set(prop_hash, SVN_WC__LOG_ATTR_NAME,
- APR_HASH_KEY_STRING, loggy_path(path, adm_access));
+ APR_HASH_KEY_STRING, loggy_path1);
 
   svn_xml_make_open_tag_hash(log_accum, pool,
                              svn_xml_self_closing,
@@ -2007,14 +2039,14 @@
                             const char *propval,
                             apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum, pool, svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_WCPROP,
- SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
- SVN_WC__LOG_ATTR_PROPNAME,
- propname,
- SVN_WC__LOG_ATTR_PROPVAL,
- propval,
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
+ SVN_WC__LOG_ATTR_PROPNAME, propname,
+ SVN_WC__LOG_ATTR_PROPVAL, propval,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2026,10 +2058,13 @@
                    const char *src_path, const char *dst_path,
                    apr_pool_t *pool)
 {
+ const char *loggy_path1;
+ const char *loggy_path2;
+
+ SVN_ERR(loggy_path(&loggy_path1, src_path, adm_access, pool));
+ SVN_ERR(loggy_path(&loggy_path2, dst_path, adm_access, pool));
   return loggy_move_copy_internal(log_accum, TRUE, adm_access,
- loggy_path(src_path, adm_access),
- loggy_path(dst_path, adm_access),
- pool);
+ loggy_path1, loggy_path2, pool);
 }
 
 svn_error_t *
@@ -2038,11 +2073,14 @@
                                    const char *path,
                                    apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MAYBE_EXECUTABLE,
- SVN_WC__LOG_ATTR_NAME, loggy_path(path, adm_access),
+ SVN_WC__LOG_ATTR_NAME, loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2054,12 +2092,15 @@
                                  const char *path,
                                  apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MAYBE_READONLY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2071,12 +2112,15 @@
                                           const char *path,
                                           apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         SVN_WC__ENTRY_ATTR_TEXT_TIME,
                         SVN_WC__TIMESTAMP_WC,
                         NULL);
@@ -2090,12 +2134,15 @@
                                                 const char *path,
                                                 apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         SVN_WC__ENTRY_ATTR_WORKING_SIZE,
                         SVN_WC__WORKING_SIZE_WC,
                         NULL);
@@ -2109,12 +2156,15 @@
                            const char *path,
                            apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_READONLY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2127,12 +2177,15 @@
                             const char *timestr,
                             apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   svn_xml_make_open_tag(log_accum,
                         pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_SET_TIMESTAMP,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         SVN_WC__LOG_ATTR_TIMESTAMP,
                         timestr,
                         NULL);
@@ -2146,13 +2199,16 @@
                      const char *path,
                      apr_pool_t *pool)
 {
+ const char *loggy_path1;
+
+ SVN_ERR(loggy_path(&loggy_path1, path, adm_access, pool));
   /* No need to check whether BASE_NAME exists: ENOENT is ignored
      by the log-runner */
   svn_xml_make_open_tag(log_accum, pool,
                         svn_xml_self_closing,
                         SVN_WC__LOG_RM,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path1,
                         NULL);
 
   return SVN_NO_ERROR;
Index: subversion/libsvn_wc/log.h
===================================================================
--- subversion/libsvn_wc/log.h (版本 38693)
+++ subversion/libsvn_wc/log.h (工作副本)
@@ -47,8 +47,8 @@
  */
 
 /* The svn_wc__loggy_* functions in this section take path arguments
- with the same base as with which the adm_access was opened.
-
+ with the same base as with which the adm_access was opened except
+ that loggy_path function can take absolute path as argument.
 */
 
 /* Extend **LOG_ACCUM with log instructions to append the contents
                                 

Best
Huihuang
--------------
yellow.flying
2009-08-12
��i��'�ē扫h∈&

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2382921
Received on 2009-08-12 17:10:47 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.