Author: stsp
Date: Thu Jun 2 13:38:51 2011
New Revision: 1130543
URL: http://svn.apache.org/viewvc?rev=1130543&view=rev
Log:
For issue #2349, "revision peg separator @ conflicts with use of @ inside URL",
introduce a special error message that shows how the problem can be worked
around in the common case.
* subversion/libsvn_subr/opt.c
(svn_opt_parse_path): If we fail to parse the peg revision in an svn+ssh://
URL, and the URL contains only one '@', suggest in the error message
to append an '@' to the URL. This should help users who fail to connect
to their repositories using user@hostname notation, and who haven't heard
about the peg revision syntax yet.
Modified:
subversion/trunk/subversion/libsvn_subr/opt.c
Modified: subversion/trunk/subversion/libsvn_subr/opt.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_subr/opt.c?rev=1130543&r1=1130542&r2=1130543&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_subr/opt.c (original)
+++ subversion/trunk/subversion/libsvn_subr/opt.c Thu Jun 2 13:38:51 2011
@@ -27,6 +27,7 @@
#include <apr_want.h>
#include <stdio.h>
+#include <string.h>
#include <assert.h>
#include <apr_pools.h>
#include <apr_general.h>
@@ -774,10 +775,28 @@ svn_opt_parse_path(svn_opt_revision_t *r
}
if (ret || end_revision.kind != svn_opt_revision_unspecified)
- return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
- _("Syntax error parsing revision '%s'"),
- &peg_rev[1]);
+ {
+ /* If an svn+ssh URL was used and it contains only one @,
+ * provide an error message that presents a possible solution
+ * to the parsing error (issue #2349). */
+ if (strncmp(path, "svn+ssh://", 10) == 0)
+ {
+ const char *at;
+ at = strchr(path, '@');
+ if (at && strrchr(path, '@') == at)
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Syntax error parsing peg revision "
+ "'%s'; if this problem is "
+ "unexpected try appending '@' to "
+ "the URL: '%s@'"),
+ &peg_rev[1], path);
+ }
+
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("Syntax error parsing revision '%s'"),
+ &peg_rev[1]);
+ }
rev->kind = start_revision.kind;
rev->value = start_revision.value;
}