[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

Re: svn commit: r1330444 - in /subversion/trunk/subversion: libsvn_client/merge.c tests/cmdline/merge_tests.py

From: Paul Burba <ptburba_at_gmail.com>
Date: Thu, 26 Apr 2012 14:07:48 -0400

On Thu, Apr 26, 2012 at 11:10 AM, Julian Foad
<julianfoad_at_btopenworld.com> wrote:
> Hi Paul.  Would you be willing to factor out those 40 lines of update-the-list code?  Then that part of the notification_receiver function can be as nice and readable as

Sure, done r1331003.

Paul

>   ...
>   if (notify->action == svn_wc_notify_update_add)
>     {
>       update_the_list_of_added_subtrees(...);
>     }
>   ...
>
> and not distract the eye from its overall flow.
>
> - Julian
>
>
>> Modified: subversion/trunk/subversion/libsvn_client/merge.c
>
>> URL:
>> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/merge.c?rev=1330444&r1=1330443&r2=1330444&view=diff
>> ==============================================================================
>> --- subversion/trunk/subversion/libsvn_client/merge.c (original)
>> +++ subversion/trunk/subversion/libsvn_client/merge.c Wed Apr 25 17:57:30 2012
>> @@ -2941,30 +2941,47 @@ notification_receiver(void *baton, const
>>
>>        if (notify->action == svn_wc_notify_update_add)
>>          {
>> -          svn_boolean_t is_root_of_added_subtree = FALSE;
>> -          const char *added_path = apr_pstrdup(notify_b->pool,
>> -                                               notify_abspath);
>> -          const char *added_path_parent = NULL;
>> +          svn_boolean_t root_of_added_subtree = TRUE;
>>
>>            /* Stash the root path of any added subtrees. */
>>            if (notify_b->added_abspaths == NULL)
>>              {
>> +              /* The first added path is always a root. */
>>                notify_b->added_abspaths = apr_hash_make(notify_b->pool);
>> -              is_root_of_added_subtree = TRUE;
>>              }
>>            else
>>              {
>> -              added_path_parent = svn_dirent_dirname(added_path, pool);
>> -              /* ### Bug. Testing whether its immediate parent is in the
>> -               * hash isn't enough: this is letting every other level of
>> -               * the added subtree hierarchy into the hash. */
>> -              if (!apr_hash_get(notify_b->added_abspaths, added_path_parent,
>> -                                APR_HASH_KEY_STRING))
>> -                is_root_of_added_subtree = TRUE;
>> -            }
>> -          if (is_root_of_added_subtree)
>> -            apr_hash_set(notify_b->added_abspaths, added_path,
>> -                         APR_HASH_KEY_STRING, added_path);
>> +              const char *added_path_parent =
>> +                svn_dirent_dirname(notify_abspath, pool);
>> +              apr_pool_t *iterpool = svn_pool_create(pool);
>> +
>> +              /* Is NOTIFY->PATH the root of an added subtree? */
>> +              while (strcmp(notify_b->merge_b->target->abspath,
>> +                            added_path_parent))
>> +                {
>> +                  if (apr_hash_get(notify_b->added_abspaths,
>> +                                   added_path_parent,
>> +                                   APR_HASH_KEY_STRING))
>> +                    {
>> +                      root_of_added_subtree = FALSE;
>> +                      break;
>> +                    }
>> +
>> +                  svn_pool_clear(iterpool);
>> +                  added_path_parent = svn_dirent_dirname(
>> +                    added_path_parent, iterpool);
>> +                }
>> +
>> +              svn_pool_destroy(iterpool);
>> +            }
>> +
>> +          if (root_of_added_subtree)
>> +            {
>> +              const char *added_root_path = apr_pstrdup(notify_b->pool,
>> +                                                        notify_abspath);
>> +              apr_hash_set(notify_b->added_abspaths, added_root_path,
>> +                           APR_HASH_KEY_STRING, added_root_path);
>> +            }
>>          }
>>
>>        if (notify->action == svn_wc_notify_update_delete
>>
Received on 2012-04-26 20:08:19 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.