📄 main.c
字号:
/* * main.c: Subversion command line client. * * ==================================================================== * Copyright (c) 2000-2006 CollabNet. All rights reserved. * * This software is licensed as described in the file COPYING, which * you should have received as part of this distribution. The terms * are also available at http://subversion.tigris.org/license-1.html. * If newer versions of this license are posted there, you may use a * newer version instead, at your option. * * This software consists of voluntary contributions made by many * individuals. For exact contribution history, see the revision * history and logs, available at http://subversion.tigris.org/. * ==================================================================== *//* ==================================================================== *//*** Includes. ***/#include <string.h>#include <assert.h>#include <apr_strings.h>#include <apr_tables.h>#include <apr_general.h>#include <apr_signal.h>#include "svn_cmdline.h"#include "svn_pools.h"#include "svn_wc.h"#include "svn_client.h"#include "svn_config.h"#include "svn_string.h"#include "svn_path.h"#include "svn_delta.h"#include "svn_diff.h"#include "svn_error.h"#include "svn_io.h"#include "svn_opt.h"#include "svn_utf.h"#include "svn_auth.h"#include "cl.h"#include "svn_private_config.h"/*** Option Processing ***//* Option codes and descriptions for the command line client. * * The entire list must be terminated with an entry of nulls. */const apr_getopt_option_t svn_cl__options[] ={ {"force", svn_cl__force_opt, 0, N_("force operation to run")}, {"force-log", svn_cl__force_log_opt, 0, N_("force validity of log message source")}, {"help", 'h', 0, N_("show help on a subcommand")}, {NULL, '?', 0, N_("show help on a subcommand")}, {"message", 'm', 1, N_("specify log message ARG")}, {"quiet", 'q', 0, N_("print as little as possible")}, {"recursive", 'R', 0, N_("descend recursively")}, {"non-recursive", 'N', 0, N_("operate on single directory only")}, {"change", 'c', 1, N_ ("the change made by revision ARG (like -r ARG-1:ARG)\n" " If ARG is negative this is like -r ARG:ARG-1") }, {"revision", 'r', 1, N_ ("ARG (some commands also take ARG1:ARG2 range)\n" " A revision argument can be one of:\n" " NUMBER revision number\n" " '{' DATE '}' revision at start of the date\n" " 'HEAD' latest in repository\n" " 'BASE' base rev of item's working copy\n" " 'COMMITTED' last commit at or before BASE\n" " 'PREV' revision just before COMMITTED") /* spacing corresponds to svn_opt_format_option */ }, {"file", 'F', 1, N_("read log message from file ARG")}, {"incremental", svn_cl__incremental_opt, 0, N_("give output suitable for concatenation")},#ifndef AS400 {"encoding", svn_cl__encoding_opt, 1, N_("treat value as being in charset encoding ARG")},#endif {"version", svn_cl__version_opt, 0, N_("show program version information")}, {"verbose", 'v', 0, N_("print extra information")}, {"show-updates", 'u', 0, N_("display update information")}, {"username", svn_cl__auth_username_opt, 1, N_("specify a username ARG")}, {"password", svn_cl__auth_password_opt, 1, N_("specify a password ARG")},#ifndef AS400 {"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")},#endif {"targets", svn_cl__targets_opt, 1, N_("pass contents of file ARG as additional args")}, {"xml", svn_cl__xml_opt, 0, N_("output in XML")}, {"strict", svn_cl__strict_opt, 0, N_("use strict semantics")}, {"stop-on-copy", svn_cl__stop_on_copy_opt, 0, N_("do not cross copies while traversing history")}, {"no-ignore", svn_cl__no_ignore_opt, 0, N_("disregard default and svn:ignore property ignores")}, {"no-auth-cache", svn_cl__no_auth_cache_opt, 0, N_("do not cache authentication tokens")}, {"non-interactive", svn_cl__non_interactive_opt, 0, N_("do no interactive prompting")}, {"dry-run", svn_cl__dry_run_opt, 0, N_("try operation but make no changes")}, {"no-diff-deleted", svn_cl__no_diff_deleted, 0, N_("do not print differences for deleted files")}, {"notice-ancestry", svn_cl__notice_ancestry_opt, 0, N_("notice ancestry when calculating differences")}, {"ignore-ancestry", svn_cl__ignore_ancestry_opt, 0, N_("ignore ancestry when calculating merges")}, {"ignore-externals", svn_cl__ignore_externals_opt, 0, N_("ignore externals definitions")},#ifndef AS400 {"diff-cmd", svn_cl__diff_cmd_opt, 1, N_("use ARG as diff command")}, {"diff3-cmd", svn_cl__merge_cmd_opt, 1, N_("use ARG as merge command")}, {"editor-cmd", svn_cl__editor_cmd_opt, 1, N_("use ARG as external editor")},#endif {"old", svn_cl__old_cmd_opt, 1, N_("use ARG as the older target")}, {"new", svn_cl__new_cmd_opt, 1, N_("use ARG as the newer target")}, {"revprop", svn_cl__revprop_opt, 0, N_("operate on a revision property (use with -r)")}, {"relocate", svn_cl__relocate_opt, 0, N_("relocate via URL-rewriting")}, {"config-dir", svn_cl__config_dir_opt, 1, N_("read user configuration files from directory ARG")}, {"auto-props", svn_cl__autoprops_opt, 0, N_("enable automatic properties")}, {"no-auto-props", svn_cl__no_autoprops_opt, 0, N_("disable automatic properties")}, {"native-eol", svn_cl__native_eol_opt, 1, N_("use a different EOL marker than the standard\n" " " "system marker for files with the svn:eol-style\n" " " "property set to 'native'.\n" " " "ARG may be one of 'LF', 'CR', 'CRLF'")}, {"limit", svn_cl__limit_opt, 1, N_("maximum number of log entries")}, {"no-unlock", svn_cl__no_unlock_opt, 0, N_("don't unlock the targets")}, {"summarize", svn_cl__summarize, 0, N_("show a summary of the results")}, {0, 0, 0, 0}};/*** Command dispatch. ***//* Our array of available subcommands. * * The entire list must be terminated with an entry of nulls. * * In most of the help text "PATH" is used where a working copy path is * required, "URL" where a repository URL is required and "TARGET" when * either a path or an url can be used. Hmm, should this be part of the * help text? *//* Options for authentication. */#define SVN_CL__AUTH_OPTIONS svn_cl__auth_username_opt, \ svn_cl__auth_password_opt, \ svn_cl__no_auth_cache_opt, \ svn_cl__non_interactive_opt/* Options for giving a log message. (Some of these also have other uses.) * * In theory, we should include svn_cl__non_interactive_opt here too, * because all the log-message-taking commands have the potential to * pop up an editor, and svn_cl__non_interactive_opt is the way to * prevent that. But so far, any command that includes these options * also includes SVN_CL__AUTH_OPTIONS, which of course already * contains svn_cl__non_interactive_opt, so we get it for free. */#define SVN_CL__LOG_MSG_OPTIONS 'm', 'F', \ svn_cl__force_log_opt, \ svn_cl__editor_cmd_opt, \ svn_cl__encoding_optconst svn_opt_subcommand_desc2_t svn_cl__cmd_table[] ={ { "add", svn_cl__add, {0}, N_ ("Put files and directories under version control, scheduling\n" "them for addition to repository. They will be added in next commit.\n" "usage: add PATH...\n"), {svn_cl__targets_opt, 'N', 'q', svn_cl__config_dir_opt, svn_cl__force_opt, svn_cl__no_ignore_opt, svn_cl__autoprops_opt, svn_cl__no_autoprops_opt} }, { "blame", svn_cl__blame, {"praise", "annotate", "ann"}, N_ ("Output the content of specified files or\n" "URLs with revision and author information in-line.\n" "usage: blame TARGET[@REV]...\n" "\n" " If specified, REV determines in which revision the target is first\n" " looked up.\n"), {'r', 'v', svn_cl__incremental_opt, svn_cl__xml_opt, 'x', svn_cl__force_opt, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, { "cat", svn_cl__cat, {0}, N_ ("Output the content of specified files or URLs.\n" "usage: cat TARGET[@REV]...\n" "\n" " If specified, REV determines in which revision the target is first\n" " looked up.\n"), {'r', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, { "checkout", svn_cl__checkout, {"co"}, N_ ("Check out a working copy from a repository.\n" "usage: checkout URL[@REV]... [PATH]\n" "\n" " If specified, REV determines in which revision the URL is first\n" " looked up.\n" "\n" " If PATH is omitted, the basename of the URL will be used as\n" " the destination. If multiple URLs are given each will be checked\n" " out into a sub-directory of PATH, with the name of the sub-directory\n" " being the basename of the URL.\n"), {'r', 'q', 'N', SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt, svn_cl__ignore_externals_opt} }, { "cleanup", svn_cl__cleanup, {0}, N_ ("Recursively clean up the working copy, removing locks, resuming\n" "unfinished operations, etc.\n" "usage: cleanup [PATH...]\n"), {svn_cl__merge_cmd_opt, svn_cl__config_dir_opt} }, { "commit", svn_cl__commit, {"ci"},#ifndef AS400 N_("Send changes from your working copy to the repository.\n" "usage: commit [PATH...]\n" "\n" " A log message must be provided, but it can be empty. If it is not\n" " given by a --message or --file option, an editor will be started.\n" " If any targets are (or contain) locked items, those will be\n" " unlocked after a successful commit.\n"),#else N_("Send changes from your working copy to the repository.\n" "usage: commit [PATH...]\n" "\n" " A log message must be provided, but it can be empty.\n" " OS400 does not support the starting of an editor,\n" " so --message or --file must be used. If any targets are\n" " (or contain) locked items, those will be unlocked after a\n" " successful commit.\n"),#endif {'q', 'N', svn_cl__targets_opt, svn_cl__no_unlock_opt, SVN_CL__LOG_MSG_OPTIONS, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, { "copy", svn_cl__copy, {"cp"}, N_ ("Duplicate something in working copy or repository, remembering history.\n" "usage: copy SRC DST\n" "\n" " SRC and DST can each be either a working copy (WC) path or URL:\n" " WC -> WC: copy and schedule for addition (with history)\n" " WC -> URL: immediately commit a copy of WC to URL\n" " URL -> WC: check out URL into WC, schedule for addition\n" " URL -> URL: complete server-side copy; used to branch & tag\n"), {'r', 'q', SVN_CL__LOG_MSG_OPTIONS, SVN_CL__AUTH_OPTIONS, svn_cl__config_dir_opt} }, { "delete", svn_cl__delete, {"del", "remove", "rm"}, N_
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -