<commit_before>/*
 * main.c: Subversion server inspection tool.
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */

#include <assert.h>
#include <stdlib.h>

#include <apr_general.h>
#include <apr_pools.h>
#include <apr_time.h>
#include <apr_file_io.h>
#include <apr_signal.h>

#define APR_WANT_STDIO
#define APR_WANT_STRFUNC
#include <apr_want.h>

#include "svn_cmdline.h"
#include "svn_types.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_error_codes.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
#include "svn_repos.h"
#include "svn_fs.h"
#include "svn_time.h"
#include "svn_utf.h"
#include "svn_subst.h"
#include "svn_opt.h"
#include "svn_props.h"
#include "svn_diff.h"
#include "svn_version.h"
#include "svn_xml.h"

#include "private/svn_diff_private.h"
#include "private/svn_cmdline_private.h"
#include "private/svn_fspath.h"

#include "svn_private_config.h"



/*** Some convenience macros and types. ***/



/* Option handling. */

static svn_opt_subcommand_t
  subcommand_author,
  subcommand_cat,
  subcommand_changed,
  subcommand_date,
  subcommand_diff,
  subcommand_dirschanged,
  subcommand_filesize,
  subcommand_help,
  subcommand_history,
  subcommand_info,
  subcommand_lock,
  subcommand_log,
  subcommand_pget,
  subcommand_plist,
  subcommand_tree,
  subcommand_uuid,
  subcommand_youngest;

/* Option codes and descriptions. */
enum
  {
    svnlook__version = SVN_OPT_FIRST_LONGOPT_ID,
    svnlook__show_ids,
    svnlook__no_diff_deleted,
    svnlook__no_diff_added,
    svnlook__diff_copy_from,
    svnlook__revprop_opt,
    svnlook__full_paths,
    svnlook__copy_info,
    svnlook__xml_opt,
    svnlook__ignore_properties,
    svnlook__properties_only,
    svnlook__diff_cmd
  };

/*
 * The entire list must be terminated with an entry of nulls.
 */
static const apr_getopt_option_t options_table[] =
{
  {NULL,                '?', 0,
   N_("show help on a subcommand")},

  {"copy-info",         svnlook__copy_info, 0,
   N_("show details for copies")},

  {"diff-copy-from",    svnlook__diff_copy_from, 0,
   N_("print differences against the copy source")},

  {"full-paths",        svnlook__full_paths, 0,
   N_("show full paths instead of indenting them")},

  {"help",              'h', 0,
   N_("show help on a subcommand")},

  {"limit",             'l', 1,
   N_("maximum number of history entries")},

  {"no-diff-added",     svnlook__no_diff_added, 0,
   N_("do not print differences for added files")},

  {"no-diff-deleted",   svnlook__no_diff_deleted, 0,
   N_("do not print differences for deleted files")},

  {"diff-cmd",          svnlook__diff_cmd, 1,
   N_("use ARG as diff command")},

  {"ignore-properties",   svnlook__ignore_properties, 0,
   N_("ignore properties during the operation")},

  {"properties-only",   svnlook__properties_only, 0,
   N_("show only properties during the operation")},

  {"non-recursive",     'N', 0,
   N_("operate on single directory only")},

  {"revision",          'r', 1,
   N_("specify revision number ARG")},

  {"revprop",           svnlook__revprop_opt, 0,
   N_("operate on a revision property (use with -r or -t)")},

  {"show-ids",          svnlook__show_ids, 0,
   N_("show node revision ids for each path")},

  {"transaction",       't', 1,
   N_("specify transaction name ARG")},

  {"verbose",           'v', 0,
   N_("be verbose")},

  {"version",           svnlook__version, 0,
   N_("show program version information")},

  {"xml",               svnlook__xml_opt, 0,
   N_("output in XML")},

  {"extensions",        'x', 1,
   N_("Default: '-u'. When Subversion is invoking an\n"
      "                            "
      " external diff program, ARG is simply passed along\n"
      "                            "
      " to the program. But when Subversion is using its\n"
      "                            "
      " default internal diff implementation, or when\n"
      "                            "
      " Subversion is displaying blame annotations, ARG\n"
      "                            "
      " could be any of the following:\n"
      "                            "
      "    -u (--unified):\n"
      "                            "
      "       Output 3 lines of unified context.\n"
      "                            "
      "    -b (--ignore-space-change):\n"
      "                            "
      "       Ignore changes in the amount of white space.\n"
      "                            "
      "    -w (--ignore-all-space):\n"
      "                            "
      "       Ignore all white space.\n"
      "                            "
      "    --ignore-eol-style:\n"
      "                            "
      "       Ignore changes in EOL style\n"
      "                            "
      "    -p (--show-c-function):\n"
      "                            "
      "       Show C function name in diff output.")},

  {"quiet",             'q', 0,
   N_("no progress (only errors) to stderr")},

  {0,                   0, 0, 0}
};


/* Array of available subcommands.
 * The entire list must be terminated with an entry of nulls.<commit_msg>Bring the help text for the '-x' option of 'svnlook diff' in line with the shorter version of 'svn'.<commit_after>/*
 * main.c: Subversion server inspection tool.
 *
 * ====================================================================
 *    Licensed to the Apache Software Foundation (ASF) under one
 *    or more contributor license agreements.  See the NOTICE file
 *    distributed with this work for additional information
 *    regarding copyright ownership.  The ASF licenses this file
 *    to you under the Apache License, Version 2.0 (the
 *    "License"); you may not use this file except in compliance
 *    with the License.  You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 *    Unless required by applicable law or agreed to in writing,
 *    software distributed under the License is distributed on an
 *    "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
 *    KIND, either express or implied.  See the License for the
 *    specific language governing permissions and limitations
 *    under the License.
 * ====================================================================
 */

#include <assert.h>
#include <stdlib.h>

#include <apr_general.h>
#include <apr_pools.h>
#include <apr_time.h>
#include <apr_file_io.h>
#include <apr_signal.h>

#define APR_WANT_STDIO
#define APR_WANT_STRFUNC
#include <apr_want.h>

#include "svn_cmdline.h"
#include "svn_types.h"
#include "svn_pools.h"
#include "svn_error.h"
#include "svn_error_codes.h"
#include "svn_dirent_uri.h"
#include "svn_path.h"
#include "svn_repos.h"
#include "svn_fs.h"
#include "svn_time.h"
#include "svn_utf.h"
#include "svn_subst.h"
#include "svn_opt.h"
#include "svn_props.h"
#include "svn_diff.h"
#include "svn_version.h"
#include "svn_xml.h"

#include "private/svn_diff_private.h"
#include "private/svn_cmdline_private.h"
#include "private/svn_fspath.h"

#include "svn_private_config.h"



/*** Some convenience macros and types. ***/



/* Option handling. */

static svn_opt_subcommand_t
  subcommand_author,
  subcommand_cat,
  subcommand_changed,
  subcommand_date,
  subcommand_diff,
  subcommand_dirschanged,
  subcommand_filesize,
  subcommand_help,
  subcommand_history,
  subcommand_info,
  subcommand_lock,
  subcommand_log,
  subcommand_pget,
  subcommand_plist,
  subcommand_tree,
  subcommand_uuid,
  subcommand_youngest;

/* Option codes and descriptions. */
enum
  {
    svnlook__version = SVN_OPT_FIRST_LONGOPT_ID,
    svnlook__show_ids,
    svnlook__no_diff_deleted,
    svnlook__no_diff_added,
    svnlook__diff_copy_from,
    svnlook__revprop_opt,
    svnlook__full_paths,
    svnlook__copy_info,
    svnlook__xml_opt,
    svnlook__ignore_properties,
    svnlook__properties_only,
    svnlook__diff_cmd
  };

/*
 * The entire list must be terminated with an entry of nulls.
 */
static const apr_getopt_option_t options_table[] =
{
  {NULL,                '?', 0,
   N_("show help on a subcommand")},

  {"copy-info",         svnlook__copy_info, 0,
   N_("show details for copies")},

  {"diff-copy-from",    svnlook__diff_copy_from, 0,
   N_("print differences against the copy source")},

  {"full-paths",        svnlook__full_paths, 0,
   N_("show full paths instead of indenting them")},

  {"help",              'h', 0,
   N_("show help on a subcommand")},

  {"limit",             'l', 1,
   N_("maximum number of history entries")},

  {"no-diff-added",     svnlook__no_diff_added, 0,
   N_("do not print differences for added files")},

  {"no-diff-deleted",   svnlook__no_diff_deleted, 0,
   N_("do not print differences for deleted files")},

  {"diff-cmd",          svnlook__diff_cmd, 1,
   N_("use ARG as diff command")},

  {"ignore-properties",   svnlook__ignore_properties, 0,
   N_("ignore properties during the operation")},

  {"properties-only",   svnlook__properties_only, 0,
   N_("show only properties during the operation")},

  {"non-recursive",     'N', 0,
   N_("operate on single directory only")},

  {"revision",          'r', 1,
   N_("specify revision number ARG")},

  {"revprop",           svnlook__revprop_opt, 0,
   N_("operate on a revision property (use with -r or -t)")},

  {"show-ids",          svnlook__show_ids, 0,
   N_("show node revision ids for each path")},

  {"transaction",       't', 1,
   N_("specify transaction name ARG")},

  {"verbose",           'v', 0,
   N_("be verbose")},

  {"version",           svnlook__version, 0,
   N_("show program version information")},

  {"xml",               svnlook__xml_opt, 0,
   N_("output in XML")},

  {"extensions",        'x', 1,
   N_("Specify differencing options for external diff or\n"
      "                             "
      "internal diff. Default: '-u'. Options are\n"
      "                             "
      "separated by spaces. Internal diff takes:\n"
      "                             "
      "  -u, --unified: Show 3 lines of unified context\n"
      "                             "
      "  -b, --ignore-space-change: Ignore changes in\n"
      "                             "
      "    amount of white space\n"
      "                             "
      "  -w, --ignore-all-space: Ignore all white space\n"
      "                             "
      "  --ignore-eol-style: Ignore changes in EOL style\n"
      "                             "
      "  -p, --show-c-function: Show C function name")},

  {"quiet",             'q', 0,
   N_("no progress (only errors) to stderr")},

  {0,                   0, 0, 0}
};


/* Array of available subcommands.
 * The entire list must be terminated with an entry of nulls.
{'fraction_non_alphanumeric': 0.13426681556567305, 'fraction_numerical': 0.005154196374881883, 'mean_word_length': 2.495046532572801, 'pattern_counts': {'":': 0, '<': 19, '<?xml version=': 0, '>': 19, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 8}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 23, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5687138', 'n_tokens_mistral': 3857, 'n_tokens_neox': 3709, 'n_words': 1006}