svn.c revision 251881
1251881Speter/* 2251881Speter * svn.c: Subversion command line client main file. 3251881Speter * 4251881Speter * ==================================================================== 5251881Speter * Licensed to the Apache Software Foundation (ASF) under one 6251881Speter * or more contributor license agreements. See the NOTICE file 7251881Speter * distributed with this work for additional information 8251881Speter * regarding copyright ownership. The ASF licenses this file 9251881Speter * to you under the Apache License, Version 2.0 (the 10251881Speter * "License"); you may not use this file except in compliance 11251881Speter * with the License. You may obtain a copy of the License at 12251881Speter * 13251881Speter * http://www.apache.org/licenses/LICENSE-2.0 14251881Speter * 15251881Speter * Unless required by applicable law or agreed to in writing, 16251881Speter * software distributed under the License is distributed on an 17251881Speter * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 18251881Speter * KIND, either express or implied. See the License for the 19251881Speter * specific language governing permissions and limitations 20251881Speter * under the License. 21251881Speter * ==================================================================== 22251881Speter */ 23251881Speter 24251881Speter/* ==================================================================== */ 25251881Speter 26251881Speter 27251881Speter 28251881Speter/*** Includes. ***/ 29251881Speter 30251881Speter#include <string.h> 31251881Speter#include <assert.h> 32251881Speter 33251881Speter#include <apr_strings.h> 34251881Speter#include <apr_tables.h> 35251881Speter#include <apr_general.h> 36251881Speter#include <apr_signal.h> 37251881Speter 38251881Speter#include "svn_cmdline.h" 39251881Speter#include "svn_pools.h" 40251881Speter#include "svn_wc.h" 41251881Speter#include "svn_client.h" 42251881Speter#include "svn_config.h" 43251881Speter#include "svn_string.h" 44251881Speter#include "svn_dirent_uri.h" 45251881Speter#include "svn_path.h" 46251881Speter#include "svn_delta.h" 47251881Speter#include "svn_diff.h" 48251881Speter#include "svn_error.h" 49251881Speter#include "svn_io.h" 50251881Speter#include "svn_opt.h" 51251881Speter#include "svn_utf.h" 52251881Speter#include "svn_auth.h" 53251881Speter#include "svn_hash.h" 54251881Speter#include "svn_version.h" 55251881Speter#include "cl.h" 56251881Speter 57251881Speter#include "private/svn_opt_private.h" 58251881Speter#include "private/svn_cmdline_private.h" 59251881Speter 60251881Speter#include "svn_private_config.h" 61251881Speter 62251881Speter 63251881Speter/*** Option Processing ***/ 64251881Speter 65251881Speter/* Add an identifier here for long options that don't have a short 66251881Speter option. Options that have both long and short options should just 67251881Speter use the short option letter as identifier. */ 68251881Spetertypedef enum svn_cl__longopt_t { 69251881Speter opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID, 70251881Speter opt_auth_username, 71251881Speter opt_autoprops, 72251881Speter opt_changelist, 73251881Speter opt_config_dir, 74251881Speter opt_config_options, 75251881Speter /* diff options */ 76251881Speter opt_diff_cmd, 77251881Speter opt_internal_diff, 78251881Speter opt_no_diff_added, 79251881Speter opt_no_diff_deleted, 80251881Speter opt_show_copies_as_adds, 81251881Speter opt_notice_ancestry, 82251881Speter opt_summarize, 83251881Speter opt_use_git_diff_format, 84251881Speter opt_ignore_properties, 85251881Speter opt_properties_only, 86251881Speter opt_patch_compatible, 87251881Speter /* end of diff options */ 88251881Speter opt_dry_run, 89251881Speter opt_editor_cmd, 90251881Speter opt_encoding, 91251881Speter opt_force_log, 92251881Speter opt_force, 93251881Speter opt_keep_changelists, 94251881Speter opt_ignore_ancestry, 95251881Speter opt_ignore_externals, 96251881Speter opt_incremental, 97251881Speter opt_merge_cmd, 98251881Speter opt_native_eol, 99251881Speter opt_new_cmd, 100251881Speter opt_no_auth_cache, 101251881Speter opt_no_autoprops, 102251881Speter opt_no_ignore, 103251881Speter opt_no_unlock, 104251881Speter opt_non_interactive, 105251881Speter opt_force_interactive, 106251881Speter opt_old_cmd, 107251881Speter opt_record_only, 108251881Speter opt_relocate, 109251881Speter opt_remove, 110251881Speter opt_revprop, 111251881Speter opt_stop_on_copy, 112251881Speter opt_strict, 113251881Speter opt_targets, 114251881Speter opt_depth, 115251881Speter opt_set_depth, 116251881Speter opt_version, 117251881Speter opt_xml, 118251881Speter opt_keep_local, 119251881Speter opt_with_revprop, 120251881Speter opt_with_all_revprops, 121251881Speter opt_with_no_revprops, 122251881Speter opt_parents, 123251881Speter opt_accept, 124251881Speter opt_show_revs, 125251881Speter opt_reintegrate, 126251881Speter opt_trust_server_cert, 127251881Speter opt_strip, 128251881Speter opt_ignore_keywords, 129251881Speter opt_reverse_diff, 130251881Speter opt_ignore_whitespace, 131251881Speter opt_diff, 132251881Speter opt_allow_mixed_revisions, 133251881Speter opt_include_externals, 134251881Speter opt_show_inherited_props, 135251881Speter opt_search, 136251881Speter opt_search_and 137251881Speter} svn_cl__longopt_t; 138251881Speter 139251881Speter 140251881Speter/* Option codes and descriptions for the command line client. 141251881Speter * 142251881Speter * The entire list must be terminated with an entry of nulls. 143251881Speter */ 144251881Speterconst apr_getopt_option_t svn_cl__options[] = 145251881Speter{ 146251881Speter {"force", opt_force, 0, N_("force operation to run")}, 147251881Speter {"force-log", opt_force_log, 0, 148251881Speter N_("force validity of log message source")}, 149251881Speter {"help", 'h', 0, N_("show help on a subcommand")}, 150251881Speter {NULL, '?', 0, N_("show help on a subcommand")}, 151251881Speter {"message", 'm', 1, N_("specify log message ARG")}, 152251881Speter {"quiet", 'q', 0, N_("print nothing, or only summary information")}, 153251881Speter {"recursive", 'R', 0, N_("descend recursively, same as --depth=infinity")}, 154251881Speter {"non-recursive", 'N', 0, N_("obsolete; try --depth=files or --depth=immediates")}, 155251881Speter {"change", 'c', 1, 156251881Speter N_("the change made by revision ARG (like -r ARG-1:ARG)\n" 157251881Speter " " 158251881Speter "If ARG is negative this is like -r ARG:ARG-1\n" 159251881Speter " " 160251881Speter "If ARG is of the form ARG1-ARG2 then this is like\n" 161251881Speter " " 162251881Speter "ARG1:ARG2, where ARG1 is inclusive")}, 163251881Speter {"revision", 'r', 1, 164251881Speter N_("ARG (some commands also take ARG1:ARG2 range)\n" 165251881Speter " " 166251881Speter "A revision argument can be one of:\n" 167251881Speter " " 168251881Speter " NUMBER revision number\n" 169251881Speter " " 170251881Speter " '{' DATE '}' revision at start of the date\n" 171251881Speter " " 172251881Speter " 'HEAD' latest in repository\n" 173251881Speter " " 174251881Speter " 'BASE' base rev of item's working copy\n" 175251881Speter " " 176251881Speter " 'COMMITTED' last commit at or before BASE\n" 177251881Speter " " 178251881Speter " 'PREV' revision just before COMMITTED")}, 179251881Speter {"file", 'F', 1, N_("read log message from file ARG")}, 180251881Speter {"incremental", opt_incremental, 0, 181251881Speter N_("give output suitable for concatenation")}, 182251881Speter {"encoding", opt_encoding, 1, 183251881Speter N_("treat value as being in charset encoding ARG")}, 184251881Speter {"version", opt_version, 0, N_("show program version information")}, 185251881Speter {"verbose", 'v', 0, N_("print extra information")}, 186251881Speter {"show-updates", 'u', 0, N_("display update information")}, 187251881Speter {"username", opt_auth_username, 1, N_("specify a username ARG")}, 188251881Speter {"password", opt_auth_password, 1, N_("specify a password ARG")}, 189251881Speter {"extensions", 'x', 1, 190251881Speter N_("Specify differencing options for external diff or\n" 191251881Speter " " 192251881Speter "internal diff or blame. Default: '-u'. Options are\n" 193251881Speter " " 194251881Speter "separated by spaces. Internal diff and blame take:\n" 195251881Speter " " 196251881Speter " -u, --unified: Show 3 lines of unified context\n" 197251881Speter " " 198251881Speter " -b, --ignore-space-change: Ignore changes in\n" 199251881Speter " " 200251881Speter " amount of white space\n" 201251881Speter " " 202251881Speter " -w, --ignore-all-space: Ignore all white space\n" 203251881Speter " " 204251881Speter " --ignore-eol-style: Ignore changes in EOL style\n" 205251881Speter " " 206251881Speter " -p, --show-c-function: Show C function name")}, 207251881Speter {"targets", opt_targets, 1, 208251881Speter N_("pass contents of file ARG as additional args")}, 209251881Speter {"depth", opt_depth, 1, 210251881Speter N_("limit operation by depth ARG ('empty', 'files',\n" 211251881Speter " " 212251881Speter "'immediates', or 'infinity')")}, 213251881Speter {"set-depth", opt_set_depth, 1, 214251881Speter N_("set new working copy depth to ARG ('exclude',\n" 215251881Speter " " 216251881Speter "'empty', 'files', 'immediates', or 'infinity')")}, 217251881Speter {"xml", opt_xml, 0, N_("output in XML")}, 218251881Speter {"strict", opt_strict, 0, N_("use strict semantics")}, 219251881Speter {"stop-on-copy", opt_stop_on_copy, 0, 220251881Speter N_("do not cross copies while traversing history")}, 221251881Speter {"no-ignore", opt_no_ignore, 0, 222251881Speter N_("disregard default and svn:ignore and\n" 223251881Speter " " 224251881Speter "svn:global-ignores property ignores")}, 225251881Speter {"no-auth-cache", opt_no_auth_cache, 0, 226251881Speter N_("do not cache authentication tokens")}, 227251881Speter {"trust-server-cert", opt_trust_server_cert, 0, 228251881Speter N_("accept SSL server certificates from unknown\n" 229251881Speter " " 230251881Speter "certificate authorities without prompting (but only\n" 231251881Speter " " 232251881Speter "with '--non-interactive')") }, 233251881Speter {"non-interactive", opt_non_interactive, 0, 234251881Speter N_("do no interactive prompting (default is to prompt\n" 235251881Speter " " 236251881Speter "only if standard input is a terminal device)")}, 237251881Speter {"force-interactive", opt_force_interactive, 0, 238251881Speter N_("do interactive prompting even if standard input\n" 239251881Speter " " 240251881Speter "is not a terminal device")}, 241251881Speter {"dry-run", opt_dry_run, 0, 242251881Speter N_("try operation but make no changes")}, 243251881Speter {"ignore-ancestry", opt_ignore_ancestry, 0, 244251881Speter N_("disable merge tracking; diff nodes as if related")}, 245251881Speter {"ignore-externals", opt_ignore_externals, 0, 246251881Speter N_("ignore externals definitions")}, 247251881Speter {"diff3-cmd", opt_merge_cmd, 1, N_("use ARG as merge command")}, 248251881Speter {"editor-cmd", opt_editor_cmd, 1, N_("use ARG as external editor")}, 249251881Speter {"record-only", opt_record_only, 0, 250251881Speter N_("merge only mergeinfo differences")}, 251251881Speter {"old", opt_old_cmd, 1, N_("use ARG as the older target")}, 252251881Speter {"new", opt_new_cmd, 1, N_("use ARG as the newer target")}, 253251881Speter {"revprop", opt_revprop, 0, 254251881Speter N_("operate on a revision property (use with -r)")}, 255251881Speter {"relocate", opt_relocate, 0, N_("relocate via URL-rewriting")}, 256251881Speter {"config-dir", opt_config_dir, 1, 257251881Speter N_("read user configuration files from directory ARG")}, 258251881Speter {"config-option", opt_config_options, 1, 259251881Speter N_("set user configuration option in the format:\n" 260251881Speter " " 261251881Speter " FILE:SECTION:OPTION=[VALUE]\n" 262251881Speter " " 263251881Speter "For example:\n" 264251881Speter " " 265251881Speter " servers:global:http-library=serf")}, 266251881Speter {"auto-props", opt_autoprops, 0, N_("enable automatic properties")}, 267251881Speter {"no-auto-props", opt_no_autoprops, 0, N_("disable automatic properties")}, 268251881Speter {"native-eol", opt_native_eol, 1, 269251881Speter N_("use a different EOL marker than the standard\n" 270251881Speter " " 271251881Speter "system marker for files with the svn:eol-style\n" 272251881Speter " " 273251881Speter "property set to 'native'.\n" 274251881Speter " " 275251881Speter "ARG may be one of 'LF', 'CR', 'CRLF'")}, 276251881Speter {"limit", 'l', 1, N_("maximum number of log entries")}, 277251881Speter {"no-unlock", opt_no_unlock, 0, N_("don't unlock the targets")}, 278251881Speter {"remove", opt_remove, 0, N_("remove changelist association")}, 279251881Speter {"changelist", opt_changelist, 1, 280251881Speter N_("operate only on members of changelist ARG")}, 281251881Speter {"keep-changelists", opt_keep_changelists, 0, 282251881Speter N_("don't delete changelists after commit")}, 283251881Speter {"keep-local", opt_keep_local, 0, N_("keep path in working copy")}, 284251881Speter {"with-all-revprops", opt_with_all_revprops, 0, 285251881Speter N_("retrieve all revision properties")}, 286251881Speter {"with-no-revprops", opt_with_no_revprops, 0, 287251881Speter N_("retrieve no revision properties")}, 288251881Speter {"with-revprop", opt_with_revprop, 1, 289251881Speter N_("set revision property ARG in new revision\n" 290251881Speter " " 291251881Speter "using the name[=value] format")}, 292251881Speter {"parents", opt_parents, 0, N_("make intermediate directories")}, 293251881Speter {"use-merge-history", 'g', 0, 294251881Speter N_("use/display additional information from merge\n" 295251881Speter " " 296251881Speter "history")}, 297251881Speter {"accept", opt_accept, 1, 298251881Speter N_("specify automatic conflict resolution action\n" 299251881Speter " " 300251881Speter "('postpone', 'working', 'base', 'mine-conflict',\n" 301251881Speter " " 302251881Speter "'theirs-conflict', 'mine-full', 'theirs-full',\n" 303251881Speter " " 304251881Speter "'edit', 'launch')\n" 305251881Speter " " 306251881Speter "(shorthand: 'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l')" 307251881Speter )}, 308251881Speter {"show-revs", opt_show_revs, 1, 309251881Speter N_("specify which collection of revisions to display\n" 310251881Speter " " 311251881Speter "('merged', 'eligible')")}, 312251881Speter {"reintegrate", opt_reintegrate, 0, 313251881Speter N_("deprecated")}, 314251881Speter {"strip", opt_strip, 1, 315251881Speter N_("number of leading path components to strip from\n" 316251881Speter " " 317251881Speter "paths parsed from the patch file. --strip 0\n" 318251881Speter " " 319251881Speter "is the default and leaves paths unmodified.\n" 320251881Speter " " 321251881Speter "--strip 1 would change the path\n" 322251881Speter " " 323251881Speter "'doc/fudge/crunchy.html' to 'fudge/crunchy.html'.\n" 324251881Speter " " 325251881Speter "--strip 2 would leave just 'crunchy.html'\n" 326251881Speter " " 327251881Speter "The expected component separator is '/' on all\n" 328251881Speter " " 329251881Speter "platforms. A leading '/' counts as one component.")}, 330251881Speter {"ignore-keywords", opt_ignore_keywords, 0, 331251881Speter N_("don't expand keywords")}, 332251881Speter {"reverse-diff", opt_reverse_diff, 0, 333251881Speter N_("apply the unidiff in reverse")}, 334251881Speter {"ignore-whitespace", opt_ignore_whitespace, 0, 335251881Speter N_("ignore whitespace during pattern matching")}, 336251881Speter {"diff", opt_diff, 0, N_("produce diff output")}, /* maps to show_diff */ 337251881Speter /* diff options */ 338251881Speter {"diff-cmd", opt_diff_cmd, 1, N_("use ARG as diff command")}, 339251881Speter {"internal-diff", opt_internal_diff, 0, 340251881Speter N_("override diff-cmd specified in config file")}, 341251881Speter {"no-diff-added", opt_no_diff_added, 0, 342251881Speter N_("do not print differences for added files")}, 343251881Speter {"no-diff-deleted", opt_no_diff_deleted, 0, 344251881Speter N_("do not print differences for deleted files")}, 345251881Speter {"show-copies-as-adds", opt_show_copies_as_adds, 0, 346251881Speter N_("don't diff copied or moved files with their source")}, 347251881Speter {"notice-ancestry", opt_notice_ancestry, 0, 348251881Speter N_("diff unrelated nodes as delete and add")}, 349251881Speter {"summarize", opt_summarize, 0, N_("show a summary of the results")}, 350251881Speter {"git", opt_use_git_diff_format, 0, 351251881Speter N_("use git's extended diff format")}, 352251881Speter {"ignore-properties", opt_ignore_properties, 0, 353251881Speter N_("ignore properties during the operation")}, 354251881Speter {"properties-only", opt_properties_only, 0, 355251881Speter N_("show only properties during the operation")}, 356251881Speter {"patch-compatible", opt_patch_compatible, 0, 357251881Speter N_("generate diff suitable for generic third-party\n" 358251881Speter " " 359251881Speter "patch tools; currently the same as\n" 360251881Speter " " 361251881Speter "--show-copies-as-adds --ignore-properties" 362251881Speter )}, 363251881Speter /* end of diff options */ 364251881Speter {"allow-mixed-revisions", opt_allow_mixed_revisions, 0, 365251881Speter N_("Allow operation on mixed-revision working copy.\n" 366251881Speter " " 367251881Speter "Use of this option is not recommended!\n" 368251881Speter " " 369251881Speter "Please run 'svn update' instead.")}, 370251881Speter {"include-externals", opt_include_externals, 0, 371251881Speter N_("Also commit file and dir externals reached by\n" 372251881Speter " " 373251881Speter "recursion. This does not include externals with a\n" 374251881Speter " " 375251881Speter "fixed revision. (See the svn:externals property)")}, 376251881Speter {"show-inherited-props", opt_show_inherited_props, 0, 377251881Speter N_("retrieve target's inherited properties")}, 378251881Speter {"search", opt_search, 1, 379251881Speter N_("use ARG as search pattern (glob syntax)")}, 380251881Speter {"search-and", opt_search_and, 1, 381251881Speter N_("combine ARG with the previous search pattern")}, 382251881Speter 383251881Speter /* Long-opt Aliases 384251881Speter * 385251881Speter * These have NULL desriptions, but an option code that matches some 386251881Speter * other option (whose description should probably mention its aliases). 387251881Speter */ 388251881Speter 389251881Speter {"cl", opt_changelist, 1, NULL}, 390251881Speter 391251881Speter {0, 0, 0, 0}, 392251881Speter}; 393251881Speter 394251881Speter 395251881Speter 396251881Speter/*** Command dispatch. ***/ 397251881Speter 398251881Speter/* Our array of available subcommands. 399251881Speter * 400251881Speter * The entire list must be terminated with an entry of nulls. 401251881Speter * 402251881Speter * In most of the help text "PATH" is used where a working copy path is 403251881Speter * required, "URL" where a repository URL is required and "TARGET" when 404251881Speter * either a path or a url can be used. Hmm, should this be part of the 405251881Speter * help text? 406251881Speter */ 407251881Speter 408251881Speter/* Options that apply to all commands. (While not every command may 409251881Speter currently require authentication or be interactive, allowing every 410251881Speter command to take these arguments allows scripts to just pass them 411251881Speter willy-nilly to every invocation of 'svn') . */ 412251881Speterconst int svn_cl__global_options[] = 413251881Speter{ opt_auth_username, opt_auth_password, opt_no_auth_cache, opt_non_interactive, 414251881Speter opt_force_interactive, opt_trust_server_cert, opt_config_dir, 415251881Speter opt_config_options, 0 416251881Speter}; 417251881Speter 418251881Speter/* Options for giving a log message. (Some of these also have other uses.) 419251881Speter */ 420251881Speter#define SVN_CL__LOG_MSG_OPTIONS 'm', 'F', \ 421251881Speter opt_force_log, \ 422251881Speter opt_editor_cmd, \ 423251881Speter opt_encoding, \ 424251881Speter opt_with_revprop 425251881Speter 426251881Speterconst svn_opt_subcommand_desc2_t svn_cl__cmd_table[] = 427251881Speter{ 428251881Speter { "add", svn_cl__add, {0}, N_ 429251881Speter ("Put files and directories under version control, scheduling\n" 430251881Speter "them for addition to repository. They will be added in next commit.\n" 431251881Speter "usage: add PATH...\n"), 432251881Speter {opt_targets, 'N', opt_depth, 'q', opt_force, opt_no_ignore, opt_autoprops, 433251881Speter opt_no_autoprops, opt_parents }, 434251881Speter {{opt_parents, N_("add intermediate parents")}} }, 435251881Speter 436251881Speter { "blame", svn_cl__blame, {"praise", "annotate", "ann"}, N_ 437251881Speter ("Output the content of specified files or\n" 438251881Speter "URLs with revision and author information in-line.\n" 439251881Speter "usage: blame TARGET[@REV]...\n" 440251881Speter "\n" 441251881Speter " If specified, REV determines in which revision the target is first\n" 442251881Speter " looked up.\n"), 443251881Speter {'r', 'v', 'g', opt_incremental, opt_xml, 'x', opt_force} }, 444251881Speter 445251881Speter { "cat", svn_cl__cat, {0}, N_ 446251881Speter ("Output the content of specified files or URLs.\n" 447251881Speter "usage: cat TARGET[@REV]...\n" 448251881Speter "\n" 449251881Speter " If specified, REV determines in which revision the target is first\n" 450251881Speter " looked up.\n"), 451251881Speter {'r'} }, 452251881Speter 453251881Speter { "changelist", svn_cl__changelist, {"cl"}, N_ 454251881Speter ("Associate (or dissociate) changelist CLNAME with the named files.\n" 455251881Speter "usage: 1. changelist CLNAME PATH...\n" 456251881Speter " 2. changelist --remove PATH...\n"), 457251881Speter { 'q', 'R', opt_depth, opt_remove, opt_targets, opt_changelist} }, 458251881Speter 459251881Speter { "checkout", svn_cl__checkout, {"co"}, N_ 460251881Speter ("Check out a working copy from a repository.\n" 461251881Speter "usage: checkout URL[@REV]... [PATH]\n" 462251881Speter "\n" 463251881Speter " If specified, REV determines in which revision the URL is first\n" 464251881Speter " looked up.\n" 465251881Speter "\n" 466251881Speter " If PATH is omitted, the basename of the URL will be used as\n" 467251881Speter " the destination. If multiple URLs are given each will be checked\n" 468251881Speter " out into a sub-directory of PATH, with the name of the sub-directory\n" 469251881Speter " being the basename of the URL.\n" 470251881Speter "\n" 471251881Speter " If --force is used, unversioned obstructing paths in the working\n" 472251881Speter " copy destination do not automatically cause the check out to fail.\n" 473251881Speter " If the obstructing path is the same type (file or directory) as the\n" 474251881Speter " corresponding path in the repository it becomes versioned but its\n" 475251881Speter " contents are left 'as-is' in the working copy. This means that an\n" 476251881Speter " obstructing directory's unversioned children may also obstruct and\n" 477251881Speter " become versioned. For files, any content differences between the\n" 478251881Speter " obstruction and the repository are treated like a local modification\n" 479251881Speter " to the working copy. All properties from the repository are applied\n" 480251881Speter " to the obstructing path.\n" 481251881Speter "\n" 482251881Speter " See also 'svn help update' for a list of possible characters\n" 483251881Speter " reporting the action taken.\n"), 484251881Speter {'r', 'q', 'N', opt_depth, opt_force, opt_ignore_externals} }, 485251881Speter 486251881Speter { "cleanup", svn_cl__cleanup, {0}, N_ 487251881Speter ("Recursively clean up the working copy, removing locks, resuming\n" 488251881Speter "unfinished operations, etc.\n" 489251881Speter "usage: cleanup [WCPATH...]\n"), 490251881Speter {opt_merge_cmd} }, 491251881Speter 492251881Speter { "commit", svn_cl__commit, {"ci"}, 493251881Speter N_("Send changes from your working copy to the repository.\n" 494251881Speter "usage: commit [PATH...]\n" 495251881Speter "\n" 496251881Speter " A log message must be provided, but it can be empty. If it is not\n" 497251881Speter " given by a --message or --file option, an editor will be started.\n" 498251881Speter " If any targets are (or contain) locked items, those will be\n" 499251881Speter " unlocked after a successful commit.\n"), 500251881Speter {'q', 'N', opt_depth, opt_targets, opt_no_unlock, SVN_CL__LOG_MSG_OPTIONS, 501251881Speter opt_changelist, opt_keep_changelists, opt_include_externals} }, 502251881Speter 503251881Speter { "copy", svn_cl__copy, {"cp"}, N_ 504251881Speter ("Copy files and directories in a working copy or repository.\n" 505251881Speter "usage: copy SRC[@REV]... DST\n" 506251881Speter "\n" 507251881Speter " SRC and DST can each be either a working copy (WC) path or URL:\n" 508251881Speter " WC -> WC: copy and schedule for addition (with history)\n" 509251881Speter " WC -> URL: immediately commit a copy of WC to URL\n" 510251881Speter " URL -> WC: check out URL into WC, schedule for addition\n" 511251881Speter " URL -> URL: complete server-side copy; used to branch and tag\n" 512251881Speter " All the SRCs must be of the same type. When copying multiple sources,\n" 513251881Speter " they will be added as children of DST, which must be a directory.\n" 514251881Speter "\n" 515251881Speter " WARNING: For compatibility with previous versions of Subversion,\n" 516251881Speter " copies performed using two working copy paths (WC -> WC) will not\n" 517251881Speter " contact the repository. As such, they may not, by default, be able\n" 518251881Speter " to propagate merge tracking information from the source of the copy\n" 519251881Speter " to the destination.\n"), 520251881Speter {'r', 'q', opt_ignore_externals, opt_parents, SVN_CL__LOG_MSG_OPTIONS} }, 521251881Speter 522251881Speter { "delete", svn_cl__delete, {"del", "remove", "rm"}, N_ 523251881Speter ("Remove files and directories from version control.\n" 524251881Speter "usage: 1. delete PATH...\n" 525251881Speter " 2. delete URL...\n" 526251881Speter "\n" 527251881Speter " 1. Each item specified by a PATH is scheduled for deletion upon\n" 528251881Speter " the next commit. Files, and directories that have not been\n" 529251881Speter " committed, are immediately removed from the working copy\n" 530251881Speter " unless the --keep-local option is given.\n" 531251881Speter " PATHs that are, or contain, unversioned or modified items will\n" 532251881Speter " not be removed unless the --force or --keep-local option is given.\n" 533251881Speter "\n" 534251881Speter " 2. Each item specified by a URL is deleted from the repository\n" 535251881Speter " via an immediate commit.\n"), 536251881Speter {opt_force, 'q', opt_targets, SVN_CL__LOG_MSG_OPTIONS, opt_keep_local} }, 537251881Speter 538251881Speter { "diff", svn_cl__diff, {"di"}, N_ 539251881Speter ("Display local changes or differences between two revisions or paths.\n" 540251881Speter "usage: 1. diff\n" 541251881Speter " 2. diff [-c M | -r N[:M]] [TARGET[@REV]...]\n" 542251881Speter " 3. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \\\n" 543251881Speter " [PATH...]\n" 544251881Speter " 4. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]\n" 545251881Speter " 5. diff OLD-URL[@OLDREV] NEW-PATH[@NEWREV]\n" 546251881Speter " 6. diff OLD-PATH[@OLDREV] NEW-URL[@NEWREV]\n" 547251881Speter "\n" 548251881Speter " 1. Use just 'svn diff' to display local modifications in a working copy.\n" 549251881Speter "\n" 550251881Speter " 2. Display the changes made to TARGETs as they are seen in REV between\n" 551251881Speter " two revisions. TARGETs may be all working copy paths or all URLs.\n" 552251881Speter " If TARGETs are working copy paths, N defaults to BASE and M to the\n" 553251881Speter " working copy; if URLs, N must be specified and M defaults to HEAD.\n" 554251881Speter " The '-c M' option is equivalent to '-r N:M' where N = M-1.\n" 555251881Speter " Using '-c -M' does the reverse: '-r M:N' where N = M-1.\n" 556251881Speter "\n" 557251881Speter " 3. Display the differences between OLD-TGT as it was seen in OLDREV and\n" 558251881Speter " NEW-TGT as it was seen in NEWREV. PATHs, if given, are relative to\n" 559251881Speter " OLD-TGT and NEW-TGT and restrict the output to differences for those\n" 560251881Speter " paths. OLD-TGT and NEW-TGT may be working copy paths or URL[@REV].\n" 561251881Speter " NEW-TGT defaults to OLD-TGT if not specified. -r N makes OLDREV default\n" 562251881Speter " to N, -r N:M makes OLDREV default to N and NEWREV default to M.\n" 563251881Speter " If OLDREV or NEWREV are not specified, they default to WORKING for\n" 564251881Speter " working copy targets and to HEAD for URL targets.\n" 565251881Speter "\n" 566251881Speter " Either or both OLD-TGT and NEW-TGT may also be paths to unversioned\n" 567251881Speter " targets. Revisions cannot be specified for unversioned targets.\n" 568251881Speter " Both targets must be of the same node kind (file or directory).\n" 569251881Speter " Diffing unversioned targets against URL targets is not supported.\n" 570251881Speter "\n" 571251881Speter " 4. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'\n" 572251881Speter " 5. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-PATH[@NEWREV]'\n" 573251881Speter " 6. Shorthand for 'svn diff --old=OLD-PATH[@OLDREV] --new=NEW-URL[@NEWREV]'\n"), 574251881Speter {'r', 'c', opt_old_cmd, opt_new_cmd, 'N', opt_depth, opt_diff_cmd, 575251881Speter opt_internal_diff, 'x', opt_no_diff_added, opt_no_diff_deleted, 576251881Speter opt_ignore_properties, opt_properties_only, 577251881Speter opt_show_copies_as_adds, opt_notice_ancestry, opt_summarize, opt_changelist, 578251881Speter opt_force, opt_xml, opt_use_git_diff_format, opt_patch_compatible} }, 579251881Speter { "export", svn_cl__export, {0}, N_ 580251881Speter ("Create an unversioned copy of a tree.\n" 581251881Speter "usage: 1. export [-r REV] URL[@PEGREV] [PATH]\n" 582251881Speter " 2. export [-r REV] PATH1[@PEGREV] [PATH2]\n" 583251881Speter "\n" 584251881Speter " 1. Exports a clean directory tree from the repository specified by\n" 585251881Speter " URL, at revision REV if it is given, otherwise at HEAD, into\n" 586251881Speter " PATH. If PATH is omitted, the last component of the URL is used\n" 587251881Speter " for the local directory name.\n" 588251881Speter "\n" 589251881Speter " 2. Exports a clean directory tree from the working copy specified by\n" 590251881Speter " PATH1, at revision REV if it is given, otherwise at WORKING, into\n" 591251881Speter " PATH2. If PATH2 is omitted, the last component of the PATH1 is used\n" 592251881Speter " for the local directory name. If REV is not specified, all local\n" 593251881Speter " changes will be preserved. Files not under version control will\n" 594251881Speter " not be copied.\n" 595251881Speter "\n" 596251881Speter " If specified, PEGREV determines in which revision the target is first\n" 597251881Speter " looked up.\n"), 598251881Speter {'r', 'q', 'N', opt_depth, opt_force, opt_native_eol, opt_ignore_externals, 599251881Speter opt_ignore_keywords} }, 600251881Speter 601251881Speter { "help", svn_cl__help, {"?", "h"}, N_ 602251881Speter ("Describe the usage of this program or its subcommands.\n" 603251881Speter "usage: help [SUBCOMMAND...]\n"), 604251881Speter {0} }, 605251881Speter /* This command is also invoked if we see option "--help", "-h" or "-?". */ 606251881Speter 607251881Speter { "import", svn_cl__import, {0}, N_ 608251881Speter ("Commit an unversioned file or tree into the repository.\n" 609251881Speter "usage: import [PATH] URL\n" 610251881Speter "\n" 611251881Speter " Recursively commit a copy of PATH to URL.\n" 612251881Speter " If PATH is omitted '.' is assumed.\n" 613251881Speter " Parent directories are created as necessary in the repository.\n" 614251881Speter " If PATH is a directory, the contents of the directory are added\n" 615251881Speter " directly under URL.\n" 616251881Speter " Unversionable items such as device files and pipes are ignored\n" 617251881Speter " if --force is specified.\n"), 618251881Speter {'q', 'N', opt_depth, opt_autoprops, opt_force, opt_no_autoprops, 619251881Speter SVN_CL__LOG_MSG_OPTIONS, opt_no_ignore} }, 620251881Speter 621251881Speter { "info", svn_cl__info, {0}, N_ 622251881Speter ("Display information about a local or remote item.\n" 623251881Speter "usage: info [TARGET[@REV]...]\n" 624251881Speter "\n" 625251881Speter " Print information about each TARGET (default: '.').\n" 626251881Speter " TARGET may be either a working-copy path or URL. If specified, REV\n" 627251881Speter " determines in which revision the target is first looked up.\n"), 628251881Speter {'r', 'R', opt_depth, opt_targets, opt_incremental, opt_xml, opt_changelist} 629251881Speter }, 630251881Speter 631251881Speter { "list", svn_cl__list, {"ls"}, N_ 632251881Speter ("List directory entries in the repository.\n" 633251881Speter "usage: list [TARGET[@REV]...]\n" 634251881Speter "\n" 635251881Speter " List each TARGET file and the contents of each TARGET directory as\n" 636251881Speter " they exist in the repository. If TARGET is a working copy path, the\n" 637251881Speter " corresponding repository URL will be used. If specified, REV determines\n" 638251881Speter " in which revision the target is first looked up.\n" 639251881Speter "\n" 640251881Speter " The default TARGET is '.', meaning the repository URL of the current\n" 641251881Speter " working directory.\n" 642251881Speter "\n" 643251881Speter " With --verbose, the following fields will be shown for each item:\n" 644251881Speter "\n" 645251881Speter " Revision number of the last commit\n" 646251881Speter " Author of the last commit\n" 647251881Speter " If locked, the letter 'O'. (Use 'svn info URL' to see details)\n" 648251881Speter " Size (in bytes)\n" 649251881Speter " Date and time of the last commit\n"), 650251881Speter {'r', 'v', 'R', opt_depth, opt_incremental, opt_xml, 651251881Speter opt_include_externals }, 652251881Speter {{opt_include_externals, N_("include externals definitions")}} }, 653251881Speter 654251881Speter { "lock", svn_cl__lock, {0}, N_ 655251881Speter ("Lock working copy paths or URLs in the repository, so that\n" 656251881Speter "no other user can commit changes to them.\n" 657251881Speter "usage: lock TARGET...\n" 658251881Speter "\n" 659251881Speter " Use --force to steal the lock from another user or working copy.\n"), 660251881Speter { opt_targets, 'm', 'F', opt_force_log, opt_encoding, opt_force }, 661251881Speter {{'F', N_("read lock comment from file ARG")}, 662251881Speter {'m', N_("specify lock comment ARG")}, 663251881Speter {opt_force_log, N_("force validity of lock comment source")}} }, 664251881Speter 665251881Speter { "log", svn_cl__log, {0}, N_ 666251881Speter ("Show the log messages for a set of revision(s) and/or path(s).\n" 667251881Speter "usage: 1. log [PATH][@REV]\n" 668251881Speter " 2. log URL[@REV] [PATH...]\n" 669251881Speter "\n" 670251881Speter " 1. Print the log messages for the URL corresponding to PATH\n" 671251881Speter " (default: '.'). If specified, REV is the revision in which the\n" 672251881Speter " URL is first looked up, and the default revision range is REV:1.\n" 673251881Speter " If REV is not specified, the default revision range is BASE:1,\n" 674251881Speter " since the URL might not exist in the HEAD revision.\n" 675251881Speter "\n" 676251881Speter " 2. Print the log messages for the PATHs (default: '.') under URL.\n" 677251881Speter " If specified, REV is the revision in which the URL is first\n" 678251881Speter " looked up, and the default revision range is REV:1; otherwise,\n" 679251881Speter " the URL is looked up in HEAD, and the default revision range is\n" 680251881Speter " HEAD:1.\n" 681251881Speter "\n" 682251881Speter " Multiple '-c' or '-r' options may be specified (but not a\n" 683251881Speter " combination of '-c' and '-r' options), and mixing of forward and\n" 684251881Speter " reverse ranges is allowed.\n" 685251881Speter "\n" 686251881Speter " With -v, also print all affected paths with each log message.\n" 687251881Speter " With -q, don't print the log message body itself (note that this is\n" 688251881Speter " compatible with -v).\n" 689251881Speter "\n" 690251881Speter " Each log message is printed just once, even if more than one of the\n" 691251881Speter " affected paths for that revision were explicitly requested. Logs\n" 692251881Speter " follow copy history by default. Use --stop-on-copy to disable this\n" 693251881Speter " behavior, which can be useful for determining branchpoints.\n" 694251881Speter "\n" 695251881Speter " The --depth option is only valid in combination with the --diff option\n" 696251881Speter " and limits the scope of the displayed diff to the specified depth.\n" 697251881Speter "\n" 698251881Speter " If the --search option is used, log messages are displayed only if the\n" 699251881Speter " provided search pattern matches any of the author, date, log message\n" 700251881Speter " text (unless --quiet is used), or, if the --verbose option is also\n" 701251881Speter " provided, a changed path.\n" 702251881Speter " The search pattern may include \"glob syntax\" wildcards:\n" 703251881Speter " ? matches any single character\n" 704251881Speter " * matches a sequence of arbitrary characters\n" 705251881Speter " [abc] matches any of the characters listed inside the brackets\n" 706251881Speter " If multiple --search options are provided, a log message is shown if\n" 707251881Speter " it matches any of the provided search patterns. If the --search-and\n" 708251881Speter " option is used, that option's argument is combined with the pattern\n" 709251881Speter " from the previous --search or --search-and option, and a log message\n" 710251881Speter " is shown only if it matches the combined search pattern.\n" 711251881Speter " If --limit is used in combination with --search, --limit restricts the\n" 712251881Speter " number of log messages searched, rather than restricting the output\n" 713251881Speter " to a particular number of matching log messages.\n" 714251881Speter "\n" 715251881Speter " Examples:\n" 716251881Speter "\n" 717251881Speter " Show the latest 5 log messages for the current working copy\n" 718251881Speter " directory and display paths changed in each commit:\n" 719251881Speter " svn log -l 5 -v\n" 720251881Speter "\n" 721251881Speter " Show the log for bar.c as of revision 42:\n" 722251881Speter " svn log bar.c@42\n" 723251881Speter "\n" 724251881Speter " Show log messages and diffs for each commit to foo.c:\n" 725251881Speter " svn log --diff http://www.example.com/repo/project/foo.c\n" 726251881Speter " (Because the above command uses a full URL it does not require\n" 727251881Speter " a working copy.)\n" 728251881Speter "\n" 729251881Speter " Show log messages for the children foo.c and bar.c of the directory\n" 730251881Speter " '/trunk' as it appeared in revision 50, using the ^/ URL shortcut:\n" 731251881Speter " svn log ^/trunk@50 foo.c bar.c\n" 732251881Speter "\n" 733251881Speter " Show the log messages for any incoming changes to foo.c during the\n" 734251881Speter " next 'svn update':\n" 735251881Speter " svn log -r BASE:HEAD foo.c\n" 736251881Speter "\n" 737251881Speter " Show the log message for the revision in which /branches/foo\n" 738251881Speter " was created:\n" 739251881Speter " svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/foo\n"), 740251881Speter {'r', 'q', 'v', 'g', 'c', opt_targets, opt_stop_on_copy, opt_incremental, 741251881Speter opt_xml, 'l', opt_with_all_revprops, opt_with_no_revprops, opt_with_revprop, 742251881Speter opt_depth, opt_diff, opt_diff_cmd, opt_internal_diff, 'x', opt_search, 743251881Speter opt_search_and, }, 744251881Speter {{opt_with_revprop, N_("retrieve revision property ARG")}, 745251881Speter {'c', N_("the change made in revision ARG")}} }, 746251881Speter 747251881Speter { "merge", svn_cl__merge, {0}, N_ 748251881Speter ( /* For this large section, let's keep it unindented for easier 749251881Speter * viewing/editing. It has been vim-treated with a textwidth=75 and 'gw' 750251881Speter * (with quotes and newlines removed). */ 751251881Speter"Merge changes into a working copy.\n" 752251881Speter"usage: 1. merge SOURCE[@REV] [TARGET_WCPATH]\n" 753251881Speter" (the 'automatic' merge)\n" 754251881Speter" 2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]\n" 755251881Speter" (the 'cherry-pick' merge)\n" 756251881Speter" 3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]\n" 757251881Speter" (the '2-URL' merge)\n" 758251881Speter"\n" 759251881Speter" 1. This form, with one source path and no revision range, is called\n" 760251881Speter" an 'automatic' merge:\n" 761251881Speter"\n" 762251881Speter" svn merge SOURCE[@REV] [TARGET_WCPATH]\n" 763251881Speter"\n" 764251881Speter" The automatic merge is used for the 'sync' and 'reintegrate' merges\n" 765251881Speter" in the 'feature branch' pattern described below. It finds all the\n" 766251881Speter" changes on the source branch that have not already been merged to the\n" 767251881Speter" target branch, and merges them into the working copy. Merge tracking\n" 768251881Speter" is used to know which changes have already been merged.\n" 769251881Speter"\n" 770251881Speter" SOURCE specifies the branch from where the changes will be pulled, and\n" 771251881Speter" TARGET_WCPATH specifies a working copy of the target branch to which\n" 772251881Speter" the changes will be applied. Normally SOURCE and TARGET_WCPATH should\n" 773251881Speter" each correspond to the root of a branch. (If you want to merge only a\n" 774251881Speter" subtree, then the subtree path must be included in both SOURCE and\n" 775251881Speter" TARGET_WCPATH; this is discouraged, to avoid subtree mergeinfo.)\n" 776251881Speter"\n" 777251881Speter" SOURCE is usually a URL. The optional '@REV' specifies both the peg\n" 778251881Speter" revision of the URL and the latest revision that will be considered\n" 779251881Speter" for merging; if REV is not specified, the HEAD revision is assumed. If\n" 780251881Speter" SOURCE is a working copy path, the corresponding URL of the path is\n" 781251881Speter" used, and the default value of 'REV' is the base revision (usually the\n" 782251881Speter" revision last updated to).\n" 783251881Speter"\n" 784251881Speter" TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n" 785251881Speter" assumed. There are some special cases:\n" 786251881Speter"\n" 787251881Speter" - If SOURCE is a URL:\n" 788251881Speter"\n" 789251881Speter" - If the basename of the URL and the basename of '.' are the\n" 790251881Speter" same, then the differences are applied to '.'. Otherwise,\n" 791251881Speter" if a file with the same basename as that of the URL is found\n" 792251881Speter" within '.', then the differences are applied to that file.\n" 793251881Speter" In all other cases, the target defaults to '.'.\n" 794251881Speter"\n" 795251881Speter" - If SOURCE is a working copy path:\n" 796251881Speter"\n" 797251881Speter" - If the source is a file, then differences are applied to that\n" 798251881Speter" file (useful for reverse-merging earlier changes). Otherwise,\n" 799251881Speter" if the source is a directory, then the target defaults to '.'.\n" 800251881Speter"\n" 801251881Speter" In normal usage the working copy should be up to date, at a single\n" 802251881Speter" revision, with no local modifications and no switched subtrees.\n" 803251881Speter"\n" 804251881Speter" - The 'Feature Branch' Merging Pattern -\n" 805251881Speter"\n" 806251881Speter" In this commonly used work flow, known also as the 'development\n" 807251881Speter" branch' pattern, a developer creates a branch and commits a series of\n" 808251881Speter" changes that implement a new feature. The developer periodically\n" 809251881Speter" merges all the latest changes from the parent branch so as to keep the\n" 810251881Speter" development branch up to date with those changes. When the feature is\n" 811251881Speter" complete, the developer performs a merge from the feature branch to\n" 812251881Speter" the parent branch to re-integrate the changes.\n" 813251881Speter"\n" 814251881Speter" parent --+----------o------o-o-------------o--\n" 815251881Speter" \\ \\ \\ /\n" 816251881Speter" \\ merge merge merge\n" 817251881Speter" \\ \\ \\ /\n" 818251881Speter" feature +--o-o-------o----o-o----o-------\n" 819251881Speter"\n" 820251881Speter" A merge from the parent branch to the feature branch is called a\n" 821251881Speter" 'sync' or 'catch-up' merge, and a merge from the feature branch to the\n" 822251881Speter" parent branch is called a 'reintegrate' merge.\n" 823251881Speter"\n" 824251881Speter" - Sync Merge Example -\n" 825251881Speter" ............\n" 826251881Speter" . .\n" 827251881Speter" trunk --+------------L--------------R------\n" 828251881Speter" \\ \\\n" 829251881Speter" \\ |\n" 830251881Speter" \\ v\n" 831251881Speter" feature +------------------------o-----\n" 832251881Speter" r100 r200\n" 833251881Speter"\n" 834251881Speter" Subversion will locate all the changes on 'trunk' that have not yet\n" 835251881Speter" been merged into the 'feature' branch. In this case that is a single\n" 836251881Speter" range, r100:200. In the diagram above, L marks the left side (trunk@100)\n" 837251881Speter" and R marks the right side (trunk@200) of the merge source. The\n" 838251881Speter" difference between L and R will be applied to the target working copy\n" 839251881Speter" path. In this case, the working copy is a clean checkout of the entire\n" 840251881Speter" 'feature' branch.\n" 841251881Speter"\n" 842251881Speter" To perform this sync merge, have a clean working copy of the feature\n" 843251881Speter" branch and run the following command in its top-level directory:\n" 844251881Speter"\n" 845251881Speter" svn merge ^/trunk\n" 846251881Speter"\n" 847251881Speter" Note that the merge is now only in your local working copy and still\n" 848251881Speter" needs to be committed to the repository so that it can be seen by\n" 849251881Speter" others. You can review the changes and you may have to resolve\n" 850251881Speter" conflicts before you commit the merge.\n" 851251881Speter"\n" 852251881Speter" - Reintegrate Merge Example -\n" 853251881Speter"\n" 854251881Speter" The feature branch was last synced with trunk up to revision X. So the\n" 855251881Speter" difference between trunk@X and feature@HEAD contains the complete set\n" 856251881Speter" of changes that implement the feature, and no other changes. These\n" 857251881Speter" changes are applied to trunk.\n" 858251881Speter"\n" 859251881Speter" rW rX\n" 860251881Speter" trunk ------+--------------------L------------------o\n" 861251881Speter" \\ . ^\n" 862251881Speter" \\ ............. /\n" 863251881Speter" \\ . /\n" 864251881Speter" feature +--------------------------------R\n" 865251881Speter"\n" 866251881Speter" In the diagram above, L marks the left side (trunk@X) and R marks the\n" 867251881Speter" right side (feature@HEAD) of the merge. The difference between the\n" 868251881Speter" left and right side is merged into trunk, the target.\n" 869251881Speter"\n" 870251881Speter" To perform the merge, have a clean working copy of trunk and run the\n" 871251881Speter" following command in its top-level directory:\n" 872251881Speter"\n" 873251881Speter" svn merge ^/feature\n" 874251881Speter"\n" 875251881Speter" To prevent unnecessary merge conflicts, a reintegrate merge requires\n" 876251881Speter" that TARGET_WCPATH is not a mixed-revision working copy, has no local\n" 877251881Speter" modifications, and has no switched subtrees.\n" 878251881Speter"\n" 879251881Speter" A reintegrate merge also requires that the source branch is coherently\n" 880251881Speter" synced with the target -- in the above example, this means that all\n" 881251881Speter" revisions between the branch point W and the last merged revision X\n" 882251881Speter" are merged to the feature branch, so that there are no unmerged\n" 883251881Speter" revisions in-between.\n" 884251881Speter"\n" 885251881Speter"\n" 886251881Speter" 2. This form is called a 'cherry-pick' merge:\n" 887251881Speter"\n" 888251881Speter" svn merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]\n" 889251881Speter"\n" 890251881Speter" A cherry-pick merge is used to merge specific revisions (or revision\n" 891251881Speter" ranges) from one branch to another. By default, this uses merge\n" 892251881Speter" tracking to automatically skip any revisions that have already been\n" 893251881Speter" merged to the target; you can use the --ignore-ancestry option to\n" 894251881Speter" disable such skipping.\n" 895251881Speter"\n" 896251881Speter" SOURCE is usually a URL. The optional '@REV' specifies only the peg\n" 897251881Speter" revision of the URL and does not affect the merge range; if REV is not\n" 898251881Speter" specified, the HEAD revision is assumed. If SOURCE is a working copy\n" 899251881Speter" path, the corresponding URL of the path is used, and the default value\n" 900251881Speter" of 'REV' is the base revision (usually the revision last updated to).\n" 901251881Speter"\n" 902251881Speter" TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n" 903251881Speter" assumed. The special cases noted above in the 'automatic' merge form\n" 904251881Speter" also apply here.\n" 905251881Speter"\n" 906251881Speter" The revision ranges to be merged are specified by the '-r' and/or '-c'\n" 907251881Speter" options. '-r N:M' refers to the difference in the history of the\n" 908251881Speter" source branch between revisions N and M. You can use '-c M' to merge\n" 909251881Speter" single revisions: '-c M' is equivalent to '-r <M-1>:M'. Each such\n" 910251881Speter" difference is applied to TARGET_WCPATH.\n" 911251881Speter"\n" 912251881Speter" If the mergeinfo in TARGET_WCPATH indicates that revisions within the\n" 913251881Speter" range were already merged, changes made in those revisions are not\n" 914251881Speter" merged again. If needed, the range is broken into multiple sub-ranges,\n" 915251881Speter" and each sub-range is merged separately.\n" 916251881Speter"\n" 917251881Speter" A 'reverse range' can be used to undo changes. For example, when\n" 918251881Speter" source and target refer to the same branch, a previously committed\n" 919251881Speter" revision can be 'undone'. In a reverse range, N is greater than M in\n" 920251881Speter" '-r N:M', or the '-c' option is used with a negative number: '-c -M'\n" 921251881Speter" is equivalent to '-r M:<M-1>'. Undoing changes like this is also known\n" 922251881Speter" as performing a 'reverse merge'.\n" 923251881Speter"\n" 924251881Speter" Multiple '-c' and/or '-r' options may be specified and mixing of\n" 925251881Speter" forward and reverse ranges is allowed.\n" 926251881Speter"\n" 927251881Speter" - Cherry-pick Merge Example -\n" 928251881Speter"\n" 929251881Speter" A bug has been fixed on trunk in revision 50. This fix needs to\n" 930251881Speter" be merged from trunk onto the release branch.\n" 931251881Speter"\n" 932251881Speter" 1.x-release +-----------------------o-----\n" 933251881Speter" / ^\n" 934251881Speter" / |\n" 935251881Speter" / |\n" 936251881Speter" trunk ------+--------------------------LR-----\n" 937251881Speter" r50\n" 938251881Speter"\n" 939251881Speter" In the above diagram, L marks the left side (trunk@49) and R marks the\n" 940251881Speter" right side (trunk@50) of the merge. The difference between the left\n" 941251881Speter" and right side is applied to the target working copy path.\n" 942251881Speter"\n" 943251881Speter" Note that the difference between revision 49 and 50 is exactly those\n" 944251881Speter" changes that were committed in revision 50, not including changes\n" 945251881Speter" committed in revision 49.\n" 946251881Speter"\n" 947251881Speter" To perform the merge, have a clean working copy of the release branch\n" 948251881Speter" and run the following command in its top-level directory; remember\n" 949251881Speter" that the default target is '.':\n" 950251881Speter"\n" 951251881Speter" svn merge -c50 ^/trunk\n" 952251881Speter"\n" 953251881Speter" You can also cherry-pick several revisions and/or revision ranges:\n" 954251881Speter"\n" 955251881Speter" svn merge -c50,54,60 -r65:68 ^/trunk\n" 956251881Speter"\n" 957251881Speter"\n" 958251881Speter" 3. This form is called a '2-URL merge':\n" 959251881Speter"\n" 960251881Speter" svn merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]\n" 961251881Speter"\n" 962251881Speter" You should use this merge variant only if the other variants do not\n" 963251881Speter" apply to your situation, as this variant can be quite complex to\n" 964251881Speter" master.\n" 965251881Speter"\n" 966251881Speter" Two source URLs are specified, identifying two trees on the same\n" 967251881Speter" branch or on different branches. The trees are compared and the\n" 968251881Speter" difference from SOURCE1@REV1 to SOURCE2@REV2 is applied to the\n" 969251881Speter" working copy of the target branch at TARGET_WCPATH. The target\n" 970251881Speter" branch may be the same as one or both sources, or different again.\n" 971251881Speter" The three branches involved can be completely unrelated.\n" 972251881Speter"\n" 973251881Speter" TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n" 974251881Speter" assumed. The special cases noted above in the 'automatic' merge form\n" 975251881Speter" also apply here.\n" 976251881Speter"\n" 977251881Speter" SOURCE1 and/or SOURCE2 can also be specified as a working copy path,\n" 978251881Speter" in which case the merge source URL is derived from the working copy.\n" 979251881Speter"\n" 980251881Speter" - 2-URL Merge Example -\n" 981251881Speter"\n" 982251881Speter" Two features have been developed on separate branches called 'foo' and\n" 983251881Speter" 'bar'. It has since become clear that 'bar' should be combined with\n" 984251881Speter" the 'foo' branch for further development before reintegration.\n" 985251881Speter"\n" 986251881Speter" Although both feature branches originate from trunk, they are not\n" 987251881Speter" directly related -- one is not a direct copy of the other. A 2-URL\n" 988251881Speter" merge is necessary.\n" 989251881Speter"\n" 990251881Speter" The 'bar' branch has been synced with trunk up to revision 500.\n" 991251881Speter" (If this revision number is not known, it can be located using the\n" 992251881Speter" 'svn log' and/or 'svn mergeinfo' commands.)\n" 993251881Speter" The difference between trunk@500 and bar@HEAD contains the complete\n" 994251881Speter" set of changes related to feature 'bar', and no other changes. These\n" 995251881Speter" changes are applied to the 'foo' branch.\n" 996251881Speter"\n" 997251881Speter" foo +-----------------------------------o\n" 998251881Speter" / ^\n" 999251881Speter" / /\n" 1000251881Speter" / r500 /\n" 1001251881Speter" trunk ------+------+-----------------L---------> /\n" 1002251881Speter" \\ . /\n" 1003251881Speter" \\ ............ /\n" 1004251881Speter" \\ . /\n" 1005251881Speter" bar +-----------------------------------R\n" 1006251881Speter"\n" 1007251881Speter" In the diagram above, L marks the left side (trunk@500) and R marks\n" 1008251881Speter" the right side (bar@HEAD) of the merge. The difference between the\n" 1009251881Speter" left and right side is applied to the target working copy path, in\n" 1010251881Speter" this case a working copy of the 'foo' branch.\n" 1011251881Speter"\n" 1012251881Speter" To perform the merge, have a clean working copy of the 'foo' branch\n" 1013251881Speter" and run the following command in its top-level directory:\n" 1014251881Speter"\n" 1015251881Speter" svn merge ^/trunk@500 ^/bar\n" 1016251881Speter"\n" 1017251881Speter" The exact changes applied by a 2-URL merge can be previewed with svn's\n" 1018251881Speter" diff command, which is a good idea to verify if you do not have the\n" 1019251881Speter" luxury of a clean working copy to merge to. In this case:\n" 1020251881Speter"\n" 1021251881Speter" svn diff ^/trunk@500 ^/bar@HEAD\n" 1022251881Speter"\n" 1023251881Speter"\n" 1024251881Speter" The following applies to all types of merges:\n" 1025251881Speter"\n" 1026251881Speter" To prevent unnecessary merge conflicts, svn merge requires that\n" 1027251881Speter" TARGET_WCPATH is not a mixed-revision working copy. Running 'svn update'\n" 1028251881Speter" before starting a merge ensures that all items in the working copy are\n" 1029251881Speter" based on the same revision.\n" 1030251881Speter"\n" 1031251881Speter" If possible, you should have no local modifications in the merge's target\n" 1032251881Speter" working copy prior to the merge, to keep things simpler. It will be\n" 1033251881Speter" easier to revert the merge and to understand the branch's history.\n" 1034251881Speter"\n" 1035251881Speter" Switched sub-paths should also be avoided during merging, as they may\n" 1036251881Speter" cause incomplete merges and create subtree mergeinfo.\n" 1037251881Speter"\n" 1038251881Speter" For each merged item a line will be printed with characters reporting the\n" 1039251881Speter" action taken. These characters have the following meaning:\n" 1040251881Speter"\n" 1041251881Speter" A Added\n" 1042251881Speter" D Deleted\n" 1043251881Speter" U Updated\n" 1044251881Speter" C Conflict\n" 1045251881Speter" G Merged\n" 1046251881Speter" E Existed\n" 1047251881Speter" R Replaced\n" 1048251881Speter"\n" 1049251881Speter" Characters in the first column report about the item itself.\n" 1050251881Speter" Characters in the second column report about properties of the item.\n" 1051251881Speter" A 'C' in the third column indicates a tree conflict, while a 'C' in\n" 1052251881Speter" the first and second columns indicate textual conflicts in files\n" 1053251881Speter" and in property values, respectively.\n" 1054251881Speter"\n" 1055251881Speter" - Merge Tracking -\n" 1056251881Speter"\n" 1057251881Speter" Subversion uses the svn:mergeinfo property to track merge history. This\n" 1058251881Speter" property is considered at the start of a merge to determine what to merge\n" 1059251881Speter" and it is updated at the conclusion of the merge to describe the merge\n" 1060251881Speter" that took place. Mergeinfo is used only if the two sources are on the\n" 1061251881Speter" same line of history -- if the first source is an ancestor of the second,\n" 1062251881Speter" or vice-versa (i.e. if one has originally been created by copying the\n" 1063251881Speter" other). This is verified and enforced when using sync merges and\n" 1064251881Speter" reintegrate merges.\n" 1065251881Speter"\n" 1066251881Speter" The --ignore-ancestry option prevents merge tracking and thus ignores\n" 1067251881Speter" mergeinfo, neither considering it nor recording it.\n" 1068251881Speter"\n" 1069251881Speter" - Merging from foreign repositories -\n" 1070251881Speter"\n" 1071251881Speter" Subversion does support merging from foreign repositories.\n" 1072251881Speter" While all merge source URLs must point to the same repository, the merge\n" 1073251881Speter" target working copy may come from a different repository than the source.\n" 1074251881Speter" However, there are some caveats. Most notably, copies made in the\n" 1075251881Speter" merge source will be transformed into plain additions in the merge\n" 1076251881Speter" target. Also, merge-tracking is not supported for merges from foreign\n" 1077251881Speter" repositories.\n"), 1078251881Speter {'r', 'c', 'N', opt_depth, 'q', opt_force, opt_dry_run, opt_merge_cmd, 1079251881Speter opt_record_only, 'x', opt_ignore_ancestry, opt_accept, opt_reintegrate, 1080251881Speter opt_allow_mixed_revisions, 'v'} }, 1081251881Speter 1082251881Speter { "mergeinfo", svn_cl__mergeinfo, {0}, N_ 1083251881Speter ("Display merge-related information.\n" 1084251881Speter "usage: 1. mergeinfo SOURCE[@REV] [TARGET[@REV]]\n" 1085251881Speter " 2. mergeinfo --show-revs=WHICH SOURCE[@REV] [TARGET[@REV]]\n" 1086251881Speter "\n" 1087251881Speter " 1. Summarize the history of merging between SOURCE and TARGET. The graph\n" 1088251881Speter " shows, from left to right:\n" 1089251881Speter " the youngest common ancestor of the branches;\n" 1090251881Speter " the latest full merge in either direction, and thus the common base\n" 1091251881Speter " that will be used for the next automatic merge;\n" 1092251881Speter " the repository path and revision number of the tip of each branch.\n" 1093251881Speter "\n" 1094251881Speter " 2. Print the revision numbers on SOURCE that have been merged to TARGET\n" 1095251881Speter " (with --show-revs=merged), or that have not been merged to TARGET\n" 1096251881Speter " (with --show-revs=eligible). Print only revisions in which there was\n" 1097251881Speter " at least one change in SOURCE.\n" 1098251881Speter "\n" 1099251881Speter " If --revision (-r) is provided, filter the displayed information to\n" 1100251881Speter " show only that which is associated with the revisions within the\n" 1101251881Speter " specified range. Revision numbers, dates, and the 'HEAD' keyword are\n" 1102251881Speter " valid range values.\n" 1103251881Speter "\n" 1104251881Speter " SOURCE and TARGET are the source and target branch URLs, respectively.\n" 1105251881Speter " (If a WC path is given, the corresponding base URL is used.) The default\n" 1106251881Speter " TARGET is the current working directory ('.'). REV specifies the revision\n" 1107251881Speter " to be considered the tip of the branch; the default for SOURCE is HEAD,\n" 1108251881Speter " and the default for TARGET is HEAD for a URL or BASE for a WC path.\n" 1109251881Speter "\n" 1110251881Speter " The depth can be 'empty' or 'infinity'; the default is 'empty'.\n"), 1111251881Speter {'r', 'R', opt_depth, opt_show_revs} }, 1112251881Speter 1113251881Speter { "mkdir", svn_cl__mkdir, {0}, N_ 1114251881Speter ("Create a new directory under version control.\n" 1115251881Speter "usage: 1. mkdir PATH...\n" 1116251881Speter " 2. mkdir URL...\n" 1117251881Speter "\n" 1118251881Speter " Create version controlled directories.\n" 1119251881Speter "\n" 1120251881Speter " 1. Each directory specified by a working copy PATH is created locally\n" 1121251881Speter " and scheduled for addition upon the next commit.\n" 1122251881Speter "\n" 1123251881Speter " 2. Each directory specified by a URL is created in the repository via\n" 1124251881Speter " an immediate commit.\n" 1125251881Speter "\n" 1126251881Speter " In both cases, all the intermediate directories must already exist,\n" 1127251881Speter " unless the --parents option is given.\n"), 1128251881Speter {'q', opt_parents, SVN_CL__LOG_MSG_OPTIONS} }, 1129251881Speter 1130251881Speter { "move", svn_cl__move, {"mv", "rename", "ren"}, N_ 1131251881Speter ("Move (rename) an item in a working copy or repository.\n" 1132251881Speter "usage: move SRC... DST\n" 1133251881Speter "\n" 1134251881Speter " SRC and DST can both be working copy (WC) paths or URLs:\n" 1135251881Speter " WC -> WC: move an item in a working copy, as a local change to\n" 1136251881Speter " be committed later (with or without further changes)\n" 1137251881Speter " URL -> URL: move an item in the repository directly, immediately\n" 1138251881Speter " creating a new revision in the repository\n" 1139251881Speter " All the SRCs must be of the same type. When moving multiple sources,\n" 1140251881Speter " they will be added as children of DST, which must be a directory.\n" 1141251881Speter "\n" 1142251881Speter " SRC and DST of WC -> WC moves must be committed in the same revision.\n" 1143251881Speter " Furthermore, WC -> WC moves will refuse to move a mixed-revision subtree.\n" 1144251881Speter " To avoid unnecessary conflicts, it is recommended to run 'svn update'\n" 1145251881Speter " to update the subtree to a single revision before moving it.\n" 1146251881Speter " The --allow-mixed-revisions option is provided for backward compatibility.\n" 1147251881Speter "\n" 1148251881Speter " The --revision option has no use and is deprecated.\n"), 1149251881Speter {'r', 'q', opt_force, opt_parents, opt_allow_mixed_revisions, 1150251881Speter SVN_CL__LOG_MSG_OPTIONS} }, 1151251881Speter 1152251881Speter { "patch", svn_cl__patch, {0}, N_ 1153251881Speter ("Apply a patch to a working copy.\n" 1154251881Speter "usage: patch PATCHFILE [WCPATH]\n" 1155251881Speter "\n" 1156251881Speter " Apply a unidiff patch in PATCHFILE to the working copy WCPATH.\n" 1157251881Speter " If WCPATH is omitted, '.' is assumed.\n" 1158251881Speter "\n" 1159251881Speter " A unidiff patch suitable for application to a working copy can be\n" 1160251881Speter " produced with the 'svn diff' command or third-party diffing tools.\n" 1161251881Speter " Any non-unidiff content of PATCHFILE is ignored, except for Subversion\n" 1162251881Speter " property diffs as produced by 'svn diff'.\n" 1163251881Speter "\n" 1164251881Speter " Changes listed in the patch will either be applied or rejected.\n" 1165251881Speter " If a change does not match at its exact line offset, it may be applied\n" 1166251881Speter " earlier or later in the file if a match is found elsewhere for the\n" 1167251881Speter " surrounding lines of context provided by the patch.\n" 1168251881Speter " A change may also be applied with fuzz, which means that one\n" 1169251881Speter " or more lines of context are ignored when matching the change.\n" 1170251881Speter " If no matching context can be found for a change, the change conflicts\n" 1171251881Speter " and will be written to a reject file with the extension .svnpatch.rej.\n" 1172251881Speter "\n" 1173251881Speter " For each patched file a line will be printed with characters reporting\n" 1174251881Speter " the action taken. These characters have the following meaning:\n" 1175251881Speter "\n" 1176251881Speter " A Added\n" 1177251881Speter " D Deleted\n" 1178251881Speter " U Updated\n" 1179251881Speter " C Conflict\n" 1180251881Speter " G Merged (with local uncommitted changes)\n" 1181251881Speter "\n" 1182251881Speter " Changes applied with an offset or fuzz are reported on lines starting\n" 1183251881Speter " with the '>' symbol. You should review such changes carefully.\n" 1184251881Speter "\n" 1185251881Speter " If the patch removes all content from a file, that file is scheduled\n" 1186251881Speter " for deletion. If the patch creates a new file, that file is scheduled\n" 1187251881Speter " for addition. Use 'svn revert' to undo deletions and additions you\n" 1188251881Speter " do not agree with.\n" 1189251881Speter "\n" 1190251881Speter " Hint: If the patch file was created with Subversion, it will contain\n" 1191251881Speter " the number of a revision N the patch will cleanly apply to\n" 1192251881Speter " (look for lines like '--- foo/bar.txt (revision N)').\n" 1193251881Speter " To avoid rejects, first update to the revision N using\n" 1194251881Speter " 'svn update -r N', apply the patch, and then update back to the\n" 1195251881Speter " HEAD revision. This way, conflicts can be resolved interactively.\n" 1196251881Speter ), 1197251881Speter {'q', opt_dry_run, opt_strip, opt_reverse_diff, 1198251881Speter opt_ignore_whitespace} }, 1199251881Speter 1200251881Speter { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_ 1201251881Speter ("Remove a property from files, dirs, or revisions.\n" 1202251881Speter "usage: 1. propdel PROPNAME [PATH...]\n" 1203251881Speter " 2. propdel PROPNAME --revprop -r REV [TARGET]\n" 1204251881Speter "\n" 1205251881Speter " 1. Removes versioned props in working copy.\n" 1206251881Speter " 2. Removes unversioned remote prop on repos revision.\n" 1207251881Speter " TARGET only determines which repository to access.\n"), 1208251881Speter {'q', 'R', opt_depth, 'r', opt_revprop, opt_changelist} }, 1209251881Speter 1210251881Speter { "propedit", svn_cl__propedit, {"pedit", "pe"}, N_ 1211251881Speter ("Edit a property with an external editor.\n" 1212251881Speter "usage: 1. propedit PROPNAME TARGET...\n" 1213251881Speter " 2. propedit PROPNAME --revprop -r REV [TARGET]\n" 1214251881Speter "\n" 1215251881Speter " 1. Edits versioned prop in working copy or repository.\n" 1216251881Speter " 2. Edits unversioned remote prop on repos revision.\n" 1217251881Speter " TARGET only determines which repository to access.\n" 1218251881Speter "\n" 1219251881Speter " See 'svn help propset' for more on setting properties.\n"), 1220251881Speter {'r', opt_revprop, SVN_CL__LOG_MSG_OPTIONS, opt_force} }, 1221251881Speter 1222251881Speter { "propget", svn_cl__propget, {"pget", "pg"}, N_ 1223251881Speter ("Print the value of a property on files, dirs, or revisions.\n" 1224251881Speter "usage: 1. propget PROPNAME [TARGET[@REV]...]\n" 1225251881Speter " 2. propget PROPNAME --revprop -r REV [TARGET]\n" 1226251881Speter "\n" 1227251881Speter " 1. Prints versioned props. If specified, REV determines in which\n" 1228251881Speter " revision the target is first looked up.\n" 1229251881Speter " 2. Prints unversioned remote prop on repos revision.\n" 1230251881Speter " TARGET only determines which repository to access.\n" 1231251881Speter "\n" 1232251881Speter " With --verbose, the target path and the property name are printed on\n" 1233251881Speter " separate lines before each value, like 'svn proplist --verbose'.\n" 1234251881Speter " Otherwise, if there is more than one TARGET or a depth other than\n" 1235251881Speter " 'empty', the target path is printed on the same line before each value.\n" 1236251881Speter "\n" 1237251881Speter " By default, an extra newline is printed after the property value so that\n" 1238251881Speter " the output looks pretty. With a single TARGET and depth 'empty', you can\n" 1239251881Speter " use the --strict option to disable this (useful when redirecting a binary\n" 1240251881Speter " property value to a file, for example).\n"), 1241251881Speter {'v', 'R', opt_depth, 'r', opt_revprop, opt_strict, opt_xml, 1242251881Speter opt_changelist, opt_show_inherited_props }, 1243251881Speter {{'v', N_("print path, name and value on separate lines")}, 1244251881Speter {opt_strict, N_("don't print an extra newline")}} }, 1245251881Speter 1246251881Speter { "proplist", svn_cl__proplist, {"plist", "pl"}, N_ 1247251881Speter ("List all properties on files, dirs, or revisions.\n" 1248251881Speter "usage: 1. proplist [TARGET[@REV]...]\n" 1249251881Speter " 2. proplist --revprop -r REV [TARGET]\n" 1250251881Speter "\n" 1251251881Speter " 1. Lists versioned props. If specified, REV determines in which\n" 1252251881Speter " revision the target is first looked up.\n" 1253251881Speter " 2. Lists unversioned remote props on repos revision.\n" 1254251881Speter " TARGET only determines which repository to access.\n" 1255251881Speter "\n" 1256251881Speter " With --verbose, the property values are printed as well, like 'svn propget\n" 1257251881Speter " --verbose'. With --quiet, the paths are not printed.\n"), 1258251881Speter {'v', 'R', opt_depth, 'r', 'q', opt_revprop, opt_xml, opt_changelist, 1259251881Speter opt_show_inherited_props }, 1260251881Speter {{'v', N_("print path, name and value on separate lines")}, 1261251881Speter {'q', N_("don't print the path")}} }, 1262251881Speter 1263251881Speter { "propset", svn_cl__propset, {"pset", "ps"}, N_ 1264251881Speter ("Set the value of a property on files, dirs, or revisions.\n" 1265251881Speter "usage: 1. propset PROPNAME PROPVAL PATH...\n" 1266251881Speter " 2. propset PROPNAME --revprop -r REV PROPVAL [TARGET]\n" 1267251881Speter "\n" 1268251881Speter " 1. Changes a versioned file or directory property in a working copy.\n" 1269251881Speter " 2. Changes an unversioned property on a repository revision.\n" 1270251881Speter " (TARGET only determines which repository to access.)\n" 1271251881Speter "\n" 1272251881Speter " The value may be provided with the --file option instead of PROPVAL.\n" 1273251881Speter "\n" 1274251881Speter " Property names starting with 'svn:' are reserved. Subversion recognizes\n" 1275251881Speter " the following special versioned properties on a file:\n" 1276251881Speter " svn:keywords - Keywords to be expanded. Valid keywords are:\n" 1277251881Speter " URL, HeadURL - The URL for the head version of the file.\n" 1278251881Speter " Author, LastChangedBy - The last person to modify the file.\n" 1279251881Speter " Date, LastChangedDate - The date/time the file was last modified.\n" 1280251881Speter " Rev, Revision, - The last revision the file changed.\n" 1281251881Speter " LastChangedRevision\n" 1282251881Speter " Id - A compressed summary of the previous four.\n" 1283251881Speter " Header - Similar to Id but includes the full URL.\n" 1284251881Speter "\n" 1285251881Speter " Custom keywords can be defined with a format string separated from\n" 1286251881Speter " the keyword name with '='. Valid format substitutions are:\n" 1287251881Speter " %a - The author of the revision given by %r.\n" 1288251881Speter " %b - The basename of the URL of the file.\n" 1289251881Speter " %d - Short format of the date of the revision given by %r.\n" 1290251881Speter " %D - Long format of the date of the revision given by %r.\n" 1291251881Speter " %P - The file's path, relative to the repository root.\n" 1292251881Speter " %r - The number of the revision which last changed the file.\n" 1293251881Speter " %R - The URL to the root of the repository.\n" 1294251881Speter " %u - The URL of the file.\n" 1295251881Speter " %_ - A space (keyword definitions cannot contain a literal space).\n" 1296251881Speter " %% - A literal '%'.\n" 1297251881Speter " %H - Equivalent to %P%_%r%_%d%_%a.\n" 1298251881Speter " %I - Equivalent to %b%_%r%_%d%_%a.\n" 1299251881Speter " Example custom keyword definition: MyKeyword=%r%_%a%_%P\n" 1300251881Speter " Once a custom keyword has been defined for a file, it can be used\n" 1301251881Speter " within the file like any other keyword: $MyKeyword$\n" 1302251881Speter "\n" 1303251881Speter " svn:executable - If present, make the file executable. Use\n" 1304251881Speter " 'svn propdel svn:executable PATH...' to clear.\n" 1305251881Speter " svn:eol-style - One of 'native', 'LF', 'CR', 'CRLF'.\n" 1306251881Speter " svn:mime-type - The mimetype of the file. Used to determine\n" 1307251881Speter " whether to merge the file, and how to serve it from Apache.\n" 1308251881Speter " A mimetype beginning with 'text/' (or an absent mimetype) is\n" 1309251881Speter " treated as text. Anything else is treated as binary.\n" 1310251881Speter " svn:needs-lock - If present, indicates that the file should be locked\n" 1311251881Speter " before it is modified. Makes the working copy file read-only\n" 1312251881Speter " when it is not locked. Use 'svn propdel svn:needs-lock PATH...'\n" 1313251881Speter " to clear.\n" 1314251881Speter "\n" 1315251881Speter " Subversion recognizes the following special versioned properties on a\n" 1316251881Speter " directory:\n" 1317251881Speter " svn:ignore - A list of file glob patterns to ignore, one per line.\n" 1318251881Speter " svn:global-ignores - Like svn:ignore, but inheritable.\n" 1319251881Speter " svn:externals - A list of module specifiers, one per line, in the\n" 1320251881Speter " following format similar to the syntax of 'svn checkout':\n" 1321251881Speter " [-r REV] URL[@PEG] LOCALPATH\n" 1322251881Speter " Example:\n" 1323251881Speter " http://example.com/repos/zig foo/bar\n" 1324251881Speter " The LOCALPATH is relative to the directory having this property.\n" 1325251881Speter " To pin the external to a known revision, specify the optional REV:\n" 1326251881Speter " -r25 http://example.com/repos/zig foo/bar\n" 1327251881Speter " To unambiguously identify an element at a path which may have been\n" 1328251881Speter " subsequently deleted or renamed, specify the optional PEG revision:\n" 1329251881Speter " -r25 http://example.com/repos/zig@42 foo/bar\n" 1330251881Speter " The URL may be a full URL or a relative URL starting with one of:\n" 1331251881Speter " ../ to the parent directory of the extracted external\n" 1332251881Speter " ^/ to the repository root\n" 1333251881Speter " / to the server root\n" 1334251881Speter " // to the URL scheme\n" 1335251881Speter " Use of the following format is discouraged but is supported for\n" 1336251881Speter " interoperability with Subversion 1.4 and earlier clients:\n" 1337251881Speter " LOCALPATH [-r PEG] URL\n" 1338251881Speter " The ambiguous format 'relative_path relative_path' is taken as\n" 1339251881Speter " 'relative_url relative_path' with peg revision support.\n" 1340251881Speter " Lines starting with a '#' character are ignored.\n"), 1341251881Speter {'F', opt_encoding, 'q', 'r', opt_targets, 'R', opt_depth, opt_revprop, 1342251881Speter opt_force, opt_changelist }, 1343251881Speter {{'F', N_("read property value from file ARG")}} }, 1344251881Speter 1345251881Speter { "relocate", svn_cl__relocate, {0}, N_ 1346251881Speter ("Relocate the working copy to point to a different repository root URL.\n" 1347251881Speter "usage: 1. relocate FROM-PREFIX TO-PREFIX [PATH...]\n" 1348251881Speter " 2. relocate TO-URL [PATH]\n" 1349251881Speter "\n" 1350251881Speter " Rewrite working copy URL metadata to reflect a syntactic change only.\n" 1351251881Speter " This is used when a repository's root URL changes (such as a scheme\n" 1352251881Speter " or hostname change) but your working copy still reflects the same\n" 1353251881Speter " directory within the same repository.\n" 1354251881Speter "\n" 1355251881Speter " 1. FROM-PREFIX and TO-PREFIX are initial substrings of the working\n" 1356251881Speter " copy's current and new URLs, respectively. (You may specify the\n" 1357251881Speter " complete old and new URLs if you wish.) Use 'svn info' to determine\n" 1358251881Speter " the current working copy URL.\n" 1359251881Speter "\n" 1360251881Speter " 2. TO-URL is the (complete) new repository URL to use for PATH.\n" 1361251881Speter "\n" 1362251881Speter " Examples:\n" 1363251881Speter " svn relocate http:// svn:// project1 project2\n" 1364251881Speter " svn relocate http://www.example.com/repo/project \\\n" 1365251881Speter " svn://svn.example.com/repo/project\n"), 1366251881Speter {opt_ignore_externals} }, 1367251881Speter 1368251881Speter { "resolve", svn_cl__resolve, {0}, N_ 1369251881Speter ("Resolve conflicts on working copy files or directories.\n" 1370251881Speter "usage: resolve [PATH...]\n" 1371251881Speter "\n" 1372251881Speter " By default, perform interactive conflict resolution on PATH.\n" 1373251881Speter " In this mode, the command is recursive by default (depth 'infinity').\n" 1374251881Speter "\n" 1375251881Speter " The --accept=ARG option prevents interactive prompting and forces\n" 1376251881Speter " conflicts on PATH to be resolved in the manner specified by ARG.\n" 1377251881Speter " In this mode, the command is not recursive by default (depth 'empty').\n"), 1378251881Speter {opt_targets, 'R', opt_depth, 'q', opt_accept}, 1379251881Speter {{opt_accept, N_("specify automatic conflict resolution source\n" 1380251881Speter " " 1381251881Speter "('base', 'working', 'mine-conflict',\n" 1382251881Speter " " 1383251881Speter "'theirs-conflict', 'mine-full', 'theirs-full')")}} }, 1384251881Speter 1385251881Speter { "resolved", svn_cl__resolved, {0}, N_ 1386251881Speter ("Remove 'conflicted' state on working copy files or directories.\n" 1387251881Speter "usage: resolved PATH...\n" 1388251881Speter "\n" 1389251881Speter " Note: this subcommand does not semantically resolve conflicts or\n" 1390251881Speter " remove conflict markers; it merely removes the conflict-related\n" 1391251881Speter " artifact files and allows PATH to be committed again. It has been\n" 1392251881Speter " deprecated in favor of running 'svn resolve --accept working'.\n"), 1393251881Speter {opt_targets, 'R', opt_depth, 'q'} }, 1394251881Speter 1395251881Speter { "revert", svn_cl__revert, {0}, N_ 1396251881Speter ("Restore pristine working copy state (undo local changes).\n" 1397251881Speter "usage: revert PATH...\n" 1398251881Speter "\n" 1399251881Speter " Revert changes in the working copy at or within PATH, and remove\n" 1400251881Speter " conflict markers as well, if any.\n" 1401251881Speter "\n" 1402251881Speter " This subcommand does not revert already committed changes.\n" 1403251881Speter " For information about undoing already committed changes, search\n" 1404251881Speter " the output of 'svn help merge' for 'undo'.\n"), 1405251881Speter {opt_targets, 'R', opt_depth, 'q', opt_changelist} }, 1406251881Speter 1407251881Speter { "status", svn_cl__status, {"stat", "st"}, N_ 1408251881Speter ("Print the status of working copy files and directories.\n" 1409251881Speter "usage: status [PATH...]\n" 1410251881Speter "\n" 1411251881Speter " With no args, print only locally modified items (no network access).\n" 1412251881Speter " With -q, print only summary information about locally modified items.\n" 1413251881Speter " With -u, add working revision and server out-of-date information.\n" 1414251881Speter " With -v, print full revision information on every item.\n" 1415251881Speter "\n" 1416251881Speter " The first seven columns in the output are each one character wide:\n" 1417251881Speter " First column: Says if item was added, deleted, or otherwise changed\n" 1418251881Speter " ' ' no modifications\n" 1419251881Speter " 'A' Added\n" 1420251881Speter " 'C' Conflicted\n" 1421251881Speter " 'D' Deleted\n" 1422251881Speter " 'I' Ignored\n" 1423251881Speter " 'M' Modified\n" 1424251881Speter " 'R' Replaced\n" 1425251881Speter " 'X' an unversioned directory created by an externals definition\n" 1426251881Speter " '?' item is not under version control\n" 1427251881Speter " '!' item is missing (removed by non-svn command) or incomplete\n" 1428251881Speter " '~' versioned item obstructed by some item of a different kind\n" 1429251881Speter " Second column: Modifications of a file's or directory's properties\n" 1430251881Speter " ' ' no modifications\n" 1431251881Speter " 'C' Conflicted\n" 1432251881Speter " 'M' Modified\n" 1433251881Speter " Third column: Whether the working copy directory is locked\n" 1434251881Speter " ' ' not locked\n" 1435251881Speter " 'L' locked\n" 1436251881Speter " Fourth column: Scheduled commit will contain addition-with-history\n" 1437251881Speter " ' ' no history scheduled with commit\n" 1438251881Speter " '+' history scheduled with commit\n" 1439251881Speter " Fifth column: Whether the item is switched or a file external\n" 1440251881Speter " ' ' normal\n" 1441251881Speter " 'S' the item has a Switched URL relative to the parent\n" 1442251881Speter " 'X' a versioned file created by an eXternals definition\n" 1443251881Speter " Sixth column: Repository lock token\n" 1444251881Speter " (without -u)\n" 1445251881Speter " ' ' no lock token\n" 1446251881Speter " 'K' lock token present\n" 1447251881Speter " (with -u)\n" 1448251881Speter " ' ' not locked in repository, no lock token\n" 1449251881Speter " 'K' locked in repository, lock toKen present\n" 1450251881Speter " 'O' locked in repository, lock token in some Other working copy\n" 1451251881Speter " 'T' locked in repository, lock token present but sTolen\n" 1452251881Speter " 'B' not locked in repository, lock token present but Broken\n" 1453251881Speter " Seventh column: Whether the item is the victim of a tree conflict\n" 1454251881Speter " ' ' normal\n" 1455251881Speter " 'C' tree-Conflicted\n" 1456251881Speter " If the item is a tree conflict victim, an additional line is printed\n" 1457251881Speter " after the item's status line, explaining the nature of the conflict.\n" 1458251881Speter "\n" 1459251881Speter " The out-of-date information appears in the ninth column (with -u):\n" 1460251881Speter " '*' a newer revision exists on the server\n" 1461251881Speter " ' ' the working copy is up to date\n" 1462251881Speter "\n" 1463251881Speter " Remaining fields are variable width and delimited by spaces:\n" 1464251881Speter " The working revision (with -u or -v; '-' if the item is copied)\n" 1465251881Speter " The last committed revision and last committed author (with -v)\n" 1466251881Speter " The working copy path is always the final field, so it can\n" 1467251881Speter " include spaces.\n" 1468251881Speter "\n" 1469251881Speter " The presence of a question mark ('?') where a working revision, last\n" 1470251881Speter " committed revision, or last committed author was expected indicates\n" 1471251881Speter " that the information is unknown or irrelevant given the state of the\n" 1472251881Speter " item (for example, when the item is the result of a copy operation).\n" 1473251881Speter " The question mark serves as a visual placeholder to facilitate parsing.\n" 1474251881Speter "\n" 1475251881Speter " Example output:\n" 1476251881Speter " svn status wc\n" 1477251881Speter " M wc/bar.c\n" 1478251881Speter " A + wc/qax.c\n" 1479251881Speter "\n" 1480251881Speter " svn status -u wc\n" 1481251881Speter " M 965 wc/bar.c\n" 1482251881Speter " * 965 wc/foo.c\n" 1483251881Speter " A + - wc/qax.c\n" 1484251881Speter " Status against revision: 981\n" 1485251881Speter "\n" 1486251881Speter " svn status --show-updates --verbose wc\n" 1487251881Speter " M 965 938 kfogel wc/bar.c\n" 1488251881Speter " * 965 922 sussman wc/foo.c\n" 1489251881Speter " A + - 687 joe wc/qax.c\n" 1490251881Speter " 965 687 joe wc/zig.c\n" 1491251881Speter " Status against revision: 981\n" 1492251881Speter "\n" 1493251881Speter " svn status\n" 1494251881Speter " M wc/bar.c\n" 1495251881Speter " ! C wc/qaz.c\n" 1496251881Speter " > local missing, incoming edit upon update\n" 1497251881Speter " D wc/qax.c\n"), 1498251881Speter { 'u', 'v', 'N', opt_depth, 'q', opt_no_ignore, opt_incremental, opt_xml, 1499251881Speter opt_ignore_externals, opt_changelist}, 1500251881Speter {{'q', N_("don't print unversioned items")}} }, 1501251881Speter 1502251881Speter { "switch", svn_cl__switch, {"sw"}, N_ 1503251881Speter ("Update the working copy to a different URL within the same repository.\n" 1504251881Speter "usage: 1. switch URL[@PEGREV] [PATH]\n" 1505251881Speter " 2. switch --relocate FROM-PREFIX TO-PREFIX [PATH...]\n" 1506251881Speter "\n" 1507251881Speter " 1. Update the working copy to mirror a new URL within the repository.\n" 1508251881Speter " This behavior is similar to 'svn update', and is the way to\n" 1509251881Speter " move a working copy to a branch or tag within the same repository.\n" 1510251881Speter " If specified, PEGREV determines in which revision the target is first\n" 1511251881Speter " looked up.\n" 1512251881Speter "\n" 1513251881Speter " If --force is used, unversioned obstructing paths in the working\n" 1514251881Speter " copy do not automatically cause a failure if the switch attempts to\n" 1515251881Speter " add the same path. If the obstructing path is the same type (file\n" 1516251881Speter " or directory) as the corresponding path in the repository it becomes\n" 1517251881Speter " versioned but its contents are left 'as-is' in the working copy.\n" 1518251881Speter " This means that an obstructing directory's unversioned children may\n" 1519251881Speter " also obstruct and become versioned. For files, any content differences\n" 1520251881Speter " between the obstruction and the repository are treated like a local\n" 1521251881Speter " modification to the working copy. All properties from the repository\n" 1522251881Speter " are applied to the obstructing path.\n" 1523251881Speter "\n" 1524251881Speter " Use the --set-depth option to set a new working copy depth on the\n" 1525251881Speter " targets of this operation.\n" 1526251881Speter "\n" 1527251881Speter " By default, Subversion will refuse to switch a working copy path to\n" 1528251881Speter " a new URL with which it shares no common version control ancestry.\n" 1529251881Speter " Use the '--ignore-ancestry' option to override this sanity check.\n" 1530251881Speter "\n" 1531251881Speter " 2. The '--relocate' option is deprecated. This syntax is equivalent to\n" 1532251881Speter " 'svn relocate FROM-PREFIX TO-PREFIX [PATH]'.\n" 1533251881Speter "\n" 1534251881Speter " See also 'svn help update' for a list of possible characters\n" 1535251881Speter " reporting the action taken.\n" 1536251881Speter "\n" 1537251881Speter " Examples:\n" 1538251881Speter " svn switch ^/branches/1.x-release\n" 1539251881Speter " svn switch --relocate http:// svn://\n" 1540251881Speter " svn switch --relocate http://www.example.com/repo/project \\\n" 1541251881Speter " svn://svn.example.com/repo/project\n"), 1542251881Speter { 'r', 'N', opt_depth, opt_set_depth, 'q', opt_merge_cmd, opt_relocate, 1543251881Speter opt_ignore_externals, opt_ignore_ancestry, opt_force, opt_accept}, 1544251881Speter {{opt_ignore_ancestry, 1545251881Speter N_("allow switching to a node with no common ancestor")}} 1546251881Speter }, 1547251881Speter 1548251881Speter { "unlock", svn_cl__unlock, {0}, N_ 1549251881Speter ("Unlock working copy paths or URLs.\n" 1550251881Speter "usage: unlock TARGET...\n" 1551251881Speter "\n" 1552251881Speter " Use --force to break the lock.\n"), 1553251881Speter { opt_targets, opt_force } }, 1554251881Speter 1555251881Speter { "update", svn_cl__update, {"up"}, N_ 1556251881Speter ("Bring changes from the repository into the working copy.\n" 1557251881Speter "usage: update [PATH...]\n" 1558251881Speter "\n" 1559251881Speter " If no revision is given, bring working copy up-to-date with HEAD rev.\n" 1560251881Speter " Else synchronize working copy to revision given by -r.\n" 1561251881Speter "\n" 1562251881Speter " For each updated item a line will be printed with characters reporting\n" 1563251881Speter " the action taken. These characters have the following meaning:\n" 1564251881Speter "\n" 1565251881Speter " A Added\n" 1566251881Speter " D Deleted\n" 1567251881Speter " U Updated\n" 1568251881Speter " C Conflict\n" 1569251881Speter " G Merged\n" 1570251881Speter " E Existed\n" 1571251881Speter " R Replaced\n" 1572251881Speter "\n" 1573251881Speter " Characters in the first column report about the item itself.\n" 1574251881Speter " Characters in the second column report about properties of the item.\n" 1575251881Speter " A 'B' in the third column signifies that the lock for the file has\n" 1576251881Speter " been broken or stolen.\n" 1577251881Speter " A 'C' in the fourth column indicates a tree conflict, while a 'C' in\n" 1578251881Speter " the first and second columns indicate textual conflicts in files\n" 1579251881Speter " and in property values, respectively.\n" 1580251881Speter "\n" 1581251881Speter " If --force is used, unversioned obstructing paths in the working\n" 1582251881Speter " copy do not automatically cause a failure if the update attempts to\n" 1583251881Speter " add the same path. If the obstructing path is the same type (file\n" 1584251881Speter " or directory) as the corresponding path in the repository it becomes\n" 1585251881Speter " versioned but its contents are left 'as-is' in the working copy.\n" 1586251881Speter " This means that an obstructing directory's unversioned children may\n" 1587251881Speter " also obstruct and become versioned. For files, any content differences\n" 1588251881Speter " between the obstruction and the repository are treated like a local\n" 1589251881Speter " modification to the working copy. All properties from the repository\n" 1590251881Speter " are applied to the obstructing path. Obstructing paths are reported\n" 1591251881Speter " in the first column with code 'E'.\n" 1592251881Speter "\n" 1593251881Speter " If the specified update target is missing from the working copy but its\n" 1594251881Speter " immediate parent directory is present, checkout the target into its\n" 1595251881Speter " parent directory at the specified depth. If --parents is specified,\n" 1596251881Speter " create any missing parent directories of the target by checking them\n" 1597251881Speter " out, too, at depth=empty.\n" 1598251881Speter "\n" 1599251881Speter " Use the --set-depth option to set a new working copy depth on the\n" 1600251881Speter " targets of this operation.\n"), 1601251881Speter {'r', 'N', opt_depth, opt_set_depth, 'q', opt_merge_cmd, opt_force, 1602251881Speter opt_ignore_externals, opt_changelist, opt_editor_cmd, opt_accept, 1603251881Speter opt_parents} }, 1604251881Speter 1605251881Speter { "upgrade", svn_cl__upgrade, {0}, N_ 1606251881Speter ("Upgrade the metadata storage format for a working copy.\n" 1607251881Speter "usage: upgrade [WCPATH...]\n" 1608251881Speter "\n" 1609251881Speter " Local modifications are preserved.\n"), 1610251881Speter { 'q' } }, 1611251881Speter 1612251881Speter { NULL, NULL, {0}, NULL, {0} } 1613251881Speter}; 1614251881Speter 1615251881Speter 1616251881Speter/* Version compatibility check */ 1617251881Speterstatic svn_error_t * 1618251881Spetercheck_lib_versions(void) 1619251881Speter{ 1620251881Speter static const svn_version_checklist_t checklist[] = 1621251881Speter { 1622251881Speter { "svn_subr", svn_subr_version }, 1623251881Speter { "svn_client", svn_client_version }, 1624251881Speter { "svn_wc", svn_wc_version }, 1625251881Speter { "svn_ra", svn_ra_version }, 1626251881Speter { "svn_delta", svn_delta_version }, 1627251881Speter { "svn_diff", svn_diff_version }, 1628251881Speter { NULL, NULL } 1629251881Speter }; 1630251881Speter SVN_VERSION_DEFINE(my_version); 1631251881Speter 1632251881Speter return svn_ver_check_list(&my_version, checklist); 1633251881Speter} 1634251881Speter 1635251881Speter 1636251881Speter/* A flag to see if we've been cancelled by the client or not. */ 1637251881Speterstatic volatile sig_atomic_t cancelled = FALSE; 1638251881Speter 1639251881Speter/* A signal handler to support cancellation. */ 1640251881Speterstatic void 1641251881Spetersignal_handler(int signum) 1642251881Speter{ 1643251881Speter apr_signal(signum, SIG_IGN); 1644251881Speter cancelled = TRUE; 1645251881Speter} 1646251881Speter 1647251881Speter/* Our cancellation callback. */ 1648251881Spetersvn_error_t * 1649251881Spetersvn_cl__check_cancel(void *baton) 1650251881Speter{ 1651251881Speter if (cancelled) 1652251881Speter return svn_error_create(SVN_ERR_CANCELLED, NULL, _("Caught signal")); 1653251881Speter else 1654251881Speter return SVN_NO_ERROR; 1655251881Speter} 1656251881Speter 1657251881Speter/* Add a --search argument to OPT_STATE. 1658251881Speter * These options start a new search pattern group. */ 1659251881Speterstatic void 1660251881Speteradd_search_pattern_group(svn_cl__opt_state_t *opt_state, 1661251881Speter const char *pattern, 1662251881Speter apr_pool_t *result_pool) 1663251881Speter{ 1664251881Speter apr_array_header_t *group = NULL; 1665251881Speter 1666251881Speter if (opt_state->search_patterns == NULL) 1667251881Speter opt_state->search_patterns = apr_array_make(result_pool, 1, 1668251881Speter sizeof(apr_array_header_t *)); 1669251881Speter 1670251881Speter group = apr_array_make(result_pool, 1, sizeof(const char *)); 1671251881Speter APR_ARRAY_PUSH(group, const char *) = pattern; 1672251881Speter APR_ARRAY_PUSH(opt_state->search_patterns, apr_array_header_t *) = group; 1673251881Speter} 1674251881Speter 1675251881Speter/* Add a --search-and argument to OPT_STATE. 1676251881Speter * These patterns are added to an existing pattern group, if any. */ 1677251881Speterstatic void 1678251881Speteradd_search_pattern_to_latest_group(svn_cl__opt_state_t *opt_state, 1679251881Speter const char *pattern, 1680251881Speter apr_pool_t *result_pool) 1681251881Speter{ 1682251881Speter apr_array_header_t *group; 1683251881Speter 1684251881Speter if (opt_state->search_patterns == NULL) 1685251881Speter { 1686251881Speter add_search_pattern_group(opt_state, pattern, result_pool); 1687251881Speter return; 1688251881Speter } 1689251881Speter 1690251881Speter group = APR_ARRAY_IDX(opt_state->search_patterns, 1691251881Speter opt_state->search_patterns->nelts - 1, 1692251881Speter apr_array_header_t *); 1693251881Speter APR_ARRAY_PUSH(group, const char *) = pattern; 1694251881Speter} 1695251881Speter 1696251881Speter 1697251881Speter/*** Main. ***/ 1698251881Speter 1699251881Speter/* Report and clear the error ERR, and return EXIT_FAILURE. Suppress the 1700251881Speter * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR. */ 1701251881Speter#define EXIT_ERROR(err) \ 1702251881Speter svn_cmdline_handle_exit_error(err, NULL, "svn: ") 1703251881Speter 1704251881Speter/* A redefinition of the public SVN_INT_ERR macro, that suppresses the 1705251881Speter * error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR. */ 1706251881Speter#undef SVN_INT_ERR 1707251881Speter#define SVN_INT_ERR(expr) \ 1708251881Speter do { \ 1709251881Speter svn_error_t *svn_err__temp = (expr); \ 1710251881Speter if (svn_err__temp) \ 1711251881Speter return EXIT_ERROR(svn_err__temp); \ 1712251881Speter } while (0) 1713251881Speter 1714251881Speterstatic int 1715251881Spetersub_main(int argc, const char *argv[], apr_pool_t *pool) 1716251881Speter{ 1717251881Speter svn_error_t *err; 1718251881Speter int opt_id; 1719251881Speter apr_getopt_t *os; 1720251881Speter svn_cl__opt_state_t opt_state = { 0, { 0 } }; 1721251881Speter svn_client_ctx_t *ctx; 1722251881Speter apr_array_header_t *received_opts; 1723251881Speter int i; 1724251881Speter const svn_opt_subcommand_desc2_t *subcommand = NULL; 1725251881Speter const char *dash_m_arg = NULL, *dash_F_arg = NULL; 1726251881Speter svn_cl__cmd_baton_t command_baton; 1727251881Speter svn_auth_baton_t *ab; 1728251881Speter svn_config_t *cfg_config; 1729251881Speter svn_boolean_t descend = TRUE; 1730251881Speter svn_boolean_t interactive_conflicts = FALSE; 1731251881Speter svn_boolean_t force_interactive = FALSE; 1732251881Speter svn_cl__conflict_stats_t *conflict_stats 1733251881Speter = svn_cl__conflict_stats_create(pool); 1734251881Speter svn_boolean_t use_notifier = TRUE; 1735251881Speter svn_boolean_t reading_file_from_stdin = FALSE; 1736251881Speter apr_hash_t *changelists; 1737251881Speter apr_hash_t *cfg_hash; 1738251881Speter 1739251881Speter received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int)); 1740251881Speter 1741251881Speter /* Check library versions */ 1742251881Speter SVN_INT_ERR(check_lib_versions()); 1743251881Speter 1744251881Speter#if defined(WIN32) || defined(__CYGWIN__) 1745251881Speter /* Set the working copy administrative directory name. */ 1746251881Speter if (getenv("SVN_ASP_DOT_NET_HACK")) 1747251881Speter { 1748251881Speter SVN_INT_ERR(svn_wc_set_adm_dir("_svn", pool)); 1749251881Speter } 1750251881Speter#endif 1751251881Speter 1752251881Speter /* Initialize the RA library. */ 1753251881Speter SVN_INT_ERR(svn_ra_initialize(pool)); 1754251881Speter 1755251881Speter /* Init our changelists hash. */ 1756251881Speter changelists = apr_hash_make(pool); 1757251881Speter 1758251881Speter /* Begin processing arguments. */ 1759251881Speter opt_state.start_revision.kind = svn_opt_revision_unspecified; 1760251881Speter opt_state.end_revision.kind = svn_opt_revision_unspecified; 1761251881Speter opt_state.revision_ranges = 1762251881Speter apr_array_make(pool, 0, sizeof(svn_opt_revision_range_t *)); 1763251881Speter opt_state.depth = svn_depth_unknown; 1764251881Speter opt_state.set_depth = svn_depth_unknown; 1765251881Speter opt_state.accept_which = svn_cl__accept_unspecified; 1766251881Speter opt_state.show_revs = svn_cl__show_revs_invalid; 1767251881Speter 1768251881Speter /* No args? Show usage. */ 1769251881Speter if (argc <= 1) 1770251881Speter { 1771251881Speter SVN_INT_ERR(svn_cl__help(NULL, NULL, pool)); 1772251881Speter return EXIT_FAILURE; 1773251881Speter } 1774251881Speter 1775251881Speter /* Else, parse options. */ 1776251881Speter SVN_INT_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool)); 1777251881Speter 1778251881Speter os->interleave = 1; 1779251881Speter while (1) 1780251881Speter { 1781251881Speter const char *opt_arg; 1782251881Speter const char *utf8_opt_arg; 1783251881Speter 1784251881Speter /* Parse the next option. */ 1785251881Speter apr_status_t apr_err = apr_getopt_long(os, svn_cl__options, &opt_id, 1786251881Speter &opt_arg); 1787251881Speter if (APR_STATUS_IS_EOF(apr_err)) 1788251881Speter break; 1789251881Speter else if (apr_err) 1790251881Speter { 1791251881Speter SVN_INT_ERR(svn_cl__help(NULL, NULL, pool)); 1792251881Speter return EXIT_FAILURE; 1793251881Speter } 1794251881Speter 1795251881Speter /* Stash the option code in an array before parsing it. */ 1796251881Speter APR_ARRAY_PUSH(received_opts, int) = opt_id; 1797251881Speter 1798251881Speter switch (opt_id) { 1799251881Speter case 'l': 1800251881Speter { 1801251881Speter err = svn_cstring_atoi(&opt_state.limit, opt_arg); 1802251881Speter if (err) 1803251881Speter { 1804251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err, 1805251881Speter _("Non-numeric limit argument given")); 1806251881Speter return EXIT_ERROR(err); 1807251881Speter } 1808251881Speter if (opt_state.limit <= 0) 1809251881Speter { 1810251881Speter err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL, 1811251881Speter _("Argument to --limit must be positive")); 1812251881Speter return EXIT_ERROR(err); 1813251881Speter } 1814251881Speter } 1815251881Speter break; 1816251881Speter case 'm': 1817251881Speter /* Note that there's no way here to detect if the log message 1818251881Speter contains a zero byte -- if it does, then opt_arg will just 1819251881Speter be shorter than the user intended. Oh well. */ 1820251881Speter opt_state.message = apr_pstrdup(pool, opt_arg); 1821251881Speter dash_m_arg = opt_arg; 1822251881Speter break; 1823251881Speter case 'c': 1824251881Speter { 1825251881Speter apr_array_header_t *change_revs = 1826251881Speter svn_cstring_split(opt_arg, ", \n\r\t\v", TRUE, pool); 1827251881Speter 1828251881Speter if (opt_state.old_target) 1829251881Speter { 1830251881Speter err = svn_error_create 1831251881Speter (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 1832251881Speter _("Can't specify -c with --old")); 1833251881Speter return EXIT_ERROR(err); 1834251881Speter } 1835251881Speter 1836251881Speter for (i = 0; i < change_revs->nelts; i++) 1837251881Speter { 1838251881Speter char *end; 1839251881Speter svn_revnum_t changeno, changeno_end; 1840251881Speter const char *change_str = 1841251881Speter APR_ARRAY_IDX(change_revs, i, const char *); 1842251881Speter const char *s = change_str; 1843251881Speter svn_boolean_t is_negative; 1844251881Speter 1845251881Speter /* Check for a leading minus to allow "-c -r42". 1846251881Speter * The is_negative flag is used to handle "-c -42" and "-c -r42". 1847251881Speter * The "-c r-42" case is handled by strtol() returning a 1848251881Speter * negative number. */ 1849251881Speter is_negative = (*s == '-'); 1850251881Speter if (is_negative) 1851251881Speter s++; 1852251881Speter 1853251881Speter /* Allow any number of 'r's to prefix a revision number. */ 1854251881Speter while (*s == 'r') 1855251881Speter s++; 1856251881Speter changeno = changeno_end = strtol(s, &end, 10); 1857251881Speter if (end != s && *end == '-') 1858251881Speter { 1859251881Speter if (changeno < 0 || is_negative) 1860251881Speter { 1861251881Speter err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, 1862251881Speter NULL, 1863251881Speter _("Negative number in range (%s)" 1864251881Speter " not supported with -c"), 1865251881Speter change_str); 1866251881Speter return EXIT_ERROR(err); 1867251881Speter } 1868251881Speter s = end + 1; 1869251881Speter while (*s == 'r') 1870251881Speter s++; 1871251881Speter changeno_end = strtol(s, &end, 10); 1872251881Speter } 1873251881Speter if (end == change_str || *end != '\0') 1874251881Speter { 1875251881Speter err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 1876251881Speter _("Non-numeric change argument (%s) " 1877251881Speter "given to -c"), change_str); 1878251881Speter return EXIT_ERROR(err); 1879251881Speter } 1880251881Speter 1881251881Speter if (changeno == 0) 1882251881Speter { 1883251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 1884251881Speter _("There is no change 0")); 1885251881Speter return EXIT_ERROR(err); 1886251881Speter } 1887251881Speter 1888251881Speter if (is_negative) 1889251881Speter changeno = -changeno; 1890251881Speter 1891251881Speter /* Figure out the range: 1892251881Speter -c N -> -r N-1:N 1893251881Speter -c -N -> -r N:N-1 1894251881Speter -c M-N -> -r M-1:N for M < N 1895251881Speter -c M-N -> -r M:N-1 for M > N 1896251881Speter -c -M-N -> error (too confusing/no valid use case) 1897251881Speter */ 1898251881Speter if (changeno > 0) 1899251881Speter { 1900251881Speter if (changeno <= changeno_end) 1901251881Speter changeno--; 1902251881Speter else 1903251881Speter changeno_end--; 1904251881Speter } 1905251881Speter else 1906251881Speter { 1907251881Speter changeno = -changeno; 1908251881Speter changeno_end = changeno - 1; 1909251881Speter } 1910251881Speter 1911251881Speter opt_state.used_change_arg = TRUE; 1912251881Speter APR_ARRAY_PUSH(opt_state.revision_ranges, 1913251881Speter svn_opt_revision_range_t *) 1914251881Speter = svn_opt__revision_range_from_revnums(changeno, changeno_end, 1915251881Speter pool); 1916251881Speter } 1917251881Speter } 1918251881Speter break; 1919251881Speter case 'r': 1920251881Speter opt_state.used_revision_arg = TRUE; 1921251881Speter if (svn_opt_parse_revision_to_range(opt_state.revision_ranges, 1922251881Speter opt_arg, pool) != 0) 1923251881Speter { 1924251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); 1925251881Speter err = svn_error_createf 1926251881Speter (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 1927251881Speter _("Syntax error in revision argument '%s'"), 1928251881Speter utf8_opt_arg); 1929251881Speter return EXIT_ERROR(err); 1930251881Speter } 1931251881Speter break; 1932251881Speter case 'v': 1933251881Speter opt_state.verbose = TRUE; 1934251881Speter break; 1935251881Speter case 'u': 1936251881Speter opt_state.update = TRUE; 1937251881Speter break; 1938251881Speter case 'h': 1939251881Speter case '?': 1940251881Speter opt_state.help = TRUE; 1941251881Speter break; 1942251881Speter case 'q': 1943251881Speter opt_state.quiet = TRUE; 1944251881Speter break; 1945251881Speter case opt_incremental: 1946251881Speter opt_state.incremental = TRUE; 1947251881Speter break; 1948251881Speter case 'F': 1949251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); 1950251881Speter SVN_INT_ERR(svn_stringbuf_from_file2(&(opt_state.filedata), 1951251881Speter utf8_opt_arg, pool)); 1952251881Speter reading_file_from_stdin = (strcmp(utf8_opt_arg, "-") == 0); 1953251881Speter dash_F_arg = opt_arg; 1954251881Speter break; 1955251881Speter case opt_targets: 1956251881Speter { 1957251881Speter svn_stringbuf_t *buffer, *buffer_utf8; 1958251881Speter 1959251881Speter /* We need to convert to UTF-8 now, even before we divide 1960251881Speter the targets into an array, because otherwise we wouldn't 1961251881Speter know what delimiter to use for svn_cstring_split(). */ 1962251881Speter 1963251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); 1964251881Speter SVN_INT_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool)); 1965251881Speter SVN_INT_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool)); 1966251881Speter opt_state.targets = svn_cstring_split(buffer_utf8->data, "\n\r", 1967251881Speter TRUE, pool); 1968251881Speter } 1969251881Speter break; 1970251881Speter case opt_force: 1971251881Speter opt_state.force = TRUE; 1972251881Speter break; 1973251881Speter case opt_force_log: 1974251881Speter opt_state.force_log = TRUE; 1975251881Speter break; 1976251881Speter case opt_dry_run: 1977251881Speter opt_state.dry_run = TRUE; 1978251881Speter break; 1979251881Speter case opt_revprop: 1980251881Speter opt_state.revprop = TRUE; 1981251881Speter break; 1982251881Speter case 'R': 1983251881Speter opt_state.depth = svn_depth_infinity; 1984251881Speter break; 1985251881Speter case 'N': 1986251881Speter descend = FALSE; 1987251881Speter break; 1988251881Speter case opt_depth: 1989251881Speter err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool); 1990251881Speter if (err) 1991251881Speter return EXIT_ERROR 1992251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err, 1993251881Speter _("Error converting depth " 1994251881Speter "from locale to UTF-8"))); 1995251881Speter opt_state.depth = svn_depth_from_word(utf8_opt_arg); 1996251881Speter if (opt_state.depth == svn_depth_unknown 1997251881Speter || opt_state.depth == svn_depth_exclude) 1998251881Speter { 1999251881Speter return EXIT_ERROR 2000251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2001251881Speter _("'%s' is not a valid depth; try " 2002251881Speter "'empty', 'files', 'immediates', " 2003251881Speter "or 'infinity'"), 2004251881Speter utf8_opt_arg)); 2005251881Speter } 2006251881Speter break; 2007251881Speter case opt_set_depth: 2008251881Speter err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool); 2009251881Speter if (err) 2010251881Speter return EXIT_ERROR 2011251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err, 2012251881Speter _("Error converting depth " 2013251881Speter "from locale to UTF-8"))); 2014251881Speter opt_state.set_depth = svn_depth_from_word(utf8_opt_arg); 2015251881Speter /* svn_depth_exclude is okay for --set-depth. */ 2016251881Speter if (opt_state.set_depth == svn_depth_unknown) 2017251881Speter { 2018251881Speter return EXIT_ERROR 2019251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2020251881Speter _("'%s' is not a valid depth; try " 2021251881Speter "'exclude', 'empty', 'files', " 2022251881Speter "'immediates', or 'infinity'"), 2023251881Speter utf8_opt_arg)); 2024251881Speter } 2025251881Speter break; 2026251881Speter case opt_version: 2027251881Speter opt_state.version = TRUE; 2028251881Speter break; 2029251881Speter case opt_auth_username: 2030251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username, 2031251881Speter opt_arg, pool)); 2032251881Speter break; 2033251881Speter case opt_auth_password: 2034251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password, 2035251881Speter opt_arg, pool)); 2036251881Speter break; 2037251881Speter case opt_encoding: 2038251881Speter opt_state.encoding = apr_pstrdup(pool, opt_arg); 2039251881Speter break; 2040251881Speter case opt_xml: 2041251881Speter opt_state.xml = TRUE; 2042251881Speter break; 2043251881Speter case opt_stop_on_copy: 2044251881Speter opt_state.stop_on_copy = TRUE; 2045251881Speter break; 2046251881Speter case opt_strict: 2047251881Speter opt_state.strict = TRUE; 2048251881Speter break; 2049251881Speter case opt_no_ignore: 2050251881Speter opt_state.no_ignore = TRUE; 2051251881Speter break; 2052251881Speter case opt_no_auth_cache: 2053251881Speter opt_state.no_auth_cache = TRUE; 2054251881Speter break; 2055251881Speter case opt_non_interactive: 2056251881Speter opt_state.non_interactive = TRUE; 2057251881Speter break; 2058251881Speter case opt_force_interactive: 2059251881Speter force_interactive = TRUE; 2060251881Speter break; 2061251881Speter case opt_trust_server_cert: 2062251881Speter opt_state.trust_server_cert = TRUE; 2063251881Speter break; 2064251881Speter case opt_no_diff_added: 2065251881Speter opt_state.diff.no_diff_added = TRUE; 2066251881Speter break; 2067251881Speter case opt_no_diff_deleted: 2068251881Speter opt_state.diff.no_diff_deleted = TRUE; 2069251881Speter break; 2070251881Speter case opt_ignore_properties: 2071251881Speter opt_state.diff.ignore_properties = TRUE; 2072251881Speter break; 2073251881Speter case opt_show_copies_as_adds: 2074251881Speter opt_state.diff.show_copies_as_adds = TRUE; 2075251881Speter break; 2076251881Speter case opt_notice_ancestry: 2077251881Speter opt_state.diff.notice_ancestry = TRUE; 2078251881Speter break; 2079251881Speter case opt_ignore_ancestry: 2080251881Speter opt_state.ignore_ancestry = TRUE; 2081251881Speter break; 2082251881Speter case opt_ignore_externals: 2083251881Speter opt_state.ignore_externals = TRUE; 2084251881Speter break; 2085251881Speter case opt_relocate: 2086251881Speter opt_state.relocate = TRUE; 2087251881Speter break; 2088251881Speter case 'x': 2089251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions, 2090251881Speter opt_arg, pool)); 2091251881Speter break; 2092251881Speter case opt_diff_cmd: 2093251881Speter opt_state.diff.diff_cmd = apr_pstrdup(pool, opt_arg); 2094251881Speter break; 2095251881Speter case opt_merge_cmd: 2096251881Speter opt_state.merge_cmd = apr_pstrdup(pool, opt_arg); 2097251881Speter break; 2098251881Speter case opt_record_only: 2099251881Speter opt_state.record_only = TRUE; 2100251881Speter break; 2101251881Speter case opt_editor_cmd: 2102251881Speter opt_state.editor_cmd = apr_pstrdup(pool, opt_arg); 2103251881Speter break; 2104251881Speter case opt_old_cmd: 2105251881Speter if (opt_state.used_change_arg) 2106251881Speter { 2107251881Speter err = svn_error_create 2108251881Speter (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2109251881Speter _("Can't specify -c with --old")); 2110251881Speter return EXIT_ERROR(err); 2111251881Speter } 2112251881Speter opt_state.old_target = apr_pstrdup(pool, opt_arg); 2113251881Speter break; 2114251881Speter case opt_new_cmd: 2115251881Speter opt_state.new_target = apr_pstrdup(pool, opt_arg); 2116251881Speter break; 2117251881Speter case opt_config_dir: 2118251881Speter { 2119251881Speter const char *path_utf8; 2120251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&path_utf8, opt_arg, pool)); 2121251881Speter opt_state.config_dir = svn_dirent_internal_style(path_utf8, pool); 2122251881Speter } 2123251881Speter break; 2124251881Speter case opt_config_options: 2125251881Speter if (!opt_state.config_options) 2126251881Speter opt_state.config_options = 2127251881Speter apr_array_make(pool, 1, 2128251881Speter sizeof(svn_cmdline__config_argument_t*)); 2129251881Speter 2130251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_arg, opt_arg, pool)); 2131251881Speter SVN_INT_ERR(svn_cmdline__parse_config_option(opt_state.config_options, 2132251881Speter opt_arg, pool)); 2133251881Speter break; 2134251881Speter case opt_autoprops: 2135251881Speter opt_state.autoprops = TRUE; 2136251881Speter break; 2137251881Speter case opt_no_autoprops: 2138251881Speter opt_state.no_autoprops = TRUE; 2139251881Speter break; 2140251881Speter case opt_native_eol: 2141251881Speter if ( !strcmp("LF", opt_arg) || !strcmp("CR", opt_arg) || 2142251881Speter !strcmp("CRLF", opt_arg)) 2143251881Speter opt_state.native_eol = apr_pstrdup(pool, opt_arg); 2144251881Speter else 2145251881Speter { 2146251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); 2147251881Speter err = svn_error_createf 2148251881Speter (SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2149251881Speter _("Syntax error in native-eol argument '%s'"), 2150251881Speter utf8_opt_arg); 2151251881Speter return EXIT_ERROR(err); 2152251881Speter } 2153251881Speter break; 2154251881Speter case opt_no_unlock: 2155251881Speter opt_state.no_unlock = TRUE; 2156251881Speter break; 2157251881Speter case opt_summarize: 2158251881Speter opt_state.diff.summarize = TRUE; 2159251881Speter break; 2160251881Speter case opt_remove: 2161251881Speter opt_state.remove = TRUE; 2162251881Speter break; 2163251881Speter case opt_changelist: 2164251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool)); 2165251881Speter opt_state.changelist = utf8_opt_arg; 2166251881Speter if (opt_state.changelist[0] == '\0') 2167251881Speter { 2168251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2169251881Speter _("Changelist names must not be empty")); 2170251881Speter return EXIT_ERROR(err); 2171251881Speter } 2172251881Speter svn_hash_sets(changelists, opt_state.changelist, (void *)1); 2173251881Speter break; 2174251881Speter case opt_keep_changelists: 2175251881Speter opt_state.keep_changelists = TRUE; 2176251881Speter break; 2177251881Speter case opt_keep_local: 2178251881Speter opt_state.keep_local = TRUE; 2179251881Speter break; 2180251881Speter case opt_with_all_revprops: 2181251881Speter /* If --with-all-revprops is specified along with one or more 2182251881Speter * --with-revprops options, --with-all-revprops takes precedence. */ 2183251881Speter opt_state.all_revprops = TRUE; 2184251881Speter break; 2185251881Speter case opt_with_no_revprops: 2186251881Speter opt_state.no_revprops = TRUE; 2187251881Speter break; 2188251881Speter case opt_with_revprop: 2189251881Speter SVN_INT_ERR(svn_opt_parse_revprop(&opt_state.revprop_table, 2190251881Speter opt_arg, pool)); 2191251881Speter break; 2192251881Speter case opt_parents: 2193251881Speter opt_state.parents = TRUE; 2194251881Speter break; 2195251881Speter case 'g': 2196251881Speter opt_state.use_merge_history = TRUE; 2197251881Speter break; 2198251881Speter case opt_accept: 2199251881Speter opt_state.accept_which = svn_cl__accept_from_word(opt_arg); 2200251881Speter if (opt_state.accept_which == svn_cl__accept_invalid) 2201251881Speter return EXIT_ERROR 2202251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2203251881Speter _("'%s' is not a valid --accept value"), 2204251881Speter opt_arg)); 2205251881Speter break; 2206251881Speter case opt_show_revs: 2207251881Speter opt_state.show_revs = svn_cl__show_revs_from_word(opt_arg); 2208251881Speter if (opt_state.show_revs == svn_cl__show_revs_invalid) 2209251881Speter return EXIT_ERROR 2210251881Speter (svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2211251881Speter _("'%s' is not a valid --show-revs value"), 2212251881Speter opt_arg)); 2213251881Speter break; 2214251881Speter case opt_reintegrate: 2215251881Speter opt_state.reintegrate = TRUE; 2216251881Speter break; 2217251881Speter case opt_strip: 2218251881Speter { 2219251881Speter err = svn_cstring_atoi(&opt_state.strip, opt_arg); 2220251881Speter if (err) 2221251881Speter { 2222251881Speter err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err, 2223251881Speter _("Invalid strip count '%s'"), opt_arg); 2224251881Speter return EXIT_ERROR(err); 2225251881Speter } 2226251881Speter if (opt_state.strip < 0) 2227251881Speter { 2228251881Speter err = svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL, 2229251881Speter _("Argument to --strip must be positive")); 2230251881Speter return EXIT_ERROR(err); 2231251881Speter } 2232251881Speter } 2233251881Speter break; 2234251881Speter case opt_ignore_keywords: 2235251881Speter opt_state.ignore_keywords = TRUE; 2236251881Speter break; 2237251881Speter case opt_reverse_diff: 2238251881Speter opt_state.reverse_diff = TRUE; 2239251881Speter break; 2240251881Speter case opt_ignore_whitespace: 2241251881Speter opt_state.ignore_whitespace = TRUE; 2242251881Speter break; 2243251881Speter case opt_diff: 2244251881Speter opt_state.show_diff = TRUE; 2245251881Speter break; 2246251881Speter case opt_internal_diff: 2247251881Speter opt_state.diff.internal_diff = TRUE; 2248251881Speter break; 2249251881Speter case opt_patch_compatible: 2250251881Speter opt_state.diff.patch_compatible = TRUE; 2251251881Speter break; 2252251881Speter case opt_use_git_diff_format: 2253251881Speter opt_state.diff.use_git_diff_format = TRUE; 2254251881Speter break; 2255251881Speter case opt_allow_mixed_revisions: 2256251881Speter opt_state.allow_mixed_rev = TRUE; 2257251881Speter break; 2258251881Speter case opt_include_externals: 2259251881Speter opt_state.include_externals = TRUE; 2260251881Speter break; 2261251881Speter case opt_show_inherited_props: 2262251881Speter opt_state.show_inherited_props = TRUE; 2263251881Speter break; 2264251881Speter case opt_properties_only: 2265251881Speter opt_state.diff.properties_only = TRUE; 2266251881Speter break; 2267251881Speter case opt_search: 2268251881Speter add_search_pattern_group(&opt_state, opt_arg, pool); 2269251881Speter break; 2270251881Speter case opt_search_and: 2271251881Speter add_search_pattern_to_latest_group(&opt_state, opt_arg, pool); 2272251881Speter default: 2273251881Speter /* Hmmm. Perhaps this would be a good place to squirrel away 2274251881Speter opts that commands like svn diff might need. Hmmm indeed. */ 2275251881Speter break; 2276251881Speter } 2277251881Speter } 2278251881Speter 2279251881Speter /* The --non-interactive and --force-interactive options are mutually 2280251881Speter * exclusive. */ 2281251881Speter if (opt_state.non_interactive && force_interactive) 2282251881Speter { 2283251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2284251881Speter _("--non-interactive and --force-interactive " 2285251881Speter "are mutually exclusive")); 2286251881Speter return EXIT_ERROR(err); 2287251881Speter } 2288251881Speter else 2289251881Speter opt_state.non_interactive = !svn_cmdline__be_interactive( 2290251881Speter opt_state.non_interactive, 2291251881Speter force_interactive); 2292251881Speter 2293251881Speter /* Turn our hash of changelists into an array of unique ones. */ 2294251881Speter SVN_INT_ERR(svn_hash_keys(&(opt_state.changelists), changelists, pool)); 2295251881Speter 2296251881Speter /* ### This really belongs in libsvn_client. The trouble is, 2297251881Speter there's no one place there to run it from, no 2298251881Speter svn_client_init(). We'd have to add it to all the public 2299251881Speter functions that a client might call. It's unmaintainable to do 2300251881Speter initialization from within libsvn_client itself, but it seems 2301251881Speter burdensome to demand that all clients call svn_client_init() 2302251881Speter before calling any other libsvn_client function... On the other 2303251881Speter hand, the alternative is effectively to demand that they call 2304251881Speter svn_config_ensure() instead, so maybe we should have a generic 2305251881Speter init function anyway. Thoughts? */ 2306251881Speter SVN_INT_ERR(svn_config_ensure(opt_state.config_dir, pool)); 2307251881Speter 2308251881Speter /* If the user asked for help, then the rest of the arguments are 2309251881Speter the names of subcommands to get help on (if any), or else they're 2310251881Speter just typos/mistakes. Whatever the case, the subcommand to 2311251881Speter actually run is svn_cl__help(). */ 2312251881Speter if (opt_state.help) 2313251881Speter subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table, "help"); 2314251881Speter 2315251881Speter /* If we're not running the `help' subcommand, then look for a 2316251881Speter subcommand in the first argument. */ 2317251881Speter if (subcommand == NULL) 2318251881Speter { 2319251881Speter if (os->ind >= os->argc) 2320251881Speter { 2321251881Speter if (opt_state.version) 2322251881Speter { 2323251881Speter /* Use the "help" subcommand to handle the "--version" option. */ 2324251881Speter static const svn_opt_subcommand_desc2_t pseudo_cmd = 2325251881Speter { "--version", svn_cl__help, {0}, "", 2326251881Speter {opt_version, /* must accept its own option */ 2327251881Speter 'q', /* brief output */ 2328251881Speter 'v', /* verbose output */ 2329251881Speter opt_config_dir /* all commands accept this */ 2330251881Speter } }; 2331251881Speter 2332251881Speter subcommand = &pseudo_cmd; 2333251881Speter } 2334251881Speter else 2335251881Speter { 2336251881Speter svn_error_clear 2337251881Speter (svn_cmdline_fprintf(stderr, pool, 2338251881Speter _("Subcommand argument required\n"))); 2339251881Speter svn_error_clear(svn_cl__help(NULL, NULL, pool)); 2340251881Speter return EXIT_FAILURE; 2341251881Speter } 2342251881Speter } 2343251881Speter else 2344251881Speter { 2345251881Speter const char *first_arg = os->argv[os->ind++]; 2346251881Speter subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table, 2347251881Speter first_arg); 2348251881Speter if (subcommand == NULL) 2349251881Speter { 2350251881Speter const char *first_arg_utf8; 2351251881Speter SVN_INT_ERR(svn_utf_cstring_to_utf8(&first_arg_utf8, 2352251881Speter first_arg, pool)); 2353251881Speter svn_error_clear 2354251881Speter (svn_cmdline_fprintf(stderr, pool, 2355251881Speter _("Unknown subcommand: '%s'\n"), 2356251881Speter first_arg_utf8)); 2357251881Speter svn_error_clear(svn_cl__help(NULL, NULL, pool)); 2358251881Speter 2359251881Speter /* Be kind to people who try 'svn undo'. */ 2360251881Speter if (strcmp(first_arg_utf8, "undo") == 0) 2361251881Speter { 2362251881Speter svn_error_clear 2363251881Speter (svn_cmdline_fprintf(stderr, pool, 2364251881Speter _("Undo is done using either the " 2365251881Speter "'svn revert' or the 'svn merge' " 2366251881Speter "command.\n"))); 2367251881Speter } 2368251881Speter 2369251881Speter return EXIT_FAILURE; 2370251881Speter } 2371251881Speter } 2372251881Speter } 2373251881Speter 2374251881Speter /* Check that the subcommand wasn't passed any inappropriate options. */ 2375251881Speter for (i = 0; i < received_opts->nelts; i++) 2376251881Speter { 2377251881Speter opt_id = APR_ARRAY_IDX(received_opts, i, int); 2378251881Speter 2379251881Speter /* All commands implicitly accept --help, so just skip over this 2380251881Speter when we see it. Note that we don't want to include this option 2381251881Speter in their "accepted options" list because it would be awfully 2382251881Speter redundant to display it in every commands' help text. */ 2383251881Speter if (opt_id == 'h' || opt_id == '?') 2384251881Speter continue; 2385251881Speter 2386251881Speter if (! svn_opt_subcommand_takes_option3(subcommand, opt_id, 2387251881Speter svn_cl__global_options)) 2388251881Speter { 2389251881Speter const char *optstr; 2390251881Speter const apr_getopt_option_t *badopt = 2391251881Speter svn_opt_get_option_from_code2(opt_id, svn_cl__options, 2392251881Speter subcommand, pool); 2393251881Speter svn_opt_format_option(&optstr, badopt, FALSE, pool); 2394251881Speter if (subcommand->name[0] == '-') 2395251881Speter svn_error_clear(svn_cl__help(NULL, NULL, pool)); 2396251881Speter else 2397251881Speter svn_error_clear 2398251881Speter (svn_cmdline_fprintf 2399251881Speter (stderr, pool, _("Subcommand '%s' doesn't accept option '%s'\n" 2400251881Speter "Type 'svn help %s' for usage.\n"), 2401251881Speter subcommand->name, optstr, subcommand->name)); 2402251881Speter return EXIT_FAILURE; 2403251881Speter } 2404251881Speter } 2405251881Speter 2406251881Speter /* Only merge and log support multiple revisions/revision ranges. */ 2407251881Speter if (subcommand->cmd_func != svn_cl__merge 2408251881Speter && subcommand->cmd_func != svn_cl__log) 2409251881Speter { 2410251881Speter if (opt_state.revision_ranges->nelts > 1) 2411251881Speter { 2412251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2413251881Speter _("Multiple revision arguments " 2414251881Speter "encountered; can't specify -c twice, " 2415251881Speter "or both -c and -r")); 2416251881Speter return EXIT_ERROR(err); 2417251881Speter } 2418251881Speter } 2419251881Speter 2420251881Speter /* Disallow simultaneous use of both --depth and --set-depth. */ 2421251881Speter if ((opt_state.depth != svn_depth_unknown) 2422251881Speter && (opt_state.set_depth != svn_depth_unknown)) 2423251881Speter { 2424251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2425251881Speter _("--depth and --set-depth are mutually " 2426251881Speter "exclusive")); 2427251881Speter return EXIT_ERROR(err); 2428251881Speter } 2429251881Speter 2430251881Speter /* Disallow simultaneous use of both --with-all-revprops and 2431251881Speter --with-no-revprops. */ 2432251881Speter if (opt_state.all_revprops && opt_state.no_revprops) 2433251881Speter { 2434251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2435251881Speter _("--with-all-revprops and --with-no-revprops " 2436251881Speter "are mutually exclusive")); 2437251881Speter return EXIT_ERROR(err); 2438251881Speter } 2439251881Speter 2440251881Speter /* Disallow simultaneous use of both --with-revprop and 2441251881Speter --with-no-revprops. */ 2442251881Speter if (opt_state.revprop_table && opt_state.no_revprops) 2443251881Speter { 2444251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2445251881Speter _("--with-revprop and --with-no-revprops " 2446251881Speter "are mutually exclusive")); 2447251881Speter return EXIT_ERROR(err); 2448251881Speter } 2449251881Speter 2450251881Speter /* Disallow simultaneous use of both -m and -F, when they are 2451251881Speter both used to pass a commit message or lock comment. ('propset' 2452251881Speter takes the property value, not a commit message, from -F.) 2453251881Speter */ 2454251881Speter if (opt_state.filedata && opt_state.message 2455251881Speter && subcommand->cmd_func != svn_cl__propset) 2456251881Speter { 2457251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2458251881Speter _("--message (-m) and --file (-F) " 2459251881Speter "are mutually exclusive")); 2460251881Speter return EXIT_ERROR(err); 2461251881Speter } 2462251881Speter 2463251881Speter /* --trust-server-cert can only be used with --non-interactive */ 2464251881Speter if (opt_state.trust_server_cert && !opt_state.non_interactive) 2465251881Speter { 2466251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2467251881Speter _("--trust-server-cert requires " 2468251881Speter "--non-interactive")); 2469251881Speter return EXIT_ERROR(err); 2470251881Speter } 2471251881Speter 2472251881Speter /* Disallow simultaneous use of both --diff-cmd and 2473251881Speter --internal-diff. */ 2474251881Speter if (opt_state.diff.diff_cmd && opt_state.diff.internal_diff) 2475251881Speter { 2476251881Speter err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2477251881Speter _("--diff-cmd and --internal-diff " 2478251881Speter "are mutually exclusive")); 2479251881Speter return EXIT_ERROR(err); 2480251881Speter } 2481251881Speter 2482251881Speter /* Ensure that 'revision_ranges' has at least one item, and make 2483251881Speter 'start_revision' and 'end_revision' match that item. */ 2484251881Speter if (opt_state.revision_ranges->nelts == 0) 2485251881Speter { 2486251881Speter svn_opt_revision_range_t *range = apr_palloc(pool, sizeof(*range)); 2487251881Speter range->start.kind = svn_opt_revision_unspecified; 2488251881Speter range->end.kind = svn_opt_revision_unspecified; 2489251881Speter APR_ARRAY_PUSH(opt_state.revision_ranges, 2490251881Speter svn_opt_revision_range_t *) = range; 2491251881Speter } 2492251881Speter opt_state.start_revision = APR_ARRAY_IDX(opt_state.revision_ranges, 0, 2493251881Speter svn_opt_revision_range_t *)->start; 2494251881Speter opt_state.end_revision = APR_ARRAY_IDX(opt_state.revision_ranges, 0, 2495251881Speter svn_opt_revision_range_t *)->end; 2496251881Speter 2497251881Speter err = svn_config_get_config(&cfg_hash, opt_state.config_dir, pool); 2498251881Speter if (err) 2499251881Speter { 2500251881Speter /* Fallback to default config if the config directory isn't readable 2501251881Speter or is not a directory. */ 2502251881Speter if (APR_STATUS_IS_EACCES(err->apr_err) 2503251881Speter || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err)) 2504251881Speter { 2505251881Speter svn_handle_warning2(stderr, err, "svn: "); 2506251881Speter svn_error_clear(err); 2507251881Speter cfg_hash = NULL; 2508251881Speter } 2509251881Speter else 2510251881Speter return EXIT_ERROR(err); 2511251881Speter } 2512251881Speter 2513251881Speter /* Relocation is infinite-depth only. */ 2514251881Speter if (opt_state.relocate) 2515251881Speter { 2516251881Speter if (opt_state.depth != svn_depth_unknown) 2517251881Speter { 2518251881Speter err = svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL, 2519251881Speter _("--relocate and --depth are mutually " 2520251881Speter "exclusive")); 2521251881Speter return EXIT_ERROR(err); 2522251881Speter } 2523251881Speter if (! descend) 2524251881Speter { 2525251881Speter err = svn_error_create( 2526251881Speter SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL, 2527251881Speter _("--relocate and --non-recursive (-N) are mutually " 2528251881Speter "exclusive")); 2529251881Speter return EXIT_ERROR(err); 2530251881Speter } 2531251881Speter } 2532251881Speter 2533251881Speter /* Only a few commands can accept a revision range; the rest can take at 2534251881Speter most one revision number. */ 2535251881Speter if (subcommand->cmd_func != svn_cl__blame 2536251881Speter && subcommand->cmd_func != svn_cl__diff 2537251881Speter && subcommand->cmd_func != svn_cl__log 2538251881Speter && subcommand->cmd_func != svn_cl__mergeinfo 2539251881Speter && subcommand->cmd_func != svn_cl__merge) 2540251881Speter { 2541251881Speter if (opt_state.end_revision.kind != svn_opt_revision_unspecified) 2542251881Speter { 2543251881Speter err = svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL); 2544251881Speter return EXIT_ERROR(err); 2545251881Speter } 2546251881Speter } 2547251881Speter 2548251881Speter /* -N has a different meaning depending on the command */ 2549251881Speter if (!descend) 2550251881Speter { 2551251881Speter if (subcommand->cmd_func == svn_cl__status) 2552251881Speter { 2553251881Speter opt_state.depth = svn_depth_immediates; 2554251881Speter } 2555251881Speter else if (subcommand->cmd_func == svn_cl__revert 2556251881Speter || subcommand->cmd_func == svn_cl__add 2557251881Speter || subcommand->cmd_func == svn_cl__commit) 2558251881Speter { 2559251881Speter /* In pre-1.5 Subversion, some commands treated -N like 2560251881Speter --depth=empty, so force that mapping here. Anyway, with 2561251881Speter revert it makes sense to be especially conservative, 2562251881Speter since revert can lose data. */ 2563251881Speter opt_state.depth = svn_depth_empty; 2564251881Speter } 2565251881Speter else 2566251881Speter { 2567251881Speter opt_state.depth = svn_depth_files; 2568251881Speter } 2569251881Speter } 2570251881Speter 2571251881Speter cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG); 2572251881Speter 2573251881Speter /* Update the options in the config */ 2574251881Speter if (opt_state.config_options) 2575251881Speter { 2576251881Speter svn_error_clear( 2577251881Speter svn_cmdline__apply_config_options(cfg_hash, 2578251881Speter opt_state.config_options, 2579251881Speter "svn: ", "--config-option")); 2580251881Speter } 2581251881Speter 2582251881Speter#if !defined(SVN_CL_NO_EXCLUSIVE_LOCK) 2583251881Speter { 2584251881Speter const char *exclusive_clients_option; 2585251881Speter apr_array_header_t *exclusive_clients; 2586251881Speter 2587251881Speter svn_config_get(cfg_config, &exclusive_clients_option, 2588251881Speter SVN_CONFIG_SECTION_WORKING_COPY, 2589251881Speter SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS, 2590251881Speter NULL); 2591251881Speter exclusive_clients = svn_cstring_split(exclusive_clients_option, 2592251881Speter " ,", TRUE, pool); 2593251881Speter for (i = 0; i < exclusive_clients->nelts; ++i) 2594251881Speter { 2595251881Speter const char *exclusive_client = APR_ARRAY_IDX(exclusive_clients, i, 2596251881Speter const char *); 2597251881Speter 2598251881Speter /* This blocks other clients from accessing the wc.db so it must 2599251881Speter be explicitly enabled.*/ 2600251881Speter if (!strcmp(exclusive_client, "svn")) 2601251881Speter svn_config_set(cfg_config, 2602251881Speter SVN_CONFIG_SECTION_WORKING_COPY, 2603251881Speter SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE, 2604251881Speter "true"); 2605251881Speter } 2606251881Speter } 2607251881Speter#endif 2608251881Speter 2609251881Speter /* Create a client context object. */ 2610251881Speter command_baton.opt_state = &opt_state; 2611251881Speter SVN_INT_ERR(svn_client_create_context2(&ctx, cfg_hash, pool)); 2612251881Speter command_baton.ctx = ctx; 2613251881Speter 2614251881Speter /* If we're running a command that could result in a commit, verify 2615251881Speter that any log message we were given on the command line makes 2616251881Speter sense (unless we've also been instructed not to care). This may 2617251881Speter access the working copy so do it after setting the locking mode. */ 2618251881Speter if ((! opt_state.force_log) 2619251881Speter && (subcommand->cmd_func == svn_cl__commit 2620251881Speter || subcommand->cmd_func == svn_cl__copy 2621251881Speter || subcommand->cmd_func == svn_cl__delete 2622251881Speter || subcommand->cmd_func == svn_cl__import 2623251881Speter || subcommand->cmd_func == svn_cl__mkdir 2624251881Speter || subcommand->cmd_func == svn_cl__move 2625251881Speter || subcommand->cmd_func == svn_cl__lock 2626251881Speter || subcommand->cmd_func == svn_cl__propedit)) 2627251881Speter { 2628251881Speter /* If the -F argument is a file that's under revision control, 2629251881Speter that's probably not what the user intended. */ 2630251881Speter if (dash_F_arg) 2631251881Speter { 2632251881Speter svn_node_kind_t kind; 2633251881Speter const char *local_abspath; 2634251881Speter const char *fname_utf8 = svn_dirent_internal_style(dash_F_arg, pool); 2635251881Speter 2636251881Speter err = svn_dirent_get_absolute(&local_abspath, fname_utf8, pool); 2637251881Speter 2638251881Speter if (!err) 2639251881Speter { 2640251881Speter err = svn_wc_read_kind2(&kind, ctx->wc_ctx, local_abspath, TRUE, 2641251881Speter FALSE, pool); 2642251881Speter 2643251881Speter if (!err && kind != svn_node_none && kind != svn_node_unknown) 2644251881Speter { 2645251881Speter if (subcommand->cmd_func != svn_cl__lock) 2646251881Speter { 2647251881Speter err = svn_error_create( 2648251881Speter SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL, 2649251881Speter _("Log message file is a versioned file; " 2650251881Speter "use '--force-log' to override")); 2651251881Speter } 2652251881Speter else 2653251881Speter { 2654251881Speter err = svn_error_create( 2655251881Speter SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL, 2656251881Speter _("Lock comment file is a versioned file; " 2657251881Speter "use '--force-log' to override")); 2658251881Speter } 2659251881Speter return EXIT_ERROR(err); 2660251881Speter } 2661251881Speter } 2662251881Speter svn_error_clear(err); 2663251881Speter } 2664251881Speter 2665251881Speter /* If the -m argument is a file at all, that's probably not what 2666251881Speter the user intended. */ 2667251881Speter if (dash_m_arg) 2668251881Speter { 2669251881Speter apr_finfo_t finfo; 2670251881Speter if (apr_stat(&finfo, dash_m_arg, 2671251881Speter APR_FINFO_MIN, pool) == APR_SUCCESS) 2672251881Speter { 2673251881Speter if (subcommand->cmd_func != svn_cl__lock) 2674251881Speter { 2675251881Speter err = svn_error_create 2676251881Speter (SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL, 2677251881Speter _("The log message is a pathname " 2678251881Speter "(was -F intended?); use '--force-log' to override")); 2679251881Speter } 2680251881Speter else 2681251881Speter { 2682251881Speter err = svn_error_create 2683251881Speter (SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL, 2684251881Speter _("The lock comment is a pathname " 2685251881Speter "(was -F intended?); use '--force-log' to override")); 2686251881Speter } 2687251881Speter return EXIT_ERROR(err); 2688251881Speter } 2689251881Speter } 2690251881Speter } 2691251881Speter 2692251881Speter /* XXX: Only diff_cmd for now, overlay rest later and stop passing 2693251881Speter opt_state altogether? */ 2694251881Speter if (opt_state.diff.diff_cmd) 2695251881Speter svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS, 2696251881Speter SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff.diff_cmd); 2697251881Speter if (opt_state.merge_cmd) 2698251881Speter svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS, 2699251881Speter SVN_CONFIG_OPTION_DIFF3_CMD, opt_state.merge_cmd); 2700251881Speter if (opt_state.diff.internal_diff) 2701251881Speter svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS, 2702251881Speter SVN_CONFIG_OPTION_DIFF_CMD, NULL); 2703251881Speter 2704251881Speter /* Check for mutually exclusive args --auto-props and --no-auto-props */ 2705251881Speter if (opt_state.autoprops && opt_state.no_autoprops) 2706251881Speter { 2707251881Speter err = svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL, 2708251881Speter _("--auto-props and --no-auto-props are " 2709251881Speter "mutually exclusive")); 2710251881Speter return EXIT_ERROR(err); 2711251881Speter } 2712251881Speter 2713251881Speter /* Update auto-props-enable option, and populate the MIME types map, 2714251881Speter for add/import commands */ 2715251881Speter if (subcommand->cmd_func == svn_cl__add 2716251881Speter || subcommand->cmd_func == svn_cl__import) 2717251881Speter { 2718251881Speter const char *mimetypes_file; 2719251881Speter svn_config_get(cfg_config, &mimetypes_file, 2720251881Speter SVN_CONFIG_SECTION_MISCELLANY, 2721251881Speter SVN_CONFIG_OPTION_MIMETYPES_FILE, FALSE); 2722251881Speter if (mimetypes_file && *mimetypes_file) 2723251881Speter { 2724251881Speter SVN_INT_ERR(svn_io_parse_mimetypes_file(&(ctx->mimetypes_map), 2725251881Speter mimetypes_file, pool)); 2726251881Speter } 2727251881Speter 2728251881Speter if (opt_state.autoprops) 2729251881Speter { 2730251881Speter svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY, 2731251881Speter SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS, TRUE); 2732251881Speter } 2733251881Speter if (opt_state.no_autoprops) 2734251881Speter { 2735251881Speter svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY, 2736251881Speter SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS, FALSE); 2737251881Speter } 2738251881Speter } 2739251881Speter 2740251881Speter /* Update the 'keep-locks' runtime option */ 2741251881Speter if (opt_state.no_unlock) 2742251881Speter svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY, 2743251881Speter SVN_CONFIG_OPTION_NO_UNLOCK, TRUE); 2744251881Speter 2745251881Speter /* Set the log message callback function. Note that individual 2746251881Speter subcommands will populate the ctx->log_msg_baton3. */ 2747251881Speter ctx->log_msg_func3 = svn_cl__get_log_message; 2748251881Speter 2749251881Speter /* Set up the notifier. 2750251881Speter 2751251881Speter In general, we use it any time we aren't in --quiet mode. 'svn 2752251881Speter status' is unique, though, in that we don't want it in --quiet mode 2753251881Speter unless we're also in --verbose mode. When in --xml mode, 2754251881Speter though, we never want it. */ 2755251881Speter if (opt_state.quiet) 2756251881Speter use_notifier = FALSE; 2757251881Speter if ((subcommand->cmd_func == svn_cl__status) && opt_state.verbose) 2758251881Speter use_notifier = TRUE; 2759251881Speter if (opt_state.xml) 2760251881Speter use_notifier = FALSE; 2761251881Speter if (use_notifier) 2762251881Speter { 2763251881Speter SVN_INT_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2, 2764251881Speter conflict_stats, pool)); 2765251881Speter } 2766251881Speter 2767251881Speter /* Set up our cancellation support. */ 2768251881Speter ctx->cancel_func = svn_cl__check_cancel; 2769251881Speter apr_signal(SIGINT, signal_handler); 2770251881Speter#ifdef SIGBREAK 2771251881Speter /* SIGBREAK is a Win32 specific signal generated by ctrl-break. */ 2772251881Speter apr_signal(SIGBREAK, signal_handler); 2773251881Speter#endif 2774251881Speter#ifdef SIGHUP 2775251881Speter apr_signal(SIGHUP, signal_handler); 2776251881Speter#endif 2777251881Speter#ifdef SIGTERM 2778251881Speter apr_signal(SIGTERM, signal_handler); 2779251881Speter#endif 2780251881Speter 2781251881Speter#ifdef SIGPIPE 2782251881Speter /* Disable SIGPIPE generation for the platforms that have it. */ 2783251881Speter apr_signal(SIGPIPE, SIG_IGN); 2784251881Speter#endif 2785251881Speter 2786251881Speter#ifdef SIGXFSZ 2787251881Speter /* Disable SIGXFSZ generation for the platforms that have it, otherwise 2788251881Speter * working with large files when compiled against an APR that doesn't have 2789251881Speter * large file support will crash the program, which is uncool. */ 2790251881Speter apr_signal(SIGXFSZ, SIG_IGN); 2791251881Speter#endif 2792251881Speter 2793251881Speter /* Set up Authentication stuff. */ 2794251881Speter SVN_INT_ERR(svn_cmdline_create_auth_baton(&ab, 2795251881Speter opt_state.non_interactive, 2796251881Speter opt_state.auth_username, 2797251881Speter opt_state.auth_password, 2798251881Speter opt_state.config_dir, 2799251881Speter opt_state.no_auth_cache, 2800251881Speter opt_state.trust_server_cert, 2801251881Speter cfg_config, 2802251881Speter ctx->cancel_func, 2803251881Speter ctx->cancel_baton, 2804251881Speter pool)); 2805251881Speter 2806251881Speter ctx->auth_baton = ab; 2807251881Speter 2808251881Speter if (opt_state.non_interactive) 2809251881Speter { 2810251881Speter if (opt_state.accept_which == svn_cl__accept_edit) 2811251881Speter return EXIT_ERROR( 2812251881Speter svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2813251881Speter _("--accept=%s incompatible with" 2814251881Speter " --non-interactive"), 2815251881Speter SVN_CL__ACCEPT_EDIT)); 2816251881Speter 2817251881Speter if (opt_state.accept_which == svn_cl__accept_launch) 2818251881Speter return EXIT_ERROR( 2819251881Speter svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL, 2820251881Speter _("--accept=%s incompatible with" 2821251881Speter " --non-interactive"), 2822251881Speter SVN_CL__ACCEPT_LAUNCH)); 2823251881Speter 2824251881Speter /* The default action when we're non-interactive is to postpone 2825251881Speter * conflict resolution. */ 2826251881Speter if (opt_state.accept_which == svn_cl__accept_unspecified) 2827251881Speter opt_state.accept_which = svn_cl__accept_postpone; 2828251881Speter } 2829251881Speter 2830251881Speter /* Check whether interactive conflict resolution is disabled by 2831251881Speter * the configuration file. If no --accept option was specified 2832251881Speter * we postpone all conflicts in this case. */ 2833251881Speter SVN_INT_ERR(svn_config_get_bool(cfg_config, &interactive_conflicts, 2834251881Speter SVN_CONFIG_SECTION_MISCELLANY, 2835251881Speter SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS, 2836251881Speter TRUE)); 2837251881Speter if (!interactive_conflicts) 2838251881Speter { 2839251881Speter /* Make 'svn resolve' non-interactive. */ 2840251881Speter if (subcommand->cmd_func == svn_cl__resolve) 2841251881Speter opt_state.non_interactive = TRUE; 2842251881Speter 2843251881Speter /* We're not resolving conflicts interactively. If no --accept option 2844251881Speter * was provided the default behaviour is to postpone all conflicts. */ 2845251881Speter if (opt_state.accept_which == svn_cl__accept_unspecified) 2846251881Speter opt_state.accept_which = svn_cl__accept_postpone; 2847251881Speter } 2848251881Speter 2849251881Speter /* Install the default conflict handler. */ 2850251881Speter { 2851251881Speter svn_cl__interactive_conflict_baton_t *b; 2852251881Speter 2853251881Speter ctx->conflict_func = NULL; 2854251881Speter ctx->conflict_baton = NULL; 2855251881Speter 2856251881Speter ctx->conflict_func2 = svn_cl__conflict_func_interactive; 2857251881Speter SVN_INT_ERR(svn_cl__get_conflict_func_interactive_baton( 2858251881Speter &b, 2859251881Speter opt_state.accept_which, 2860251881Speter ctx->config, opt_state.editor_cmd, conflict_stats, 2861251881Speter ctx->cancel_func, ctx->cancel_baton, pool)); 2862251881Speter ctx->conflict_baton2 = b; 2863251881Speter } 2864251881Speter 2865251881Speter /* And now we finally run the subcommand. */ 2866251881Speter err = (*subcommand->cmd_func)(os, &command_baton, pool); 2867251881Speter if (err) 2868251881Speter { 2869251881Speter /* For argument-related problems, suggest using the 'help' 2870251881Speter subcommand. */ 2871251881Speter if (err->apr_err == SVN_ERR_CL_INSUFFICIENT_ARGS 2872251881Speter || err->apr_err == SVN_ERR_CL_ARG_PARSING_ERROR) 2873251881Speter { 2874251881Speter err = svn_error_quick_wrap( 2875251881Speter err, apr_psprintf(pool, 2876251881Speter _("Try 'svn help %s' for more information"), 2877251881Speter subcommand->name)); 2878251881Speter } 2879251881Speter if (err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED) 2880251881Speter { 2881251881Speter err = svn_error_quick_wrap(err, 2882251881Speter _("Please see the 'svn upgrade' command")); 2883251881Speter } 2884251881Speter 2885251881Speter if (err->apr_err == SVN_ERR_AUTHN_FAILED && opt_state.non_interactive) 2886251881Speter { 2887251881Speter err = svn_error_quick_wrap(err, 2888251881Speter _("Authentication failed and interactive" 2889251881Speter " prompting is disabled; see the" 2890251881Speter " --force-interactive option")); 2891251881Speter if (reading_file_from_stdin) 2892251881Speter err = svn_error_quick_wrap(err, 2893251881Speter _("Reading file from standard input " 2894251881Speter "because of -F option; this can " 2895251881Speter "interfere with interactive " 2896251881Speter "prompting")); 2897251881Speter } 2898251881Speter 2899251881Speter /* Tell the user about 'svn cleanup' if any error on the stack 2900251881Speter was about locked working copies. */ 2901251881Speter if (svn_error_find_cause(err, SVN_ERR_WC_LOCKED)) 2902251881Speter { 2903251881Speter err = svn_error_quick_wrap( 2904251881Speter err, _("Run 'svn cleanup' to remove locks " 2905251881Speter "(type 'svn help cleanup' for details)")); 2906251881Speter } 2907251881Speter 2908251881Speter if (err->apr_err == SVN_ERR_SQLITE_BUSY) 2909251881Speter { 2910251881Speter err = svn_error_quick_wrap(err, 2911251881Speter _("Another process is blocking the " 2912251881Speter "working copy database, or the " 2913251881Speter "underlying filesystem does not " 2914251881Speter "support file locking; if the working " 2915251881Speter "copy is on a network filesystem, make " 2916251881Speter "sure file locking has been enabled " 2917251881Speter "on the file server")); 2918251881Speter } 2919251881Speter 2920251881Speter if (svn_error_find_cause(err, SVN_ERR_RA_CANNOT_CREATE_TUNNEL) && 2921251881Speter (opt_state.auth_username || opt_state.auth_password)) 2922251881Speter { 2923251881Speter err = svn_error_quick_wrap( 2924251881Speter err, _("When using svn+ssh:// URLs, keep in mind that the " 2925251881Speter "--username and --password options are ignored " 2926251881Speter "because authentication is performed by SSH, not " 2927251881Speter "Subversion")); 2928251881Speter } 2929251881Speter 2930251881Speter return EXIT_ERROR(err); 2931251881Speter } 2932251881Speter else 2933251881Speter { 2934251881Speter /* Ensure that stdout is flushed, so the user will see any write errors. 2935251881Speter This makes sure that output is not silently lost. */ 2936251881Speter SVN_INT_ERR(svn_cmdline_fflush(stdout)); 2937251881Speter 2938251881Speter return EXIT_SUCCESS; 2939251881Speter } 2940251881Speter} 2941251881Speter 2942251881Speterint 2943251881Spetermain(int argc, const char *argv[]) 2944251881Speter{ 2945251881Speter apr_pool_t *pool; 2946251881Speter int exit_code; 2947251881Speter 2948251881Speter /* Initialize the app. */ 2949251881Speter if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS) 2950251881Speter return EXIT_FAILURE; 2951251881Speter 2952251881Speter /* Create our top-level pool. Use a separate mutexless allocator, 2953251881Speter * given this application is single threaded. 2954251881Speter */ 2955251881Speter pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE)); 2956251881Speter 2957251881Speter exit_code = sub_main(argc, argv, pool); 2958251881Speter 2959251881Speter svn_pool_destroy(pool); 2960251881Speter return exit_code; 2961251881Speter} 2962