Bill Tutt convinced me that adding svn_error_cause() was not a good
idea (people might be tempted to use it). I've inlined it instead.
As an added benefit, the scope of the patch is reduced.
Produce a more appropriate error message when the repository is
found, but cannot be opened (fixes issue 900).
* subversion/include/svn_error_codes.h
SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED: New error code, distinguished
from SVN_ERR_RA_LOCAL_REPOS_NOT_FOUND in that some error other than
not being able to locate the repository has occurred.
* subversion/libsvn_ra_local/split_url.c
(svn_ra_local__split_URL): Check the inner-most error from
svn_repos_open() to determine why it failed, and produce
an appropriate error message.
Index: subversion/include/svn_error_codes.h
===================================================================
--- subversion/include/svn_error_codes.h
+++ subversion/include/svn_error_codes.h Fri Sep 13 09:44:31 2002
@@ -519,6 +519,10 @@
SVN_ERR_RA_LOCAL_CATEGORY_START + 0,
"Couldn't find a repository.")
+ SVN_ERRDEF (SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED,
+ SVN_ERR_RA_LOCAL_CATEGORY_START + 1,
+ "Couldn't open the repository.")
+
/* svndiff errors */
SVN_ERRDEF (SVN_ERR_SVNDIFF_INVALID_HEADER,
Index: subversion/libsvn_ra_local/split_url.c
===================================================================
--- subversion/libsvn_ra_local/split_url.c
+++ subversion/libsvn_ra_local/split_url.c Fri Sep 13 13:11:59 2002
@@ -104,6 +104,8 @@
the last component from the URL, then try again. */
while (1)
{
+ svn_error_t *cause;
+
/* Attempt to open a repository at URL. */
err = svn_repos_open (&repos, candidate_url, subpool);
@@ -111,6 +113,16 @@
if (err == SVN_NO_ERROR)
break;
+ cause = err;
+ while (cause->child)
+ cause = cause->child;
+
+ if (cause && !APR_STATUS_IS_ENOENT(cause->apr_err))
+ return svn_error_createf
+ (SVN_ERR_RA_LOCAL_REPOS_OPEN_FAILED, 0, err, pool,
+ "svn_ra_local__split_URL: Unable to open repository\n"
+ " (%s)", URL);
+
/* It would be strange indeed if "/" were a repository, but hey,
people do strange things sometimes. Anyway, if "/" failed
the test above, then reduce it to the empty string.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Fri Sep 13 19:29:49 2002