2 * svn.c: Subversion command line client main file.
4 * ====================================================================
5 * Licensed to the Apache Software Foundation (ASF) under one
6 * or more contributor license agreements. See the NOTICE file
7 * distributed with this work for additional information
8 * regarding copyright ownership. The ASF licenses this file
9 * to you under the Apache License, Version 2.0 (the
10 * "License"); you may not use this file except in compliance
11 * with the License. You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing,
16 * software distributed under the License is distributed on an
17 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
18 * KIND, either express or implied. See the License for the
19 * specific language governing permissions and limitations
21 * ====================================================================
24 /* ==================================================================== */
33 #include <apr_strings.h>
34 #include <apr_tables.h>
35 #include <apr_general.h>
37 #include "svn_cmdline.h"
38 #include "svn_pools.h"
40 #include "svn_client.h"
41 #include "svn_config.h"
42 #include "svn_string.h"
43 #include "svn_dirent_uri.h"
45 #include "svn_delta.h"
47 #include "svn_error.h"
53 #include "svn_version.h"
56 #include "private/svn_opt_private.h"
57 #include "private/svn_cmdline_private.h"
58 #include "private/svn_subr_private.h"
59 #include "private/svn_utf_private.h"
61 #include "svn_private_config.h"
64 /*** Option Processing ***/
66 /* Add an identifier here for long options that don't have a short
67 option. Options that have both long and short options should just
68 use the short option letter as identifier. */
69 typedef enum svn_cl__longopt_t {
70 opt_auth_password = SVN_OPT_FIRST_LONGOPT_ID,
71 opt_auth_password_from_stdin,
82 opt_show_copies_as_adds,
85 opt_use_git_diff_format,
86 opt_ignore_properties,
89 /* end of diff options */
107 opt_force_interactive,
114 opt_strict, /* ### DEPRECATED */
122 opt_with_all_revprops,
123 opt_with_no_revprops,
128 opt_trust_server_cert,
129 opt_trust_server_cert_failures,
133 opt_ignore_whitespace,
135 opt_allow_mixed_revisions,
136 opt_include_externals,
137 opt_show_inherited_props,
141 opt_remove_unversioned,
147 opt_adds_as_modification,
148 opt_vacuum_pristines,
155 /* Option codes and descriptions for the command line client.
157 * The entire list must be terminated with an entry of nulls.
159 const apr_getopt_option_t svn_cl__options[] =
161 {"force", opt_force, 0, N_("force operation to run")},
162 {"force-log", opt_force_log, 0,
163 N_("force validity of log message source")},
164 {"help", 'h', 0, N_("show help on a subcommand")},
165 {NULL, '?', 0, N_("show help on a subcommand")},
166 {"message", 'm', 1, N_("specify log message ARG")},
167 {"quiet", 'q', 0, N_("print nothing, or only summary information")},
168 {"recursive", 'R', 0, N_("descend recursively, same as --depth=infinity")},
169 {"non-recursive", 'N', 0, N_("obsolete; try --depth=files or --depth=immediates")},
171 N_("the change made by revision ARG (like -r ARG-1:ARG)\n"
173 "If ARG is negative this is like -r ARG:ARG-1\n"
175 "If ARG is of the form ARG1-ARG2 then this is like\n"
177 "ARG1:ARG2, where ARG1 is inclusive")},
179 N_("ARG (some commands also take ARG1:ARG2 range)\n"
181 "A revision argument can be one of:\n"
183 " NUMBER revision number\n"
185 " '{' DATE '}' revision at start of the date\n"
187 " 'HEAD' latest in repository\n"
189 " 'BASE' base rev of item's working copy\n"
191 " 'COMMITTED' last commit at or before BASE\n"
193 " 'PREV' revision just before COMMITTED")},
194 {"file", 'F', 1, N_("read log message from file ARG")},
195 {"incremental", opt_incremental, 0,
196 N_("give output suitable for concatenation")},
197 {"encoding", opt_encoding, 1,
198 N_("treat value as being in charset encoding ARG")},
199 {"version", opt_version, 0, N_("show program version information")},
200 {"verbose", 'v', 0, N_("print extra information")},
201 {"show-updates", 'u', 0, N_("display update information")},
202 {"username", opt_auth_username, 1, N_("specify a username ARG")},
203 {"password", opt_auth_password, 1,
204 N_("specify a password ARG (caution: on many operating\n"
206 "systems, other users will be able to see this)")},
207 {"password-from-stdin",
208 opt_auth_password_from_stdin, 0,
209 N_("read password from stdin")},
210 {"extensions", 'x', 1,
211 N_("Specify differencing options for external diff or\n"
213 "internal diff or blame. Default: '-u'. Options are\n"
215 "separated by spaces. Internal diff and blame take:\n"
217 " -u, --unified: Show 3 lines of unified context\n"
219 " -b, --ignore-space-change: Ignore changes in\n"
221 " amount of white space\n"
223 " -w, --ignore-all-space: Ignore all white space\n"
225 " --ignore-eol-style: Ignore changes in EOL style\n"
227 " -U ARG, --context ARG: Show ARG lines of context\n"
229 " -p, --show-c-function: Show C function name")},
230 {"targets", opt_targets, 1,
231 N_("pass contents of file ARG as additional args")},
232 {"depth", opt_depth, 1,
233 N_("limit operation by depth ARG ('empty', 'files',\n"
235 "'immediates', or 'infinity')")},
236 {"set-depth", opt_set_depth, 1,
237 N_("set new working copy depth to ARG ('exclude',\n"
239 "'empty', 'files', 'immediates', or 'infinity')")},
240 {"xml", opt_xml, 0, N_("output in XML")},
241 {"strict", opt_strict, 0, N_("DEPRECATED")},
242 {"stop-on-copy", opt_stop_on_copy, 0,
243 N_("do not cross copies while traversing history")},
244 {"no-ignore", opt_no_ignore, 0,
245 N_("disregard default and svn:ignore and\n"
247 "svn:global-ignores property ignores")},
248 {"no-auth-cache", opt_no_auth_cache, 0,
249 N_("do not cache authentication tokens")},
250 {"trust-server-cert", opt_trust_server_cert, 0,
251 N_("deprecated; same as\n"
253 "--trust-server-cert-failures=unknown-ca")},
254 {"trust-server-cert-failures", opt_trust_server_cert_failures, 1,
255 N_("with --non-interactive, accept SSL server\n"
257 "certificates with failures; ARG is comma-separated\n"
259 "list of 'unknown-ca' (Unknown Authority),\n"
261 "'cn-mismatch' (Hostname mismatch), 'expired'\n"
263 "(Expired certificate), 'not-yet-valid' (Not yet\n"
265 "valid certificate) and 'other' (all other not\n"
267 "separately classified certificate errors).")},
268 {"non-interactive", opt_non_interactive, 0,
269 N_("do no interactive prompting (default is to prompt\n"
271 "only if standard input is a terminal device)")},
272 {"force-interactive", opt_force_interactive, 0,
273 N_("do interactive prompting even if standard input\n"
275 "is not a terminal device")},
276 {"dry-run", opt_dry_run, 0,
277 N_("try operation but make no changes")},
278 {"ignore-ancestry", opt_ignore_ancestry, 0,
279 N_("disable merge tracking; diff nodes as if related")},
280 {"ignore-externals", opt_ignore_externals, 0,
281 N_("ignore externals definitions")},
282 {"diff3-cmd", opt_merge_cmd, 1, N_("use ARG as merge command")},
283 {"editor-cmd", opt_editor_cmd, 1, N_("use ARG as external editor")},
284 {"record-only", opt_record_only, 0,
285 N_("merge only mergeinfo differences")},
286 {"old", opt_old_cmd, 1, N_("use ARG as the older target")},
287 {"new", opt_new_cmd, 1, N_("use ARG as the newer target")},
288 {"revprop", opt_revprop, 0,
289 N_("operate on a revision property (use with -r)")},
290 {"relocate", opt_relocate, 0, N_("relocate via URL-rewriting")},
291 {"config-dir", opt_config_dir, 1,
292 N_("read user configuration files from directory ARG")},
293 {"config-option", opt_config_options, 1,
294 N_("set user configuration option in the format:\n"
296 " FILE:SECTION:OPTION=[VALUE]\n"
300 " servers:global:http-library=serf")},
301 {"auto-props", opt_autoprops, 0, N_("enable automatic properties")},
302 {"no-auto-props", opt_no_autoprops, 0, N_("disable automatic properties")},
303 {"native-eol", opt_native_eol, 1,
304 N_("use a different EOL marker than the standard\n"
306 "system marker for files with the svn:eol-style\n"
308 "property set to 'native'.\n"
310 "ARG may be one of 'LF', 'CR', 'CRLF'")},
311 {"limit", 'l', 1, N_("maximum number of log entries")},
312 {"no-unlock", opt_no_unlock, 0, N_("don't unlock the targets")},
313 {"remove", opt_remove, 0, N_("remove changelist association")},
314 {"changelist", opt_changelist, 1,
315 N_("operate only on members of changelist ARG")},
316 {"keep-changelists", opt_keep_changelists, 0,
317 N_("don't delete changelists after commit")},
318 {"keep-local", opt_keep_local, 0, N_("keep path in working copy")},
319 {"with-all-revprops", opt_with_all_revprops, 0,
320 N_("retrieve all revision properties")},
321 {"with-no-revprops", opt_with_no_revprops, 0,
322 N_("retrieve no revision properties")},
323 {"with-revprop", opt_with_revprop, 1,
324 N_("set revision property ARG in new revision\n"
326 "using the name[=value] format")},
327 {"parents", opt_parents, 0, N_("make intermediate directories")},
328 {"use-merge-history", 'g', 0,
329 N_("use/display additional information from merge\n"
332 {"accept", opt_accept, 1,
333 N_("specify automatic conflict resolution action\n"
335 "('postpone', 'working', 'base', 'mine-conflict',\n"
337 "'theirs-conflict', 'mine-full', 'theirs-full',\n"
339 "'edit', 'launch', 'recommended') (shorthand:\n"
341 "'p', 'mc', 'tc', 'mf', 'tf', 'e', 'l', 'r')"
343 {"show-revs", opt_show_revs, 1,
344 N_("specify which collection of revisions to display\n"
346 "('merged', 'eligible')")},
347 {"reintegrate", opt_reintegrate, 0,
349 {"strip", opt_strip, 1,
350 N_("number of leading path components to strip from\n"
352 "paths parsed from the patch file. --strip 0\n"
354 "is the default and leaves paths unmodified.\n"
356 "--strip 1 would change the path\n"
358 "'doc/fudge/crunchy.html' to 'fudge/crunchy.html'.\n"
360 "--strip 2 would leave just 'crunchy.html'\n"
362 "The expected component separator is '/' on all\n"
364 "platforms. A leading '/' counts as one component.")},
365 {"ignore-keywords", opt_ignore_keywords, 0,
366 N_("don't expand keywords")},
367 {"reverse-diff", opt_reverse_diff, 0,
368 N_("apply the unidiff in reverse")},
369 {"ignore-whitespace", opt_ignore_whitespace, 0,
370 N_("ignore whitespace during pattern matching")},
371 {"diff", opt_diff, 0, N_("produce diff output")}, /* maps to show_diff */
373 {"diff-cmd", opt_diff_cmd, 1, N_("use ARG as diff command")},
374 {"internal-diff", opt_internal_diff, 0,
375 N_("override diff-cmd specified in config file")},
376 {"no-diff-added", opt_no_diff_added, 0,
377 N_("do not print differences for added files")},
378 {"no-diff-deleted", opt_no_diff_deleted, 0,
379 N_("do not print differences for deleted files")},
380 {"show-copies-as-adds", opt_show_copies_as_adds, 0,
381 N_("don't diff copied or moved files with their source")},
382 {"notice-ancestry", opt_notice_ancestry, 0,
383 N_("diff unrelated nodes as delete and add")},
384 {"summarize", opt_summarize, 0, N_("show a summary of the results")},
385 {"git", opt_use_git_diff_format, 0,
386 N_("use git's extended diff format")},
387 {"ignore-properties", opt_ignore_properties, 0,
388 N_("ignore properties during the operation")},
389 {"properties-only", opt_properties_only, 0,
390 N_("show only properties during the operation")},
391 {"patch-compatible", opt_patch_compatible, 0,
392 N_("generate diff suitable for generic third-party\n"
394 "patch tools; currently the same as\n"
396 "--show-copies-as-adds --ignore-properties"
398 /* end of diff options */
399 {"allow-mixed-revisions", opt_allow_mixed_revisions, 0,
400 N_("Allow operation on mixed-revision working copy.\n"
402 "Use of this option is not recommended!\n"
404 "Please run 'svn update' instead.")},
405 {"include-externals", opt_include_externals, 0,
406 N_("also operate on externals defined by\n"
408 "svn:externals properties")},
409 {"show-inherited-props", opt_show_inherited_props, 0,
410 N_("retrieve properties set on parents of the target")},
411 {"search", opt_search, 1,
412 N_("use ARG as search pattern (glob syntax, case-\n"
414 "and accent-insensitive, may require quotation marks\n"
416 "to prevent shell expansion)")},
417 {"search-and", opt_search_and, 1,
418 N_("combine ARG with the previous search pattern")},
419 {"log", opt_mergeinfo_log, 0,
420 N_("show revision log message, author and date")},
421 {"remove-unversioned", opt_remove_unversioned, 0,
422 N_("remove unversioned items")},
423 {"remove-ignored", opt_remove_ignored, 0, N_("remove ignored items")},
424 {"no-newline", opt_no_newline, 0, N_("do not output the trailing newline")},
425 {"show-passwords", opt_show_passwords, 0, N_("show cached passwords")},
426 {"pin-externals", opt_pin_externals, 0,
427 N_("pin externals with no explicit revision to their\n"
429 "current revision (recommended when tagging)")},
430 {"show-item", opt_show_item, 1,
431 N_("print only the item identified by ARG:\n"
433 " 'kind' node kind of TARGET\n"
435 " 'url' URL of TARGET in the repository\n"
439 " repository-relative URL of TARGET\n"
441 " 'repos-root-url'\n"
443 " root URL of repository\n"
445 " 'repos-uuid' UUID of repository\n"
447 " 'revision' specified or implied revision\n"
449 " 'last-changed-revision'\n"
451 " last change of TARGET at or before\n"
455 " 'last-changed-date'\n"
457 " date of 'last-changed-revision'\n"
459 " 'last-changed-author'\n"
461 " author of 'last-changed-revision'\n"
463 " 'wc-root' root of TARGET's working copy")},
465 {"adds-as-modification", opt_adds_as_modification, 0,
466 N_("Local additions are merged with incoming additions\n"
468 "instead of causing a tree conflict. Use of this\n"
470 "option is not recommended! Use 'svn resolve' to\n"
472 "resolve tree conflicts instead.")},
474 {"vacuum-pristines", opt_vacuum_pristines, 0,
475 N_("remove unreferenced pristines from .svn directory")},
477 {"list", opt_list, 0, N_("list shelved patches")},
478 {"keep-shelved", opt_keep_shelved, 0, N_("do not delete the shelved patch")},
479 {"delete", opt_delete, 0, N_("delete the shelved patch")},
483 * These have NULL desriptions, but an option code that matches some
484 * other option (whose description should probably mention its aliases).
487 {"cl", opt_changelist, 1, NULL},
494 /*** Command dispatch. ***/
496 /* Our array of available subcommands.
498 * The entire list must be terminated with an entry of nulls.
500 * In most of the help text "PATH" is used where a working copy path is
501 * required, "URL" where a repository URL is required and "TARGET" when
502 * either a path or a url can be used. Hmm, should this be part of the
506 /* Options that apply to all commands. (While not every command may
507 currently require authentication or be interactive, allowing every
508 command to take these arguments allows scripts to just pass them
509 willy-nilly to every invocation of 'svn') . */
510 const int svn_cl__global_options[] =
511 { opt_auth_username, opt_auth_password, opt_auth_password_from_stdin,
512 opt_no_auth_cache, opt_non_interactive,
513 opt_force_interactive, opt_trust_server_cert,
514 opt_trust_server_cert_failures,
515 opt_config_dir, opt_config_options, 0
518 /* Options for giving a log message. (Some of these also have other uses.)
520 #define SVN_CL__LOG_MSG_OPTIONS 'm', 'F', \
526 const svn_opt_subcommand_desc2_t svn_cl__cmd_table[] =
528 { "add", svn_cl__add, {0}, N_
529 ("Put files and directories under version control, scheduling\n"
530 "them for addition to repository. They will be added in next commit.\n"
531 "usage: add PATH...\n"),
532 {opt_targets, 'N', opt_depth, 'q', opt_force, opt_no_ignore, opt_autoprops,
533 opt_no_autoprops, opt_parents },
534 {{opt_parents, N_("add intermediate parents")}} },
536 { "auth", svn_cl__auth, {0}, N_
537 ("Manage cached authentication credentials.\n"
538 "usage: 1. svn auth [PATTERN ...]\n"
539 "usage: 2. svn auth --remove PATTERN [PATTERN ...]\n"
541 " With no arguments, list all cached authentication credentials.\n"
542 " Authentication credentials include usernames, passwords,\n"
543 " SSL certificates, and SSL client-certificate passphrases.\n"
544 " If PATTERN is specified, only list credentials with attributes matching one\n"
545 " or more patterns. With the --remove option, remove cached authentication\n"
546 " credentials matching one or more patterns.\n"
548 " If more than one pattern is specified credentials are considered only if they\n"
549 " match all specified patterns. Patterns are matched case-sensitively and may\n"
550 " contain glob wildcards:\n"
551 " ? matches any single character\n"
552 " * matches a sequence of arbitrary characters\n"
553 " [abc] matches any of the characters listed inside the brackets\n"
554 " Note that wildcards will usually need to be quoted or escaped on the\n"
555 " command line because many command shells will interfere by trying to\n"
557 { opt_remove, opt_show_passwords },
558 { {opt_remove, N_("remove matching authentication credentials")} }
562 { "blame", svn_cl__blame, {"praise", "annotate", "ann"}, N_
563 ("Show when each line of a file was last (or\n"
565 "usage: blame [-rM:N] TARGET[@REV]...\n"
567 " Annotate each line of a file with the revision number and author of the\n"
568 " last change (or optionally the next change) to that line.\n"
570 " With no revision range (same as -r0:REV), or with '-r M:N' where M < N,\n"
571 " annotate each line that is present in revision N of the file, with\n"
572 " the last revision at or before rN that changed or added the line,\n"
573 " looking back no further than rM.\n"
575 " With a reverse revision range '-r M:N' where M > N,\n"
576 " annotate each line that is present in revision N of the file, with\n"
577 " the next revision after rN that changed or deleted the line,\n"
578 " looking forward no further than rM.\n"
580 " If specified, REV determines in which revision the target is first\n"
583 " Write the annotated result to standard output.\n"),
584 {'r', 'v', 'g', opt_incremental, opt_xml, 'x', opt_force} },
586 { "cat", svn_cl__cat, {0}, N_
587 ("Output the content of specified files or URLs.\n"
588 "usage: cat TARGET[@REV]...\n"
590 " If specified, REV determines in which revision the target is first\n"
592 {'r', opt_ignore_keywords} },
594 { "changelist", svn_cl__changelist, {"cl"}, N_
595 ("Associate (or dissociate) changelist CLNAME with the named files.\n"
596 "usage: 1. changelist CLNAME PATH...\n"
597 " 2. changelist --remove PATH...\n"),
598 { 'q', 'R', opt_depth, opt_remove, opt_targets, opt_changelist} },
600 { "checkout", svn_cl__checkout, {"co"}, N_
601 ("Check out a working copy from a repository.\n"
602 "usage: checkout URL[@REV]... [PATH]\n"
604 " If specified, REV determines in which revision the URL is first\n"
607 " If PATH is omitted, the basename of the URL will be used as\n"
608 " the destination. If multiple URLs are given each will be checked\n"
609 " out into a sub-directory of PATH, with the name of the sub-directory\n"
610 " being the basename of the URL.\n"
612 " If --force is used, unversioned obstructing paths in the working\n"
613 " copy destination do not automatically cause the check out to fail.\n"
614 " If the obstructing path is the same type (file or directory) as the\n"
615 " corresponding path in the repository it becomes versioned but its\n"
616 " contents are left 'as-is' in the working copy. This means that an\n"
617 " obstructing directory's unversioned children may also obstruct and\n"
618 " become versioned. For files, any content differences between the\n"
619 " obstruction and the repository are treated like a local modification\n"
620 " to the working copy. All properties from the repository are applied\n"
621 " to the obstructing path.\n"
623 " See also 'svn help update' for a list of possible characters\n"
624 " reporting the action taken.\n"),
625 {'r', 'q', 'N', opt_depth, opt_force, opt_ignore_externals} },
627 { "cleanup", svn_cl__cleanup, {0}, N_
628 ("Either recover from an interrupted operation that left the working copy locked,\n"
629 "or remove unwanted files.\n"
630 "usage: 1. cleanup [WCPATH...]\n"
631 " 2. cleanup --remove-unversioned [WCPATH...]\n"
632 " cleanup --remove-ignored [WCPATH...]\n"
633 " 3. cleanup --vacuum-pristines [WCPATH...]\n"
635 " 1. When none of the options --remove-unversioned, --remove-ignored, and\n"
636 " --vacuum-pristines is specified, remove all write locks (shown as 'L' by\n"
637 " the 'svn status' command) from the working copy. Usually, this is only\n"
638 " necessary if a Subversion client has crashed while using the working copy,\n"
639 " leaving it in an unusable state.\n"
641 " WARNING: There is no mechanism that will protect write locks still\n"
642 " being used by other Subversion clients. Running this command\n"
643 " without any options while another client is using the working\n"
644 " copy can corrupt the working copy beyond repair!\n"
646 " 2. If the --remove-unversioned option or the --remove-ignored option\n"
647 " is given, remove any unversioned or ignored items within WCPATH.\n"
648 " Note that the 'svn status' command shows unversioned items as '?',\n"
649 " and ignored items as 'I' if the --no-ignore option is given to it.\n"
651 " 3. If the --vacuum-pristines option is given, remove pristine copies of\n"
652 " files which are stored inside the .svn directory and which are no longer\n"
653 " referenced by any file in the working copy.\n"),
654 { opt_remove_unversioned, opt_remove_ignored, opt_vacuum_pristines,
655 opt_include_externals, 'q', opt_merge_cmd },
656 { { opt_merge_cmd, N_("deprecated and ignored") } } },
658 { "commit", svn_cl__commit, {"ci"},
659 N_("Send changes from your working copy to the repository.\n"
660 "usage: commit [PATH...]\n"
662 " A log message must be provided, but it can be empty. If it is not\n"
663 " given by a --message or --file option, an editor will be started.\n"
665 " If any targets are (or contain) locked items, those will be\n"
666 " unlocked after a successful commit, unless --no-unlock is given.\n"
668 " If --include-externals is given, also commit file and directory\n"
669 " externals reached by recursion. Do not commit externals with a\n"
670 " fixed revision.\n"),
671 {'q', 'N', opt_depth, opt_targets, opt_no_unlock, SVN_CL__LOG_MSG_OPTIONS,
672 opt_changelist, opt_keep_changelists, opt_include_externals} },
674 { "copy", svn_cl__copy, {"cp"}, N_
675 ("Copy files and directories in a working copy or repository.\n"
676 "usage: copy SRC[@REV]... DST\n"
678 " SRC and DST can each be either a working copy (WC) path or URL:\n"
679 " WC -> WC: copy and schedule for addition (with history)\n"
680 " WC -> URL: immediately commit a copy of WC to URL\n"
681 " URL -> WC: check out URL into WC, schedule for addition\n"
682 " URL -> URL: complete server-side copy; used to branch and tag\n"
683 " All the SRCs must be of the same type. If DST is an existing directory,\n"
684 " the sources will be added as children of DST. When copying multiple\n"
685 " sources, DST must be an existing directory.\n"
687 " WARNING: For compatibility with previous versions of Subversion,\n"
688 " copies performed using two working copy paths (WC -> WC) will not\n"
689 " contact the repository. As such, they may not, by default, be able\n"
690 " to propagate merge tracking information from the source of the copy\n"
691 " to the destination.\n"),
692 {'r', 'q', opt_ignore_externals, opt_parents, SVN_CL__LOG_MSG_OPTIONS,
693 opt_pin_externals} },
695 { "delete", svn_cl__delete, {"del", "remove", "rm"}, N_
696 ("Remove files and directories from version control.\n"
697 "usage: 1. delete PATH...\n"
698 " 2. delete URL...\n"
700 " 1. Each item specified by a PATH is scheduled for deletion upon\n"
701 " the next commit. Files, and directories that have not been\n"
702 " committed, are immediately removed from the working copy\n"
703 " unless the --keep-local option is given.\n"
704 " PATHs that are, or contain, unversioned or modified items will\n"
705 " not be removed unless the --force or --keep-local option is given.\n"
707 " 2. Each item specified by a URL is deleted from the repository\n"
708 " via an immediate commit.\n"),
709 {opt_force, 'q', opt_targets, SVN_CL__LOG_MSG_OPTIONS, opt_keep_local} },
711 { "diff", svn_cl__diff, {"di"}, N_
712 ("Display local changes or differences between two revisions or paths.\n"
714 " 2. diff [-c M | -r N[:M]] [TARGET[@REV]...]\n"
715 " 3. diff [-r N[:M]] --old=OLD-TGT[@OLDREV] [--new=NEW-TGT[@NEWREV]] \\\n"
717 " 4. diff OLD-URL[@OLDREV] NEW-URL[@NEWREV]\n"
718 " 5. diff OLD-URL[@OLDREV] NEW-PATH[@NEWREV]\n"
719 " 6. diff OLD-PATH[@OLDREV] NEW-URL[@NEWREV]\n"
721 " 1. Use just 'svn diff' to display local modifications in a working copy.\n"
723 " 2. Display the changes made to TARGETs as they are seen in REV between\n"
724 " two revisions. TARGETs may be all working copy paths or all URLs.\n"
725 " If TARGETs are working copy paths, N defaults to BASE and M to the\n"
726 " working copy; if URLs, N must be specified and M defaults to HEAD.\n"
727 " The '-c M' option is equivalent to '-r N:M' where N = M-1.\n"
728 " Using '-c -M' does the reverse: '-r M:N' where N = M-1.\n"
730 " 3. Display the differences between OLD-TGT as it was seen in OLDREV and\n"
731 " NEW-TGT as it was seen in NEWREV. PATHs, if given, are relative to\n"
732 " OLD-TGT and NEW-TGT and restrict the output to differences for those\n"
733 " paths. OLD-TGT and NEW-TGT may be working copy paths or URL[@REV].\n"
734 " NEW-TGT defaults to OLD-TGT if not specified. -r N makes OLDREV default\n"
735 " to N, -r N:M makes OLDREV default to N and NEWREV default to M.\n"
736 " If OLDREV or NEWREV are not specified, they default to WORKING for\n"
737 " working copy targets and to HEAD for URL targets.\n"
739 " Either or both OLD-TGT and NEW-TGT may also be paths to unversioned\n"
740 " targets. Revisions cannot be specified for unversioned targets.\n"
741 " Both targets must be of the same node kind (file or directory).\n"
742 " Diffing unversioned targets against URL targets is not supported.\n"
744 " 4. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-URL[@NEWREV]'\n"
745 " 5. Shorthand for 'svn diff --old=OLD-URL[@OLDREV] --new=NEW-PATH[@NEWREV]'\n"
746 " 6. Shorthand for 'svn diff --old=OLD-PATH[@OLDREV] --new=NEW-URL[@NEWREV]'\n"),
747 {'r', 'c', opt_old_cmd, opt_new_cmd, 'N', opt_depth, opt_diff_cmd,
748 opt_internal_diff, 'x', opt_no_diff_added, opt_no_diff_deleted,
749 opt_ignore_properties, opt_properties_only,
750 opt_show_copies_as_adds, opt_notice_ancestry, opt_summarize, opt_changelist,
751 opt_force, opt_xml, opt_use_git_diff_format, opt_patch_compatible} },
752 { "export", svn_cl__export, {0}, N_
753 ("Create an unversioned copy of a tree.\n"
754 "usage: 1. export [-r REV] URL[@PEGREV] [PATH]\n"
755 " 2. export [-r REV] PATH1[@PEGREV] [PATH2]\n"
757 " 1. Exports a clean directory tree from the repository specified by\n"
758 " URL, at revision REV if it is given, otherwise at HEAD, into\n"
759 " PATH. If PATH is omitted, the last component of the URL is used\n"
760 " for the local directory name.\n"
762 " 2. Exports a clean directory tree from the working copy specified by\n"
763 " PATH1, at revision REV if it is given, otherwise at WORKING, into\n"
764 " PATH2. If PATH2 is omitted, the last component of the PATH1 is used\n"
765 " for the local directory name. If REV is not specified, all local\n"
766 " changes will be preserved. Files not under version control will\n"
769 " If specified, PEGREV determines in which revision the target is first\n"
771 {'r', 'q', 'N', opt_depth, opt_force, opt_native_eol, opt_ignore_externals,
772 opt_ignore_keywords} },
774 { "help", svn_cl__help, {"?", "h"}, N_
775 ("Describe the usage of this program or its subcommands.\n"
776 "usage: help [SUBCOMMAND...]\n"),
778 /* This command is also invoked if we see option "--help", "-h" or "-?". */
780 { "import", svn_cl__import, {0}, N_
781 ("Commit an unversioned file or tree into the repository.\n"
782 "usage: import [PATH] URL\n"
784 " Recursively commit a copy of PATH to URL.\n"
785 " If PATH is omitted '.' is assumed.\n"
786 " Parent directories are created as necessary in the repository.\n"
787 " If PATH is a directory, the contents of the directory are added\n"
788 " directly under URL.\n"
789 " Unversionable items such as device files and pipes are ignored\n"
790 " if --force is specified.\n"),
791 {'q', 'N', opt_depth, opt_autoprops, opt_force, opt_no_autoprops,
792 SVN_CL__LOG_MSG_OPTIONS, opt_no_ignore} },
794 { "info", svn_cl__info, {0}, N_
795 ("Display information about a local or remote item.\n"
796 "usage: info [TARGET[@REV]...]\n"
798 " Print information about each TARGET (default: '.').\n"
799 " TARGET may be either a working-copy path or a URL. If specified, REV\n"
800 " determines in which revision the target is first looked up; the default\n"
801 " is HEAD for a URL or BASE for a WC path.\n"
803 " With --show-item, print only the value of one item of information\n"
805 {'r', 'R', opt_depth, opt_targets, opt_incremental, opt_xml,
806 opt_changelist, opt_include_externals, opt_show_item, opt_no_newline}
809 { "list", svn_cl__list, {"ls"},
812 ("List directory entries in the repository.\n"
813 "usage: list [TARGET[@REV]...]\n"
815 " List each TARGET file and the contents of each TARGET directory as\n"
816 " they exist in the repository. If TARGET is a working copy path, the\n"
817 " corresponding repository URL will be used. If specified, REV determines\n"
818 " in which revision the target is first looked up.\n"
820 " The default TARGET is '.', meaning the repository URL of the current\n"
821 " working directory.\n"
823 " Multiple --search patterns may be specified and the output will be\n"
824 " reduced to those paths whose last segment - i.e. the file or directory\n"
825 " name - contains a sub-string matching at least one of these patterns\n"
828 " With --verbose, the following fields will be shown for each item:\n"
830 " Revision number of the last commit\n"
831 " Author of the last commit\n"
832 " If locked, the letter 'O'. (Use 'svn info URL' to see details)\n"
834 " Date and time of the last commit\n"),
837 ("List directory entries in the repository.\n"
838 "usage: list [TARGET[@REV]...]\n"
840 " List each TARGET file and the contents of each TARGET directory as\n"
841 " they exist in the repository. If TARGET is a working copy path, the\n"
842 " corresponding repository URL will be used. If specified, REV determines\n"
843 " in which revision the target is first looked up.\n"
845 " The default TARGET is '.', meaning the repository URL of the current\n"
846 " working directory.\n"
848 " Multiple --search patterns may be specified and the output will be\n"
849 " reduced to those paths whose last segment - i.e. the file or directory\n"
850 " name - matches at least one of these patterns.\n"
852 " With --verbose, the following fields will be shown for each item:\n"
854 " Revision number of the last commit\n"
855 " Author of the last commit\n"
856 " If locked, the letter 'O'. (Use 'svn info URL' to see details)\n"
858 " Date and time of the last commit\n"),
860 {'r', 'v', 'R', opt_depth, opt_incremental, opt_xml,
861 opt_include_externals, opt_search}, },
863 { "lock", svn_cl__lock, {0}, N_
864 ("Lock working copy paths or URLs in the repository, so that\n"
865 "no other user can commit changes to them.\n"
866 "usage: lock TARGET...\n"
868 " Use --force to steal a lock from another user or working copy.\n"),
869 { opt_targets, 'm', 'F', opt_force_log, opt_encoding, opt_force, 'q' },
870 {{'F', N_("read lock comment from file ARG")},
871 {'m', N_("specify lock comment ARG")},
872 {opt_force_log, N_("force validity of lock comment source")},
873 {opt_force, N_("steal locks")}} },
875 { "log", svn_cl__log, {0}, N_
876 ("Show the log messages for a set of revision(s) and/or path(s).\n"
877 "usage: 1. log [PATH][@REV]\n"
878 " 2. log URL[@REV] [PATH...]\n"
880 " 1. Print the log messages for the URL corresponding to PATH\n"
881 " (default: '.'). If specified, REV is the revision in which the\n"
882 " URL is first looked up, and the default revision range is REV:1.\n"
883 " If REV is not specified, the default revision range is BASE:1,\n"
884 " since the URL might not exist in the HEAD revision.\n"
886 " 2. Print the log messages for the PATHs (default: '.') under URL.\n"
887 " If specified, REV is the revision in which the URL is first\n"
888 " looked up, and the default revision range is REV:1; otherwise,\n"
889 " the URL is looked up in HEAD, and the default revision range is\n"
892 " Multiple '-c' or '-r' options may be specified (but not a\n"
893 " combination of '-c' and '-r' options), and mixing of forward and\n"
894 " reverse ranges is allowed.\n"
896 " With -v, also print all affected paths with each log message.\n"
897 " Each changed path is preceded with a symbol describing the change:\n"
898 " A: The path was added or copied.\n"
899 " D: The path was deleted.\n"
900 " R: The path was replaced (deleted and re-added in the same revision).\n"
901 " M: The path's file and/or property content was modified.\n"
902 " If an added or replaced path was copied from somewhere else, the copy\n"
903 " source path and revision are shown in parentheses.\n"
904 " If a file or directory was moved from one path to another with 'svn move'\n"
905 " the old path will be listed as deleted and the new path will be listed\n"
906 " as copied from the old path at a prior revision.\n"
908 " With -q, don't print the log message body itself (note that this is\n"
909 " compatible with -v).\n"
911 " Each log message is printed just once, even if more than one of the\n"
912 " affected paths for that revision were explicitly requested. Logs\n"
913 " follow copy history by default. Use --stop-on-copy to disable this\n"
914 " behavior, which can be useful for determining branchpoints.\n"
916 " The --depth option is only valid in combination with the --diff option\n"
917 " and limits the scope of the displayed diff to the specified depth.\n"
919 " If the --search option is used, log messages are displayed only if the\n"
920 " provided search pattern matches any of the author, date, log message\n"
921 " text (unless --quiet is used), or, if the --verbose option is also\n"
922 " provided, a changed path.\n"
923 " The search pattern may include \"glob syntax\" wildcards:\n"
924 " ? matches any single character\n"
925 " * matches a sequence of arbitrary characters\n"
926 " [abc] matches any of the characters listed inside the brackets\n"
927 " If multiple --search options are provided, a log message is shown if\n"
928 " it matches any of the provided search patterns. If the --search-and\n"
929 " option is used, that option's argument is combined with the pattern\n"
930 " from the previous --search or --search-and option, and a log message\n"
931 " is shown only if it matches the combined search pattern.\n"
932 " If --limit is used in combination with --search, --limit restricts the\n"
933 " number of log messages searched, rather than restricting the output\n"
934 " to a particular number of matching log messages.\n"
938 " Show the latest 5 log messages for the current working copy\n"
939 " directory and display paths changed in each commit:\n"
942 " Show the log for bar.c as of revision 42:\n"
943 " svn log bar.c@42\n"
945 " Show log messages and diffs for each commit to foo.c:\n"
946 " svn log --diff http://www.example.com/repo/project/foo.c\n"
947 " (Because the above command uses a full URL it does not require\n"
948 " a working copy.)\n"
950 " Show log messages for the children foo.c and bar.c of the directory\n"
951 " '/trunk' as it appeared in revision 50, using the ^/ URL shortcut:\n"
952 " svn log ^/trunk@50 foo.c bar.c\n"
954 " Show the log messages for any incoming changes to foo.c during the\n"
955 " next 'svn update':\n"
956 " svn log -r BASE:HEAD foo.c\n"
958 " Show the log message for the revision in which /branches/foo\n"
960 " svn log --stop-on-copy --limit 1 -r0:HEAD ^/branches/foo\n"
962 " If ^/trunk/foo.c was moved to ^/trunk/bar.c' in revision 22, 'svn log -v'\n"
963 " shows a deletion and a copy in its changed paths list, such as:\n"
965 " A /trunk/bar.c (from /trunk/foo.c:21)\n"),
966 {'r', 'c', 'q', 'v', 'g', opt_targets, opt_stop_on_copy, opt_incremental,
967 opt_xml, 'l', opt_with_all_revprops, opt_with_no_revprops,
968 opt_with_revprop, opt_depth, opt_diff, opt_diff_cmd,
969 opt_internal_diff, 'x', opt_search, opt_search_and },
970 {{opt_with_revprop, N_("retrieve revision property ARG")},
971 {'c', N_("the change made in revision ARG")},
972 {'v', N_("also print all affected paths")},
973 {'q', N_("do not print the log message")}} },
975 { "merge", svn_cl__merge, {0}, N_
976 ( /* For this large section, let's keep it unindented for easier
977 * viewing/editing. It has been vim-treated with a textwidth=75 and 'gw'
978 * (with quotes and newlines removed). */
979 "Merge changes into a working copy.\n"
980 "usage: 1. merge SOURCE[@REV] [TARGET_WCPATH]\n"
981 " (the 'complete' merge)\n"
982 " 2. merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]\n"
983 " (the 'cherry-pick' merge)\n"
984 " 3. merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]\n"
985 " (the '2-URL' merge)\n"
987 " 1. This form, with one source path and no revision range, is called\n"
988 " a 'complete' merge:\n"
990 " svn merge SOURCE[@REV] [TARGET_WCPATH]\n"
992 " The complete merge is used for the 'sync' and 'reintegrate' merges\n"
993 " in the 'feature branch' pattern described below. It finds all the\n"
994 " changes on the source branch that have not already been merged to the\n"
995 " target branch, and merges them into the working copy. Merge tracking\n"
996 " is used to know which changes have already been merged.\n"
998 " SOURCE specifies the branch from where the changes will be pulled, and\n"
999 " TARGET_WCPATH specifies a working copy of the target branch to which\n"
1000 " the changes will be applied. Normally SOURCE and TARGET_WCPATH should\n"
1001 " each correspond to the root of a branch. (If you want to merge only a\n"
1002 " subtree, then the subtree path must be included in both SOURCE and\n"
1003 " TARGET_WCPATH; this is discouraged, to avoid subtree mergeinfo.)\n"
1005 " SOURCE is usually a URL. The optional '@REV' specifies both the peg\n"
1006 " revision of the URL and the latest revision that will be considered\n"
1007 " for merging; if REV is not specified, the HEAD revision is assumed. If\n"
1008 " SOURCE is a working copy path, the corresponding URL of the path is\n"
1009 " used, and the default value of 'REV' is the base revision (usually the\n"
1010 " revision last updated to).\n"
1012 " TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n"
1013 " assumed. There are some special cases:\n"
1015 " - If SOURCE is a URL:\n"
1017 " - If the basename of the URL and the basename of '.' are the\n"
1018 " same, then the differences are applied to '.'. Otherwise,\n"
1019 " if a file with the same basename as that of the URL is found\n"
1020 " within '.', then the differences are applied to that file.\n"
1021 " In all other cases, the target defaults to '.'.\n"
1023 " - If SOURCE is a working copy path:\n"
1025 " - If the source is a file, then differences are applied to that\n"
1026 " file (useful for reverse-merging earlier changes). Otherwise,\n"
1027 " if the source is a directory, then the target defaults to '.'.\n"
1029 " In normal usage the working copy should be up to date, at a single\n"
1030 " revision, with no local modifications and no switched subtrees.\n"
1032 " - The 'Feature Branch' Merging Pattern -\n"
1034 " In this commonly used work flow, known also as the 'development\n"
1035 " branch' pattern, a developer creates a branch and commits a series of\n"
1036 " changes that implement a new feature. The developer periodically\n"
1037 " merges all the latest changes from the parent branch so as to keep the\n"
1038 " development branch up to date with those changes. When the feature is\n"
1039 " complete, the developer performs a merge from the feature branch to\n"
1040 " the parent branch to re-integrate the changes.\n"
1042 " parent --+----------o------o-o-------------o--\n"
1044 " \\ merge merge merge\n"
1046 " feature +--o-o-------o----o-o----o-------\n"
1048 " A merge from the parent branch to the feature branch is called a\n"
1049 " 'sync' or 'catch-up' merge, and a merge from the feature branch to the\n"
1050 " parent branch is called a 'reintegrate' merge.\n"
1052 " - Sync Merge Example -\n"
1055 " trunk --+------------L--------------R------\n"
1059 " feature +------------------------o-----\n"
1062 " Subversion will locate all the changes on 'trunk' that have not yet\n"
1063 " been merged into the 'feature' branch. In this case that is a single\n"
1064 " range, r100:200. In the diagram above, L marks the left side (trunk@100)\n"
1065 " and R marks the right side (trunk@200) of the merge source. The\n"
1066 " difference between L and R will be applied to the target working copy\n"
1067 " path. In this case, the working copy is a clean checkout of the entire\n"
1068 " 'feature' branch.\n"
1070 " To perform this sync merge, have a clean working copy of the feature\n"
1071 " branch and run the following command in its top-level directory:\n"
1073 " svn merge ^/trunk\n"
1075 " Note that the merge is now only in your local working copy and still\n"
1076 " needs to be committed to the repository so that it can be seen by\n"
1077 " others. You can review the changes and you may have to resolve\n"
1078 " conflicts before you commit the merge.\n"
1080 " - Reintegrate Merge Example -\n"
1082 " The feature branch was last synced with trunk up to revision X. So the\n"
1083 " difference between trunk@X and feature@HEAD contains the complete set\n"
1084 " of changes that implement the feature, and no other changes. These\n"
1085 " changes are applied to trunk.\n"
1088 " trunk ------+--------------------L------------------o\n"
1090 " \\ ............. /\n"
1092 " feature +--------------------------------R\n"
1094 " In the diagram above, L marks the left side (trunk@X) and R marks the\n"
1095 " right side (feature@HEAD) of the merge. The difference between the\n"
1096 " left and right side is merged into trunk, the target.\n"
1098 " To perform the merge, have a clean working copy of trunk and run the\n"
1099 " following command in its top-level directory:\n"
1101 " svn merge ^/feature\n"
1103 " To prevent unnecessary merge conflicts, a reintegrate merge requires\n"
1104 " that TARGET_WCPATH is not a mixed-revision working copy, has no local\n"
1105 " modifications, and has no switched subtrees.\n"
1107 " A reintegrate merge also requires that the source branch is coherently\n"
1108 " synced with the target -- in the above example, this means that all\n"
1109 " revisions between the branch point W and the last merged revision X\n"
1110 " are merged to the feature branch, so that there are no unmerged\n"
1111 " revisions in-between.\n"
1114 " 2. This form is called a 'cherry-pick' merge:\n"
1116 " svn merge [-c M[,N...] | -r N:M ...] SOURCE[@REV] [TARGET_WCPATH]\n"
1118 " A cherry-pick merge is used to merge specific revisions (or revision\n"
1119 " ranges) from one branch to another. By default, this uses merge\n"
1120 " tracking to automatically skip any revisions that have already been\n"
1121 " merged to the target; you can use the --ignore-ancestry option to\n"
1122 " disable such skipping.\n"
1124 " SOURCE is usually a URL. The optional '@REV' specifies only the peg\n"
1125 " revision of the URL and does not affect the merge range; if REV is not\n"
1126 " specified, the HEAD revision is assumed. If SOURCE is a working copy\n"
1127 " path, the corresponding URL of the path is used, and the default value\n"
1128 " of 'REV' is the base revision (usually the revision last updated to).\n"
1130 " TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n"
1131 " assumed. The special cases noted above in the 'complete' merge form\n"
1132 " also apply here.\n"
1134 " The revision ranges to be merged are specified by the '-r' and/or '-c'\n"
1135 " options. '-r N:M' refers to the difference in the history of the\n"
1136 " source branch between revisions N and M. You can use '-c M' to merge\n"
1137 " single revisions: '-c M' is equivalent to '-r <M-1>:M'. Each such\n"
1138 " difference is applied to TARGET_WCPATH.\n"
1140 " If the mergeinfo in TARGET_WCPATH indicates that revisions within the\n"
1141 " range were already merged, changes made in those revisions are not\n"
1142 " merged again. If needed, the range is broken into multiple sub-ranges,\n"
1143 " and each sub-range is merged separately.\n"
1145 " A 'reverse range' can be used to undo changes. For example, when\n"
1146 " source and target refer to the same branch, a previously committed\n"
1147 " revision can be 'undone'. In a reverse range, N is greater than M in\n"
1148 " '-r N:M', or the '-c' option is used with a negative number: '-c -M'\n"
1149 " is equivalent to '-r M:<M-1>'. Undoing changes like this is also known\n"
1150 " as performing a 'reverse merge'.\n"
1152 " Multiple '-c' and/or '-r' options may be specified and mixing of\n"
1153 " forward and reverse ranges is allowed.\n"
1155 " - Cherry-pick Merge Example -\n"
1157 " A bug has been fixed on trunk in revision 50. This fix needs to\n"
1158 " be merged from trunk onto the release branch.\n"
1160 " 1.x-release +-----------------------o-----\n"
1164 " trunk ------+--------------------------LR-----\n"
1167 " In the above diagram, L marks the left side (trunk@49) and R marks the\n"
1168 " right side (trunk@50) of the merge. The difference between the left\n"
1169 " and right side is applied to the target working copy path.\n"
1171 " Note that the difference between revision 49 and 50 is exactly those\n"
1172 " changes that were committed in revision 50, not including changes\n"
1173 " committed in revision 49.\n"
1175 " To perform the merge, have a clean working copy of the release branch\n"
1176 " and run the following command in its top-level directory; remember\n"
1177 " that the default target is '.':\n"
1179 " svn merge -c50 ^/trunk\n"
1181 " You can also cherry-pick several revisions and/or revision ranges:\n"
1183 " svn merge -c50,54,60 -r65:68 ^/trunk\n"
1186 " 3. This form is called a '2-URL merge':\n"
1188 " svn merge SOURCE1[@REV1] SOURCE2[@REV2] [TARGET_WCPATH]\n"
1190 " You should use this merge variant only if the other variants do not\n"
1191 " apply to your situation, as this variant can be quite complex to\n"
1194 " Two source URLs are specified, identifying two trees on the same\n"
1195 " branch or on different branches. The trees are compared and the\n"
1196 " difference from SOURCE1@REV1 to SOURCE2@REV2 is applied to the\n"
1197 " working copy of the target branch at TARGET_WCPATH. The target\n"
1198 " branch may be the same as one or both sources, or different again.\n"
1199 " The three branches involved can be completely unrelated.\n"
1201 " TARGET_WCPATH is a working copy path; if omitted, '.' is generally\n"
1202 " assumed. The special cases noted above in the 'complete' merge form\n"
1203 " also apply here.\n"
1205 " SOURCE1 and/or SOURCE2 can also be specified as a working copy path,\n"
1206 " in which case the merge source URL is derived from the working copy.\n"
1208 " - 2-URL Merge Example -\n"
1210 " Two features have been developed on separate branches called 'foo' and\n"
1211 " 'bar'. It has since become clear that 'bar' should be combined with\n"
1212 " the 'foo' branch for further development before reintegration.\n"
1214 " Although both feature branches originate from trunk, they are not\n"
1215 " directly related -- one is not a direct copy of the other. A 2-URL\n"
1216 " merge is necessary.\n"
1218 " The 'bar' branch has been synced with trunk up to revision 500.\n"
1219 " (If this revision number is not known, it can be located using the\n"
1220 " 'svn log' and/or 'svn mergeinfo' commands.)\n"
1221 " The difference between trunk@500 and bar@HEAD contains the complete\n"
1222 " set of changes related to feature 'bar', and no other changes. These\n"
1223 " changes are applied to the 'foo' branch.\n"
1225 " foo +-----------------------------------o\n"
1229 " trunk ------+------+-----------------L---------> /\n"
1231 " \\ ............ /\n"
1233 " bar +-----------------------------------R\n"
1235 " In the diagram above, L marks the left side (trunk@500) and R marks\n"
1236 " the right side (bar@HEAD) of the merge. The difference between the\n"
1237 " left and right side is applied to the target working copy path, in\n"
1238 " this case a working copy of the 'foo' branch.\n"
1240 " To perform the merge, have a clean working copy of the 'foo' branch\n"
1241 " and run the following command in its top-level directory:\n"
1243 " svn merge ^/trunk@500 ^/bar\n"
1245 " The exact changes applied by a 2-URL merge can be previewed with svn's\n"
1246 " diff command, which is a good idea to verify if you do not have the\n"
1247 " luxury of a clean working copy to merge to. In this case:\n"
1249 " svn diff ^/trunk@500 ^/bar@HEAD\n"
1252 " The following applies to all types of merges:\n"
1254 " To prevent unnecessary merge conflicts, svn merge requires that\n"
1255 " TARGET_WCPATH is not a mixed-revision working copy. Running 'svn update'\n"
1256 " before starting a merge ensures that all items in the working copy are\n"
1257 " based on the same revision.\n"
1259 " If possible, you should have no local modifications in the merge's target\n"
1260 " working copy prior to the merge, to keep things simpler. It will be\n"
1261 " easier to revert the merge and to understand the branch's history.\n"
1263 " Switched sub-paths should also be avoided during merging, as they may\n"
1264 " cause incomplete merges and create subtree mergeinfo.\n"
1266 " For each merged item a line will be printed with characters reporting the\n"
1267 " action taken. These characters have the following meaning:\n"
1277 " Characters in the first column report about the item itself.\n"
1278 " Characters in the second column report about properties of the item.\n"
1279 " A 'C' in the third column indicates a tree conflict, while a 'C' in\n"
1280 " the first and second columns indicate textual conflicts in files\n"
1281 " and in property values, respectively.\n"
1283 " - Merge Tracking -\n"
1285 " Subversion uses the svn:mergeinfo property to track merge history. This\n"
1286 " property is considered at the start of a merge to determine what to merge\n"
1287 " and it is updated at the conclusion of the merge to describe the merge\n"
1288 " that took place. Mergeinfo is used only if the two sources are on the\n"
1289 " same line of history -- if the first source is an ancestor of the second,\n"
1290 " or vice-versa (i.e. if one has originally been created by copying the\n"
1291 " other). This is verified and enforced when using sync merges and\n"
1292 " reintegrate merges.\n"
1294 " The --ignore-ancestry option prevents merge tracking and thus ignores\n"
1295 " mergeinfo, neither considering it nor recording it.\n"
1297 " - Merging from foreign repositories -\n"
1299 " Subversion does support merging from foreign repositories.\n"
1300 " While all merge source URLs must point to the same repository, the merge\n"
1301 " target working copy may come from a different repository than the source.\n"
1302 " However, there are some caveats. Most notably, copies made in the\n"
1303 " merge source will be transformed into plain additions in the merge\n"
1304 " target. Also, merge-tracking is not supported for merges from foreign\n"
1305 " repositories.\n"),
1306 {'r', 'c', 'N', opt_depth, 'q', opt_force, opt_dry_run, opt_merge_cmd,
1307 opt_record_only, 'x', opt_ignore_ancestry, opt_accept, opt_reintegrate,
1308 opt_allow_mixed_revisions, 'v'},
1309 { { opt_force, N_("force deletions even if deleted contents don't match") } }
1312 { "mergeinfo", svn_cl__mergeinfo, {0}, N_
1313 ("Display merge-related information.\n"
1314 "usage: 1. mergeinfo SOURCE[@REV] [TARGET[@REV]]\n"
1315 " 2. mergeinfo --show-revs=WHICH SOURCE[@REV] [TARGET[@REV]]\n"
1317 " 1. Summarize the history of merging between SOURCE and TARGET. The graph\n"
1318 " shows, from left to right:\n"
1319 " the youngest common ancestor of the branches;\n"
1320 " the latest full merge in either direction, and thus the common base\n"
1321 " that will be used for the next complete merge;\n"
1322 " the repository path and revision number of the tip of each branch.\n"
1324 " 2. Print the revision numbers on SOURCE that have been merged to TARGET\n"
1325 " (with --show-revs=merged), or that have not been merged to TARGET\n"
1326 " (with --show-revs=eligible). Print only revisions in which there was\n"
1327 " at least one change in SOURCE.\n"
1329 " If --revision (-r) is provided, filter the displayed information to\n"
1330 " show only that which is associated with the revisions within the\n"
1331 " specified range. Revision numbers, dates, and the 'HEAD' keyword are\n"
1332 " valid range values.\n"
1334 " SOURCE and TARGET are the source and target branch URLs, respectively.\n"
1335 " (If a WC path is given, the corresponding base URL is used.) The default\n"
1336 " TARGET is the current working directory ('.'). REV specifies the revision\n"
1337 " to be considered the tip of the branch; the default for SOURCE is HEAD,\n"
1338 " and the default for TARGET is HEAD for a URL or BASE for a WC path.\n"
1340 " The depth can be 'empty' or 'infinity'; the default is 'empty'.\n"),
1341 {'r', 'R', 'q', 'v', opt_depth, opt_show_revs, opt_mergeinfo_log,
1342 opt_incremental } },
1344 { "mkdir", svn_cl__mkdir, {0}, N_
1345 ("Create a new directory under version control.\n"
1346 "usage: 1. mkdir PATH...\n"
1347 " 2. mkdir URL...\n"
1349 " Create version controlled directories.\n"
1351 " 1. Each directory specified by a working copy PATH is created locally\n"
1352 " and scheduled for addition upon the next commit.\n"
1354 " 2. Each directory specified by a URL is created in the repository via\n"
1355 " an immediate commit.\n"
1357 " In both cases, all the intermediate directories must already exist,\n"
1358 " unless the --parents option is given.\n"),
1359 {'q', opt_parents, SVN_CL__LOG_MSG_OPTIONS} },
1361 { "move", svn_cl__move, {"mv", "rename", "ren"}, N_
1362 ("Move (rename) an item in a working copy or repository.\n"
1363 "usage: move SRC... DST\n"
1365 " SRC and DST can both be working copy (WC) paths or URLs:\n"
1366 " WC -> WC: move an item in a working copy, as a local change to\n"
1367 " be committed later (with or without further changes)\n"
1368 " URL -> URL: move an item in the repository directly, immediately\n"
1369 " creating a new revision in the repository\n"
1370 " All the SRCs must be of the same type. If DST is an existing directory,\n"
1371 " the sources will be added as children of DST. When moving multiple\n"
1372 " sources, DST must be an existing directory.\n"
1374 " SRC and DST of WC -> WC moves must be committed in the same revision.\n"
1375 " Furthermore, WC -> WC moves will refuse to move a mixed-revision subtree.\n"
1376 " To avoid unnecessary conflicts, it is recommended to run 'svn update'\n"
1377 " to update the subtree to a single revision before moving it.\n"
1378 " The --allow-mixed-revisions option is provided for backward compatibility.\n"),
1379 {'q', opt_force, opt_parents, opt_allow_mixed_revisions,
1380 SVN_CL__LOG_MSG_OPTIONS, 'r'},
1381 {{'r', "deprecated and ignored"}} },
1383 { "patch", svn_cl__patch, {0}, N_
1384 ("Apply a patch to a working copy.\n"
1385 "usage: patch PATCHFILE [WCPATH]\n"
1387 " Apply a unidiff patch in PATCHFILE to the working copy WCPATH.\n"
1388 " If WCPATH is omitted, '.' is assumed.\n"
1390 " A unidiff patch suitable for application to a working copy can be\n"
1391 " produced with the 'svn diff' command or third-party diffing tools.\n"
1392 " Any non-unidiff content of PATCHFILE is ignored, except for Subversion\n"
1393 " property diffs as produced by 'svn diff'.\n"
1395 " Changes listed in the patch will either be applied or rejected.\n"
1396 " If a change does not match at its exact line offset, it may be applied\n"
1397 " earlier or later in the file if a match is found elsewhere for the\n"
1398 " surrounding lines of context provided by the patch.\n"
1399 " A change may also be applied with fuzz, which means that one\n"
1400 " or more lines of context are ignored when matching the change.\n"
1401 " If no matching context can be found for a change, the change conflicts\n"
1402 " and will be written to a reject file with the extension .svnpatch.rej.\n"
1404 " For each patched file a line will be printed with characters reporting\n"
1405 " the action taken. These characters have the following meaning:\n"
1411 " G Merged (with local uncommitted changes)\n"
1413 " Changes applied with an offset or fuzz are reported on lines starting\n"
1414 " with the '>' symbol. You should review such changes carefully.\n"
1416 " If the patch removes all content from a file, that file is scheduled\n"
1417 " for deletion. If the patch creates a new file, that file is scheduled\n"
1418 " for addition. Use 'svn revert' to undo deletions and additions you\n"
1419 " do not agree with.\n"
1421 " Hint: If the patch file was created with Subversion, it will contain\n"
1422 " the number of a revision N the patch will cleanly apply to\n"
1423 " (look for lines like '--- foo/bar.txt (revision N)').\n"
1424 " To avoid rejects, first update to the revision N using\n"
1425 " 'svn update -r N', apply the patch, and then update back to the\n"
1426 " HEAD revision. This way, conflicts can be resolved interactively.\n"
1428 {'q', opt_dry_run, opt_strip, opt_reverse_diff,
1429 opt_ignore_whitespace} },
1431 { "propdel", svn_cl__propdel, {"pdel", "pd"}, N_
1432 ("Remove a property from files, dirs, or revisions.\n"
1433 "usage: 1. propdel PROPNAME [PATH...]\n"
1434 " 2. propdel PROPNAME --revprop -r REV [TARGET]\n"
1436 " 1. Removes versioned props in working copy.\n"
1437 " 2. Removes unversioned remote prop on repos revision.\n"
1438 " TARGET only determines which repository to access.\n"
1440 " See 'svn help propset' for descriptions of the svn:* special properties.\n"),
1441 {'q', 'R', opt_depth, 'r', opt_revprop, opt_changelist} },
1443 { "propedit", svn_cl__propedit, {"pedit", "pe"}, N_
1444 ("Edit a property with an external editor.\n"
1445 "usage: 1. propedit PROPNAME TARGET...\n"
1446 " 2. propedit PROPNAME --revprop -r REV [TARGET]\n"
1448 " 1. Edits versioned prop in working copy or repository.\n"
1449 " 2. Edits unversioned remote prop on repos revision.\n"
1450 " TARGET only determines which repository to access.\n"
1452 " See 'svn help propset' for descriptions of the svn:* special properties.\n"),
1453 {'r', opt_revprop, SVN_CL__LOG_MSG_OPTIONS, opt_force} },
1455 { "propget", svn_cl__propget, {"pget", "pg"}, N_
1456 ("Print the value of a property on files, dirs, or revisions.\n"
1457 "usage: 1. propget PROPNAME [TARGET[@REV]...]\n"
1458 " 2. propget PROPNAME --revprop -r REV [TARGET]\n"
1460 " 1. Prints versioned props. If specified, REV determines in which\n"
1461 " revision the target is first looked up.\n"
1462 " 2. Prints unversioned remote prop on repos revision.\n"
1463 " TARGET only determines which repository to access.\n"
1465 " With --verbose, the target path and the property name are printed on\n"
1466 " separate lines before each value, like 'svn proplist --verbose'.\n"
1467 " Otherwise, if there is more than one TARGET or a depth other than\n"
1468 " 'empty', the target path is printed on the same line before each value.\n"
1470 " By default, an extra newline is printed after the property value so that\n"
1471 " the output looks pretty. With a single TARGET, depth 'empty' and without\n"
1472 " --show-inherited-props, you can use the --no-newline option to disable this\n"
1473 " (useful when redirecting a binary property value to a file, for example).\n"
1475 " See 'svn help propset' for descriptions of the svn:* special properties.\n"),
1476 {'v', 'R', opt_depth, 'r', opt_revprop, opt_strict, opt_no_newline, opt_xml,
1477 opt_changelist, opt_show_inherited_props },
1478 {{'v', N_("print path, name and value on separate lines")},
1479 {opt_strict, N_("(deprecated; use --no-newline)")}} },
1481 { "proplist", svn_cl__proplist, {"plist", "pl"}, N_
1482 ("List all properties on files, dirs, or revisions.\n"
1483 "usage: 1. proplist [TARGET[@REV]...]\n"
1484 " 2. proplist --revprop -r REV [TARGET]\n"
1486 " 1. Lists versioned props. If specified, REV determines in which\n"
1487 " revision the target is first looked up.\n"
1488 " 2. Lists unversioned remote props on repos revision.\n"
1489 " TARGET only determines which repository to access.\n"
1491 " With --verbose, the property values are printed as well, like 'svn propget\n"
1492 " --verbose'. With --quiet, the paths are not printed.\n"
1494 " See 'svn help propset' for descriptions of the svn:* special properties.\n"),
1495 {'v', 'R', opt_depth, 'r', 'q', opt_revprop, opt_xml, opt_changelist,
1496 opt_show_inherited_props },
1497 {{'v', N_("print path, name and value on separate lines")},
1498 {'q', N_("don't print the path")}} },
1500 { "propset", svn_cl__propset, {"pset", "ps"}, N_
1501 ("Set the value of a property on files, dirs, or revisions.\n"
1502 "usage: 1. propset PROPNAME PROPVAL PATH...\n"
1503 " 2. propset PROPNAME --revprop -r REV PROPVAL [TARGET]\n"
1505 " 1. Changes a versioned file or directory property in a working copy.\n"
1506 " 2. Changes an unversioned property on a repository revision.\n"
1507 " (TARGET only determines which repository to access.)\n"
1509 " The value may be provided with the --file option instead of PROPVAL.\n"
1511 " Property names starting with 'svn:' are reserved. Subversion recognizes\n"
1512 " the following special versioned properties on a file:\n"
1513 " svn:keywords - Keywords to be expanded. Valid keywords are:\n"
1514 " URL, HeadURL - The URL for the head version of the file.\n"
1515 " Author, LastChangedBy - The last person to modify the file.\n"
1516 " Date, LastChangedDate - The date/time the file was last modified.\n"
1517 " Rev, Revision, - The last revision the file changed.\n"
1518 " LastChangedRevision\n"
1519 " Id - A compressed summary of the previous four.\n"
1520 " Header - Similar to Id but includes the full URL.\n"
1522 " Custom keywords can be defined with a format string separated from\n"
1523 " the keyword name with '='. Valid format substitutions are:\n"
1524 " %a - The author of the revision given by %r.\n"
1525 " %b - The basename of the URL of the file.\n"
1526 " %d - Short format of the date of the revision given by %r.\n"
1527 " %D - Long format of the date of the revision given by %r.\n"
1528 " %P - The file's path, relative to the repository root.\n"
1529 " %r - The number of the revision which last changed the file.\n"
1530 " %R - The URL to the root of the repository.\n"
1531 " %u - The URL of the file.\n"
1532 " %_ - A space (keyword definitions cannot contain a literal space).\n"
1533 " %% - A literal '%'.\n"
1534 " %H - Equivalent to %P%_%r%_%d%_%a.\n"
1535 " %I - Equivalent to %b%_%r%_%d%_%a.\n"
1536 " Example custom keyword definition: MyKeyword=%r%_%a%_%P\n"
1537 " Once a custom keyword has been defined for a file, it can be used\n"
1538 " within the file like any other keyword: $MyKeyword$\n"
1540 " svn:executable - If present, make the file executable. Use\n"
1541 " 'svn propdel svn:executable PATH...' to clear.\n"
1542 " svn:eol-style - One of 'native', 'LF', 'CR', 'CRLF'.\n"
1543 " svn:mime-type - The mimetype of the file. Used to determine\n"
1544 " whether to merge the file, and how to serve it from Apache.\n"
1545 " A mimetype beginning with 'text/' (or an absent mimetype) is\n"
1546 " treated as text. Anything else is treated as binary.\n"
1547 " svn:needs-lock - If present, indicates that the file should be locked\n"
1548 " before it is modified. Makes the working copy file read-only\n"
1549 " when it is not locked. Use 'svn propdel svn:needs-lock PATH...'\n"
1552 " Subversion recognizes the following special versioned properties on a\n"
1554 " svn:ignore - A list of file glob patterns to ignore, one per line.\n"
1555 " svn:global-ignores - Like svn:ignore, but inheritable.\n"
1556 " svn:auto-props - Automatically set properties on files when they are\n"
1557 " added or imported. Contains key-value pairs, one per line, in the format:\n"
1558 " PATTERN = PROPNAME=VALUE[;PROPNAME=VALUE ...]\n"
1559 " Example (where a literal ';' is escaped by adding another ';'):\n"
1560 " *.html = svn:eol-style=native;svn:mime-type=text/html;; charset=UTF8\n"
1561 " Applies recursively to all files added or imported under the directory\n"
1562 " it is set on. See also [auto-props] in the client configuration file.\n"
1563 " svn:externals - A list of module specifiers, one per line, in the\n"
1564 " following format similar to the syntax of 'svn checkout':\n"
1565 " [-r REV] URL[@PEG] LOCALPATH\n"
1567 " http://example.com/repos/zig foo/bar\n"
1568 " The LOCALPATH is relative to the directory having this property.\n"
1569 " To pin the external to a known revision, specify the optional REV:\n"
1570 " -r25 http://example.com/repos/zig foo/bar\n"
1571 " To unambiguously identify an element at a path which may have been\n"
1572 " subsequently deleted or renamed, specify the optional PEG revision:\n"
1573 " -r25 http://example.com/repos/zig@42 foo/bar\n"
1574 " The URL may be a full URL or a relative URL starting with one of:\n"
1575 " ../ to the parent directory of the extracted external\n"
1576 " ^/ to the repository root\n"
1577 " / to the server root\n"
1578 " // to the URL scheme\n"
1579 " ^/../ to a sibling repository beneath the same SVNParentPath location\n"
1580 " Use of the following format is discouraged but is supported for\n"
1581 " interoperability with Subversion 1.4 and earlier clients:\n"
1582 " LOCALPATH [-r PEG] URL\n"
1583 " The ambiguous format 'relative_path relative_path' is taken as\n"
1584 " 'relative_url relative_path' with peg revision support.\n"
1585 " Lines starting with a '#' character are ignored.\n"),
1586 {'F', opt_encoding, 'q', 'r', opt_targets, 'R', opt_depth, opt_revprop,
1587 opt_force, opt_changelist },
1588 {{'F', N_("read property value from file ARG")}} },
1590 { "relocate", svn_cl__relocate, {0}, N_
1591 ("Relocate the working copy to point to a different repository root URL.\n"
1592 "usage: 1. relocate FROM-PREFIX TO-PREFIX [PATH...]\n"
1593 " 2. relocate TO-URL [PATH]\n"
1595 " Rewrite working copy URL metadata to reflect a syntactic change only.\n"
1596 " This is used when a repository's root URL changes (such as a scheme\n"
1597 " or hostname change) but your working copy still reflects the same\n"
1598 " directory within the same repository.\n"
1600 " 1. FROM-PREFIX and TO-PREFIX are initial substrings of the working\n"
1601 " copy's current and new URLs, respectively. (You may specify the\n"
1602 " complete old and new URLs if you wish.) Use 'svn info' to determine\n"
1603 " the current working copy URL.\n"
1605 " 2. TO-URL is the (complete) new repository URL to use for PATH.\n"
1608 " svn relocate http:// svn:// project1 project2\n"
1609 " svn relocate http://www.example.com/repo/project \\\n"
1610 " svn://svn.example.com/repo/project\n"),
1611 {opt_ignore_externals} },
1613 { "resolve", svn_cl__resolve, {0}, N_
1614 ("Resolve conflicts on working copy files or directories.\n"
1615 "usage: resolve [PATH...]\n"
1617 " By default, perform interactive conflict resolution on PATH.\n"
1618 " In this mode, the command is recursive by default (depth 'infinity').\n"
1620 " The --accept=ARG option prevents interactive prompting and forces\n"
1621 " conflicts on PATH to be resolved in the manner specified by ARG.\n"
1622 " In this mode, the command is not recursive by default (depth 'empty').\n"
1624 " A conflicted path cannot be committed with 'svn commit' until it\n"
1625 " has been marked as resolved with 'svn resolve'.\n"
1627 " Subversion knows three types of conflicts:\n"
1628 " Text conflicts, Property conflicts, and Tree conflicts.\n"
1630 " Text conflicts occur when overlapping changes to file contents were\n"
1631 " made. Text conflicts are usually resolved by editing the conflicted\n"
1632 " file or by using a merge tool (which may be an external program).\n"
1633 " 'svn resolve' provides options which can be used to automatically\n"
1634 " edit files (such as 'mine-full' or 'theirs-conflict'), but these are\n"
1635 " only useful in situations where it is acceptable to discard local or\n"
1636 " incoming changes altogether.\n"
1638 " Property conflicts are usually resolved by editing the value of the\n"
1639 " conflicted property (either from the interactive prompt, or with\n"
1640 " 'svn propedit'). As with text conflicts, options exist to edit a\n"
1641 " property automatically, discarding some changes in favour of others.\n"
1643 " Tree conflicts occur when a change to the directory structure was\n"
1644 " made, and when this change cannot be applied to the working copy\n"
1645 " without affecting other changes (text changes, property changes,\n"
1646 " or other changes to the directory structure). Brief information about\n"
1647 " tree conflicts is shown by the 'svn status' and 'svn info' commands.\n"
1648 " In interactive mode, 'svn resolve' will attempt to describe tree conflicts\n"
1649 " in detail, and may offer options to resolve the conflict automatically.\n"
1650 " It is recommended to use these automatic options whenever possible,\n"
1651 " rather than attempting manual tree conflict resolution.\n"
1653 " If a tree conflict cannot be resolved automatically, it is recommended\n"
1654 " to figure out why the conflict occurred before attempting to resolve it.\n"
1655 " The 'svn log -v' command can be used to inspect structural changes\n"
1656 " made in past revisions, and perhaps even on other branches.\n"
1657 " 'svn help log' describes how these structural changes are presented.\n"
1658 " Once the conflicting \"incoming\" change has been identified with 'svn log'\n"
1659 " the current \"local\" working copy state should be examined and adjusted\n"
1660 " in a way such that the conflict is resolved. This may involve editing\n"
1661 " files manually or with 'svn merge'. It may be necessary to discard some\n"
1662 " local changes with 'svn revert'. Files or directories might have to be\n"
1663 " copied, deleted, or moved.\n"),
1664 {opt_targets, 'R', opt_depth, 'q', opt_accept},
1665 {{opt_accept, N_("specify automatic conflict resolution source\n"
1667 "('base', 'working', 'mine-conflict',\n"
1669 "'theirs-conflict', 'mine-full', 'theirs-full')")}} },
1671 { "resolved", svn_cl__resolved, {0}, N_
1672 ("Remove 'conflicted' state on working copy files or directories.\n"
1673 "usage: resolved PATH...\n"
1675 " Note: this subcommand does not semantically resolve conflicts or\n"
1676 " remove conflict markers; it merely removes the conflict-related\n"
1677 " artifact files and allows PATH to be committed again. It has been\n"
1678 " deprecated in favor of running 'svn resolve --accept working'.\n"),
1679 {opt_targets, 'R', opt_depth, 'q'} },
1681 { "revert", svn_cl__revert, {0}, N_
1682 ("Restore pristine working copy state (undo local changes).\n"
1683 "usage: revert PATH...\n"
1685 " Revert changes in the working copy at or within PATH, and remove\n"
1686 " conflict markers as well, if any.\n"
1688 " This subcommand does not revert already committed changes.\n"
1689 " For information about undoing already committed changes, search\n"
1690 " the output of 'svn help merge' for 'undo'.\n"),
1691 {opt_targets, 'R', opt_depth, 'q', opt_changelist} },
1693 { "status", svn_cl__status, {"stat", "st"}, N_
1694 ("Print the status of working copy files and directories.\n"
1695 "usage: status [PATH...]\n"
1697 " With no args, print only locally modified items (no network access).\n"
1698 " With -q, print only summary information about locally modified items.\n"
1699 " With -u, add working revision and server out-of-date information.\n"
1700 " With -v, print full revision information on every item.\n"
1702 " The first seven columns in the output are each one character wide:\n"
1703 " First column: Says if item was added, deleted, or otherwise changed\n"
1704 " ' ' no modifications\n"
1711 " 'X' an unversioned directory created by an externals definition\n"
1712 " '?' item is not under version control\n"
1713 " '!' item is missing (removed by non-svn command) or incomplete\n"
1714 " '~' versioned item obstructed by some item of a different kind\n"
1715 " Second column: Modifications of a file's or directory's properties\n"
1716 " ' ' no modifications\n"
1719 " Third column: Whether the working copy is locked for writing by\n"
1720 " another Subversion client modifying the working copy\n"
1721 " ' ' not locked for writing\n"
1722 " 'L' locked for writing\n"
1723 " Fourth column: Scheduled commit will create a copy (addition-with-history)\n"
1724 " ' ' no history scheduled with commit (item was newly added)\n"
1725 " '+' history scheduled with commit (item was copied)\n"
1726 " Fifth column: Whether the item is switched or a file external\n"
1728 " 'S' the item has a Switched URL relative to the parent\n"
1729 " 'X' a versioned file created by an eXternals definition\n"
1730 " Sixth column: Whether the item is locked in repository for exclusive commit\n"
1732 " ' ' not locked by this working copy\n"
1733 " 'K' locked by this working copy, but lock might be stolen or broken\n"
1735 " ' ' not locked in repository, not locked by this working copy\n"
1736 " 'K' locked in repository, lock owned by this working copy\n"
1737 " 'O' locked in repository, lock owned by another working copy\n"
1738 " 'T' locked in repository, lock owned by this working copy was stolen\n"
1739 " 'B' not locked in repository, lock owned by this working copy is broken\n"
1740 " Seventh column: Whether the item is the victim of a tree conflict\n"
1742 " 'C' tree-Conflicted\n"
1743 " If the item is a tree conflict victim, an additional line is printed\n"
1744 " after the item's status line, explaining the nature of the conflict.\n"
1746 " The out-of-date information appears in the ninth column (with -u):\n"
1747 " '*' a newer revision exists on the server\n"
1748 " ' ' the working copy is up to date\n"
1750 " Remaining fields are variable width and delimited by spaces:\n"
1751 " The working revision (with -u or -v; '-' if the item is copied)\n"
1752 " The last committed revision and last committed author (with -v)\n"
1753 " The working copy path is always the final field, so it can\n"
1754 " include spaces.\n"
1756 " The presence of a question mark ('?') where a working revision, last\n"
1757 " committed revision, or last committed author was expected indicates\n"
1758 " that the information is unknown or irrelevant given the state of the\n"
1759 " item (for example, when the item is the result of a copy operation).\n"
1760 " The question mark serves as a visual placeholder to facilitate parsing.\n"
1762 " Example output:\n"
1767 " svn status -u wc\n"
1771 " Status against revision: 981\n"
1773 " svn status --show-updates --verbose wc\n"
1774 " M 965 938 kfogel wc/bar.c\n"
1775 " * 965 922 sussman wc/foo.c\n"
1776 " A + - 687 joe wc/qax.c\n"
1777 " 965 687 joe wc/zig.c\n"
1778 " Status against revision: 981\n"
1783 " > local missing, incoming edit upon update\n"
1785 { 'u', 'v', 'N', opt_depth, 'r', 'q', opt_no_ignore, opt_incremental,
1786 opt_xml, opt_ignore_externals, opt_changelist},
1787 {{'q', N_("don't print unversioned items")}} },
1789 { "switch", svn_cl__switch, {"sw"}, N_
1790 ("Update the working copy to a different URL within the same repository.\n"
1791 "usage: 1. switch URL[@PEGREV] [PATH]\n"
1792 " 2. switch --relocate FROM-PREFIX TO-PREFIX [PATH...]\n"
1794 " 1. Update the working copy to mirror a new URL within the repository.\n"
1795 " This behavior is similar to 'svn update', and is the way to\n"
1796 " move a working copy to a branch or tag within the same repository.\n"
1797 " If specified, PEGREV determines in which revision the target is first\n"
1800 " If --force is used, unversioned obstructing paths in the working\n"
1801 " copy do not automatically cause a failure if the switch attempts to\n"
1802 " add the same path. If the obstructing path is the same type (file\n"
1803 " or directory) as the corresponding path in the repository it becomes\n"
1804 " versioned but its contents are left 'as-is' in the working copy.\n"
1805 " This means that an obstructing directory's unversioned children may\n"
1806 " also obstruct and become versioned. For files, any content differences\n"
1807 " between the obstruction and the repository are treated like a local\n"
1808 " modification to the working copy. All properties from the repository\n"
1809 " are applied to the obstructing path.\n"
1811 " Use the --set-depth option to set a new working copy depth on the\n"
1812 " targets of this operation.\n"
1814 " By default, Subversion will refuse to switch a working copy path to\n"
1815 " a new URL with which it shares no common version control ancestry.\n"
1816 " Use the '--ignore-ancestry' option to override this sanity check.\n"
1818 " 2. The '--relocate' option is deprecated. This syntax is equivalent to\n"
1819 " 'svn relocate FROM-PREFIX TO-PREFIX [PATH]'.\n"
1821 " See also 'svn help update' for a list of possible characters\n"
1822 " reporting the action taken.\n"
1825 " svn switch ^/branches/1.x-release\n"
1826 " svn switch --relocate http:// svn://\n"
1827 " svn switch --relocate http://www.example.com/repo/project \\\n"
1828 " svn://svn.example.com/repo/project\n"),
1829 { 'r', 'N', opt_depth, opt_set_depth, 'q', opt_merge_cmd,
1830 opt_ignore_externals, opt_ignore_ancestry, opt_force, opt_accept,
1832 {{opt_ignore_ancestry,
1833 N_("allow switching to a node with no common ancestor")},
1835 N_("handle unversioned obstructions as changes")},
1836 {opt_relocate,N_("deprecated; use 'svn relocate'")}}
1839 { "unlock", svn_cl__unlock, {0}, N_
1840 ("Unlock working copy paths or URLs.\n"
1841 "usage: unlock TARGET...\n"
1843 " Use --force to break a lock held by another user or working copy.\n"),
1844 { opt_targets, opt_force, 'q' },
1845 {{opt_force, N_("break locks")}} },
1847 { "update", svn_cl__update, {"up"}, N_
1848 ("Bring changes from the repository into the working copy.\n"
1849 "usage: update [PATH...]\n"
1851 " If no revision is given, bring working copy up-to-date with HEAD rev.\n"
1852 " Else synchronize working copy to revision given by -r.\n"
1854 " For each updated item a line will be printed with characters reporting\n"
1855 " the action taken. These characters have the following meaning:\n"
1865 " Characters in the first column report about the item itself.\n"
1866 " Characters in the second column report about properties of the item.\n"
1867 " A 'B' in the third column signifies that the lock for the file has\n"
1868 " been broken or stolen.\n"
1869 " A 'C' in the fourth column indicates a tree conflict, while a 'C' in\n"
1870 " the first and second columns indicate textual conflicts in files\n"
1871 " and in property values, respectively.\n"
1873 " If --force is used, unversioned obstructing paths in the working\n"
1874 " copy do not automatically cause a failure if the update attempts to\n"
1875 " add the same path. If the obstructing path is the same type (file\n"
1876 " or directory) as the corresponding path in the repository it becomes\n"
1877 " versioned but its contents are left 'as-is' in the working copy.\n"
1878 " This means that an obstructing directory's unversioned children may\n"
1879 " also obstruct and become versioned. For files, any content differences\n"
1880 " between the obstruction and the repository are treated like a local\n"
1881 " modification to the working copy. All properties from the repository\n"
1882 " are applied to the obstructing path. Obstructing paths are reported\n"
1883 " in the first column with code 'E'.\n"
1885 " If the specified update target is missing from the working copy but its\n"
1886 " immediate parent directory is present, checkout the target into its\n"
1887 " parent directory at the specified depth. If --parents is specified,\n"
1888 " create any missing parent directories of the target by checking them\n"
1889 " out, too, at depth=empty.\n"
1891 " Use the --set-depth option to set a new working copy depth on the\n"
1892 " targets of this operation.\n"),
1893 {'r', 'N', opt_depth, opt_set_depth, 'q', opt_merge_cmd, opt_force,
1894 opt_ignore_externals, opt_changelist, opt_editor_cmd, opt_accept,
1895 opt_parents, opt_adds_as_modification},
1897 N_("handle unversioned obstructions as changes")} } },
1899 { "upgrade", svn_cl__upgrade, {0}, N_
1900 ("Upgrade the metadata storage format for a working copy.\n"
1901 "usage: upgrade [WCPATH...]\n"
1903 " Local modifications are preserved.\n"),
1906 { "x-shelve", svn_cl__shelve, {"shelve"}, N_
1907 ("Put a local change aside, as if putting it on a shelf.\n"
1908 "usage: 1. x-shelve [--keep-local] NAME [PATH...]\n"
1909 " 2. x-shelve --delete NAME\n"
1910 " 3. x-shelve --list\n"
1912 " 1. Save the local change in the given PATHs to a patch file, and\n"
1913 " revert that change from the WC unless '--keep-local' is given.\n"
1914 " If a log message is given with '-m' or '-F', include it at the\n"
1915 " beginning of the patch file.\n"
1917 " 2. Delete the shelved change NAME.\n"
1918 " (A backup is kept, named with a '.bak' extension.)\n"
1920 " 3. List shelved changes. Include the first line of any log message\n"
1921 " and some details about the contents of the change, unless '-q' is\n"
1924 " The kinds of change you can shelve are those supported by 'svn diff'\n"
1925 " and 'svn patch'. The following are currently NOT supported:\n"
1926 " mergeinfo changes, copies, moves, mkdir, rmdir,\n"
1927 " 'binary' content, uncommittable states\n"
1929 " To bring back a shelved change, use 'svn x-unshelve NAME'.\n"
1931 " Shelved changes are stored in <WC>/.svn/shelves/\n"
1933 " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
1934 " in the next release, and there is no promise of backward compatibility.\n"
1936 {opt_delete, opt_list, 'q', opt_dry_run, opt_keep_local,
1937 opt_depth, opt_targets, opt_changelist,
1938 /* almost SVN_CL__LOG_MSG_OPTIONS but not currently opt_with_revprop: */
1939 'm', 'F', opt_force_log, opt_editor_cmd, opt_encoding,
1942 { "x-unshelve", svn_cl__unshelve, {"unshelve"}, N_
1943 ("Bring a shelved change back to a local change in the WC.\n"
1944 "usage: 1. x-unshelve [--keep-shelved] [NAME]\n"
1945 " 2. x-unshelve --list\n"
1947 " 1. Apply the shelved change NAME to the working copy.\n"
1948 " Delete the patch unless the '--keep-shelved' option is given.\n"
1949 " (A backup is kept, named with a '.bak' extension.)\n"
1950 " NAME defaults to the most recent shelved change.\n"
1952 " 2. List shelved changes. Include the first line of any log message\n"
1953 " and some details about the contents of the change, unless '-q' is\n"
1956 " Any conflict between the change being unshelved and a change\n"
1957 " already in the WC is handled the same way as by 'svn patch',\n"
1958 " creating a 'reject' file.\n"
1960 " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
1961 " in the next release, and there is no promise of backward compatibility.\n"
1963 {opt_keep_shelved, opt_list, 'q', opt_dry_run} },
1965 { "x-shelves", svn_cl__shelves, {"shelves"}, N_
1966 ("List shelved changes.\n"
1967 "usage: x-shelves\n"
1969 " The shelving feature is EXPERIMENTAL. This command is likely to change\n"
1970 " in the next release, and there is no promise of backward compatibility.\n"
1974 { NULL, NULL, {0}, NULL, {0} }
1978 /* Version compatibility check */
1979 static svn_error_t *
1980 check_lib_versions(void)
1982 static const svn_version_checklist_t checklist[] =
1984 { "svn_subr", svn_subr_version },
1985 { "svn_client", svn_client_version },
1986 { "svn_wc", svn_wc_version },
1987 { "svn_ra", svn_ra_version },
1988 { "svn_delta", svn_delta_version },
1989 { "svn_diff", svn_diff_version },
1992 SVN_VERSION_DEFINE(my_version);
1994 return svn_ver_check_list2(&my_version, checklist, svn_ver_equal);
1997 /* The cancelation handler setup by the cmdline library. */
1998 svn_cancel_func_t svn_cl__check_cancel = NULL;
2000 /* Add a --search argument to OPT_STATE.
2001 * These options start a new search pattern group. */
2003 add_search_pattern_group(svn_cl__opt_state_t *opt_state,
2004 const char *pattern,
2005 apr_pool_t *result_pool)
2007 apr_array_header_t *group = NULL;
2009 if (opt_state->search_patterns == NULL)
2010 opt_state->search_patterns = apr_array_make(result_pool, 1,
2011 sizeof(apr_array_header_t *));
2013 group = apr_array_make(result_pool, 1, sizeof(const char *));
2014 APR_ARRAY_PUSH(group, const char *) = pattern;
2015 APR_ARRAY_PUSH(opt_state->search_patterns, apr_array_header_t *) = group;
2018 /* Add a --search-and argument to OPT_STATE.
2019 * These patterns are added to an existing pattern group, if any. */
2021 add_search_pattern_to_latest_group(svn_cl__opt_state_t *opt_state,
2022 const char *pattern,
2023 apr_pool_t *result_pool)
2025 apr_array_header_t *group;
2027 if (opt_state->search_patterns == NULL)
2029 add_search_pattern_group(opt_state, pattern, result_pool);
2033 group = APR_ARRAY_IDX(opt_state->search_patterns,
2034 opt_state->search_patterns->nelts - 1,
2035 apr_array_header_t *);
2036 APR_ARRAY_PUSH(group, const char *) = pattern;
2043 * On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
2044 * either return an error to be displayed, or set *EXIT_CODE to non-zero and
2045 * return SVN_NO_ERROR.
2047 static svn_error_t *
2048 sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
2053 svn_cl__opt_state_t opt_state = { 0, { 0 } };
2054 svn_client_ctx_t *ctx;
2055 apr_array_header_t *received_opts;
2057 const svn_opt_subcommand_desc2_t *subcommand = NULL;
2058 const char *dash_F_arg = NULL;
2059 svn_cl__cmd_baton_t command_baton;
2060 svn_auth_baton_t *ab;
2061 svn_config_t *cfg_config;
2062 svn_boolean_t descend = TRUE;
2063 svn_boolean_t interactive_conflicts = FALSE;
2064 svn_boolean_t force_interactive = FALSE;
2065 svn_cl__conflict_stats_t *conflict_stats
2066 = svn_cl__conflict_stats_create(pool);
2067 svn_boolean_t use_notifier = TRUE;
2068 svn_boolean_t reading_file_from_stdin = FALSE;
2069 apr_hash_t *changelists;
2070 apr_hash_t *cfg_hash;
2072 svn_boolean_t read_pass_from_stdin = FALSE;
2074 received_opts = apr_array_make(pool, SVN_OPT_MAX_OPTIONS, sizeof(int));
2076 /* Check library versions */
2077 SVN_ERR(check_lib_versions());
2079 #if defined(WIN32) || defined(__CYGWIN__)
2080 /* Set the working copy administrative directory name. */
2081 if (getenv("SVN_ASP_DOT_NET_HACK"))
2083 SVN_ERR(svn_wc_set_adm_dir("_svn", pool));
2087 /* Initialize the RA library. */
2088 SVN_ERR(svn_ra_initialize(pool));
2090 /* Init our changelists hash. */
2091 changelists = apr_hash_make(pool);
2093 /* Init the temporary buffer. */
2094 svn_membuf__create(&buf, 0, pool);
2096 /* Begin processing arguments. */
2097 opt_state.start_revision.kind = svn_opt_revision_unspecified;
2098 opt_state.end_revision.kind = svn_opt_revision_unspecified;
2099 opt_state.revision_ranges =
2100 apr_array_make(pool, 0, sizeof(svn_opt_revision_range_t *));
2101 opt_state.depth = svn_depth_unknown;
2102 opt_state.set_depth = svn_depth_unknown;
2103 opt_state.accept_which = svn_cl__accept_unspecified;
2104 opt_state.show_revs = svn_cl__show_revs_invalid;
2106 /* No args? Show usage. */
2109 SVN_ERR(svn_cl__help(NULL, NULL, pool));
2110 *exit_code = EXIT_FAILURE;
2111 return SVN_NO_ERROR;
2114 /* Else, parse options. */
2115 SVN_ERR(svn_cmdline__getopt_init(&os, argc, argv, pool));
2120 const char *opt_arg;
2121 const char *utf8_opt_arg;
2123 /* Parse the next option. */
2124 apr_status_t apr_err = apr_getopt_long(os, svn_cl__options, &opt_id,
2126 if (APR_STATUS_IS_EOF(apr_err))
2130 SVN_ERR(svn_cl__help(NULL, NULL, pool));
2131 *exit_code = EXIT_FAILURE;
2132 return SVN_NO_ERROR;
2135 /* Stash the option code in an array before parsing it. */
2136 APR_ARRAY_PUSH(received_opts, int) = opt_id;
2141 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2142 err = svn_cstring_atoi(&opt_state.limit, utf8_opt_arg);
2145 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, err,
2146 _("Non-numeric limit argument given"));
2148 if (opt_state.limit <= 0)
2150 return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
2151 _("Argument to --limit must be positive"));
2156 /* We store the raw message here. We will convert it to UTF-8
2157 * later, according to the value of the '--encoding' option. */
2158 opt_state.message = apr_pstrdup(pool, opt_arg);
2162 apr_array_header_t *change_revs;
2164 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2165 change_revs = svn_cstring_split(utf8_opt_arg, ", \n\r\t\v", TRUE,
2168 if (opt_state.old_target)
2170 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2171 _("Can't specify -c with --old"));
2174 for (i = 0; i < change_revs->nelts; i++)
2177 svn_revnum_t changeno, changeno_end;
2178 const char *change_str =
2179 APR_ARRAY_IDX(change_revs, i, const char *);
2180 const char *s = change_str;
2181 svn_boolean_t is_negative;
2183 /* Check for a leading minus to allow "-c -r42".
2184 * The is_negative flag is used to handle "-c -42" and "-c -r42".
2185 * The "-c r-42" case is handled by strtol() returning a
2186 * negative number. */
2187 is_negative = (*s == '-');
2191 /* Allow any number of 'r's to prefix a revision number. */
2194 changeno = changeno_end = strtol(s, &end, 10);
2195 if (end != s && *end == '-')
2197 if (changeno < 0 || is_negative)
2199 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR,
2201 _("Negative number in range (%s)"
2202 " not supported with -c"),
2208 changeno_end = strtol(s, &end, 10);
2210 if (end == change_str || *end != '\0')
2212 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2213 _("Non-numeric change argument (%s) "
2214 "given to -c"), change_str);
2219 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2220 _("There is no change 0"));
2224 changeno = -changeno;
2226 /* Figure out the range:
2229 -c M-N -> -r M-1:N for M < N
2230 -c M-N -> -r M:N-1 for M > N
2231 -c -M-N -> error (too confusing/no valid use case)
2235 if (changeno <= changeno_end)
2242 changeno = -changeno;
2243 changeno_end = changeno - 1;
2246 opt_state.used_change_arg = TRUE;
2247 APR_ARRAY_PUSH(opt_state.revision_ranges,
2248 svn_opt_revision_range_t *)
2249 = svn_opt__revision_range_from_revnums(changeno, changeno_end,
2255 opt_state.used_revision_arg = TRUE;
2256 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2257 if (svn_opt_parse_revision_to_range(opt_state.revision_ranges,
2258 utf8_opt_arg, pool) != 0)
2260 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2261 _("Syntax error in revision argument '%s'"),
2266 opt_state.verbose = TRUE;
2269 opt_state.update = TRUE;
2273 opt_state.help = TRUE;
2276 opt_state.quiet = TRUE;
2278 case opt_incremental:
2279 opt_state.incremental = TRUE;
2282 /* We read the raw file content here. We will convert it to UTF-8
2283 * later (if it's a log/lock message or an svn:* prop value),
2284 * according to the value of the '--encoding' option. */
2285 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2286 SVN_ERR(svn_stringbuf_from_file2(&(opt_state.filedata),
2287 utf8_opt_arg, pool));
2288 reading_file_from_stdin = (strcmp(utf8_opt_arg, "-") == 0);
2289 dash_F_arg = utf8_opt_arg;
2293 svn_stringbuf_t *buffer, *buffer_utf8;
2295 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2296 SVN_ERR(svn_stringbuf_from_file2(&buffer, utf8_opt_arg, pool));
2297 SVN_ERR(svn_utf_stringbuf_to_utf8(&buffer_utf8, buffer, pool));
2298 opt_state.targets = svn_cstring_split(buffer_utf8->data, "\n\r",
2303 opt_state.force = TRUE;
2306 opt_state.force_log = TRUE;
2309 opt_state.dry_run = TRUE;
2312 opt_state.list = TRUE;
2315 opt_state.revprop = TRUE;
2318 opt_state.depth = svn_depth_infinity;
2324 err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool);
2326 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
2327 _("Error converting depth "
2328 "from locale to UTF-8"));
2329 opt_state.depth = svn_depth_from_word(utf8_opt_arg);
2330 if (opt_state.depth == svn_depth_unknown
2331 || opt_state.depth == svn_depth_exclude)
2333 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2334 _("'%s' is not a valid depth; try "
2335 "'empty', 'files', 'immediates', "
2341 err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool);
2343 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
2344 _("Error converting depth "
2345 "from locale to UTF-8"));
2346 opt_state.set_depth = svn_depth_from_word(utf8_opt_arg);
2347 /* svn_depth_exclude is okay for --set-depth. */
2348 if (opt_state.set_depth == svn_depth_unknown)
2350 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2351 _("'%s' is not a valid depth; try "
2352 "'exclude', 'empty', 'files', "
2353 "'immediates', or 'infinity'"),
2358 opt_state.version = TRUE;
2360 case opt_auth_username:
2361 SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_username,
2364 case opt_auth_password:
2365 SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.auth_password,
2368 case opt_auth_password_from_stdin:
2369 read_pass_from_stdin = TRUE;
2372 opt_state.encoding = apr_pstrdup(pool, opt_arg);
2375 opt_state.xml = TRUE;
2377 case opt_stop_on_copy:
2378 opt_state.stop_on_copy = TRUE;
2381 opt_state.no_ignore = TRUE;
2383 case opt_no_auth_cache:
2384 opt_state.no_auth_cache = TRUE;
2386 case opt_non_interactive:
2387 opt_state.non_interactive = TRUE;
2389 case opt_force_interactive:
2390 force_interactive = TRUE;
2392 case opt_trust_server_cert: /* backwards compat to 1.8 */
2393 opt_state.trust_server_cert_unknown_ca = TRUE;
2395 case opt_trust_server_cert_failures:
2396 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2397 SVN_ERR(svn_cmdline__parse_trust_options(
2398 &opt_state.trust_server_cert_unknown_ca,
2399 &opt_state.trust_server_cert_cn_mismatch,
2400 &opt_state.trust_server_cert_expired,
2401 &opt_state.trust_server_cert_not_yet_valid,
2402 &opt_state.trust_server_cert_other_failure,
2403 utf8_opt_arg, pool));
2405 case opt_no_diff_added:
2406 opt_state.diff.no_diff_added = TRUE;
2408 case opt_no_diff_deleted:
2409 opt_state.diff.no_diff_deleted = TRUE;
2411 case opt_ignore_properties:
2412 opt_state.diff.ignore_properties = TRUE;
2414 case opt_show_copies_as_adds:
2415 opt_state.diff.show_copies_as_adds = TRUE;
2417 case opt_notice_ancestry:
2418 opt_state.diff.notice_ancestry = TRUE;
2420 case opt_ignore_ancestry:
2421 opt_state.ignore_ancestry = TRUE;
2423 case opt_ignore_externals:
2424 opt_state.ignore_externals = TRUE;
2427 opt_state.relocate = TRUE;
2430 SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.extensions,
2434 opt_state.diff.diff_cmd = apr_pstrdup(pool, opt_arg);
2437 opt_state.merge_cmd = apr_pstrdup(pool, opt_arg);
2439 case opt_record_only:
2440 opt_state.record_only = TRUE;
2442 case opt_editor_cmd:
2443 opt_state.editor_cmd = apr_pstrdup(pool, opt_arg);
2446 if (opt_state.used_change_arg)
2448 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2449 _("Can't specify -c with --old"));
2451 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2452 opt_state.old_target = apr_pstrdup(pool, utf8_opt_arg);
2455 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2456 opt_state.new_target = apr_pstrdup(pool, utf8_opt_arg);
2458 case opt_config_dir:
2459 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2460 opt_state.config_dir = svn_dirent_internal_style(utf8_opt_arg, pool);
2462 case opt_config_options:
2463 if (!opt_state.config_options)
2464 opt_state.config_options =
2465 apr_array_make(pool, 1,
2466 sizeof(svn_cmdline__config_argument_t*));
2468 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2469 SVN_ERR(svn_cmdline__parse_config_option(opt_state.config_options,
2470 utf8_opt_arg, "svn: ", pool));
2473 opt_state.autoprops = TRUE;
2475 case opt_no_autoprops:
2476 opt_state.no_autoprops = TRUE;
2478 case opt_native_eol:
2479 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2480 if ( !strcmp("LF", utf8_opt_arg) || !strcmp("CR", utf8_opt_arg) ||
2481 !strcmp("CRLF", utf8_opt_arg))
2482 opt_state.native_eol = utf8_opt_arg;
2485 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2486 _("Syntax error in native-eol argument '%s'"),
2491 opt_state.no_unlock = TRUE;
2494 opt_state.diff.summarize = TRUE;
2498 opt_state.remove = TRUE;
2500 case opt_changelist:
2501 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2502 if (utf8_opt_arg[0] == '\0')
2504 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2505 _("Changelist names must not be empty"));
2507 svn_hash_sets(changelists, utf8_opt_arg, (void *)1);
2509 case opt_keep_changelists:
2510 opt_state.keep_changelists = TRUE;
2512 case opt_keep_local:
2513 case opt_keep_shelved:
2514 opt_state.keep_local = TRUE;
2516 case opt_with_all_revprops:
2517 /* If --with-all-revprops is specified along with one or more
2518 * --with-revprops options, --with-all-revprops takes precedence. */
2519 opt_state.all_revprops = TRUE;
2521 case opt_with_no_revprops:
2522 opt_state.no_revprops = TRUE;
2524 case opt_with_revprop:
2525 SVN_ERR(svn_opt_parse_revprop(&opt_state.revprop_table,
2529 opt_state.parents = TRUE;
2532 opt_state.use_merge_history = TRUE;
2535 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2536 opt_state.accept_which = svn_cl__accept_from_word(utf8_opt_arg);
2537 if (opt_state.accept_which == svn_cl__accept_invalid)
2538 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2539 _("'%s' is not a valid --accept value"),
2543 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2544 opt_state.show_revs = svn_cl__show_revs_from_word(utf8_opt_arg);
2545 if (opt_state.show_revs == svn_cl__show_revs_invalid)
2546 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2547 _("'%s' is not a valid --show-revs value"),
2550 case opt_mergeinfo_log:
2551 opt_state.mergeinfo_log = TRUE;
2553 case opt_reintegrate:
2554 opt_state.reintegrate = TRUE;
2558 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2559 err = svn_cstring_atoi(&opt_state.strip, utf8_opt_arg);
2562 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, err,
2563 _("Invalid strip count '%s'"),
2566 if (opt_state.strip < 0)
2568 return svn_error_create(SVN_ERR_INCORRECT_PARAMS, NULL,
2569 _("Argument to --strip must be positive"));
2573 case opt_ignore_keywords:
2574 opt_state.ignore_keywords = TRUE;
2576 case opt_reverse_diff:
2577 opt_state.reverse_diff = TRUE;
2579 case opt_ignore_whitespace:
2580 opt_state.ignore_whitespace = TRUE;
2583 opt_state.show_diff = TRUE;
2585 case opt_internal_diff:
2586 opt_state.diff.internal_diff = TRUE;
2588 case opt_patch_compatible:
2589 opt_state.diff.patch_compatible = TRUE;
2591 case opt_use_git_diff_format:
2592 opt_state.diff.use_git_diff_format = TRUE;
2594 case opt_allow_mixed_revisions:
2595 opt_state.allow_mixed_rev = TRUE;
2597 case opt_include_externals:
2598 opt_state.include_externals = TRUE;
2600 case opt_show_inherited_props:
2601 opt_state.show_inherited_props = TRUE;
2603 case opt_properties_only:
2604 opt_state.diff.properties_only = TRUE;
2607 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2608 SVN_ERR(svn_utf__xfrm(&utf8_opt_arg, utf8_opt_arg,
2609 strlen(utf8_opt_arg), TRUE, TRUE, &buf));
2610 add_search_pattern_group(&opt_state,
2611 apr_pstrdup(pool, utf8_opt_arg),
2614 case opt_search_and:
2615 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2616 SVN_ERR(svn_utf__xfrm(&utf8_opt_arg, utf8_opt_arg,
2617 strlen(utf8_opt_arg), TRUE, TRUE, &buf));
2618 add_search_pattern_to_latest_group(&opt_state,
2619 apr_pstrdup(pool, utf8_opt_arg),
2622 case opt_remove_unversioned:
2623 opt_state.remove_unversioned = TRUE;
2625 case opt_remove_ignored:
2626 opt_state.remove_ignored = TRUE;
2628 case opt_no_newline:
2629 case opt_strict: /* ### DEPRECATED */
2630 opt_state.no_newline = TRUE;
2632 case opt_show_passwords:
2633 opt_state.show_passwords = TRUE;
2635 case opt_pin_externals:
2636 opt_state.pin_externals = TRUE;
2639 SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2640 opt_state.show_item = utf8_opt_arg;
2642 case opt_adds_as_modification:
2643 opt_state.adds_as_modification = TRUE;
2645 case opt_vacuum_pristines:
2646 opt_state.vacuum_pristines = TRUE;
2649 /* Hmmm. Perhaps this would be a good place to squirrel away
2650 opts that commands like svn diff might need. Hmmm indeed. */
2655 /* The --non-interactive and --force-interactive options are mutually
2657 if (opt_state.non_interactive && force_interactive)
2659 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2660 _("--non-interactive and --force-interactive "
2661 "are mutually exclusive"));
2664 opt_state.non_interactive = !svn_cmdline__be_interactive(
2665 opt_state.non_interactive,
2668 /* Turn our hash of changelists into an array of unique ones. */
2669 SVN_ERR(svn_hash_keys(&(opt_state.changelists), changelists, pool));
2671 /* ### This really belongs in libsvn_client. The trouble is,
2672 there's no one place there to run it from, no
2673 svn_client_init(). We'd have to add it to all the public
2674 functions that a client might call. It's unmaintainable to do
2675 initialization from within libsvn_client itself, but it seems
2676 burdensome to demand that all clients call svn_client_init()
2677 before calling any other libsvn_client function... On the other
2678 hand, the alternative is effectively to demand that they call
2679 svn_config_ensure() instead, so maybe we should have a generic
2680 init function anyway. Thoughts? */
2681 SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
2683 /* If the user asked for help, then the rest of the arguments are
2684 the names of subcommands to get help on (if any), or else they're
2685 just typos/mistakes. Whatever the case, the subcommand to
2686 actually run is svn_cl__help(). */
2688 subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table, "help");
2690 /* If we're not running the `help' subcommand, then look for a
2691 subcommand in the first argument. */
2692 if (subcommand == NULL)
2694 if (os->ind >= os->argc)
2696 if (opt_state.version)
2698 /* Use the "help" subcommand to handle the "--version" option. */
2699 static const svn_opt_subcommand_desc2_t pseudo_cmd =
2700 { "--version", svn_cl__help, {0}, "",
2701 {opt_version, /* must accept its own option */
2702 'q', /* brief output */
2703 'v', /* verbose output */
2704 opt_config_dir /* all commands accept this */
2707 subcommand = &pseudo_cmd;
2712 (svn_cmdline_fprintf(stderr, pool,
2713 _("Subcommand argument required\n")));
2714 svn_error_clear(svn_cl__help(NULL, NULL, pool));
2715 *exit_code = EXIT_FAILURE;
2716 return SVN_NO_ERROR;
2721 const char *first_arg;
2723 SVN_ERR(svn_utf_cstring_to_utf8(&first_arg, os->argv[os->ind++],
2725 subcommand = svn_opt_get_canonical_subcommand2(svn_cl__cmd_table,
2727 if (subcommand == NULL)
2730 (svn_cmdline_fprintf(stderr, pool,
2731 _("Unknown subcommand: '%s'\n"),
2733 svn_error_clear(svn_cl__help(NULL, NULL, pool));
2735 /* Be kind to people who try 'svn undo'. */
2736 if (strcmp(first_arg, "undo") == 0)
2739 (svn_cmdline_fprintf(stderr, pool,
2740 _("Undo is done using either the "
2741 "'svn revert' or the 'svn merge' "
2745 *exit_code = EXIT_FAILURE;
2746 return SVN_NO_ERROR;
2751 /* Check that the subcommand wasn't passed any inappropriate options. */
2752 for (i = 0; i < received_opts->nelts; i++)
2754 opt_id = APR_ARRAY_IDX(received_opts, i, int);
2756 /* All commands implicitly accept --help, so just skip over this
2757 when we see it. Note that we don't want to include this option
2758 in their "accepted options" list because it would be awfully
2759 redundant to display it in every commands' help text. */
2760 if (opt_id == 'h' || opt_id == '?')
2763 if (! svn_opt_subcommand_takes_option3(subcommand, opt_id,
2764 svn_cl__global_options))
2767 const apr_getopt_option_t *badopt =
2768 svn_opt_get_option_from_code2(opt_id, svn_cl__options,
2770 svn_opt_format_option(&optstr, badopt, FALSE, pool);
2771 if (subcommand->name[0] == '-')
2772 svn_error_clear(svn_cl__help(NULL, NULL, pool));
2775 (svn_cmdline_fprintf
2776 (stderr, pool, _("Subcommand '%s' doesn't accept option '%s'\n"
2777 "Type 'svn help %s' for usage.\n"),
2778 subcommand->name, optstr, subcommand->name));
2779 *exit_code = EXIT_FAILURE;
2780 return SVN_NO_ERROR;
2784 /* Only merge and log support multiple revisions/revision ranges. */
2785 if (subcommand->cmd_func != svn_cl__merge
2786 && subcommand->cmd_func != svn_cl__log)
2788 if (opt_state.revision_ranges->nelts > 1)
2790 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2791 _("Multiple revision arguments "
2792 "encountered; can't specify -c twice, "
2793 "or both -c and -r"));
2797 /* Disallow simultaneous use of both --depth and --set-depth. */
2798 if ((opt_state.depth != svn_depth_unknown)
2799 && (opt_state.set_depth != svn_depth_unknown))
2801 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2802 _("--depth and --set-depth are mutually "
2806 /* Disallow simultaneous use of both --with-all-revprops and
2807 --with-no-revprops. */
2808 if (opt_state.all_revprops && opt_state.no_revprops)
2810 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2811 _("--with-all-revprops and --with-no-revprops "
2812 "are mutually exclusive"));
2815 /* Disallow simultaneous use of both --with-revprop and
2816 --with-no-revprops. */
2817 if (opt_state.revprop_table && opt_state.no_revprops)
2819 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2820 _("--with-revprop and --with-no-revprops "
2821 "are mutually exclusive"));
2824 #ifdef SVN_CL__OPTION_WITH_REVPROP_CAN_SET_PROPERTIES_IN_SVN_NAMESPACE
2825 /* XXX This is incomplete, since we do not yet check for --force, nor
2826 do all the commands that accept --with-revprop also accept --force. */
2828 /* Check the spelling of the revision properties given by --with-revprop. */
2829 if (opt_state.revprop_table)
2831 apr_hash_index_t *hi;
2832 for (hi = apr_hash_first(pool, opt_state.revprop_table);
2833 hi; hi = apr_hash_next(hi))
2835 SVN_ERR(svn_cl__check_svn_prop_name(apr_hash_this_key(hi),
2836 TRUE, svn_cl__prop_use_use,
2840 #endif /* SVN_CL__OPTION_WITH_REVPROP_CAN_SET_PROPERTIES_IN_SVN_NAMESPACE */
2842 /* Disallow simultaneous use of both -m and -F, when they are
2843 both used to pass a commit message or lock comment. ('propset'
2844 takes the property value, not a commit message, from -F.)
2846 if (opt_state.filedata && opt_state.message
2847 && subcommand->cmd_func != svn_cl__propset)
2849 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2850 _("--message (-m) and --file (-F) "
2851 "are mutually exclusive"));
2854 /* --trust-* options can only be used with --non-interactive */
2855 if (!opt_state.non_interactive)
2857 if (opt_state.trust_server_cert_unknown_ca
2858 || opt_state.trust_server_cert_cn_mismatch
2859 || opt_state.trust_server_cert_expired
2860 || opt_state.trust_server_cert_not_yet_valid
2861 || opt_state.trust_server_cert_other_failure)
2862 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2863 _("--trust-server-cert-failures requires "
2864 "--non-interactive"));
2867 /* --password-from-stdin can only be used with --non-interactive */
2868 if (read_pass_from_stdin && !opt_state.non_interactive)
2870 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2871 _("--password-from-stdin requires "
2872 "--non-interactive"));
2875 /* Disallow simultaneous use of both --diff-cmd and
2877 if (opt_state.diff.diff_cmd && opt_state.diff.internal_diff)
2879 return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2880 _("--diff-cmd and --internal-diff "
2881 "are mutually exclusive"));
2884 /* Ensure that 'revision_ranges' has at least one item, and make
2885 'start_revision' and 'end_revision' match that item. */
2886 if (opt_state.revision_ranges->nelts == 0)
2888 svn_opt_revision_range_t *range = apr_palloc(pool, sizeof(*range));
2889 range->start.kind = svn_opt_revision_unspecified;
2890 range->end.kind = svn_opt_revision_unspecified;
2891 APR_ARRAY_PUSH(opt_state.revision_ranges,
2892 svn_opt_revision_range_t *) = range;
2894 opt_state.start_revision = APR_ARRAY_IDX(opt_state.revision_ranges, 0,
2895 svn_opt_revision_range_t *)->start;
2896 opt_state.end_revision = APR_ARRAY_IDX(opt_state.revision_ranges, 0,
2897 svn_opt_revision_range_t *)->end;
2899 err = svn_config_get_config(&cfg_hash, opt_state.config_dir, pool);
2902 /* Fallback to default config if the config directory isn't readable
2903 or is not a directory. */
2904 if (APR_STATUS_IS_EACCES(err->apr_err)
2905 || SVN__APR_STATUS_IS_ENOTDIR(err->apr_err))
2907 svn_handle_warning2(stderr, err, "svn: ");
2908 svn_error_clear(err);
2910 SVN_ERR(svn_config__get_default_config(&cfg_hash, pool));
2916 /* Relocation is infinite-depth only. */
2917 if (opt_state.relocate)
2919 if (opt_state.depth != svn_depth_unknown)
2921 return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
2922 _("--relocate and --depth are mutually "
2927 return svn_error_create(
2928 SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
2929 _("--relocate and --non-recursive (-N) are mutually "
2934 /* Only a few commands can accept a revision range; the rest can take at
2935 most one revision number. */
2936 if (subcommand->cmd_func != svn_cl__blame
2937 && subcommand->cmd_func != svn_cl__diff
2938 && subcommand->cmd_func != svn_cl__log
2939 && subcommand->cmd_func != svn_cl__mergeinfo
2940 && subcommand->cmd_func != svn_cl__merge)
2942 if (opt_state.end_revision.kind != svn_opt_revision_unspecified)
2944 return svn_error_create(SVN_ERR_CLIENT_REVISION_RANGE, NULL, NULL);
2948 /* -N has a different meaning depending on the command */
2951 if (subcommand->cmd_func == svn_cl__status)
2953 opt_state.depth = svn_depth_immediates;
2955 else if (subcommand->cmd_func == svn_cl__revert
2956 || subcommand->cmd_func == svn_cl__add
2957 || subcommand->cmd_func == svn_cl__commit)
2959 /* In pre-1.5 Subversion, some commands treated -N like
2960 --depth=empty, so force that mapping here. Anyway, with
2961 revert it makes sense to be especially conservative,
2962 since revert can lose data. */
2963 opt_state.depth = svn_depth_empty;
2967 opt_state.depth = svn_depth_files;
2971 /* Update the options in the config */
2972 if (opt_state.config_options)
2975 svn_cmdline__apply_config_options(cfg_hash,
2976 opt_state.config_options,
2977 "svn: ", "--config-option"));
2980 cfg_config = svn_hash_gets(cfg_hash, SVN_CONFIG_CATEGORY_CONFIG);
2981 #if !defined(SVN_CL_NO_EXCLUSIVE_LOCK)
2983 const char *exclusive_clients_option;
2984 apr_array_header_t *exclusive_clients;
2986 svn_config_get(cfg_config, &exclusive_clients_option,
2987 SVN_CONFIG_SECTION_WORKING_COPY,
2988 SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE_CLIENTS,
2990 exclusive_clients = svn_cstring_split(exclusive_clients_option,
2992 for (i = 0; i < exclusive_clients->nelts; ++i)
2994 const char *exclusive_client = APR_ARRAY_IDX(exclusive_clients, i,
2997 /* This blocks other clients from accessing the wc.db so it must
2998 be explicitly enabled.*/
2999 if (!strcmp(exclusive_client, "svn"))
3000 svn_config_set(cfg_config,
3001 SVN_CONFIG_SECTION_WORKING_COPY,
3002 SVN_CONFIG_OPTION_SQLITE_EXCLUSIVE,
3008 /* Create a client context object. */
3009 command_baton.opt_state = &opt_state;
3010 command_baton.conflict_stats = conflict_stats;
3011 SVN_ERR(svn_client_create_context2(&ctx, cfg_hash, pool));
3012 command_baton.ctx = ctx;
3014 /* If we're running a command that could result in a commit, verify
3015 that any log message we were given on the command line makes
3016 sense (unless we've also been instructed not to care). This may
3017 access the working copy so do it after setting the locking mode. */
3018 if ((! opt_state.force_log)
3019 && (subcommand->cmd_func == svn_cl__commit
3020 || subcommand->cmd_func == svn_cl__copy
3021 || subcommand->cmd_func == svn_cl__delete
3022 || subcommand->cmd_func == svn_cl__import
3023 || subcommand->cmd_func == svn_cl__mkdir
3024 || subcommand->cmd_func == svn_cl__move
3025 || subcommand->cmd_func == svn_cl__lock
3026 || subcommand->cmd_func == svn_cl__propedit
3027 || subcommand->cmd_func == svn_cl__shelve))
3029 /* If the -F argument is a file that's under revision control,
3030 that's probably not what the user intended. */
3033 svn_node_kind_t kind;
3034 const char *local_abspath;
3035 const char *fname = svn_dirent_internal_style(dash_F_arg, pool);
3037 err = svn_dirent_get_absolute(&local_abspath, fname, pool);
3041 err = svn_wc_read_kind2(&kind, ctx->wc_ctx, local_abspath, TRUE,
3044 if (!err && kind != svn_node_none && kind != svn_node_unknown)
3046 if (subcommand->cmd_func != svn_cl__lock)
3048 return svn_error_create(
3049 SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL,
3050 _("Log message file is a versioned file; "
3051 "use '--force-log' to override"));
3055 return svn_error_create(
3056 SVN_ERR_CL_LOG_MESSAGE_IS_VERSIONED_FILE, NULL,
3057 _("Lock comment file is a versioned file; "
3058 "use '--force-log' to override"));
3062 svn_error_clear(err);
3065 /* If the -m argument is a file at all, that's probably not what
3066 the user intended. */
3067 if (opt_state.message)
3070 if (apr_stat(&finfo, opt_state.message /* not converted to UTF-8 */,
3071 APR_FINFO_MIN, pool) == APR_SUCCESS)
3073 if (subcommand->cmd_func != svn_cl__lock)
3075 return svn_error_create
3076 (SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL,
3077 _("The log message is a pathname "
3078 "(was -F intended?); use '--force-log' to override"));
3082 return svn_error_create
3083 (SVN_ERR_CL_LOG_MESSAGE_IS_PATHNAME, NULL,
3084 _("The lock comment is a pathname "
3085 "(was -F intended?); use '--force-log' to override"));
3091 /* XXX: Only diff_cmd for now, overlay rest later and stop passing
3092 opt_state altogether? */
3093 if (opt_state.diff.diff_cmd)
3094 svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
3095 SVN_CONFIG_OPTION_DIFF_CMD, opt_state.diff.diff_cmd);
3096 if (opt_state.merge_cmd)
3097 svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
3098 SVN_CONFIG_OPTION_DIFF3_CMD, opt_state.merge_cmd);
3099 if (opt_state.diff.internal_diff)
3100 svn_config_set(cfg_config, SVN_CONFIG_SECTION_HELPERS,
3101 SVN_CONFIG_OPTION_DIFF_CMD, NULL);
3103 /* Check for mutually exclusive args --auto-props and --no-auto-props */
3104 if (opt_state.autoprops && opt_state.no_autoprops)
3106 return svn_error_create(SVN_ERR_CL_MUTUALLY_EXCLUSIVE_ARGS, NULL,
3107 _("--auto-props and --no-auto-props are "
3108 "mutually exclusive"));
3111 /* Update auto-props-enable option, and populate the MIME types map,
3112 for add/import commands */
3113 if (subcommand->cmd_func == svn_cl__add
3114 || subcommand->cmd_func == svn_cl__import)
3116 const char *mimetypes_file;
3117 svn_config_get(cfg_config, &mimetypes_file,
3118 SVN_CONFIG_SECTION_MISCELLANY,
3119 SVN_CONFIG_OPTION_MIMETYPES_FILE, FALSE);
3120 if (mimetypes_file && *mimetypes_file)
3122 SVN_ERR(svn_io_parse_mimetypes_file(&(ctx->mimetypes_map),
3123 mimetypes_file, pool));
3126 if (opt_state.autoprops)
3128 svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY,
3129 SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS, TRUE);
3131 if (opt_state.no_autoprops)
3133 svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY,
3134 SVN_CONFIG_OPTION_ENABLE_AUTO_PROPS, FALSE);
3138 /* Update the 'keep-locks' runtime option */
3139 if (opt_state.no_unlock)
3140 svn_config_set_bool(cfg_config, SVN_CONFIG_SECTION_MISCELLANY,
3141 SVN_CONFIG_OPTION_NO_UNLOCK, TRUE);
3143 /* Set the log message callback function. Note that individual
3144 subcommands will populate the ctx->log_msg_baton3. */
3145 ctx->log_msg_func3 = svn_cl__get_log_message;
3147 /* Set up the notifier.
3149 In general, we use it any time we aren't in --quiet mode. 'svn
3150 status' is unique, though, in that we don't want it in --quiet mode
3151 unless we're also in --verbose mode. When in --xml mode,
3152 though, we never want it. */
3153 if (opt_state.quiet)
3154 use_notifier = FALSE;
3155 if ((subcommand->cmd_func == svn_cl__status) && opt_state.verbose)
3156 use_notifier = TRUE;
3158 use_notifier = FALSE;
3161 SVN_ERR(svn_cl__get_notifier(&ctx->notify_func2, &ctx->notify_baton2,
3162 conflict_stats, pool));
3165 /* Get password from stdin if necessary */
3166 if (read_pass_from_stdin)
3168 SVN_ERR(svn_cmdline__stdin_readline(&opt_state.auth_password, pool, pool));
3171 /* Set up our cancellation support. */
3172 svn_cl__check_cancel = svn_cmdline__setup_cancellation_handler();
3173 ctx->cancel_func = svn_cl__check_cancel;
3175 /* Set up Authentication stuff. */
3176 SVN_ERR(svn_cmdline_create_auth_baton2(
3178 opt_state.non_interactive,
3179 opt_state.auth_username,
3180 opt_state.auth_password,
3181 opt_state.config_dir,
3182 opt_state.no_auth_cache,
3183 opt_state.trust_server_cert_unknown_ca,
3184 opt_state.trust_server_cert_cn_mismatch,
3185 opt_state.trust_server_cert_expired,
3186 opt_state.trust_server_cert_not_yet_valid,
3187 opt_state.trust_server_cert_other_failure,
3193 ctx->auth_baton = ab;
3195 if (opt_state.non_interactive)
3197 if (opt_state.accept_which == svn_cl__accept_edit)
3199 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
3200 _("--accept=%s incompatible with"
3201 " --non-interactive"),
3202 SVN_CL__ACCEPT_EDIT);
3204 if (opt_state.accept_which == svn_cl__accept_launch)
3206 return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
3207 _("--accept=%s incompatible with"
3208 " --non-interactive"),
3209 SVN_CL__ACCEPT_LAUNCH);
3212 /* The default action when we're non-interactive is to use the
3213 * recommended conflict resolution (this will postpone conflicts
3214 * for which no recommended resolution is available). */
3215 if (opt_state.accept_which == svn_cl__accept_unspecified)
3216 opt_state.accept_which = svn_cl__accept_recommended;
3219 /* Check whether interactive conflict resolution is disabled by
3220 * the configuration file. If no --accept option was specified
3221 * we postpone all conflicts in this case. */
3222 SVN_ERR(svn_config_get_bool(cfg_config, &interactive_conflicts,
3223 SVN_CONFIG_SECTION_MISCELLANY,
3224 SVN_CONFIG_OPTION_INTERACTIVE_CONFLICTS,
3226 if (!interactive_conflicts)
3228 /* Make 'svn resolve' non-interactive. */
3229 if (subcommand->cmd_func == svn_cl__resolve)
3230 opt_state.non_interactive = TRUE;
3232 /* We're not resolving conflicts interactively. If no --accept option
3233 * was provided the default behaviour is to postpone all conflicts. */
3234 if (opt_state.accept_which == svn_cl__accept_unspecified)
3235 opt_state.accept_which = svn_cl__accept_postpone;
3238 /* We don't use legacy libsvn_wc conflict handlers by default. */
3240 ctx->conflict_func = NULL;
3241 ctx->conflict_baton = NULL;
3242 ctx->conflict_func2 = NULL;
3243 ctx->conflict_baton2 = NULL;
3246 /* And now we finally run the subcommand. */
3247 err = (*subcommand->cmd_func)(os, &command_baton, pool);
3250 /* For argument-related problems, suggest using the 'help'
3252 if (err->apr_err == SVN_ERR_CL_INSUFFICIENT_ARGS
3253 || err->apr_err == SVN_ERR_CL_ARG_PARSING_ERROR)
3255 err = svn_error_quick_wrapf(
3256 err, _("Try 'svn help %s' for more information"),
3259 if (err->apr_err == SVN_ERR_WC_UPGRADE_REQUIRED)
3261 err = svn_error_quick_wrap(err,
3262 _("Please see the 'svn upgrade' command"));
3265 if (err->apr_err == SVN_ERR_AUTHN_FAILED && opt_state.non_interactive)
3267 err = svn_error_quick_wrap(err,
3268 _("Authentication failed and interactive"
3269 " prompting is disabled; see the"
3270 " --force-interactive option"));
3271 if (reading_file_from_stdin)
3272 err = svn_error_quick_wrap(err,
3273 _("Reading file from standard input "
3274 "because of -F option; this can "
3275 "interfere with interactive "
3279 /* Tell the user about 'svn cleanup' if any error on the stack
3280 was about locked working copies. */
3281 if (svn_error_find_cause(err, SVN_ERR_WC_LOCKED))
3283 err = svn_error_quick_wrap(
3284 err, _("Run 'svn cleanup' to remove locks "
3285 "(type 'svn help cleanup' for details)"));
3288 if (err->apr_err == SVN_ERR_SQLITE_BUSY)
3290 err = svn_error_quick_wrap(err,
3291 _("Another process is blocking the "
3292 "working copy database, or the "
3293 "underlying filesystem does not "
3294 "support file locking; if the working "
3295 "copy is on a network filesystem, make "
3296 "sure file locking has been enabled "
3297 "on the file server"));
3300 if (svn_error_find_cause(err, SVN_ERR_RA_CANNOT_CREATE_TUNNEL) &&
3301 (opt_state.auth_username || opt_state.auth_password))
3303 err = svn_error_quick_wrap(
3304 err, _("When using svn+ssh:// URLs, keep in mind that the "
3305 "--username and --password options are ignored "
3306 "because authentication is performed by SSH, not "
3313 return SVN_NO_ERROR;
3317 main(int argc, const char *argv[])
3320 int exit_code = EXIT_SUCCESS;
3323 /* Initialize the app. */
3324 if (svn_cmdline_init("svn", stderr) != EXIT_SUCCESS)
3325 return EXIT_FAILURE;
3327 /* Create our top-level pool. Use a separate mutexless allocator,
3328 * given this application is single threaded.
3330 pool = apr_allocator_owner_get(svn_pool_create_allocator(FALSE));
3332 err = sub_main(&exit_code, argc, argv, pool);
3334 /* Flush stdout and report if it fails. It would be flushed on exit anyway
3335 but this makes sure that output is not silently lost if it fails. */
3336 err = svn_error_compose_create(err, svn_cmdline_fflush(stdout));
3340 exit_code = EXIT_FAILURE;
3341 svn_cmdline_handle_exit_error(err, NULL, "svn: ");
3344 svn_pool_destroy(pool);
3346 svn_cmdline__cancellation_exit();