Author: julianfoad
Date: Thu Nov 26 15:23:44 2009
New Revision: 884576

URL: http://svn.apache.org/viewvc?rev=884576&view=rev
Log:
Make "diff" fail gracefully if a revision kind COMMITTED or PREVIOUS or BASE
is used with a URL. Previously only BASE was handled gracefully, and only in
the non-summarizing diff; any other case resulted in a cryptic error message.
Also make the error message the same as the one in "merge" (see:
<http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2417716>).

Suggested by: Kannan R <kannanr{_AT_}collab.net>

* subversion/libsvn_client/diff.c
  (check_paths): If a URL is used with a revision kind that requires a WC,
    throw an error with an appropriate message.
  (svn_client_diff_peg5): Remove the check for the revision kind BASE, as
    it is now included in check_paths().

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

Modified: subversion/trunk/subversion/libsvn_client/diff.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/diff.c?rev=884576&r1=884575&r2=884576&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/diff.c (original)
+++ subversion/trunk/subversion/libsvn_client/diff.c Thu Nov 26 15:23:44 2009
@@ -959,6 +959,14 @@
     return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
                             _("Not all required revisions are specified"));
 
+  if ((svn_path_is_url(params->path1)
+       && SVN_CLIENT__REVKIND_NEEDS_WC(params->revision1->kind))
+      || (svn_path_is_url(params->path2)
+          && SVN_CLIENT__REVKIND_NEEDS_WC(params->revision2->kind)))
+    return svn_error_create(
+      SVN_ERR_CLIENT_BAD_REVISION, NULL,
+      _("PREV, BASE, or COMMITTED revision keywords are invalid for URL"));
+
   /* Revisions can be said to be local or remote.  BASE and WORKING,
      for example, are local.  */
   is_local_rev1 =
@@ -1762,13 +1770,6 @@
   struct diff_cmd_baton diff_cmd_baton;
   svn_wc_diff_callbacks4_t diff_callbacks;
 
-  if (svn_path_is_url(path) &&
-        (start_revision->kind == svn_opt_revision_base
-         || end_revision->kind == svn_opt_revision_base) )
-    return svn_error_create(SVN_ERR_CLIENT_BAD_REVISION, NULL,
-                            _("Revision type requires a working copy "
-                              "path, not a URL"));
-
   /* fill diff_param */
   diff_params.path1 = path;
   diff_params.revision1 = start_revision;


Reply via email to