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/26 16:25:30 UTC

svn commit: r1127938 - /subversion/trunk/subversion/libsvn_client/externals.c

Author: rhuijben
Date: Thu May 26 14:25:30 2011
New Revision: 1127938

URL: http://svn.apache.org/viewvc?rev=1127938&view=rev
Log:
Perform the externals processing in a different order: Start with processing
the externals in paths that exist after the update instead of with the old
externals that might not exist after the update.

Because every external path is processed just once this is no real functional
change, but it makes it easier to switch to the db driven processing.

* subversion/libsvn_client/externals.c
  (handle_externals_change): Create a hash of old externals and process the
    new definitions against this list instead of the other way around.
    Store abspaths in the hash instead of relpaths in preparation for getting
    the old information from the database.

Modified:
    subversion/trunk/subversion/libsvn_client/externals.c

Modified: subversion/trunk/subversion/libsvn_client/externals.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1127938&r1=1127937&r2=1127938&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/externals.c (original)
+++ subversion/trunk/subversion/libsvn_client/externals.c Thu May 26 14:25:30 2011
@@ -1058,7 +1058,7 @@ handle_externals_change(const struct ext
                         apr_pool_t *scratch_pool)
 {
   apr_array_header_t *old_desc, *new_desc;
-  apr_hash_t *new_desc_hash;
+  apr_hash_t *old_desc_hash;
   int i;
   apr_pool_t *iterpool;
   const char *url;
@@ -1089,18 +1089,21 @@ handle_externals_change(const struct ext
   else
     new_desc = NULL;
 
-  new_desc_hash = apr_hash_make(scratch_pool);
+  old_desc_hash = apr_hash_make(scratch_pool);
 
   /* Create a hash of our new item array so that we can efficiently generate
      a diff for them. */
-  for (i = 0; new_desc && (i < new_desc->nelts); i++)
+  for (i = 0; old_desc && (i < old_desc->nelts); i++)
     {
       svn_wc_external_item2_t *item;
+      const char *target_abspath;
 
-      item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
+      item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
 
-      apr_hash_set(new_desc_hash, item->target_dir,
-                   APR_HASH_KEY_STRING, item);
+      target_abspath = svn_dirent_join(local_abspath, item->target_dir,
+                                       scratch_pool);
+
+      apr_hash_set(old_desc_hash, target_abspath, APR_HASH_KEY_STRING, item);
     }
 
   SVN_ERR(svn_wc__node_get_url(&url, eb->ctx->wc_ctx, local_abspath,
@@ -1108,20 +1111,20 @@ handle_externals_change(const struct ext
 
   SVN_ERR_ASSERT(url);
 
-  for (i = 0; old_desc && (i < old_desc->nelts); i++)
+  for (i = 0; new_desc && (i < new_desc->nelts); i++)
     {
       svn_wc_external_item2_t *old_item;
       svn_wc_external_item2_t *new_item;
       const char *target_abspath;
 
-      old_item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
+      new_item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
 
       svn_pool_clear(iterpool);
 
-      target_abspath = svn_dirent_join(local_abspath, old_item->target_dir,
+      target_abspath = svn_dirent_join(local_abspath, new_item->target_dir,
                                        iterpool);
 
-      new_item = apr_hash_get(new_desc_hash, old_item->target_dir,
+      old_item = apr_hash_get(old_desc_hash, target_abspath,
                               APR_HASH_KEY_STRING);
 
       SVN_ERR(handle_external_item_change_wrapper(eb, local_abspath, url,
@@ -1129,29 +1132,29 @@ handle_externals_change(const struct ext
                                                   old_item, new_item,
                                                   iterpool));
 
-      /* And remove already processed items from the hash */
-      if (new_item)
-        apr_hash_set(new_desc_hash, new_item->target_dir,
+      /* And remove already processed items from the to-remove hash */
+      if (old_item)
+        apr_hash_set(old_desc_hash, target_abspath,
                      APR_HASH_KEY_STRING, NULL);
     }
-  for (i = 0; new_desc && (i < new_desc->nelts); i++)
+  for (i = 0; old_desc && (i < old_desc->nelts); i++)
     {
-      svn_wc_external_item2_t *new_item;
-      new_item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
+      svn_wc_external_item2_t *item;
+      const char *target_abspath;
+
+      item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
 
       svn_pool_clear(iterpool);
 
+      target_abspath = svn_dirent_join(local_abspath, item->target_dir,
+                                       iterpool);
+
       /* Only if the item is still in the hash, we should process it */
-      if (apr_hash_get(new_desc_hash, new_item->target_dir,
-                       APR_HASH_KEY_STRING))
+      if (apr_hash_get(old_desc_hash, target_abspath, APR_HASH_KEY_STRING))
         {
-          const char *target_abspath = svn_dirent_join(local_abspath,
-                                                       new_item->target_dir,
-                                                       iterpool);
-
           SVN_ERR(handle_external_item_change_wrapper(eb, local_abspath, url,
                                                       target_abspath,
-                                                      NULL, new_item,
+                                                      item, NULL,
                                                       iterpool));
         }
     }



Re: svn commit: r1127938 - /subversion/trunk/subversion/libsvn_client/externals.c

Posted by Mark Phippard <ma...@gmail.com>.
Do not know if it is related but I just updated and am running the
tests on my Mac.  I have not run the tests in a while.  I got a crash
during the tests. I think it was the externals tests but everything is
reporting success so far.

Here is the info that came up from the crash:

Application Specific Information:
abort() called

Thread 0 Crashed:  Dispatch queue: com.apple.main-thread
0   libSystem.B.dylib             	0x00007fff830425d6 __kill + 10
1   libSystem.B.dylib             	0x00007fff830e2cd6 abort + 83
2   libsvn_subr-1.0.dylib         	0x0000000100457bc5
svn_error_set_malfunction_handler + 0
3   libsvn_subr-1.0.dylib         	0x0000000100457c16
svn_error__malfunction + 45
4   libsvn_wc-1.0.dylib           	0x000000010014e6cd run_file_install + 864
5   libsvn_wc-1.0.dylib           	0x0000000100150e74 dispatch_work_item + 123
6   libsvn_wc-1.0.dylib           	0x0000000100151045 svn_wc__wq_run + 279
7   libsvn_wc-1.0.dylib           	0x00000001000ebe1d close_file + 3308
8   libsvn_delta-1.0.dylib        	0x0000000100430b85 close_file + 136
9   libsvn_delta-1.0.dylib        	0x0000000100430b85 close_file + 136
10  libsvn_repos-1.0.dylib        	0x00000001001cf49c update_entry + 3070
11  libsvn_repos-1.0.dylib        	0x00000001001d0435 drive + 1438
12  libsvn_repos-1.0.dylib        	0x00000001001d0838 finish_report + 909
13  libsvn_repos-1.0.dylib        	0x00000001001d0c9a
svn_repos_finish_report + 37
14  libsvn_ra_local-1.0.dylib     	0x00000001001a9b33
reporter_finish_report + 41
15  libsvn_wc-1.0.dylib           	0x00000001000ec5fa
svn_wc__crawl_file_external + 597
16  libsvn_client-1.0.dylib       	0x000000010006c5c4
switch_file_external + 2622
17  libsvn_client-1.0.dylib       	0x000000010006d67b
handle_external_item_change + 2204
18  libsvn_client-1.0.dylib       	0x000000010006dce0
handle_external_item_change_wrapper + 87
19  libsvn_client-1.0.dylib       	0x000000010006e09f
handle_externals_change + 920
20  libsvn_client-1.0.dylib       	0x000000010006e4d5
svn_client__handle_externals + 655
21  libsvn_client-1.0.dylib       	0x00000001000a32d7 update_internal + 3971
22  libsvn_client-1.0.dylib       	0x00000001000a3799
svn_client__update_internal + 905
23  libsvn_client-1.0.dylib       	0x00000001000a3a2d svn_client_update4 + 567
24  svn                           	0x000000010001d37c svn_cl__update + 788
25  svn                           	0x0000000100010bbb main + 11470
26  svn                           	0x00000001000016f8 start + 52





On Thu, May 26, 2011 at 10:25 AM,  <rh...@apache.org> wrote:
> Author: rhuijben
> Date: Thu May 26 14:25:30 2011
> New Revision: 1127938
>
> URL: http://svn.apache.org/viewvc?rev=1127938&view=rev
> Log:
> Perform the externals processing in a different order: Start with processing
> the externals in paths that exist after the update instead of with the old
> externals that might not exist after the update.
>
> Because every external path is processed just once this is no real functional
> change, but it makes it easier to switch to the db driven processing.
>
> * subversion/libsvn_client/externals.c
>  (handle_externals_change): Create a hash of old externals and process the
>    new definitions against this list instead of the other way around.
>    Store abspaths in the hash instead of relpaths in preparation for getting
>    the old information from the database.
>
> Modified:
>    subversion/trunk/subversion/libsvn_client/externals.c
>
> Modified: subversion/trunk/subversion/libsvn_client/externals.c
> URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/externals.c?rev=1127938&r1=1127937&r2=1127938&view=diff
> ==============================================================================
> --- subversion/trunk/subversion/libsvn_client/externals.c (original)
> +++ subversion/trunk/subversion/libsvn_client/externals.c Thu May 26 14:25:30 2011
> @@ -1058,7 +1058,7 @@ handle_externals_change(const struct ext
>                         apr_pool_t *scratch_pool)
>  {
>   apr_array_header_t *old_desc, *new_desc;
> -  apr_hash_t *new_desc_hash;
> +  apr_hash_t *old_desc_hash;
>   int i;
>   apr_pool_t *iterpool;
>   const char *url;
> @@ -1089,18 +1089,21 @@ handle_externals_change(const struct ext
>   else
>     new_desc = NULL;
>
> -  new_desc_hash = apr_hash_make(scratch_pool);
> +  old_desc_hash = apr_hash_make(scratch_pool);
>
>   /* Create a hash of our new item array so that we can efficiently generate
>      a diff for them. */
> -  for (i = 0; new_desc && (i < new_desc->nelts); i++)
> +  for (i = 0; old_desc && (i < old_desc->nelts); i++)
>     {
>       svn_wc_external_item2_t *item;
> +      const char *target_abspath;
>
> -      item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
> +      item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
>
> -      apr_hash_set(new_desc_hash, item->target_dir,
> -                   APR_HASH_KEY_STRING, item);
> +      target_abspath = svn_dirent_join(local_abspath, item->target_dir,
> +                                       scratch_pool);
> +
> +      apr_hash_set(old_desc_hash, target_abspath, APR_HASH_KEY_STRING, item);
>     }
>
>   SVN_ERR(svn_wc__node_get_url(&url, eb->ctx->wc_ctx, local_abspath,
> @@ -1108,20 +1111,20 @@ handle_externals_change(const struct ext
>
>   SVN_ERR_ASSERT(url);
>
> -  for (i = 0; old_desc && (i < old_desc->nelts); i++)
> +  for (i = 0; new_desc && (i < new_desc->nelts); i++)
>     {
>       svn_wc_external_item2_t *old_item;
>       svn_wc_external_item2_t *new_item;
>       const char *target_abspath;
>
> -      old_item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
> +      new_item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
>
>       svn_pool_clear(iterpool);
>
> -      target_abspath = svn_dirent_join(local_abspath, old_item->target_dir,
> +      target_abspath = svn_dirent_join(local_abspath, new_item->target_dir,
>                                        iterpool);
>
> -      new_item = apr_hash_get(new_desc_hash, old_item->target_dir,
> +      old_item = apr_hash_get(old_desc_hash, target_abspath,
>                               APR_HASH_KEY_STRING);
>
>       SVN_ERR(handle_external_item_change_wrapper(eb, local_abspath, url,
> @@ -1129,29 +1132,29 @@ handle_externals_change(const struct ext
>                                                   old_item, new_item,
>                                                   iterpool));
>
> -      /* And remove already processed items from the hash */
> -      if (new_item)
> -        apr_hash_set(new_desc_hash, new_item->target_dir,
> +      /* And remove already processed items from the to-remove hash */
> +      if (old_item)
> +        apr_hash_set(old_desc_hash, target_abspath,
>                      APR_HASH_KEY_STRING, NULL);
>     }
> -  for (i = 0; new_desc && (i < new_desc->nelts); i++)
> +  for (i = 0; old_desc && (i < old_desc->nelts); i++)
>     {
> -      svn_wc_external_item2_t *new_item;
> -      new_item = APR_ARRAY_IDX(new_desc, i, svn_wc_external_item2_t *);
> +      svn_wc_external_item2_t *item;
> +      const char *target_abspath;
> +
> +      item = APR_ARRAY_IDX(old_desc, i, svn_wc_external_item2_t *);
>
>       svn_pool_clear(iterpool);
>
> +      target_abspath = svn_dirent_join(local_abspath, item->target_dir,
> +                                       iterpool);
> +
>       /* Only if the item is still in the hash, we should process it */
> -      if (apr_hash_get(new_desc_hash, new_item->target_dir,
> -                       APR_HASH_KEY_STRING))
> +      if (apr_hash_get(old_desc_hash, target_abspath, APR_HASH_KEY_STRING))
>         {
> -          const char *target_abspath = svn_dirent_join(local_abspath,
> -                                                       new_item->target_dir,
> -                                                       iterpool);
> -
>           SVN_ERR(handle_external_item_change_wrapper(eb, local_abspath, url,
>                                                       target_abspath,
> -                                                      NULL, new_item,
> +                                                      item, NULL,
>                                                       iterpool));
>         }
>     }
>
>
>



-- 
Thanks

Mark Phippard
http://markphip.blogspot.com/