[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() can deal with absolute path

From: HuiHuang <yellow.flying_at_yahoo.com.cn>
Date: Sun, 9 Aug 2009 16:03:25 +0800

Hey,

My previous patch *remove adm_access in svn_wc_translated_file3* cause several tests
failed, and I find that is because loggy_path cannot deal with absolute path. So I make this
patch. After applying this patch, the previous one will perform well.

Thank you~~

Log:
Make loggy_path() deal with absolute path and tweak the callers.

* subversion/libsvn_wc/log.c
   (loggy_path): Add an apr_pool_t parameter and make it can deal with absolute pathes.

Modified:
trunk/subversion/libsvn_wc/log.c

Index: subversion/libsvn_wc/log.c
===================================================================
--- subversion/libsvn_wc/log.c (revision 38646)
+++ subversion/libsvn_wc/log.c (working copy)
@@ -1729,11 +1729,19 @@
  * directory. PATH must not be outside that directory. */
 static const char *
 loggy_path(const char *path,
- svn_wc_adm_access_t *adm_access)
+ svn_wc_adm_access_t *adm_access,
+ apr_pool_t *pool)
 {
+ const char *adm_abspath = NULL;
+ const char *abspath = NULL;
+ const char *local_path = NULL;
   const char *adm_path = svn_wc_adm_access_path(adm_access);
- const char *local_path = svn_dirent_is_child(adm_path, path, NULL);
 
+ SVN_ERR(svn_dirent_get_absolute(&adm_abspath, adm_path, pool));
+ SVN_ERR(svn_dirent_get_absolute(&abspath, path, pool));
+
+ local_path = svn_dirent_is_child(adm_abspath, abspath, NULL);
+
   if (! local_path && strcmp(path, adm_path) == 0)
     local_path = SVN_WC_ENTRY_THIS_DIR;
 
@@ -1751,9 +1759,9 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_APPEND,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(src, adm_access),
+ loggy_path(src, adm_access, pool),
                         SVN_WC__LOG_ATTR_DEST,
- loggy_path(dst, adm_access),
+ loggy_path(dst, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1768,7 +1776,7 @@
 {
   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_path(path, adm_access, pool),
                         SVN_WC__LOG_ATTR_REVISION,
                         apr_psprintf(pool, "%ld", revnum),
                         NULL);
@@ -1783,8 +1791,8 @@
                    apr_pool_t *pool)
 {
   return loggy_move_copy_internal(log_accum, FALSE, adm_access,
- loggy_path(src_path, adm_access),
- loggy_path(dst_path, adm_access),
+ loggy_path(src_path, adm_access, pool),
+ loggy_path(dst_path, adm_access, pool),
                                   pool);
 }
 
@@ -1799,9 +1807,9 @@
   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_path(src, adm_access, pool),
+ SVN_WC__LOG_ATTR_DEST, loggy_path(dst, adm_access, pool),
+ SVN_WC__LOG_ATTR_ARG_2, loggy_path(versioned, adm_access, pool),
      NULL);
 
   return SVN_NO_ERROR;
@@ -1815,7 +1823,7 @@
 {
   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_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1829,7 +1837,7 @@
 {
   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_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1843,7 +1851,7 @@
 {
   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_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -1988,7 +1996,7 @@
     return SVN_NO_ERROR;
 
   apr_hash_set(prop_hash, SVN_WC__LOG_ATTR_NAME,
- APR_HASH_KEY_STRING, loggy_path(path, adm_access));
+ APR_HASH_KEY_STRING, loggy_path(path, adm_access, pool));
 
   svn_xml_make_open_tag_hash(log_accum, pool,
                              svn_xml_self_closing,
@@ -2010,7 +2018,7 @@
   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),
+ loggy_path(path, adm_access, pool),
                         SVN_WC__LOG_ATTR_PROPNAME,
                         propname,
                         SVN_WC__LOG_ATTR_PROPVAL,
@@ -2027,8 +2035,8 @@
                    apr_pool_t *pool)
 {
   return loggy_move_copy_internal(log_accum, TRUE, adm_access,
- loggy_path(src_path, adm_access),
- loggy_path(dst_path, adm_access),
+ loggy_path(src_path, adm_access, pool),
+ loggy_path(dst_path, adm_access, pool),
                                   pool);
 }
 
@@ -2042,7 +2050,7 @@
                         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_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2059,7 +2067,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_MAYBE_READONLY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2076,7 +2084,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         SVN_WC__ENTRY_ATTR_TEXT_TIME,
                         SVN_WC__TIMESTAMP_WC,
                         NULL);
@@ -2095,7 +2103,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_MODIFY_ENTRY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         SVN_WC__ENTRY_ATTR_WORKING_SIZE,
                         SVN_WC__WORKING_SIZE_WC,
                         NULL);
@@ -2114,7 +2122,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_READONLY,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;
@@ -2132,7 +2140,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_SET_TIMESTAMP,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         SVN_WC__LOG_ATTR_TIMESTAMP,
                         timestr,
                         NULL);
@@ -2152,7 +2160,7 @@
                         svn_xml_self_closing,
                         SVN_WC__LOG_RM,
                         SVN_WC__LOG_ATTR_NAME,
- loggy_path(path, adm_access),
+ loggy_path(path, adm_access, pool),
                         NULL);
 
   return SVN_NO_ERROR;

Best~
Huihuang

2009-08-09
yellow.flying

__________________________________________________
¸Ï¿ì×¢²áÑÅ»¢³¬´óÈÝÁ¿Ãâ·ÑÓÊÏä?
http://cn.mail.yahoo.com

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2381808
Received on 2009-08-09 10:03:50 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.