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/05/10 14:30:39 UTC

svn commit: r1101428 - in /subversion/trunk/subversion/libsvn_wc: adm_ops.c props.c questions.c translate.c translate.h workqueue.c

Author: rhuijben
Date: Tue May 10 12:30:38 2011
New Revision: 1101428

URL: http://svn.apache.org/viewvc?rev=1101428&view=rev
Log:
[This is patch 1/3. This one is self contained, but doesn't update
  subversion/libsvn_wc/external.c, subversion/libsvn_wc/merge.c
  and subversion/libsvn_wc/update_editor.c yet.]

Make the translate api use a passed set of properties and make retrieving the
values needed for keyword expansion optional for the simple normalization case.

This patch prepares this part of our libsvn_wc api for when file externals
are no longer normal versioned files.

The next patch updates the editors to use the new api and the last one will
update the merge code. You need all or none of these patches, but this allows
easier review.

* subversion/libsvn_wc/adm_ops.c
  (svn_wc__internal_remove_from_revision_control): Update caller.

* subversion/libsvn_wc/props.c
  (do_propset): Update caller.

* subversion/libsvn_wc/questions.c
  (compare_and_verify): Update caller.

* subversion/libsvn_wc/translate.c
  (svn_wc__internal_translated_stream): Update caller.
  (svn_wc__internal_translated_file): Update caller.
  (svn_wc__get_translate_info): Forward for_normalization boolean.
  (svn_wc__expand_keywords): If normalizing, don't read from db. Try to obtain
    url via read info.

* subversion/libsvn_wc/translate.h
  (svn_wc__get_translate_info): Update arguments and documentation.
  (svn_wc__expand_keywords): Update arguments and documentation.

* subversion/libsvn_wc/workqueue.c
  (install_committed_file,
   run_file_install,
   run_file_copy_translated): Update callers.

Modified:
    subversion/trunk/subversion/libsvn_wc/adm_ops.c
    subversion/trunk/subversion/libsvn_wc/props.c
    subversion/trunk/subversion/libsvn_wc/questions.c
    subversion/trunk/subversion/libsvn_wc/translate.c
    subversion/trunk/subversion/libsvn_wc/translate.h
    subversion/trunk/subversion/libsvn_wc/workqueue.c

Modified: subversion/trunk/subversion/libsvn_wc/adm_ops.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/adm_ops.c?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/adm_ops.c (original)
+++ subversion/trunk/subversion/libsvn_wc/adm_ops.c Tue May 10 12:30:38 2011
@@ -1915,7 +1915,7 @@ svn_wc__internal_remove_from_revision_co
 
           SVN_ERR(svn_wc__get_translate_info(NULL, NULL, NULL,
                                              &wc_special,
-                                             db, local_abspath, NULL,
+                                             db, local_abspath, NULL, TRUE,
                                              scratch_pool, scratch_pool));
           SVN_ERR(svn_io_check_special_path(local_abspath, &on_disk,
                                             &local_special, scratch_pool));

Modified: subversion/trunk/subversion/libsvn_wc/props.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/props.c?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/props.c (original)
+++ subversion/trunk/subversion/libsvn_wc/props.c Tue May 10 12:30:38 2011
@@ -2086,14 +2086,16 @@ do_propset(svn_wc__db_t *db,
 
       if (old_value)
         SVN_ERR(svn_wc__expand_keywords(&old_keywords,
-                                        db, local_abspath, old_value->data,
+                                        db, local_abspath, NULL,
+                                        old_value->data, TRUE,
                                         scratch_pool, scratch_pool));
       else
         old_keywords = apr_hash_make(scratch_pool);
 
       if (value)
         SVN_ERR(svn_wc__expand_keywords(&new_keywords,
-                                        db, local_abspath, value->data,
+                                        db, local_abspath, NULL,
+                                        value->data, TRUE,
                                         scratch_pool, scratch_pool));
       else
         new_keywords = apr_hash_make(scratch_pool);

Modified: subversion/trunk/subversion/libsvn_wc/questions.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/questions.c?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/questions.c (original)
+++ subversion/trunk/subversion/libsvn_wc/questions.c Tue May 10 12:30:38 2011
@@ -137,6 +137,7 @@ compare_and_verify(svn_boolean_t *modifi
                                          &keywords,
                                          &special,
                                          db, versioned_file_abspath, NULL,
+                                         compare_textbases,
                                          scratch_pool, scratch_pool));
 
       need_translation = svn_subst_translation_required(eol_style, eol_str,

Modified: subversion/trunk/subversion/libsvn_wc/translate.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.c?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.c (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.c Tue May 10 12:30:38 2011
@@ -85,7 +85,7 @@ svn_wc__internal_translated_stream(svn_s
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, versioned_abspath, NULL,
+                                     db, versioned_abspath, NULL, FALSE,
                                      scratch_pool, scratch_pool));
 
   if (special)
@@ -170,7 +170,7 @@ svn_wc__internal_translated_file(const c
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, versioned_abspath, NULL, 
+                                     db, versioned_abspath, NULL, FALSE,
                                      scratch_pool, scratch_pool));
 
   if (! svn_subst_translation_required(style, eol, keywords, special, TRUE)
@@ -259,6 +259,7 @@ svn_wc__get_translate_info(svn_subst_eol
                            svn_wc__db_t *db,
                            const char *local_abspath,
                            apr_hash_t *props,
+                           svn_boolean_t for_normalization,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool)
 {
@@ -286,8 +287,8 @@ svn_wc__get_translate_info(svn_subst_eol
         *keywords = NULL;
       else
         SVN_ERR(svn_wc__expand_keywords(keywords,
-                                        db, local_abspath,
-                                        propval->data,
+                                        db, local_abspath, NULL,
+                                        propval->data, for_normalization,
                                         result_pool, scratch_pool));
     }
   if (special)
@@ -305,7 +306,9 @@ svn_error_t *
 svn_wc__expand_keywords(apr_hash_t **keywords,
                         svn_wc__db_t *db,
                         const char *local_abspath,
+                        const char *wri_abspath,
                         const char *keyword_list,
+                        svn_boolean_t for_normalization,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool)
 {
@@ -314,17 +317,34 @@ svn_wc__expand_keywords(apr_hash_t **key
   const char *changed_author;
   const char *url;
 
-  SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, NULL,
-                               NULL, NULL, &changed_rev,
-                               &changed_date, &changed_author, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL, NULL, NULL, NULL,
-                               NULL, NULL, NULL, NULL,
-                               db, local_abspath,
-                               scratch_pool, scratch_pool));
+  if (! for_normalization)
+    {
+      const char *repos_root_url;
+      const char *repos_relpath;
 
-  SVN_ERR(svn_wc__db_read_url(&url, db, local_abspath, scratch_pool,
-                              scratch_pool));
+      SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, &repos_relpath,
+                                   &repos_root_url, NULL, &changed_rev,
+                                   &changed_date, &changed_author, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+                                   NULL, NULL, NULL, NULL,
+                                   db, local_abspath,
+                                   scratch_pool, scratch_pool));
+
+      if (repos_relpath)
+        url = svn_path_url_add_component2(repos_root_url, repos_relpath,
+                                          scratch_pool);
+      else
+         SVN_ERR(svn_wc__db_read_url(&url, db, local_abspath, scratch_pool,
+                                     scratch_pool));
+    }
+  else
+    {
+      url = "";
+      changed_rev = SVN_INVALID_REVNUM;
+      changed_date = 0;
+      changed_author = "";
+    }
 
   SVN_ERR(svn_subst_build_keywords2(keywords,
                                     keyword_list,

Modified: subversion/trunk/subversion/libsvn_wc/translate.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/translate.h?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/translate.h (original)
+++ subversion/trunk/subversion/libsvn_wc/translate.h Tue May 10 12:30:38 2011
@@ -66,6 +66,13 @@ extern "C" {
 
    If PROPS is not NULL, use PROPS instead of the properties on LOCAL_ABSPATH.
 
+   If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH
+   from the working copy identified by WRI_ABSPATH. Falling back to file
+   external information if the file is not present as versioned node.
+
+   If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of
+   calculating their intended values.
+
    Use SCRATCH_POOL for temporary allocation, RESULT_POOL for allocating
    *STYLE and *EOL.
 */
@@ -77,6 +84,7 @@ svn_wc__get_translate_info(svn_subst_eol
                            svn_wc__db_t *db,
                            const char *local_abspath,
                            apr_hash_t *props,
+                           svn_boolean_t for_normalization,
                            apr_pool_t *result_pool,
                            apr_pool_t *scratch_pool);
 
@@ -98,13 +106,22 @@ void svn_wc__eol_value_from_string(const
 
    Use LOCAL_ABSPATH to expand keyword values.
 
+   If WRI_ABSPATH is not NULL, retrieve the information for LOCAL_ABSPATH
+   from the working copy identified by WRI_ABSPATH. Falling back to file
+   external information if the file is not present as versioned node.
+
+   If FOR_NORMALIZATION is TRUE, just return a list of keywords instead of
+   calculating their intended values.
+
    Use SCRATCH_POOL for any temporary allocations.
 */
 svn_error_t *
 svn_wc__expand_keywords(apr_hash_t **keywords,
                         svn_wc__db_t *db,
                         const char *local_abspath,
+                        const char *wri_abspath,
                         const char *keyword_list,
+                        svn_boolean_t for_normalization,
                         apr_pool_t *result_pool,
                         apr_pool_t *scratch_pool);
 

Modified: subversion/trunk/subversion/libsvn_wc/workqueue.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/workqueue.c?rev=1101428&r1=1101427&r2=1101428&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/workqueue.c (original)
+++ subversion/trunk/subversion/libsvn_wc/workqueue.c Tue May 10 12:30:38 2011
@@ -414,9 +414,9 @@ install_committed_file(svn_boolean_t *ov
     SVN_ERR(svn_wc__get_translate_info(NULL, NULL,
                                        NULL,
                                        &special,
-                                       db, file_abspath, NULL,
+                                       db, file_abspath, NULL, FALSE,
                                        scratch_pool, scratch_pool));
-    /* ### Should this be a strcmp()? */
+    /* Translated file returns the exact pointer if not translated. */
     if (! special && tmp != tmp_wfile)
       SVN_ERR(svn_io_files_contents_same_p(&same, tmp_wfile,
                                            file_abspath, scratch_pool));
@@ -652,7 +652,8 @@ run_file_install(svn_wc__db_t *db,
   /* Fetch all the translation bits.  */
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
-                                     &special, db, local_abspath, props,
+                                     &special, db, local_abspath,
+                                     props, FALSE,
                                      scratch_pool, scratch_pool));
   if (special)
     {
@@ -952,7 +953,7 @@ run_file_copy_translated(svn_wc__db_t *d
   SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                      &keywords,
                                      &special,
-                                     db, local_abspath, NULL,
+                                     db, local_abspath, NULL, FALSE,
                                      scratch_pool, scratch_pool));
 
   SVN_ERR(svn_subst_copy_and_translate4(src_abspath, dst_abspath,