Author: julianfoad
Date: Mon Jun  9 12:55:30 2014
New Revision: 1601362

URL: http://svn.apache.org/r1601362
Log:
Add a '--no-newline' option to 'svnlook youngest', for consistency with
'svn youngest'. See issue #4299 'Remote version of "svnlook youngest"'.

* subversion/svnlook/svnlook.c
  (svnlook__no_newline): New constant.
  (options_table, svnlook_opt_state): Add a 'no-newline' option.
  (cmd_table): Add the 'no-newline' option to the 'youngest' command.
  (subcommand_youngest): Use it.
  (sub_main): Parse it.

Modified:
    subversion/trunk/subversion/svnlook/svnlook.c

Modified: subversion/trunk/subversion/svnlook/svnlook.c
URL: 
http://svn.apache.org/viewvc/subversion/trunk/subversion/svnlook/svnlook.c?rev=1601362&r1=1601361&r2=1601362&view=diff
==============================================================================
--- subversion/trunk/subversion/svnlook/svnlook.c (original)
+++ subversion/trunk/subversion/svnlook/svnlook.c Mon Jun  9 12:55:30 2014
@@ -102,7 +102,8 @@ enum
     svnlook__ignore_properties,
     svnlook__properties_only,
     svnlook__diff_cmd,
-    svnlook__show_inherited_props
+    svnlook__show_inherited_props,
+    svnlook__no_newline
   };
 
 /*
@@ -143,6 +144,9 @@ static const apr_getopt_option_t options
   {"properties-only",   svnlook__properties_only, 0,
    N_("show only properties during the operation")},
 
+  {"no-newline",        svnlook__no_newline, 0,
+   N_("do not output the trailing newline")},
+
   {"non-recursive",     'N', 0,
    N_("operate on single directory only")},
 
@@ -300,7 +304,7 @@ static const svn_opt_subcommand_desc2_t 
   {"youngest", subcommand_youngest, {0},
    N_("usage: svnlook youngest REPOS_PATH\n\n"
       "Print the youngest revision number.\n"),
-   {0} },
+   {svnlook__no_newline} },
 
   { NULL, NULL, {0}, NULL, {0} }
 };
@@ -333,6 +337,7 @@ struct svnlook_opt_state
   svn_boolean_t properties_only;    /* --properties-only */
   const char *diff_cmd;           /* --diff-cmd */
   svn_boolean_t show_inherited_props; /*  --show-inherited-props */
+  svn_boolean_t no_newline;       /* --no-newline */
 };
 
 
@@ -2412,7 +2417,8 @@ subcommand_youngest(apr_getopt_t *os, vo
   SVN_ERR(check_number_of_args(opt_state, 0));
 
   SVN_ERR(get_ctxt_baton(&c, opt_state, pool));
-  SVN_ERR(svn_cmdline_printf(pool, "%ld\n", c->rev_id));
+  SVN_ERR(svn_cmdline_printf(pool, "%ld%s", c->rev_id,
+                             opt_state->no_newline ? "" : "\n"));
   return SVN_NO_ERROR;
 }
 
@@ -2603,6 +2609,10 @@ sub_main(int *exit_code, int argc, const
           opt_state.show_inherited_props = TRUE;
           break;
 
+        case svnlook__no_newline:
+          opt_state.no_newline = TRUE;
+          break;
+
         default:
           SVN_ERR(subcommand_help(NULL, NULL, pool));
           *exit_code = EXIT_FAILURE;


Reply via email to