You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2011/03/25 21:00:35 UTC

svn commit: r1085545 - in /subversion/trunk/subversion/libsvn_client: client.h externals.c switch.c update.c

Author: danielsh
Date: Fri Mar 25 20:00:35 2011
New Revision: 1085545

URL: http://svn.apache.org/viewvc?rev=1085545&view=rev
Log:
Fix issue #3819, "'svn update' touches file externals in ../sibling/ too",
at least for some cases. (see below)

* subversion/libsvn_client/client.h
  (svn_client__handle_externals): Add TARGET parameter.

* subversion/libsvn_client/externals.c
  (handle_externals_desc_change_baton): Grow TARGET_ABSPATH member.
  (handle_externals_desc_change): Document KEY parameter, and ignore
    externals not under TARGET_ABSPATH --- when the latter is not NULL.
  (svn_client__handle_externals): Add TARGET parameter, and use it to
    populate the baton's TARGET_ABSPATH member.

* subversion/libsvn_client/switch.c
  (switch_internal): Pass TARGET to svn_client__handle_externals().

* subversion/libsvn_client/update.c
  (update_internal): Pass TARGET to svn_client__handle_externals().

Additionally:

* subversion/libsvn_client/externals.c
  (svn_client__fetch_externals): Pass NULL for TARGET_ABSPATH, thus
    bypassing the fix for this use case (which is only called from
    export.c).  All tests pass, but I'm not happy with this.

Modified:
    subversion/trunk/subversion/libsvn_client/client.h
    subversion/trunk/subversion/libsvn_client/externals.c
    subversion/trunk/subversion/libsvn_client/switch.c
    subversion/trunk/subversion/libsvn_client/update.c

Modified: subversion/trunk/subversion/libsvn_client/client.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/client.h?rev=1085545&r1=1085544&r2=1085545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/client.h (original)
+++ subversion/trunk/subversion/libsvn_client/client.h Fri Mar 25 20:00:35 2011
@@ -944,6 +944,7 @@ svn_client__handle_externals(apr_hash_t 
                              apr_hash_t *ambient_depths,
                              const char *from_url,
                              const char *to_abspath,
+                             const char *target,
                              const char *repos_root_url,
                              svn_depth_t requested_depth,
                              svn_boolean_t *timestamp_sleep,

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1085545&r1=1085544&r2=1085545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Fri Mar 25 20:00:35 2011
@@ -1026,6 +1026,7 @@ struct handle_externals_desc_change_bato
      external item parent directory path. */
   const char *from_url;
   const char *to_abspath;
+  const char *target_abspath;
 
   /* Passed through to handle_external_item_change_baton. */
   svn_client_ctx_t *ctx;
@@ -1042,6 +1043,7 @@ struct handle_externals_desc_change_bato
 
 /* This implements the 'svn_hash_diff_func_t' interface.
    BATON is of type 'struct handle_externals_desc_change_baton *'.
+   KEY is a 'const char *'.
 */
 static svn_error_t *
 handle_externals_desc_change(const void *key, apr_ssize_t klen,
@@ -1088,6 +1090,13 @@ handle_externals_desc_change(const void 
           && cb->requested_depth < svn_depth_infinity))
     return SVN_NO_ERROR;
 
+  /* Only handle externals under TARGET. */
+  if (cb->target_abspath)
+    {
+      if (! svn_dirent_is_ancestor(cb->target_abspath, (const char *) key))
+        return SVN_NO_ERROR;
+    }
+
   if ((old_desc_text = apr_hash_get(cb->externals_old, key, klen)))
     SVN_ERR(svn_wc_parse_externals_description3(&old_desc, key, old_desc_text,
                                                 FALSE, cb->pool));
@@ -1206,6 +1215,7 @@ svn_client__handle_externals(apr_hash_t 
                              apr_hash_t *ambient_depths,
                              const char *from_url,
                              const char *to_abspath,
+                             const char *target,
                              const char *repos_root_url,
                              svn_depth_t requested_depth,
                              svn_boolean_t *timestamp_sleep,
@@ -1227,6 +1237,7 @@ svn_client__handle_externals(apr_hash_t 
   cb.ambient_depths    = ambient_depths;
   cb.from_url          = from_url;
   cb.to_abspath        = to_abspath;
+  cb.target_abspath    = svn_dirent_join(to_abspath, target, pool);
   cb.repos_root_url    = repos_root_url;
   cb.ctx               = ctx;
   cb.timestamp_sleep   = timestamp_sleep;
@@ -1262,6 +1273,7 @@ svn_client__fetch_externals(apr_hash_t *
   cb.ctx               = ctx;
   cb.from_url          = from_url;
   cb.to_abspath        = to_abspath;
+  cb.target_abspath    = NULL; /* ### wrong? */
   cb.repos_root_url    = repos_root_url;
   cb.timestamp_sleep   = timestamp_sleep;
   cb.native_eol        = native_eol;

Modified: subversion/trunk/subversion/libsvn_client/switch.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/switch.c?rev=1085545&r1=1085544&r2=1085545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/switch.c (original)
+++ subversion/trunk/subversion/libsvn_client/switch.c Fri Mar 25 20:00:35 2011
@@ -237,7 +237,8 @@ switch_internal(svn_revnum_t *result_rev
                 depth, ctx, pool));
       err = svn_client__handle_externals(efb.externals_old,
                                          efb.externals_new, efb.ambient_depths,
-                                         switch_url, local_abspath, source_root,
+                                         switch_url, anchor_abspath, target,
+                                         source_root,
                                          depth, use_sleep, ctx, pool);
     }
 

Modified: subversion/trunk/subversion/libsvn_client/update.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/update.c?rev=1085545&r1=1085544&r2=1085545&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/update.c (original)
+++ subversion/trunk/subversion/libsvn_client/update.c Fri Mar 25 20:00:35 2011
@@ -262,7 +262,7 @@ update_internal(svn_revnum_t *result_rev
                                            efb.externals_new,
                                            efb.ambient_depths,
                                            anchor_url, anchor_abspath,
-                                           repos_root,
+                                           target, repos_root,
                                            depth, use_sleep, ctx, pool));
     }