Login | Register
My pages Projects Community openCollabNet

Discussions > dev [DISABLED] > Re: svn commit: r37519 - trunk/subversion/libsvn_client

subversion
Discussion topic

Back to topic list

Re: svn commit: r37519 - trunk/subversion/libsvn_client

Author Paul Burba <ptburba at gmail dot com>
Full name Paul Burba <ptburba at gmail dot com>
Date 2009-05-18 10:10:15 PDT
Message On Thu, Apr 30, 2009 at 4:27 PM, Bert Huijben <rhuijben at sharpsvn dot net> wrote:
>> -----Original Message-----
>> From: Paul T. Burba [mailto:pburba at collab dot net]
>> Sent: donderdag 30 april 2009 21:32
>> To: svn at subversion dot tigris dot org
>> Subject: svn commit: r37519 - trunk/subversion/libsvn_client
>>
>> Author: pburba
>> Date: Thu Apr 30 12:32:07 2009
>> New Revision: 37519
>>
>> Log:
>> Stop merge of difference between two different repositories from
>> occasionally "working".
>>
>> Previously, given URL_X and URL_Y which point to two completely
>> different
>> repositories, the merge,
>>
>>   svn merge URL_X@M URL_Y@N TARGET_WC
>>
>> might actually succeed and merge URL_X@M:URL_X@N to TARGET_WC.
>>                                      ^       ^
>>
>> * subversion/libsvn_cl​ient/client.h
>>   (svn_client__get_you​ngest_common_ancesto​r): Note assumption that
>> path/urls
>>   being examined are assumed to point to the same repos.  This function
>> can
>>   find a "common" ancestor between two *different* repositories which
>> have
>>   similar path structures.
>>
>> * subversion/libsvn_cl​ient/merge.c
>>   (svn_client_merge3): Raise an error immediately when trying to merge
>> the
>>   difference between different repositories, don't let things proceed
>>   because svn_client__get_youn​gest_common_ancestor​'s limitations might
>> allow
>>   some strange (and incorrect) results.
>>
>> Modified:
>>    trunk/subversion/li​bsvn_client/client.h​
>>    trunk/subversion/li​bsvn_client/merge.c
>>
>> Modified: trunk/subversion/lib​svn_client/client.h
>> URL:
>> http://svn.collab.ne​t/viewvc/svn/trunk/s​ubversion/libsvn_cli​ent/client.
>> h?pathrev=37519&​r1=37518&r2=3751​9
>> ====================​====================​====================​===========
>> =======
>> --- trunk/subversion/lib​svn_client/client.h   Thu Apr 30 12:23:46 2009
>>       (r37518)
>> +++ trunk/subversion/lib​svn_client/client.h   Thu Apr 30 12:32:07 2009
>>       (r37519)
>> @@ -191,8 +191,9 @@ svn_client__repos_lo​cation_segments(apr_​
>>     ancestor path (a path relative to the root of the repository) and
>>     revision, respectively, of the two locations identified as
>>     PATH_OR_URL1@REV1 and PATH_OR_URL2@REV1.  Use the authentication
>> -   baton cached in CTX to authenticate against the repository.  Use
>> -   POOL for all allocations. */
>> +   baton cached in CTX to authenticate against the repository.
>> +   This function assumes that PATH_OR_URL1@REV1 and PATH_OR_URL2@REV1
>> +   both refer to the same repository.  Use POOL for all allocations.
>> */
>>  svn_error_t *
>>  svn_client__get_you​ngest_common_ancesto​r(const char **ancestor_path,
>>                                           svn_revnum_t
>> *ancestor_revision,
>>
>> Modified: trunk/subversion/lib​svn_client/merge.c
>> URL:
>> http://svn.collab.ne​t/viewvc/svn/trunk/s​ubversion/libsvn_cli​ent/merge.c
>> ?pathrev=37519&r​1=37518&r2=37519​
>> ====================​====================​====================​===========
>> =======
>> --- trunk/subversion/lib​svn_client/merge.c    Thu Apr 30 12:23:46 2009
>>       (r37518)
>> +++ trunk/subversion/lib​svn_client/merge.c    Thu Apr 30 12:32:07 2009
>>       (r37519)
>> @@ -4002,12 +4002,12 @@ drive_merge_report_editor(const char *ta
>>          }
>>      }
>>
>> -  /* Temporarily point our second RA session to URL1, too.  We use
>> -     this to request individual file contents. */
>> -  SVN_ERR(svn_client_​_ensure_ra_session_u​rl(&old_sess2_ur​l,
>> -                                            merge_b->ra_session2,
>> -                                            url1, pool));
>> -
>> +      /* Temporarily point our second RA session to URL1, too.  We use
>> +         this to request individual file contents. */
>> +      SVN_ERR(svn_client_​_ensure_ra_session_u​rl(&old_sess2_ur​l,
>> +                                                merge_b->ra_session2,
>> +                                                url1, pool));
>> +
>>    /* Get the diff editor and a reporter with which to, ultimately,
>>       drive it. */
>>    SVN_ERR(svn_client_​_get_diff_editor(tar​get_wcpath, adm_access,
>> callbacks,
>> @@ -7114,6 +7114,7 @@ svn_client_merge3(const char *source1,
>>    svn_revnum_t yc_rev = SVN_INVALID_REVNUM;
>>    apr_pool_t *sesspool;
>>    svn_boolean_t same_repos;
>> +  const char *source_repos_uuid1, *source_repos_uuid2;
>>
>>    /* Sanity check our input -- we require specified revisions. */
>>    if ((revision1->kind == svn_opt_revision_unspecified)
>> @@ -7174,24 +7175,29 @@ svn_client_merge3(const char *source1,
>>    SVN_ERR(svn_client_​_get_revision_number​(&rev2, &youngest_rev,
>> ra_session2,
>>                                            revision2, NULL, sesspool));
>>
>> -  /* Get the repository root URL from one of our sessions (the other
>> -     doesn't matter -- if it ain't the same, other stuff would fall
>> -     over later).  */
>> +  SVN_ERR(svn_ra_get_​uuid2(ra_session1, &source_repos_uuid1, pool));
>> +  SVN_ERR(svn_ra_get_​uuid2(ra_session2, &source_repos_uuid2, pool));
>> +
>> +  /* We can't do a diff between different repositories. */
>> +  if (strcmp(source_repos_uuid1, source_repos_uuid2) != 0)
>> +    return svn_error_createf(SV​N_ERR_RA_UUID_MISMAT​CH, NULL,
>> +                             _("'%s' isn't in the same repository as
>> '%s'"),
>> +                             URL1, URL2);
>> +
>> +  /* Get the repository root URL from one of our sessions. */
>>    SVN_ERR(svn_ra_get_​repos_root2(ra_sessi​on1, &source_repos_root,
>> sesspool));
>>
>>    /* Do our working copy and sources come from the same repository? */
>>    if (strcmp(wc_repos_root, source_repos_root) != 0)
>>      {
>> -      const char *source_repos_uuid;
>>        const char *wc_repos_uuid;
>>
>> -      SVN_ERR(svn_ra_get_​uuid2(ra_session1, &source_repos_uuid,
>> pool));
>>        if (entry)
>>          wc_repos_uuid = entry->uuid;
>>        else
>>          SVN_ERR(svn_client_​uuid_from_url(&w​c_repos_uuid,
>> wc_repos_root,
>>                                           ctx, pool));
>
> Not really part of your patch, but we should be able to retrieve this last
> uuid from the working copy with svn_client_uuid_from_path() without always
> opening a third ra session.

Bert,

Agreed. There were also a couple other opportunities for similar
changes in merge.c. Done r37773.

Paul

« Previous message in topic | 2 of 2 | Next message in topic »

Messages

Show all messages in topic

RE: svn commit: r37519 - trunk/subversion/libsvn_client rhuijben Bert Huijben 2009-04-30 13:27:56 PDT
     Re: svn commit: r37519 - trunk/subversion/libsvn_client Paul Burba <ptburba at gmail dot com> Paul Burba <ptburba at gmail dot com> 2009-05-18 10:10:15 PDT
Messages per page: