-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Julian Foad wrote:
[..]
>>>> I suggest adding
>>>>
>>>>   SVN_ERR_ASSERT(!svn_path_is_url(relative));
>>>>
[..]
>> "Assertions are forever." (A quote from the book "Writing Solid Code".)
>> The purpose of assertions is to catch programming errors (bugs). They
>> don't become obsolete when we have eliminated all known bugs, they stay
>> there to catch any future bugs or any bugs that haven't so far shown up.
> 
> (BTW: When I wrote "... at least for debugging ..." in my original
> message, what I meant was we might not want to put that assertion in the
> repository yet, until we fix the bugs that it finds, because if we do
> then all the tests break.)
[..]
> (BTW: THe variable was originally called just "source", and was changed
> to "source_abspath" when the get_absolute() call was added.)
> 

 The patch attached herewith fixes the way urls are handled with
 dirents in `svn merge'.

 [[[
 Log:
 Make `svn merge' treat urls gracefully, by checking the type of the
 path obtained and invoking `svn_dirent_get_absolute()' only if its a wc
 path.

 * subversion/libsvn_client/merge.c
  (normalize_merge_sources): As above and rename the variable
   `source_abspath' to `source_abspath_or_url' as it holds either a wc
   abs-path or a url.

 * subversion/libsvn_client/ra.c
  (svn_client__repos_locations): As above.

 Found by: julianf
           me
 Patch by: Kannan R <kann...@collab.net>
 ]]]

 BTW, the FIXME can be removed if the above patch is ok?

- --
Thanks & Regards,
Kannan
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEVAwUBSxZ4rHlTqcY7ytmIAQIljggAnB7ISx1ZelXsp9JsQsXNh2o0DjnxZJTG
aro+jthTs+32iOKVEHZvuet3NMuWB4fj+WPkWGB3JqbdX11UEZevJX6NUs2sxxcL
FW1FWcyXUNFRJ+Xmh4v9gWknfeAb4TuqgqCjQMGMD9PwwEduv5DLGCJyPol3dGX4
X1nsjs/hkNUIx0lPzbf1d93dEdm8iDlaH9+/Pi8SnGTzCoOzE6HwVQF8P1T+SDLv
GgQBrxDa87NuBcMx4zGtQWWuQlyi3BoQYC0dkFBxYkVl5xuEu0T15PxCfKr5p0Eo
ROzjfuTtcQRTvgVFn9+v0qsgIqt+ngPCnWj7loNJoLgdghcm7zABcw==
=GzH3
-----END PGP SIGNATURE-----
Index: subversion/libsvn_client/merge.c
===================================================================
--- subversion/libsvn_client/merge.c	(revision 886087)
+++ subversion/libsvn_client/merge.c	(working copy)
@@ -5952,7 +5952,7 @@
   svn_revnum_t trim_revision = SVN_INVALID_REVNUM;
   svn_opt_revision_t youngest_opt_rev;
   apr_array_header_t *merge_range_ts, *segments;
-  const char *source_abspath;
+  const char *source_abspath_or_url;
   apr_pool_t *subpool;
   int i;
   youngest_opt_rev.kind = svn_opt_revision_head;
@@ -5963,15 +5963,18 @@
      ### operations are just as sloppy/forgiving as we are about
      ### handling URL inputs where local paths are expected, but
      ### that's a shaky limb to stand on.  */
+  if(!svn_path_is_url(source))
+    SVN_ERR(svn_dirent_get_absolute(&source_abspath_or_url, source, pool));
+  else
+    source_abspath_or_url = source;
 
-  SVN_ERR(svn_dirent_get_absolute(&source_abspath, source, pool));
-
   /* Initialize our return variable. */
   *merge_sources_p = apr_array_make(pool, 1, sizeof(merge_source_t *));
 
   /* Resolve our PEG_REVISION to a real number. */
   SVN_ERR(svn_client__get_revision_number(&peg_revnum, &youngest_rev,
-                                          ctx->wc_ctx, source_abspath,
+                                          ctx->wc_ctx,
+                                          source_abspath_or_url,
                                           ra_session, peg_revision, pool));
   if (! SVN_IS_VALID_REVNUM(peg_revnum))
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL, NULL);
@@ -6013,11 +6016,13 @@
           _("PREV, BASE, or COMMITTED revision keywords are invalid for URL"));
 
       SVN_ERR(svn_client__get_revision_number(&range_start_rev, &youngest_rev,
-                                              ctx->wc_ctx, source_abspath,
+                                              ctx->wc_ctx,
+                                              source_abspath_or_url,
                                               ra_session, range_start,
                                               subpool));
       SVN_ERR(svn_client__get_revision_number(&range_end_rev, &youngest_rev,
-                                              ctx->wc_ctx, source_abspath,
+                                              ctx->wc_ctx,
+                                              source_abspath_or_url,
                                               ra_session, range_end,
                                               subpool));
 
Index: subversion/libsvn_client/ra.c
===================================================================
--- subversion/libsvn_client/ra.c	(revision 886087)
+++ subversion/libsvn_client/ra.c	(working copy)
@@ -555,8 +555,6 @@
   apr_hash_t *rev_locs;
   apr_pool_t *subpool = svn_pool_create(pool);
 
-  SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, subpool));
-
   /* Ensure that we are given some real revision data to work with.
      (It's okay if the END is unspecified -- in that case, we'll just
      set it to the same thing as START.)  */
@@ -571,6 +569,7 @@
     {
       const svn_wc_entry_t *entry;
 
+      SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, subpool));
       SVN_ERR(svn_wc__get_entry_versioned(&entry, ctx->wc_ctx, local_abspath,
                                           svn_node_unknown, FALSE, FALSE,
                                           pool, pool));

Reply via email to