Author: stefan2
Date: Tue Aug 29 09:56:31 2017
New Revision: 1806548

URL: http://svn.apache.org/viewvc?rev=1806548&view=rev
Log:
As Julian discovered, '--search' as used with 'svn log' is may not suitable
for 'svn ls'.  File name matching should be case-sensitive and requires
full patterns just like e.g. the ordinary unix command line 'ls' command.

Therefore, introduce a separate '--pattern' option for 'svn log' that works
similar to patterns with Unix command line 'ls'.  Since the actual matching
already confirms to that, we only need a different option pre-processing.

* subversion/svn/svn.c
  (svn_cl__longopt_t,
   svn_cl__options): Add '--pattern' option as a non-normalizing,
                     case-sensitive alternative to '--search'.
  (svn_cl__cmd_table): For 'ls', replace '--search' by '--pattern'.
  (sub_main): Handle the new '--pattern' option.

* subversion/svnbench/svnbench.c
  (svn_cl__longopt_t,
   svn_cl__options,
   svn_cl__cmd_table): Replace '--search' by '--pattern'.
  (sub_main): Handle the new '--pattern' option.

* subversion/tests/cmdline/basic_tests.py
  (filtered_ls): Update option names used by the test.

Modified:
    subversion/trunk/subversion/svn/svn.c
    subversion/trunk/subversion/svnbench/svnbench.c
    subversion/trunk/subversion/tests/cmdline/basic_tests.py

Modified: subversion/trunk/subversion/svn/svn.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1806548&r1=1806547&r2=1806548&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Tue Aug 29 09:56:31 2017
@@ -145,6 +145,7 @@ typedef enum svn_cl__longopt_t {
   opt_show_item,
   opt_adds_as_modification,
   opt_vacuum_pristines,
+  opt_pattern,
 } svn_cl__longopt_t;
 
 
@@ -463,6 +464,11 @@ const apr_getopt_option_t svn_cl__option
   {"vacuum-pristines", opt_vacuum_pristines, 0,
                        N_("remove unreferenced pristines from .svn 
directory")},
 
+  {"pattern", opt_pattern, 1,
+                       N_("use ARG as search pattern (glob syntax,\n"
+                          "                             "
+                          "case-sensitive)")},
+
   /* Long-opt Aliases
    *
    * These have NULL desriptions, but an option code that matches some
@@ -810,7 +816,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "    Size (in bytes)\n"
      "    Date and time of the last commit\n"),
     {'r', 'v', 'R', opt_depth, opt_incremental, opt_xml,
-     opt_include_externals, opt_search}, },
+     opt_include_externals, opt_pattern}, },
 
   { "lock", svn_cl__lock, {0}, N_
     ("Lock working copy paths or URLs in the repository, so that\n"
@@ -2520,6 +2526,10 @@ sub_main(int *exit_code, int argc, const
       case opt_vacuum_pristines:
         opt_state.vacuum_pristines = TRUE;
         break;
+      case opt_pattern:
+        SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+        add_search_pattern_group(&opt_state, utf8_opt_arg, pool);
+        break;
       default:
         /* Hmmm. Perhaps this would be a good place to squirrel away
            opts that commands like svn diff might need. Hmmm indeed. */

Modified: subversion/trunk/subversion/svnbench/svnbench.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnbench/svnbench.c?rev=1806548&r1=1806547&r2=1806548&view=diff
==============================================================================
--- subversion/trunk/subversion/svnbench/svnbench.c (original)
+++ subversion/trunk/subversion/svnbench/svnbench.c Tue Aug 29 09:56:31 2017
@@ -69,7 +69,7 @@ typedef enum svn_cl__longopt_t {
   opt_trust_server_cert,
   opt_trust_server_cert_failures,
   opt_changelist,
-  opt_search
+  opt_pattern
 } svn_cl__longopt_t;
 
 
@@ -166,8 +166,10 @@ const apr_getopt_option_t svn_cl__option
                     N_("use/display additional information from merge\n"
                        "                             "
                        "history")},
-  {"search", opt_search, 1,
-                       N_("use ARG as search pattern (glob syntax)")},
+  {"pattern", opt_pattern, 1,
+                       N_("use ARG as search pattern (glob syntax,\n"
+                          "                             "
+                          "case-sensitive)")},
 
   /* Long-opt Aliases
    *
@@ -260,7 +262,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "    If locked, the letter 'O'.  (Use 'svn info URL' to see details)\n"
      "    Size (in bytes)\n"
      "    Date and time of the last commit\n"),
-    {'r', 'v', 'q', 'R', opt_depth, opt_search} },
+    {'r', 'v', 'q', 'R', opt_depth, opt_pattern} },
 
   { "null-log", svn_cl__null_log, {0}, N_
     ("Fetch the log messages for a set of revision(s) and/or path(s).\n"
@@ -682,13 +684,9 @@ sub_main(int *exit_code, int argc, const
       case 'g':
         opt_state.use_merge_history = TRUE;
         break;
-      case opt_search:
+      case opt_pattern:
         SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
-        SVN_ERR(svn_utf__xfrm(&utf8_opt_arg, utf8_opt_arg,
-                              strlen(utf8_opt_arg), TRUE, TRUE, &buf));
-        add_search_pattern_group(&opt_state,
-                                 apr_pstrdup(pool, utf8_opt_arg),
-                                 pool);
+        add_search_pattern_group(&opt_state, utf8_opt_arg, pool);
         break;
       default:
         /* Hmmm. Perhaps this would be a good place to squirrel away

Modified: subversion/trunk/subversion/tests/cmdline/basic_tests.py
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/basic_tests.py?rev=1806548&r1=1806547&r2=1806548&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/basic_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/basic_tests.py Tue Aug 29 
09:56:31 2017
@@ -3126,7 +3126,7 @@ def filtered_ls(sbox):
                "gamma\n" ]
 
   exit_code, output, error = svntest.actions.run_and_verify_svn(
-    None, [], 'ls', path, '--depth=infinity', '--search=*a')
+    None, [], 'ls', path, '--depth=infinity', '--pattern=*a')
 
 ########################################################################
 # Run the tests


Reply via email to