[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Fix for issue 3620 - status command

From: Noorul Islam K M <noorul_at_collab.net>
Date: Thu, 04 Nov 2010 09:50:15 +0530

Log

[[[

Make 'svn revert' verify that none of its targets are URLs.

* subversion/libsvn_client/status.c,
  subversion/svn/status-cmd.c
  (svn_client_status5, svn_cl__status): Raise an error if any targets
  look like URLs.

* subversion/tests/cmdline/input_validation_tests.py
  (invalid_status_targets, test_list): New test.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>

]]]

Index: subversion/tests/cmdline/input_validation_tests.py
===================================================================
--- subversion/tests/cmdline/input_validation_tests.py (revision 1030801)
+++ subversion/tests/cmdline/input_validation_tests.py (working copy)
@@ -201,6 +201,13 @@
     run_and_verify_svn_in_wc(sbox, "svn: Cannot mix repository and working "
                              "copy targets", 'lock', target1, target2)
 
+def invalid_status_targets(sbox):
+ "non-working copy paths for 'status'"
+ sbox.build(read_only=True)
+ for target in _invalid_wc_path_targets:
+ run_and_verify_svn_in_wc(sbox, "svn:.*is not a local path", 'status',
+ target)
+
 ########################################################################
 # Run the tests
 
@@ -223,6 +230,7 @@
               invalid_resolved_targets,
               invalid_revert_targets,
               invalid_lock_targets,
+ invalid_status_targets,
              ]
 
 if __name__ == '__main__':
Index: subversion/svn/status-cmd.c
===================================================================
--- subversion/svn/status-cmd.c (revision 1030801)
+++ subversion/svn/status-cmd.c (working copy)
@@ -249,6 +249,18 @@
   /* Add "." if user passed 0 arguments */
   svn_opt_push_implicit_dot_target(targets, scratch_pool);
 
+ /* URLs are invalid input. */
+ for (i = 0; i < targets->nelts; i++)
+ {
+ const char *target = APR_ARRAY_IDX(targets, i, const char *);
+
+ if (svn_path_is_url(target))
+ return svn_error_return(svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
+ NULL,
+ _("'%s' is not a local path"),
+ target));
+ }
+
   /* We want our -u statuses to be against HEAD. */
   rev.kind = svn_opt_revision_head;
 
Index: subversion/libsvn_client/status.c
===================================================================
--- subversion/libsvn_client/status.c (revision 1030801)
+++ subversion/libsvn_client/status.c (working copy)
@@ -32,6 +32,7 @@
 #include "svn_pools.h"
 #include "client.h"
 
+#include "svn_path.h"
 #include "svn_dirent_uri.h"
 #include "svn_delta.h"
 #include "svn_client.h"
@@ -268,6 +269,11 @@
   apr_hash_t *changelist_hash = NULL;
   struct svn_cl__externals_store externals_store = { NULL };
 
+ if (svn_path_is_url(path))
+ return svn_error_return(svn_error_createf(SVN_ERR_ILLEGAL_TARGET, NULL,
+ _("'%s' is not a local path"),
+ path));
+
   if (changelists && changelists->nelts)
     SVN_ERR(svn_hash_from_cstring_keys(&changelist_hash, changelists, pool));
 
Received on 2010-11-04 05:21:11 CET

This is an archived mail posted to the Subversion Dev mailing list.