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

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

From: Bert Huijben <rhuijben_at_sharpsvn.net>
Date: Thu, 30 Apr 2009 22:27:42 +0200

> -----Original Message-----
> From: Paul T. Burba [mailto:pburba_at_collab.net]
> Sent: donderdag 30 april 2009 21:32
> To: svn_at_subversion.tigris.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_at_M URL_Y_at_N TARGET_WC
>
> might actually succeed and merge URL_X_at_M:URL_X_at_N to TARGET_WC.
> ^ ^
>
> * subversion/libsvn_client/client.h
> (svn_client__get_youngest_common_ancestor): 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_client/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_youngest_common_ancestor's limitations might
> allow
> some strange (and incorrect) results.
>
> Modified:
> trunk/subversion/libsvn_client/client.h
> trunk/subversion/libsvn_client/merge.c
>
> Modified: trunk/subversion/libsvn_client/client.h
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/client.
> h?pathrev=37519&r1=37518&r2=37519
> =======================================================================
> =======
> --- trunk/subversion/libsvn_client/client.h Thu Apr 30 12:23:46 2009
> (r37518)
> +++ trunk/subversion/libsvn_client/client.h Thu Apr 30 12:32:07 2009
> (r37519)
> @@ -191,8 +191,9 @@ svn_client__repos_location_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_at_REV1 and PATH_OR_URL2_at_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_at_REV1 and PATH_OR_URL2_at_REV1
> + both refer to the same repository. Use POOL for all allocations.
> */
> svn_error_t *
> svn_client__get_youngest_common_ancestor(const char **ancestor_path,
> svn_revnum_t
> *ancestor_revision,
>
> Modified: trunk/subversion/libsvn_client/merge.c
> URL:
> http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/merge.c
> ?pathrev=37519&r1=37518&r2=37519
> =======================================================================
> =======
> --- trunk/subversion/libsvn_client/merge.c Thu Apr 30 12:23:46 2009
> (r37518)
> +++ trunk/subversion/libsvn_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_url(&old_sess2_url,
> - 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_url(&old_sess2_url,
> + 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(target_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(SVN_ERR_RA_UUID_MISMATCH, 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_session1, &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(&wc_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

> - same_repos = (strcmp(wc_repos_uuid, source_repos_uuid) == 0);
> + same_repos = (strcmp(wc_repos_uuid, source_repos_uuid1) == 0);
> }
> else
> same_repos = TRUE;
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageI
> d=2000107

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2000846
Received on 2009-04-30 22:28:11 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.