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 2010/05/23 19:00:14 UTC

svn commit: r947443 - /subversion/trunk/subversion/svn/main.c

Author: stsp
Date: Sun May 23 17:00:13 2010
New Revision: 947443

URL: http://svn.apache.org/viewvc?rev=947443&view=rev
Log:
Rename the global "-p" option to "--strip-count" to avoid a semantic
conflict with the common "mkdir -p" option (which we support under the
name --parents, but people may well try running "svn mkdir -p" anyway
and the error message was confusing). Tweak the option's help text, too,
and improve error output for invalid strip count arguments.

* subversion/svn/main.c
  (svn_cl__longopt_t): Add STRIP_COUNT.
  (svn_cl__options, svn_cl__cmd_table): Rename "-p" to "--strip-count".
   Tweak help text. Add "--strip" as an alias for "--strip-count".
  (main): Track option rename. Improve error output for invalid strip
   counts arguments.

Modified:
    subversion/trunk/subversion/svn/main.c

Modified: subversion/trunk/subversion/svn/main.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/main.c?rev=947443&r1=947442&r2=947443&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/main.c (original)
+++ subversion/trunk/subversion/svn/main.c Sun May 23 17:00:13 2010
@@ -114,6 +114,7 @@ typedef enum {
   opt_show_revs,
   opt_reintegrate,
   opt_trust_server_cert,
+  opt_strip_count,
   opt_show_copies_as_adds,
   opt_ignore_keywords,
   opt_reverse_diff,
@@ -325,20 +326,24 @@ const apr_getopt_option_t svn_cl__option
                     N_("lump-merge all of source URL's unmerged changes\n"
                        "                             "
                        "[alias: --ri]")},
-  {"strip",         'p', 1,
-                    N_("number of leading path components to strip\n"
+  {"strip-count",   opt_strip_count, 1,
+                    N_("number of leading path components to strip from\n"
                        "                             "
-                       "from pathnames. Specifying -p0 gives the entire\n"
+                       "paths parsed from the patch file. --strip-count 0\n"
                        "                             "
-                       "path unmodified. Specifying -p1 causes the path\n"
+                       "is the default and leaves paths unmodified.\n"
                        "                             "
-                       "    doc/fudge/crunchy.html\n"
+                       "--strip-count 1 would change the path\n"
                        "                             "
-                       "to be interpreted as\n"
+                       "'doc/fudge/crunchy.html' to 'fudge/crunchy.html'.\n"
                        "                             "
-                       "    fudge/crunchy.html\n"
+                       "--strip-count 2 would leave just 'crunchy.html'\n"
                        "                             "
-                       "while -p2 would give just crunchy.html")},
+                       "The expected component separator is '/' on all\n"
+                       "                             "
+                       "platforms. A leading '/' counts as one component.\n"
+                       "                             "
+                       "[alias: --strip]")},
   {"show-copies-as-adds", opt_show_copies_as_adds, 0,
                     N_("don't diff copied or moved files with their source\n"
                        "                             "
@@ -411,6 +416,7 @@ const apr_getopt_option_t svn_cl__option
   {"kl",            opt_keep_local, 0, NULL},
   {"sr",            opt_show_revs, 1, NULL},
   {"ri",            opt_reintegrate, 0, NULL},
+  {"strip",         opt_strip_count, 1, NULL},
   {"sca",           opt_show_copies_as_adds, 0, NULL},
   {"ik",            opt_ignore_keywords, 0, NULL},
   {"ip",            opt_include_pattern, 1, NULL},
@@ -858,7 +864,7 @@ const svn_opt_subcommand_desc2_t svn_cl_
      "  for addition. Use 'svn revert' to undo deletions and additions you\n"
      "  do not agree with.\n"
      ),
-    {'q', opt_dry_run, 'p', opt_reverse_diff, opt_include_pattern,
+    {'q', opt_dry_run, opt_strip_count, opt_reverse_diff, opt_include_pattern,
      opt_exclude_pattern, opt_ignore_whitespace} },
 
   { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_
@@ -1750,20 +1756,22 @@ main(int argc, const char *argv[])
       case opt_reintegrate:
         opt_state.reintegrate = TRUE;
         break;
-      case 'p':
+      case opt_strip_count:
         {
           char *end;
           opt_state.strip_count = (int) strtol(opt_arg, &end, 10);
           if (end == opt_arg || *end != '\0')
             {
-              err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
-                                     _("Non-numeric strip argument given"));
+              err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+                                      _("Invalid strip count '%s'"), opt_arg);
               return svn_cmdline_handle_exit_error(err, pool, "svn: ");
             }
           if (opt_state.strip_count < 0)
             {
-              err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
-                                    _("Argument to --strip must be positive"));
+              err = svn_error_createf(SVN_ERR_INCORRECT_PARAMS, NULL,
+                                      _("Negative strip count '%i' "
+                                        "(strip count must be positive)"),
+                                      opt_state.strip_count);
               return svn_cmdline_handle_exit_error(err, pool, "svn: ");
             }
         }