You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by rh...@apache.org on 2011/04/24 03:56:42 UTC
svn commit: r1096266 - in /subversion/trunk/subversion/libsvn_wc:
deprecated.c translate.c translate.h
Author: rhuijben
Date: Sun Apr 24 01:56:42 2011
New Revision: 1096266
URL: http://svn.apache.org/viewvc?rev=1096266&view=rev
Log:
Make svn_wc__internal_translated_file() assume absolute paths.
(All callers already handled this correctly)
* subversion/libsvn_wc/deprecated.c
(svn_wc_translated_file2): Pass absolute paths and handle cases where the
returned path is not below the current directory or in the temp dir.
* subversion/libsvn_wc/translate.c
(svn_wc__internal_translated_file): Assume an absolute src path to avoid
calculating the abspath again and to reinstate the old pointer compare
hack.
* subversion/libsvn_wc/translate.h
(svn_wc__internal_translated_file): Update docsting. Remove reference to
svn_wc_translated_file3 as that does not exist.
Modified:
subversion/trunk/subversion/libsvn_wc/deprecated.c
subversion/trunk/subversion/libsvn_wc/translate.c
subversion/trunk/subversion/libsvn_wc/translate.h
Modified: subversion/trunk/subversion/libsvn_wc/deprecated.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/deprecated.c?rev=1096266&r1=1096265&r2=1096266&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_wc/deprecated.c Sun Apr 24 01:56:42 2011
@@ -3419,20 +3419,27 @@ svn_wc_translated_file2(const char **xla
const char *versioned_abspath;
const char *root;
const char *tmp_root;
+ const char *src_abspath;
SVN_ERR(svn_dirent_get_absolute(&versioned_abspath, versioned_file, pool));
+ SVN_ERR(svn_dirent_get_absolute(&src_abspath, src, pool));
- SVN_ERR(svn_wc__internal_translated_file(xlated_path, src,
+ SVN_ERR(svn_wc__internal_translated_file(xlated_path, src_abspath,
svn_wc__adm_get_db(adm_access),
versioned_abspath,
flags, NULL, NULL, pool, pool));
- if (! svn_dirent_is_absolute(versioned_file))
+
+ if (strcmp(*xlated_path, src_abspath) == 0)
+ *xlated_path = src;
+ else if (! svn_dirent_is_absolute(versioned_file))
{
SVN_ERR(svn_io_temp_dir(&tmp_root, pool));
if (! svn_dirent_is_child(tmp_root, *xlated_path, pool))
{
SVN_ERR(svn_dirent_get_absolute(&root, "", pool));
- *xlated_path = svn_dirent_is_child(root, *xlated_path, pool);
+
+ if (svn_dirent_is_child(root, *xlated_path, pool))
+ *xlated_path = svn_dirent_is_child(root, *xlated_path, pool);
}
}
Modified: subversion/trunk/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.c?rev=1096266&r1=1096265&r2=1096266&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.c (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.c Sun Apr 24 01:56:42 2011
@@ -151,7 +151,7 @@ svn_wc__internal_translated_stream(svn_s
svn_error_t *
svn_wc__internal_translated_file(const char **xlated_abspath,
- const char *src,
+ const char *src_abspath,
svn_wc__db_t *db,
const char *versioned_abspath,
apr_uint32_t flags,
@@ -162,11 +162,10 @@ svn_wc__internal_translated_file(const c
{
svn_subst_eol_style_t style;
const char *eol;
- const char *xlated_path;
apr_hash_t *keywords;
svn_boolean_t special;
-
+ SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath));
SVN_ERR(svn_wc__get_translate_info(&style, &eol,
&keywords,
@@ -178,7 +177,7 @@ svn_wc__internal_translated_file(const c
&& (! (flags & SVN_WC_TRANSLATE_FORCE_COPY)))
{
/* Translation would be a no-op, so return the original file. */
- xlated_path = src;
+ *xlated_abspath = src_abspath;
}
else /* some translation (or copying) is necessary */
{
@@ -223,7 +222,7 @@ svn_wc__internal_translated_file(const c
return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
}
- SVN_ERR(svn_subst_copy_and_translate4(src, tmp_vfile,
+ SVN_ERR(svn_subst_copy_and_translate4(src_abspath, tmp_vfile,
eol, repair_forced,
keywords,
expand,
@@ -231,9 +230,8 @@ svn_wc__internal_translated_file(const c
cancel_func, cancel_baton,
result_pool));
- xlated_path = tmp_vfile;
+ *xlated_abspath = tmp_vfile;
}
- SVN_ERR(svn_dirent_get_absolute(xlated_abspath, xlated_path, result_pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/libsvn_wc/translate.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.h?rev=1096266&r1=1096265&r2=1096266&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.h (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.h Sun Apr 24 01:56:42 2011
@@ -142,12 +142,11 @@ svn_wc__internal_translated_stream(svn_s
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
-/* Like svn_wc_translated_file3(), except the working copy database
- * is specified directly by DB instead of indirectly through a
- * svn_wc_context_t parameter. */
+/* Like svn_wc_translated_file2(), except the working copy database
+ * is used directly and the function assumes abspaths. */
svn_error_t *
svn_wc__internal_translated_file(const char **xlated_abspath,
- const char *src,
+ const char *src_abspath,
svn_wc__db_t *db,
const char *versioned_abspath,
apr_uint32_t flags,