You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by st...@apache.org on 2017/12/22 13:04:20 UTC

svn commit: r1819036 - in /subversion/trunk/subversion: svn/list-cmd.c svn/svn.c tests/cmdline/basic_tests.py

Author: stefan2
Date: Fri Dec 22 13:04:20 2017
New Revision: 1819036

URL: http://svn.apache.org/viewvc?rev=1819036&view=rev
Log:
Work-around for our common Windows CLI limitations with 'svn ls --search'.

Since we currently can't pass typical glob patterns like "*.txt", we will
instead implicitly add '*' to the beginning and the end of all search
patterns.  As a result, we will do sub-string matches similar to 'svn log'.

Note that this effects the Windows CLI client only and any other client as
well as the bindings retain their "full pattern match" semantics.

The latest discussion on that issue can be found here:

	https://lists.apache.org/thread.html/828defe6827fad3d4d8cea338ca4de5962060534a2a9275c82184d4e@%3Cdev.subversion.apache.org%3E
	From: Johan Corveleyn <j....@gmail.com>
	Subject: list --search matching and Windows *-expansion
	Date: 2017-12-18 15:20
	List: dev@subversion.apache.org

* subversion/svn/list-cmd.c
  (svn_cl__list): Under Windows, expand the pattern to effectively perform
                  a sub-string search - like we do for 'svn log --search'.

* subversion/svn/svn.c
  (svn_cl__cmd_table): Under Windows, mention that we will match sub-strings
                       instead of whole path segments.

* subversion/tests/cmdline/basic_tests.py
  (filtered_ls): Disable under Windows because sub-string matching produces
                 a super-set of the expected results.

Modified:
    subversion/trunk/subversion/svn/list-cmd.c
    subversion/trunk/subversion/svn/svn.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/svn/list-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/list-cmd.c?rev=1819036&r1=1819035&r2=1819036&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/list-cmd.c (original)
+++ subversion/trunk/subversion/svn/list-cmd.c Fri Dec 22 13:04:20 2017
@@ -385,14 +385,20 @@ svn_cl__list(apr_getopt_t *os,
               apr_array_header_t *pattern_group
                 = APR_ARRAY_IDX(opt_state->search_patterns, k,
                                 apr_array_header_t *);
+              const char *pattern;
 
               /* Should never fail but ... */
               if (pattern_group->nelts != 1)
                 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
                                   _("'search-and' option is not supported"));
 
-              APR_ARRAY_PUSH(patterns, const char *)
-                = APR_ARRAY_IDX(pattern_group, 0, const char *);
+              pattern = APR_ARRAY_IDX(pattern_group, 0, const char *);
+#if defined(WIN32)
+              /* As we currently can't pass glob patterns via the Windows
+                 CLI, fall back to sub-string search. */
+              pattern = apr_psprintf(subpool, "*%s*", pattern);
+#endif
+              APR_ARRAY_PUSH(patterns, const char *) = pattern;
             }
         }
 

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1819036&r1=1819035&r2=1819036&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Fri Dec 22 13:04:20 2017
@@ -815,7 +815,12 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "\n"
      "  Multiple --search patterns may be specified and the output will be\n"
      "  reduced to those paths whose last segment - i.e. the file or directory\n"
+#if defined(WIN32)
+     "  name - contains a sub-string matching at least one of these patterns\n"
+     "  (Windows only).\n"
+#else
      "  name - matches at least one of these patterns.\n"
+#endif
      "\n"
      "  With --verbose, the following fields will be shown for each item:\n"
      "\n"

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1819036&r1=1819035&r2=1819036&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Fri Dec 22 13:04:20 2017
@@ -3114,7 +3114,7 @@ def plaintext_password_storage_disabled(
       f.close()
 
 
-
+@Skip(svntest.main.is_os_windows)
 def filtered_ls(sbox):
   "filtered 'svn ls'"