You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by cm...@apache.org on 2010/02/25 03:23:24 UTC

svn commit: r916089 - in /subversion/branches/1.6.x-issue-3242-partial: ./ CHANGES subversion/libsvn_client/copy.c subversion/libsvn_client/delete.c subversion/libsvn_client/merge.c subversion/libsvn_client/mergeinfo.c subversion/libsvn_client/mergeinfo.h

Author: cmpilato
Date: Thu Feb 25 02:23:24 2010
New Revision: 916089

URL: http://svn.apache.org/viewvc?rev=916089&view=rev
Log:
On the '1.6.x-issue-3242-partial' branch, merge (with heavy conflict
resolution) r879762, r880472, and r880579 from old 'issue-3242-dev'
branch (which see for log message information).

These changes represent a subset of the changes I made on that branch
for issue 3242.  Specifically, these changes cause the
mergeinfo-querying helper functions to not forcibly operate against
the repository root URL, but to operate instead against the RA
session's current URL (which is generally going to be something that
is readable by the accessing user).

Modified:
    subversion/branches/1.6.x-issue-3242-partial/   (props changed)
    subversion/branches/1.6.x-issue-3242-partial/CHANGES   (props changed)
    subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/copy.c
    subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/delete.c
    subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/merge.c
    subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.c
    subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.h

Propchange: subversion/branches/1.6.x-issue-3242-partial/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 25 02:23:24 2010
@@ -41,6 +41,7 @@
 /subversion/branches/issue-3067-deleted-subtrees:869720-870429
 /subversion/branches/issue-3148-dev:871538-871549
 /subversion/branches/issue-3220-dev:868555-868571
+/subversion/branches/issue-3242-dev:879762,880472,880579
 /subversion/branches/issue-3334-dirs:871501-872212
 /subversion/branches/kwallet:867130-867659
 /subversion/branches/log-g-performance:867286-867377

Propchange: subversion/branches/1.6.x-issue-3242-partial/CHANGES
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Thu Feb 25 02:23:24 2010
@@ -40,6 +40,7 @@
 /subversion/branches/issue-3067-deleted-subtrees/CHANGES:869720-870429
 /subversion/branches/issue-3148-dev/CHANGES:871538-871549
 /subversion/branches/issue-3220-dev/CHANGES:868555-868571
+/subversion/branches/issue-3242-dev/CHANGES:879762,880472,880579
 /subversion/branches/issue-3334-dirs/CHANGES:871501-872212
 /subversion/branches/kwallet/CHANGES:867130-867659
 /subversion/branches/log-g-performance/CHANGES:867286-867377

Modified: subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/copy.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/copy.c?rev=916089&r1=916088&r2=916089&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/copy.c (original)
+++ subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/copy.c Thu Feb 25 02:23:24 2010
@@ -67,7 +67,7 @@
    *TARGET_MERGEINFO.  ADM_ACCESS may be NULL, if SRC_PATH_OR_URL is an
    URL.  If NO_REPOS_ACCESS is set, this function is disallowed from
    consulting the repository about anything.  RA_SESSION may be NULL but
-   only if NO_REPOS_ACCESS is true. */
+   only if NO_REPOS_ACCESS is true.  */
 static svn_error_t *
 calculate_target_mergeinfo(svn_ra_session_t *ra_session,
                            apr_hash_t **target_mergeinfo,
@@ -109,19 +109,22 @@
 
   if (! locally_added)
     {
-      const char *mergeinfo_path;
-
       if (! no_repos_access)
         {
-          /* Fetch any existing (explicit) mergeinfo. */
-          SVN_ERR(svn_client__path_relative_to_root(&mergeinfo_path, src_url,
-                                                    entry ? entry->repos : NULL,
-                                                    FALSE, ra_session,
-                                                    adm_access, pool));
+          /* Fetch any existing (explicit) mergeinfo.  We'll temporarily
+             reparent to the target URL here, just to keep the code simple.
+             We could, as an alternative, first see if the target URL was a
+             child of the session URL and use the relative "remainder", 
+             falling back to this reparenting as necessary.  */
+          const char *old_session_url = NULL;
+          SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url,
+                                                    ra_session, src_url, pool));
           SVN_ERR(svn_client__get_repos_mergeinfo(ra_session, &src_mergeinfo,
-                                                  mergeinfo_path, src_revnum,
+                                                  "", src_revnum,
                                                   svn_mergeinfo_inherited,
                                                   TRUE, pool));
+          if (old_session_url)
+            SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool));
         }
       else
         {

Modified: subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/delete.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/delete.c?rev=916089&r1=916088&r2=916089&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/delete.c (original)
+++ subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/delete.c Thu Feb 25 02:23:24 2010
@@ -109,7 +109,7 @@
             svn_client_ctx_t *ctx,
             apr_pool_t *pool)
 {
-  svn_ra_session_t *ra_session;
+  svn_ra_session_t *ra_session = NULL;
   const svn_delta_editor_t *editor;
   void *edit_baton;
   void *commit_baton;
@@ -162,30 +162,47 @@
   SVN_ERR(svn_client__ensure_revprop_table(&commit_revprops, revprop_table,
                                            log_msg, ctx, pool));
 
-  /* Open an RA session for the URL. Note that we don't have a local
-     directory, nor a place to put temp files. */
-  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, common, NULL,
-                                               NULL, NULL, FALSE, TRUE,
-                                               ctx, pool));
-
   /* Verify that each thing to be deleted actually exists (to prevent
      the creation of a revision that has no changes, since the
-     filesystem allows for no-op deletes). */
+     filesystem allows for no-op deletes).  While here, we'll
+     URI-decode our targets.  */
   for (i = 0; i < targets->nelts; i++)
     {
       const char *path = APR_ARRAY_IDX(targets, i, const char *);
+      const char *item_url;
+
       svn_pool_clear(subpool);
+      item_url = svn_path_url_add_component2(common, path, subpool);
       path = svn_path_uri_decode(path, pool);
       APR_ARRAY_IDX(targets, i, const char *) = path;
-      SVN_ERR(svn_ra_check_path(ra_session, path, SVN_INVALID_REVNUM,
+
+      /* If we've not yet done so, open an RA session for the
+         URL. Note that we don't have a local directory, nor a place
+         to put temp files.  Otherwise, reparent our existing
+         session.  */
+      if (! ra_session)
+        {
+          SVN_ERR(svn_client__open_ra_session_internal(&ra_session, item_url,
+                                                       NULL, NULL, NULL, FALSE,
+                                                       TRUE, ctx, pool));
+        }
+      else
+        {
+          SVN_ERR(svn_ra_reparent(ra_session, item_url, subpool));
+        }
+
+      SVN_ERR(svn_ra_check_path(ra_session, "", SVN_INVALID_REVNUM,
                                 &kind, subpool));
       if (kind == svn_node_none)
         return svn_error_createf(SVN_ERR_FS_NOT_FOUND, NULL,
                                  "URL '%s' does not exist",
-                                 svn_path_local_style(path, pool));
+                                 svn_path_local_style(item_url, pool));
     }
   svn_pool_destroy(subpool);
 
+  /* Reparent the RA_session to the common parent of our deletees. */
+  SVN_ERR(svn_ra_reparent(ra_session, common, pool));
+
   /* Fetch RA commit editor */
   SVN_ERR(svn_client__commit_get_baton(&commit_baton, commit_info_p, pool));
   SVN_ERR(svn_ra_get_commit_editor3(ra_session, &editor, &edit_baton,

Modified: subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/merge.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/merge.c?rev=916089&r1=916088&r2=916089&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/merge.c (original)
+++ subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/merge.c Thu Feb 25 02:23:24 2010
@@ -2838,7 +2838,7 @@
       svn_boolean_t inherited;
       SVN_ERR(svn_client__get_wc_or_repos_mergeinfo(recorded_mergeinfo, entry,
                                                     &inherited, FALSE,
-                                                    inherit, ra_session,
+                                                    inherit, NULL,
                                                     target_wcpath,
                                                     adm_access, ctx, pool));
       if (indirect)

Modified: subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.c?rev=916089&r1=916088&r2=916089&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.c Thu Feb 25 02:23:24 2010
@@ -304,15 +304,10 @@
 {
   svn_error_t *err;
   svn_mergeinfo_t repos_mergeinfo;
-  const char *old_session_url;
   apr_array_header_t *rel_paths = apr_array_make(pool, 1, sizeof(rel_path));
 
   APR_ARRAY_PUSH(rel_paths, const char *) = rel_path;
 
-  /* Temporarily point the session at the root of the repository. */
-  SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
-                                            NULL, pool));
-
   /* Fetch the mergeinfo. */
   err = svn_ra_get_mergeinfo(ra_session, &repos_mergeinfo, rel_paths, rev,
                              inherit, FALSE, pool);
@@ -327,10 +322,6 @@
         return err;
     }
 
-  /* If we reparented the session, put it back where our caller had it. */
-  if (old_session_url)
-    SVN_ERR(svn_ra_reparent(ra_session, old_session_url, pool));
-
   /* Grab only the mergeinfo provided for REL_PATH. */
   if (repos_mergeinfo)
     *target_mergeinfo = apr_hash_get(repos_mergeinfo, rel_path,
@@ -392,21 +383,28 @@
                                                NULL, ctx, pool));
           if (apr_hash_get(props, target_wcpath, APR_HASH_KEY_STRING) == NULL)
             {
-              const char *repos_rel_path;
+              const char *session_url = NULL;
+              apr_pool_t *sesspool = NULL;
 
-              if (ra_session == NULL)
-                SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
-                                                             NULL, NULL, NULL,
-                                                             FALSE, TRUE, ctx,
-                                                             pool));
-
-              SVN_ERR(svn_client__path_relative_to_root(&repos_rel_path, url,
-                                                        entry->repos, FALSE,
-                                                        ra_session, NULL,
-                                                        pool));
+              if (ra_session)
+                {
+                  SVN_ERR(svn_client__ensure_ra_session_url(&session_url,
+                                                            ra_session,
+                                                            url, pool));
+                }
+              else
+                {
+                  sesspool = svn_pool_create(pool);
+                  SVN_ERR(svn_client__open_ra_session_internal(&ra_session, url,
+                                                               NULL, NULL, NULL,
+                                                               FALSE, TRUE,
+                                                               ctx,
+                                                               sesspool));
+                }
+              
               SVN_ERR(svn_client__get_repos_mergeinfo(ra_session,
                                                       &repos_mergeinfo,
-                                                      repos_rel_path,
+                                                      "",
                                                       target_rev,
                                                       inherit,
                                                       TRUE,
@@ -416,6 +414,18 @@
                   *target_mergeinfo = repos_mergeinfo;
                   *indirect = TRUE;
                 }
+
+              /* If we created an RA_SESSION above, destroy it.
+                 Otherwise, if reparented an existing session, point
+                 it back where it was when we were called. */
+              if (sesspool)
+                {
+                  svn_pool_destroy(sesspool);
+                }
+              else if (session_url)
+                {
+                  SVN_ERR(svn_ra_reparent(ra_session, session_url, pool));
+                }
             }
         }
     }

Modified: subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.h?rev=916089&r1=916088&r2=916089&view=diff
==============================================================================
--- subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.h (original)
+++ subversion/branches/1.6.x-issue-3242-partial/subversion/libsvn_client/mergeinfo.h Thu Feb 25 02:23:24 2010
@@ -103,11 +103,9 @@
                              svn_client_ctx_t *ctx,
                              apr_pool_t *pool);
 
-/* Obtain any mergeinfo for the root-relative repository filesystem path
-   REL_PATH from the repository, and set it in *TARGET_MERGEINFO.
-   RA_SESSION should be an open RA session pointing at the URL that REL_PATH
-   is relative to, or NULL, in which case this function will open its own
-   temporary session.
+/* Obtain any mergeinfo for repository filesystem path REL_PATH
+   (relative to RA_SESSION's session URL) from the repository, and set
+   it in *TARGET_MERGEINFO.
 
    INHERIT indicates whether explicit, explicit or inherited, or only
    inherited mergeinfo for REL_PATH is obtained.
@@ -133,18 +131,18 @@
    target has no info of its own.
 
    If no mergeinfo can be obtained from the WC or REPOS_ONLY is TRUE,
-   get it from the repository.  RA_SESSION should be an open RA session
-   pointing at ENTRY->URL, or NULL, in which case this function will open
-   its own temporary session.
+   get it from the repository.  RA_SESSION should be an open RA
+   session pointing at ENTRY->URL, or NULL, in which case this
+   function will open its own temporary session.
 
    (opening a new RA session if RA_SESSION
    is NULL).  Store any mergeinfo obtained for TARGET_WCPATH -- which
    is reflected by ENTRY -- in *TARGET_MERGEINFO, if no mergeinfo is
    found *TARGET_MERGEINFO is NULL.
 
-   Like svn_client__get_wc_mergeinfo, this function considers no inherited
-   mergeinfo to be found in the WC when trying to crawl into a parent path
-   with a different working revision.
+   Like svn_client__get_wc_mergeinfo(), this function considers no
+   inherited mergeinfo to be found in the WC when trying to crawl into
+   a parent path with a different working revision.
 
    INHERIT indicates whether explicit, explicit or inherited, or only
    inherited mergeinfo for TARGET_WCPATH is retrieved.