subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From cmpil...@apache.org
Subject svn commit: r931211 - /subversion/trunk/subversion/libsvn_client/mergeinfo.c
Date Tue, 06 Apr 2010 16:27:06 GMT
Author: cmpilato
Date: Tue Apr  6 16:27:06 2010
New Revision: 931211

URL: http://svn.apache.org/viewvc?rev=931211&view=rev
Log:
More issue-3242-related improvements.

* subversion/libsvn_client/mergeinfo.c
  (get_mergeinfo): Issue mergeinfo requests against the input path,
    not against the repository root, then patch up the results to make
    good on the promise to return a catalog with keys relative to the
    repository root.

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

Modified: subversion/trunk/subversion/libsvn_client/mergeinfo.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/mergeinfo.c?rev=931211&r1=931210&r2=931211&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/mergeinfo.c (original)
+++ subversion/trunk/subversion/libsvn_client/mergeinfo.c Tue Apr  6 16:27:06 2010
@@ -1031,8 +1031,7 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
 
   if (is_url)
     {
-      const char *repos_rel_path;
-      const char *old_session_url;
+      svn_mergeinfo_catalog_t tmp_catalog;
 
       SVN_ERR(svn_dirent_get_absolute(&local_abspath, "", scratch_pool));
       SVN_ERR(svn_client__open_ra_session_internal(&ra_session, path_or_url,
@@ -1042,21 +1041,43 @@ get_mergeinfo(svn_mergeinfo_catalog_t *m
                                               local_abspath, ra_session,
                                               &peg_rev, scratch_pool));
       SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, scratch_pool));
-      SVN_ERR(svn_client__path_relative_to_root(&repos_rel_path, ctx->wc_ctx,
-                                                path_or_url, *repos_root,
-                                                FALSE, NULL,
-                                                scratch_pool,
-                                                scratch_pool));
-      SVN_ERR(svn_client__ensure_ra_session_url(&old_session_url, ra_session,
-                                                *repos_root, scratch_pool));
-      SVN_ERR(svn_client__get_repos_mergeinfo_catalog(mergeinfo_catalog,
+      SVN_ERR(svn_client__get_repos_mergeinfo_catalog(&tmp_catalog,
                                                       ra_session,
-                                                      repos_rel_path, rev,
+                                                      "", rev,
                                                       svn_mergeinfo_inherited,
                                                       FALSE,
                                                       include_descendants,
                                                       result_pool,
                                                       scratch_pool));
+
+      /* If we're not querying the root of the repository, the catalog
+         we fetched will be keyed on paths relative to the session
+         URL.  But our caller is expecting repository relpaths.  So we
+         do a little dance...  */
+      if (tmp_catalog && (strcmp(path_or_url, *repos_root) != 0))
+        {
+          apr_hash_index_t *hi;
+
+          *mergeinfo_catalog = apr_hash_make(result_pool);
+
+          for (hi = apr_hash_first(scratch_pool, tmp_catalog);
+               hi; hi = apr_hash_next(hi))
+            {
+              /* session-relpath -> repos-url -> repos-relpath */
+              const char *path =
+                svn_path_url_add_component2(path_or_url,
+                                            svn__apr_hash_index_key(hi),
+                                            scratch_pool);
+              SVN_ERR(svn_ra_get_path_relative_to_root(ra_session, &path, path,
+                                                       result_pool));
+              apr_hash_set(*mergeinfo_catalog, path, APR_HASH_KEY_STRING,
+                           svn__apr_hash_index_val(hi));
+            }
+        }
+      else
+        {
+          *mergeinfo_catalog = tmp_catalog;
+        }
     }
   else /* ! svn_path_is_url() */
     {



Mime
View raw message