subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From danie...@apache.org
Subject svn commit: r1870750 - in /subversion/trunk: CHANGES subversion/svn/info-cmd.c subversion/svn/svn.c subversion/tests/cmdline/info_tests.py
Date Tue, 03 Dec 2019 12:05:22 GMT
Author: danielsh
Date: Tue Dec  3 12:05:22 2019
New Revision: 1870750

URL: http://svn.apache.org/viewvc?rev=1870750&view=rev
Log:
Revert r1869578 and r1869579.

Thread: https://mail-archives.apache.org/mod_mbox/subversion-dev/201912.mbox/%3C697aa9cb-e03e-4270-8890-d30ae7cd781c%40www.fastmail.com%3E
(items #3 and #4)

Modified:
    subversion/trunk/CHANGES
    subversion/trunk/subversion/svn/info-cmd.c
    subversion/trunk/subversion/svn/svn.c
    subversion/trunk/subversion/tests/cmdline/info_tests.py

Modified: subversion/trunk/CHANGES
URL: http://svn.apache.org/viewvc/subversion/trunk/CHANGES?rev=1870750&r1=1870749&r2=1870750&view=diff
==============================================================================
--- subversion/trunk/CHANGES (original)
+++ subversion/trunk/CHANGES Tue Dec  3 12:05:22 2019
@@ -11,7 +11,6 @@ https://svn.apache.org/repos/asf/subvers
  User-visible changes:
   - Minor new features and improvements:
     * Add 'svn info --show-item=changelist' (r1869481)
-    * Add multiple item arguments to 'svn info --show-item=...' (r1869578)
 
 
 Version 1.13.0

Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1870750&r1=1870749&r2=1870750&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Tue Dec  3 12:05:22 2019
@@ -411,8 +411,8 @@ typedef struct print_info_baton_t
    * The following fields are used by print_info_item().
    */
 
-  /* Which items to print. */
-  apr_array_header_t *print_whats;
+  /* Which item to print. */
+  info_item_t print_what;
 
   /* Do we expect to show info for multiple targets? */
   svn_boolean_t multiple_targets;
@@ -431,12 +431,12 @@ typedef struct print_info_baton_t
 } print_info_baton_t;
 
 
-/* Find the appropriate info_item_t for KEYWORDS_FROM_ARGV and initialize
+/* Find the appropriate info_item_t for KEYWORD and initialize
  * RECEIVER_BATON for print_info_item(). Use SCRATCH_POOL for
  * temporary allocation.
  */
 static svn_error_t *
-find_print_what(const char *keywords_from_argv,
+find_print_what(const char *keyword,
                 print_info_baton_t *receiver_baton,
                 apr_pool_t *scratch_pool)
 {
@@ -445,9 +445,7 @@ find_print_what(const char *keywords_fro
   svn_cl__simcheck_t *kwbuf = apr_palloc(
       scratch_pool, info_item_map_len * sizeof(svn_cl__simcheck_t));
   apr_size_t i;
-  apr_array_header_t *whats;
-  
-  /* Initialize KEYWORDS and KWBUF. */
+
   for (i = 0; i < info_item_map_len; ++i)
     {
       keywords[i] = &kwbuf[i];
@@ -456,67 +454,55 @@ find_print_what(const char *keywords_fro
       kwbuf[i].data = &info_item_map[i];
     }
 
-  whats = svn_cstring_split(keywords_from_argv, ",", TRUE, scratch_pool);
-  for (i = 0; i < whats->nelts; i++)
+  switch (svn_cl__similarity_check(keyword, keywords,
+                                   info_item_map_len, scratch_pool))
     {
-      const char *keyword = APR_ARRAY_IDX(whats, i, const char *);
-      switch (svn_cl__similarity_check(keyword, keywords,
-                                       info_item_map_len, scratch_pool))
-        {
-          const info_item_map_t *kw0;
-          const info_item_map_t *kw1;
-          const info_item_map_t *kw2;
-
-        case 0:                     /* Exact match. */
-          kw0 = keywords[0]->data;
-          APR_ARRAY_PUSH(receiver_baton->print_whats, info_item_t) =
-            kw0->print_what;
-          break;
+      const info_item_map_t *kw0;
+      const info_item_map_t *kw1;
+      const info_item_map_t *kw2;
+
+    case 0:                     /* Exact match. */
+      kw0 = keywords[0]->data;
+      receiver_baton->print_what = kw0->print_what;
+      return SVN_NO_ERROR;
 
-        case 1:
-          /* The best alternative isn't good enough */
-          return svn_error_createf(
-              SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-              _("'%s' is not a valid value for --show-item"),
-              keyword);
-
-        case 2:
-          /* There is only one good candidate */
-          kw0 = keywords[0]->data;
-          return svn_error_createf(
-              SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-              _("'%s' is not a valid value for --show-item;"
-                " did you mean '%s'?"),
-              keyword, kw0->keyword.data);
-
-        case 3:
-          /* Suggest a list of the most likely candidates */
-          kw0 = keywords[0]->data;
-          kw1 = keywords[1]->data;
-          return svn_error_createf(
-              SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-              _("'%s' is not a valid value for --show-item;"
-                " did you mean '%s' or '%s'?"),
-              keyword, kw0->keyword.data, kw1->keyword.data);
+    case 1:
+      /* The best alternative isn't good enough */
+      return svn_error_createf(
+          SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+          _("'%s' is not a valid value for --show-item"),
+          keyword);
+
+    case 2:
+      /* There is only one good candidate */
+      kw0 = keywords[0]->data;
+      return svn_error_createf(
+          SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+          _("'%s' is not a valid value for --show-item;"
+            " did you mean '%s'?"),
+          keyword, kw0->keyword.data);
+
+    case 3:
+      /* Suggest a list of the most likely candidates */
+      kw0 = keywords[0]->data;
+      kw1 = keywords[1]->data;
+      return svn_error_createf(
+          SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+          _("'%s' is not a valid value for --show-item;"
+            " did you mean '%s' or '%s'?"),
+          keyword, kw0->keyword.data, kw1->keyword.data);
 
-        default:
-          /* Never suggest more than three candidates */
-          kw0 = keywords[0]->data;
-          kw1 = keywords[1]->data;
-          kw2 = keywords[2]->data;
-          return svn_error_createf(
-              SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-              _("'%s' is not a valid value for --show-item;"
-                " did you mean '%s', '%s' or '%s'?"),
-              keyword, kw0->keyword.data, kw1->keyword.data, kw2->keyword.data);
-        }
+    default:
+      /* Never suggest more than three candidates */
+      kw0 = keywords[0]->data;
+      kw1 = keywords[1]->data;
+      kw2 = keywords[2]->data;
+      return svn_error_createf(
+          SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+          _("'%s' is not a valid value for --show-item;"
+            " did you mean '%s', '%s' or '%s'?"),
+          keyword, kw0->keyword.data, kw1->keyword.data, kw2->keyword.data);
     }
-
-  if (whats->nelts == 0)
-    return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                            _("--show-item requires a non-empty argument"));
-
-  return SVN_NO_ERROR;
 }
 
 /* A callback of type svn_client_info_receiver2_t.
@@ -1139,123 +1125,115 @@ print_info_item(void *baton,
          receiver_baton->path_prefix, target, pool));
   const char *const target_path =
     (receiver_baton->multiple_targets ? actual_target_path : NULL);
-  int i;
 
   if (receiver_baton->start_new_line)
     SVN_ERR(svn_cmdline_fputs("\n", stdout, pool));
 
-  for (i = 0; i < receiver_baton->print_whats->nelts; i++)
+  switch (receiver_baton->print_what)
     {
-      if (i > 0) 
-        SVN_ERR(svn_cmdline_fputs("\t", stdout, pool));
+    case info_item_kind:
+      SVN_ERR(print_info_item_string(svn_node_kind_to_word(info->kind),
+                                     target_path, pool));
+      break;
 
-      switch (APR_ARRAY_IDX(receiver_baton->print_whats, i, info_item_t))
-        {
-        case info_item_kind:
-          SVN_ERR(print_info_item_string(svn_node_kind_to_word(info->kind),
-                                         target_path, pool));
-          break;
+    case info_item_url:
+      SVN_ERR(print_info_item_string(info->URL, target_path, pool));
+      break;
 
-        case info_item_url:
-          SVN_ERR(print_info_item_string(info->URL, target_path, pool));
-          break;
+    case info_item_relative_url:
+      SVN_ERR(print_info_item_string(relative_url(info, pool),
+                                     target_path, pool));
+      break;
 
-        case info_item_relative_url:
-          SVN_ERR(print_info_item_string(relative_url(info, pool),
-                                         target_path, pool));
-          break;
+    case info_item_repos_root_url:
+      SVN_ERR(print_info_item_string(info->repos_root_URL, target_path, pool));
+      break;
 
-        case info_item_repos_root_url:
-          SVN_ERR(print_info_item_string(info->repos_root_URL, target_path,
-                                         pool));
-          break;
+    case info_item_repos_uuid:
+      SVN_ERR(print_info_item_string(info->repos_UUID, target_path, pool));
+      break;
 
-        case info_item_repos_uuid:
-          SVN_ERR(print_info_item_string(info->repos_UUID, target_path, pool));
-          break;
+    case info_item_repos_size:
+      if (info->kind != svn_node_file)
+        {
+          receiver_baton->start_new_line = FALSE;
+          return SVN_NO_ERROR;
+        }
 
-        case info_item_repos_size:
-          if (info->kind != svn_node_file)
+      if (info->size == SVN_INVALID_FILESIZE)
+        {
+          if (receiver_baton->multiple_targets)
             {
               receiver_baton->start_new_line = FALSE;
               return SVN_NO_ERROR;
             }
 
-          if (info->size == SVN_INVALID_FILESIZE)
-            {
-              if (receiver_baton->multiple_targets)
-                {
-                  receiver_baton->start_new_line = FALSE;
-                  return SVN_NO_ERROR;
-                }
-
-              return svn_error_createf(
-                  SVN_ERR_UNSUPPORTED_FEATURE, NULL,
-                  _("can't show in-repository size of working copy file '%s'"),
-                  actual_target_path);
-            }
+          return svn_error_createf(
+              SVN_ERR_UNSUPPORTED_FEATURE, NULL,
+              _("can't show in-repository size of working copy file '%s'"),
+              actual_target_path);
+        }
 
-          {
-            const char *sizestr;
-            SVN_ERR(svn_cl__format_file_size(&sizestr, info->size,
-                                             receiver_baton->file_size_unit,
-                                             TRUE, pool));
-            SVN_ERR(print_info_item_string(sizestr, target_path, pool));
-          }
-          break;
+      {
+        const char *sizestr;
+        SVN_ERR(svn_cl__format_file_size(&sizestr, info->size,
+                                         receiver_baton->file_size_unit,
+                                         TRUE, pool));
+        SVN_ERR(print_info_item_string(sizestr, target_path, pool));
+      }
+      break;
 
-        case info_item_revision:
-          SVN_ERR(print_info_item_revision(info->rev, target_path, pool));
-          break;
+    case info_item_revision:
+      SVN_ERR(print_info_item_revision(info->rev, target_path, pool));
+      break;
 
-        case info_item_last_changed_rev:
-          SVN_ERR(print_info_item_revision(info->last_changed_rev,
-                                           target_path, pool));
-          break;
+    case info_item_last_changed_rev:
+      SVN_ERR(print_info_item_revision(info->last_changed_rev,
+                                       target_path, pool));
+      break;
 
-        case info_item_last_changed_date:
-          SVN_ERR(print_info_item_string(
-                      (!info->last_changed_date ? NULL
-                       : svn_time_to_cstring(info->last_changed_date, pool)),
-                      target_path, pool));
-          break;
+    case info_item_last_changed_date:
+      SVN_ERR(print_info_item_string(
+                  (!info->last_changed_date ? NULL
+                   : svn_time_to_cstring(info->last_changed_date, pool)),
+                  target_path, pool));
+      break;
 
-        case info_item_last_changed_author:
-          SVN_ERR(print_info_item_string(info->last_changed_author,
-                                         target_path, pool));
-          break;
+    case info_item_last_changed_author:
+      SVN_ERR(print_info_item_string(info->last_changed_author,
+                                     target_path, pool));
+      break;
 
-        case info_item_wc_root:
-          SVN_ERR(print_info_item_string(
-                      (info->wc_info && info->wc_info->wcroot_abspath
-                       ? info->wc_info->wcroot_abspath : NULL),
-                      target_path, pool));
-          break;
+    case info_item_wc_root:
+      SVN_ERR(print_info_item_string(
+                  (info->wc_info && info->wc_info->wcroot_abspath
+                   ? info->wc_info->wcroot_abspath : NULL),
+                  target_path, pool));
+      break;
 
-        case info_item_schedule:
-          SVN_ERR(print_info_item_string(
-                      (info->wc_info
-                       ? schedule_str(info->wc_info->schedule) : NULL),
-                      target_path, pool));
-          break;
+    case info_item_schedule:
+      SVN_ERR(print_info_item_string(
+                  (info->wc_info
+                   ? schedule_str(info->wc_info->schedule) : NULL),
+                  target_path, pool));
+      break;
 
-        case info_item_depth:
-          SVN_ERR(print_info_item_string(
-                      ((info->wc_info && info->kind == svn_node_dir)
-                       ? svn_depth_to_word(info->wc_info->depth) : NULL),
-                      target_path, pool));
-          break;
+    case info_item_depth:
+      SVN_ERR(print_info_item_string(
+                  ((info->wc_info && info->kind == svn_node_dir)
+                   ? svn_depth_to_word(info->wc_info->depth) : NULL),
+                  target_path, pool));
+      break;
 
-        case info_item_changelist:
-          SVN_ERR(print_info_item_string(
-                      ((info->wc_info && info->wc_info->changelist)
-                       ? info->wc_info->changelist : NULL),
-                      target_path, pool));
-          break;
+    case info_item_changelist:
+      SVN_ERR(print_info_item_string(
+                  ((info->wc_info && info->wc_info->changelist)
+                   ? info->wc_info->changelist : NULL),
+                  target_path, pool));
+      break;
 
-        default:
-          SVN_ERR_MALFUNCTION();
-        }
+    default:
+      SVN_ERR_MALFUNCTION();
     }
 
   receiver_baton->start_new_line = TRUE;
@@ -1322,7 +1300,6 @@ svn_cl__info(apr_getopt_t *os,
   else if (opt_state->show_item)
     {
       receiver = print_info_item;
-      receiver_baton.print_whats = apr_array_make(pool, 5, sizeof(info_item_t));
 
       if (opt_state->incremental)
         return svn_error_create(

Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1870750&r1=1870749&r2=1870750&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Tue Dec  3 12:05:22 2019
@@ -431,9 +431,7 @@ const apr_getopt_option_t svn_cl__option
                           "                             "
                           "current revision (recommended when tagging)")},
   {"show-item", opt_show_item, 1,
-                       N_("print only the items identified by ARG, which is\n"
-                          "                             "
-                          "a comma-separated list of:\n"
+                       N_("print only the item identified by ARG:\n"
                           "                             "
                           "   'kind'       node kind of TARGET\n"
                           "                             "

Modified: subversion/trunk/subversion/tests/cmdline/info_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/info_tests.py?rev=1870750&r1=1870749&r2=1870750&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/info_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/info_tests.py Tue Dec  3 12:05:22 2019
@@ -644,10 +644,6 @@ def info_item_simple(sbox):
     ['1'], [],
     'info', '--show-item=revision', '--no-newline',
     sbox.ospath(''))
-  svntest.actions.run_and_verify_svn(
-    ['1\tdir'], [],
-    'info', '--show-item=revision,kind', '--no-newline',
-    sbox.ospath(''))
 
 
 def info_item_simple_multiple(sbox):



Mime
View raw message