319
357
svnadmin__pre_1_6_compatible
360
{"delrevprop", subcommand_delrevprop, {0}, N_
361
("usage: 1. svnadmin delrevprop REPOS_PATH -r REVISION NAME\n"
362
" 2. svnadmin delrevprop REPO_PATH -t TXN NAME\n\n"
363
"1. Delete the property NAME on revision REVISION.\n\n"
364
"Use --use-pre-revprop-change-hook/--use-post-revprop-change-hook to\n"
365
"trigger the revision property-related hooks (for example, if you want\n"
366
"an email notification sent from your post-revprop-change hook).\n\n"
367
"NOTE: Revision properties are not versioned, so this command will\n"
368
"irreversibly destroy the previous value of the property.\n\n"
369
"2. Delete the property NAME on transaction TXN.\n"),
370
{'r', 't', svnadmin__use_pre_revprop_change_hook,
371
svnadmin__use_post_revprop_change_hook} },
322
373
{"deltify", subcommand_deltify, {0}, N_
323
374
("usage: svnadmin deltify [-r LOWER[:UPPER]] REPOS_PATH\n\n"
324
375
"Run over the requested revision range, performing predecessor delti-\n"
442
499
{'r', svnadmin__bypass_hooks} },
444
501
{"setrevprop", subcommand_setrevprop, {0}, N_
445
("usage: svnadmin setrevprop REPOS_PATH -r REVISION NAME FILE\n\n"
446
"Set the property NAME on revision REVISION to the contents of FILE. Use\n"
447
"--use-pre-revprop-change-hook/--use-post-revprop-change-hook to trigger\n"
448
"the revision property-related hooks (for example, if you want an email\n"
449
"notification sent from your post-revprop-change hook).\n\n"
502
("usage: 1. svnadmin setrevprop REPOS_PATH -r REVISION NAME FILE\n"
503
" 2. svnadmin setrevprop REPOS_PATH -t TXN NAME FILE\n\n"
504
"1. Set the property NAME on revision REVISION to the contents of FILE.\n\n"
505
"Use --use-pre-revprop-change-hook/--use-post-revprop-change-hook to\n"
506
"trigger the revision property-related hooks (for example, if you want\n"
507
"an email notification sent from your post-revprop-change hook).\n\n"
450
508
"NOTE: Revision properties are not versioned, so this command will\n"
451
"overwrite the previous value of the property.\n"),
452
{'r', svnadmin__use_pre_revprop_change_hook,
509
"overwrite the previous value of the property.\n\n"
510
"2. Set the property NAME on transaction TXN to the contents of FILE.\n"),
511
{'r', 't', svnadmin__use_pre_revprop_change_hook,
453
512
svnadmin__use_post_revprop_change_hook} },
455
514
{"setuuid", subcommand_setuuid, {0}, N_
683
751
svn_hash_sets(fs_config, SVN_FS_CONFIG_PRE_1_6_COMPATIBLE, "1");
684
752
if (! svn_version__at_least(opt_state->compatible_version, 1, 8, 0))
685
753
svn_hash_sets(fs_config, SVN_FS_CONFIG_PRE_1_8_COMPATIBLE, "1");
754
/* In 1.9, we figured out that we didn't have to keep extending this
755
madness indefinitely. */
756
svn_hash_sets(fs_config, SVN_FS_CONFIG_COMPATIBLE_VERSION,
757
apr_psprintf(pool, "%d.%d.%d%s%s",
758
opt_state->compatible_version->major,
759
opt_state->compatible_version->minor,
760
opt_state->compatible_version->patch,
761
opt_state->compatible_version->tag
763
opt_state->compatible_version->tag
764
? opt_state->compatible_version->tag : ""));
688
if (opt_state->compatible_version
689
&& ! svn_version__at_least(opt_state->compatible_version, 1, 1, 0)
690
/* ### TODO: this NULL check hard-codes knowledge of the library's
691
default fs-type value */
692
&& (opt_state->fs_type == NULL
693
|| !strcmp(opt_state->fs_type, SVN_FS_TYPE_FSFS)))
767
if (opt_state->compatible_version)
695
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
696
_("Repositories compatible with 1.0.x must use "
769
if (! svn_version__at_least(opt_state->compatible_version, 1, 1, 0)
770
/* ### TODO: this NULL check hard-codes knowledge of the library's
771
default fs-type value */
772
&& (opt_state->fs_type == NULL
773
|| !strcmp(opt_state->fs_type, SVN_FS_TYPE_FSFS)))
775
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
776
_("Repositories compatible with 1.0.x must "
777
"use --fs-type=bdb"));
780
if (! svn_version__at_least(opt_state->compatible_version, 1, 9, 0)
781
&& opt_state->fs_type && !strcmp(opt_state->fs_type, SVN_FS_TYPE_FSX))
783
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
784
_("Repositories compatible with 1.8.x or "
785
"earlier cannot use --fs-type=%s"),
700
790
SVN_ERR(svn_repos_create(&repos, opt_state->repository_path,
756
846
return SVN_NO_ERROR;
849
/* Structure for errors encountered during 'svnadmin verify --keep-going'. */
850
struct verification_error
856
/* Pool cleanup function to clear an svn_error_t *. */
858
err_cleanup(void *data)
860
svn_error_t *err = data;
862
svn_error_clear(err);
867
struct repos_verify_callback_baton
869
/* Should we continue after receiving a first verification error? */
870
svn_boolean_t keep_going;
872
/* List of errors encountered during 'svnadmin verify --keep-going'. */
873
apr_array_header_t *error_summary;
875
/* Pool for data collected during callback invocations. */
876
apr_pool_t *result_pool;
879
/* Implementation of svn_repos_verify_callback_t to handle errors coming
880
from svn_repos_verify_fs3(). */
882
repos_verify_callback(void *baton,
883
svn_revnum_t revision,
884
svn_error_t *verify_err,
885
apr_pool_t *scratch_pool)
887
struct repos_verify_callback_baton *b = baton;
889
if (revision == SVN_INVALID_REVNUM)
891
SVN_ERR(svn_cmdline_fputs(_("* Error verifying repository metadata.\n"),
892
stderr, scratch_pool));
896
SVN_ERR(svn_cmdline_fprintf(stderr, scratch_pool,
897
_("* Error verifying revision %ld.\n"),
903
struct verification_error *verr;
905
svn_handle_error2(verify_err, stderr, FALSE, "svnadmin: ");
907
/* Remember the error in B->ERROR_SUMMARY. */
908
verr = apr_palloc(b->result_pool, sizeof(*verr));
909
verr->rev = revision;
910
verr->err = svn_error_dup(verify_err);
911
apr_pool_cleanup_register(b->result_pool, verr->err, err_cleanup,
912
apr_pool_cleanup_null);
913
APR_ARRAY_PUSH(b->error_summary, struct verification_error *) = verr;
918
return svn_error_trace(svn_error_dup(verify_err));
760
921
/* Implementation of svn_repos_notify_func_t to wrap the output to a
761
response stream for svn_repos_dump_fs2() and svn_repos_verify_fs() */
922
response stream for svn_repos_dump_fs2(), svn_repos_verify_fs(),
923
svn_repos_hotcopy3() and others. */
763
925
repos_notify_handler(void *baton,
764
926
const svn_repos_notify_t *notify,
765
927
apr_pool_t *scratch_pool)
767
929
svn_stream_t *feedback_stream = baton;
770
931
switch (notify->action)
924
1083
" repository may take some time...\n")));
1086
case svn_repos_notify_pack_revprops:
1088
const char *shardstr = apr_psprintf(scratch_pool,
1089
"%" APR_INT64_T_FMT,
1091
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
1092
_("Packing revision properties"
1098
case svn_repos_notify_cleanup_revprops:
1100
const char *shardstr = apr_psprintf(scratch_pool,
1101
"%" APR_INT64_T_FMT,
1103
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
1104
_("Removing non-packed revision properties"
1110
case svn_repos_notify_format_bumped:
1111
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
1112
_("Bumped repository format to %ld\n"),
1116
case svn_repos_notify_hotcopy_rev_range:
1117
if (notify->start_revision == notify->end_revision)
1119
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
1120
_("* Copied revision %ld.\n"),
1121
notify->start_revision));
1125
svn_error_clear(svn_stream_printf(feedback_stream, scratch_pool,
1126
_("* Copied revisions from %ld to %ld.\n"),
1127
notify->start_revision, notify->end_revision));
1200
1407
/* Progress feedback goes to STDOUT, unless they asked to suppress it. */
1201
1408
if (! opt_state->quiet)
1202
stdout_stream = recode_stream_create(stdout, pool);
1409
feedback_stream = recode_stream_create(stdout, pool);
1204
err = svn_repos_load_fs4(repos, stdin_stream, lower, upper,
1411
err = svn_repos_load_fs5(repos, stdin_stream, lower, upper,
1205
1412
opt_state->uuid_action, opt_state->parent_dir,
1206
1413
opt_state->use_pre_commit_hook,
1207
1414
opt_state->use_post_commit_hook,
1208
1415
!opt_state->bypass_prop_validation,
1416
opt_state->ignore_dates,
1209
1417
opt_state->quiet ? NULL : repos_notify_handler,
1210
stdout_stream, check_cancel, NULL, pool);
1418
feedback_stream, check_cancel, NULL, pool);
1211
1419
if (err && err->apr_err == SVN_ERR_BAD_PROPERTY_VALUE)
1212
1420
return svn_error_quick_wrap(err,
1213
1421
_("Invalid property value found in "
1425
1633
/* A helper for the 'setrevprop' and 'setlog' commands. Expects
1426
OPT_STATE->use_pre_revprop_change_hook and
1427
OPT_STATE->use_post_revprop_change_hook to be set appropriately. */
1634
OPT_STATE->txn_id, OPT_STATE->use_pre_revprop_change_hook and
1635
OPT_STATE->use_post_revprop_change_hook to be set appropriately.
1636
If FILENAME is NULL, delete property PROP_NAME. */
1428
1637
static svn_error_t *
1429
1638
set_revprop(const char *prop_name, const char *filename,
1430
1639
struct svnadmin_opt_state *opt_state, apr_pool_t *pool)
1432
1641
svn_repos_t *repos;
1433
svn_string_t *prop_value = svn_string_create_empty(pool);
1434
svn_stringbuf_t *file_contents;
1436
SVN_ERR(svn_stringbuf_from_file2(&file_contents, filename, pool));
1438
prop_value->data = file_contents->data;
1439
prop_value->len = file_contents->len;
1441
SVN_ERR(svn_subst_translate_string2(&prop_value, NULL, NULL, prop_value,
1442
NULL, FALSE, pool, pool));
1642
svn_string_t *prop_value;
1646
svn_stringbuf_t *file_contents;
1648
SVN_ERR(svn_stringbuf_from_file2(&file_contents, filename, pool));
1650
prop_value = svn_string_create_empty(pool);
1651
prop_value->data = file_contents->data;
1652
prop_value->len = file_contents->len;
1654
SVN_ERR(svn_subst_translate_string2(&prop_value, NULL, NULL, prop_value,
1655
NULL, FALSE, pool, pool));
1444
1662
/* Open the filesystem */
1445
1663
SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
1447
/* If we are bypassing the hooks system, we just hit the filesystem
1449
SVN_ERR(svn_repos_fs_change_rev_prop4(
1665
if (opt_state->txn_id)
1667
svn_fs_t *fs = svn_repos_fs(repos);
1670
SVN_ERR(svn_fs_open_txn(&txn, fs, opt_state->txn_id, pool));
1671
SVN_ERR(svn_fs_change_txn_prop(txn, prop_name, prop_value, pool));
1674
SVN_ERR(svn_repos_fs_change_rev_prop4(
1450
1675
repos, opt_state->start_revision.value.number,
1451
1676
NULL, prop_name, NULL, prop_value,
1452
1677
opt_state->use_pre_revprop_change_hook,
1471
1696
filename = APR_ARRAY_IDX(args, 1, const char *);
1472
1697
SVN_ERR(target_arg_to_dirent(&filename, filename, pool));
1474
if (opt_state->start_revision.kind != svn_opt_revision_number)
1699
if (opt_state->txn_id)
1701
if (opt_state->start_revision.kind != svn_opt_revision_unspecified
1702
|| opt_state->end_revision.kind != svn_opt_revision_unspecified)
1703
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
1704
_("--revision (-r) and --transaction (-t) "
1705
"are mutually exclusive"));
1707
if (opt_state->use_pre_revprop_change_hook
1708
|| opt_state->use_post_revprop_change_hook)
1709
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
1710
_("Calling hooks is incompatible with "
1711
"--transaction (-t)"));
1713
else if (opt_state->start_revision.kind != svn_opt_revision_number)
1475
1714
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
1476
1715
_("Missing revision"));
1477
1716
else if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
1612
if (! opt_state->quiet)
1613
progress_stream = recode_stream_create(stderr, pool);
1615
return svn_repos_verify_fs2(repos, lower, upper,
1617
? repos_notify_handler : NULL,
1618
progress_stream, check_cancel, NULL, pool);
1852
if (!opt_state->quiet)
1853
feedback_stream = recode_stream_create(stdout, pool);
1855
verify_baton.keep_going = opt_state->keep_going;
1856
verify_baton.error_summary =
1857
apr_array_make(pool, 0, sizeof(struct verification_error *));
1858
verify_baton.result_pool = pool;
1860
SVN_ERR(svn_repos_verify_fs3(repos, lower, upper,
1861
opt_state->check_normalization,
1862
opt_state->metadata_only,
1864
? repos_notify_handler : NULL,
1866
repos_verify_callback, &verify_baton,
1867
check_cancel, NULL, pool));
1869
/* Show the --keep-going error summary. */
1870
if (!opt_state->quiet
1871
&& opt_state->keep_going
1872
&& verify_baton.error_summary->nelts > 0)
1875
svn_revnum_t end_revnum;
1876
apr_pool_t *iterpool;
1880
svn_stream_puts(feedback_stream,
1881
_("\n-----Summary of corrupt revisions-----\n")));
1883
/* The standard column width for the revision number is 6 characters.
1884
If the revision number can potentially be larger (i.e. if end_revnum
1885
is larger than 1000000), we increase the column width as needed. */
1887
end_revnum = APR_ARRAY_IDX(verify_baton.error_summary,
1888
verify_baton.error_summary->nelts - 1,
1889
struct verification_error *)->rev;
1890
while (end_revnum >= 1000000)
1893
end_revnum = end_revnum / 10;
1896
iterpool = svn_pool_create(pool);
1897
for (i = 0; i < verify_baton.error_summary->nelts; i++)
1899
struct verification_error *verr;
1901
const char *rev_str;
1903
svn_pool_clear(iterpool);
1905
verr = APR_ARRAY_IDX(verify_baton.error_summary, i,
1906
struct verification_error *);
1908
if (verr->rev != SVN_INVALID_REVNUM)
1910
rev_str = apr_psprintf(iterpool, "r%ld", verr->rev);
1911
rev_str = apr_psprintf(iterpool, "%*s", rev_maxlength, rev_str);
1912
for (err = svn_error_purge_tracing(verr->err);
1913
err != SVN_NO_ERROR; err = err->child)
1916
const char *message;
1918
message = svn_err_best_message(err, buf, sizeof(buf));
1919
svn_error_clear(svn_stream_printf(feedback_stream, iterpool,
1921
rev_str, err->apr_err,
1927
svn_pool_destroy(iterpool);
1930
if (verify_baton.error_summary->nelts > 0)
1932
return svn_error_createf(SVN_ERR_CL_REPOS_VERIFY_FAILED, NULL,
1933
_("Failed to verify repository '%s'"),
1934
svn_dirent_local_style(
1935
opt_state->repository_path, pool));
1938
return SVN_NO_ERROR;
1621
1941
/* This implements `svn_opt_subcommand_t'. */
1631
1952
new_repos_path = APR_ARRAY_IDX(targets, 0, const char *);
1632
1953
SVN_ERR(target_arg_to_dirent(&new_repos_path, new_repos_path, pool));
1634
return svn_repos_hotcopy2(opt_state->repository_path, new_repos_path,
1955
/* Progress feedback goes to STDOUT, unless they asked to suppress it. */
1956
if (! opt_state->quiet)
1957
feedback_stream = recode_stream_create(stdout, pool);
1959
return svn_repos_hotcopy3(opt_state->repository_path, new_repos_path,
1635
1960
opt_state->clean_logs, opt_state->incremental,
1636
check_cancel, NULL, pool);
1961
!opt_state->quiet ? repos_notify_handler : NULL,
1962
feedback_stream, check_cancel, NULL, pool);
1966
subcommand_info(apr_getopt_t *os, void *baton, apr_pool_t *pool)
1968
struct svnadmin_opt_state *opt_state = baton;
1974
/* Expect no more arguments. */
1975
SVN_ERR(parse_args(NULL, os, 0, 0, pool));
1977
SVN_ERR(open_repos(&repos, opt_state->repository_path, pool));
1978
fs = svn_repos_fs(repos);
1979
SVN_ERR(svn_cmdline_printf(pool, _("Path: %s\n"),
1980
svn_dirent_local_style(svn_repos_path(repos, pool),
1983
SVN_ERR(svn_fs_get_uuid(fs, &uuid, pool));
1984
SVN_ERR(svn_cmdline_printf(pool, _("UUID: %s\n"), uuid));
1986
int repos_format, minor;
1987
svn_version_t *repos_version, *fs_version;
1988
SVN_ERR(svn_repos_info_format(&repos_format, &repos_version,
1989
repos, pool, pool));
1990
SVN_ERR(svn_cmdline_printf(pool, _("Repository Format: %d\n"),
1993
SVN_ERR(svn_fs_info_format(&fs_format, &fs_version,
1995
/* fs_format will be printed later. */
1997
SVN_ERR_ASSERT(repos_version->major == SVN_VER_MAJOR);
1998
SVN_ERR_ASSERT(fs_version->major == SVN_VER_MAJOR);
1999
SVN_ERR_ASSERT(repos_version->patch == 0);
2000
SVN_ERR_ASSERT(fs_version->patch == 0);
2002
minor = (repos_version->minor > fs_version->minor)
2003
? repos_version->minor : fs_version->minor;
2004
SVN_ERR(svn_cmdline_printf(pool, _("Compatible With Version: %d.%d.0\n"),
2005
SVN_VER_MAJOR, minor));
2009
apr_hash_t *capabilities_set;
2010
apr_array_header_t *capabilities;
2013
SVN_ERR(svn_repos_capabilities(&capabilities_set, repos, pool, pool));
2014
capabilities = svn_sort__hash(capabilities_set,
2015
svn_sort_compare_items_lexically,
2018
for (i = 0; i < capabilities->nelts; i++)
2020
svn_sort__item_t *item = &APR_ARRAY_IDX(capabilities, i,
2022
const char *capability = item->key;
2023
SVN_ERR(svn_cmdline_printf(pool, _("Repository Capability: %s\n"),
2029
const svn_fs_info_placeholder_t *info;
2031
SVN_ERR(svn_fs_info(&info, fs, pool, pool));
2032
SVN_ERR(svn_cmdline_printf(pool, _("Filesystem Type: %s\n"),
2034
SVN_ERR(svn_cmdline_printf(pool, _("Filesystem Format: %d\n"),
2036
if (!strcmp(info->fs_type, SVN_FS_TYPE_FSFS))
2038
const svn_fs_fsfs_info_t *fsfs_info = (const void *)info;
2039
svn_revnum_t youngest;
2040
SVN_ERR(svn_fs_youngest_rev(&youngest, fs, pool));
2042
if (fsfs_info->shard_size)
2043
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Sharded: yes\n")));
2045
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Sharded: no\n")));
2047
if (fsfs_info->shard_size)
2048
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Shard Size: %d\n"),
2049
fsfs_info->shard_size));
2051
/* Print packing statistics, if enabled on the FS. */
2052
if (fsfs_info->shard_size)
2054
const int shard_size = fsfs_info->shard_size;
2055
const long shards_packed = fsfs_info->min_unpacked_rev / shard_size;
2056
const long shards_full = (youngest + 1) / shard_size;
2057
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Shards Packed: %ld/%ld\n"),
2058
shards_packed, shards_full));
2061
if (fsfs_info->log_addressing)
2062
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Logical Addressing: yes\n")));
2064
SVN_ERR(svn_cmdline_printf(pool, _("FSFS Logical Addressing: no\n")));
2069
apr_array_header_t *files;
2072
SVN_ERR(svn_fs_info_config_files(&files, fs, pool, pool));
2073
for (i = 0; i < files->nelts; i++)
2074
SVN_ERR(svn_cmdline_printf(pool, _("Configuration File: %s\n"),
2075
svn_dirent_local_style(
2076
APR_ARRAY_IDX(files, i, const char *),
2080
/* 'svn info' prints an extra newline here, to support multiple targets.
2081
We'll do the same. */
2082
SVN_ERR(svn_cmdline_printf(pool, "\n"));
2084
return SVN_NO_ERROR;
1639
2087
/* This implements `svn_opt_subcommand_t'. */
1729
2178
for (hi = apr_hash_first(pool, locks); hi; hi = apr_hash_next(hi))
1731
2180
const char *cr_date, *exp_date = "";
1732
const char *path = svn__apr_hash_index_key(hi);
1733
svn_lock_t *lock = svn__apr_hash_index_val(hi);
2181
const char *path = apr_hash_this_key(hi);
2182
svn_lock_t *lock = apr_hash_this_val(hi);
1734
2183
int comment_lines = 0;
1736
cr_date = svn_time_to_human_cstring(lock->creation_date, pool);
2185
svn_pool_clear(iterpool);
2187
SVN_ERR(check_cancel(NULL));
2189
cr_date = svn_time_to_human_cstring(lock->creation_date, iterpool);
1738
2191
if (lock->expiration_date)
1739
exp_date = svn_time_to_human_cstring(lock->expiration_date, pool);
2192
exp_date = svn_time_to_human_cstring(lock->expiration_date, iterpool);
1741
2194
if (lock->comment)
1742
2195
comment_lines = svn_cstring_count_newlines(lock->comment) + 1;
1744
SVN_ERR(svn_cmdline_printf(pool, _("Path: %s\n"), path));
1745
SVN_ERR(svn_cmdline_printf(pool, _("UUID Token: %s\n"), lock->token));
1746
SVN_ERR(svn_cmdline_printf(pool, _("Owner: %s\n"), lock->owner));
1747
SVN_ERR(svn_cmdline_printf(pool, _("Created: %s\n"), cr_date));
1748
SVN_ERR(svn_cmdline_printf(pool, _("Expires: %s\n"), exp_date));
1749
SVN_ERR(svn_cmdline_printf(pool,
2197
SVN_ERR(svn_cmdline_printf(iterpool, _("Path: %s\n"), path));
2198
SVN_ERR(svn_cmdline_printf(iterpool, _("UUID Token: %s\n"), lock->token));
2199
SVN_ERR(svn_cmdline_printf(iterpool, _("Owner: %s\n"), lock->owner));
2200
SVN_ERR(svn_cmdline_printf(iterpool, _("Created: %s\n"), cr_date));
2201
SVN_ERR(svn_cmdline_printf(iterpool, _("Expires: %s\n"), exp_date));
2202
SVN_ERR(svn_cmdline_printf(iterpool,
1750
2203
Q_("Comment (%i line):\n%s\n\n",
1751
2204
"Comment (%i lines):\n%s\n\n",
1752
2205
comment_lines),
2399
/* This implements `svn_opt_subcommand_t'. */
2400
static svn_error_t *
2401
subcommand_delrevprop(apr_getopt_t *os, void *baton, apr_pool_t *pool)
2403
struct svnadmin_opt_state *opt_state = baton;
2404
apr_array_header_t *args;
2405
const char *prop_name;
2407
/* Expect one more argument: NAME */
2408
SVN_ERR(parse_args(&args, os, 1, 1, pool));
2409
prop_name = APR_ARRAY_IDX(args, 0, const char *);
2411
if (opt_state->txn_id)
2413
if (opt_state->start_revision.kind != svn_opt_revision_unspecified
2414
|| opt_state->end_revision.kind != svn_opt_revision_unspecified)
2415
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2416
_("--revision (-r) and --transaction (-t) "
2417
"are mutually exclusive"));
2419
if (opt_state->use_pre_revprop_change_hook
2420
|| opt_state->use_post_revprop_change_hook)
2421
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2422
_("Calling hooks is incompatible with "
2423
"--transaction (-t)"));
2425
else if (opt_state->start_revision.kind != svn_opt_revision_number)
2426
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2427
_("Missing revision"));
2428
else if (opt_state->end_revision.kind != svn_opt_revision_unspecified)
2429
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2430
_("Only one revision allowed"));
2432
return set_revprop(prop_name, NULL, opt_state, pool);
1947
/* Report and clear the error ERR, and return EXIT_FAILURE. */
1948
#define EXIT_ERROR(err) \
1949
svn_cmdline_handle_exit_error(err, NULL, "svnadmin: ")
1951
/* A redefinition of the public SVN_INT_ERR macro, that suppresses the
1952
* error message if it is SVN_ERR_IO_PIPE_WRITE_ERROR, amd with the
1953
* program name 'svnadmin' instead of 'svn'. */
1955
#define SVN_INT_ERR(expr) \
1957
svn_error_t *svn_err__temp = (expr); \
1958
if (svn_err__temp) \
1959
return EXIT_ERROR(svn_err__temp); \
1963
sub_main(int argc, const char *argv[], apr_pool_t *pool)
2440
* On success, leave *EXIT_CODE untouched and return SVN_NO_ERROR. On error,
2441
* either return an error to be displayed, or set *EXIT_CODE to non-zero and
2442
* return SVN_NO_ERROR.
2444
static svn_error_t *
2445
sub_main(int *exit_code, int argc, const char *argv[], apr_pool_t *pool)
1965
2447
svn_error_t *err;
1966
2448
apr_status_t apr_err;
2021
2505
if (opt_state.start_revision.kind != svn_opt_revision_unspecified)
2023
err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2024
_("Multiple revision arguments encountered; "
2025
"try '-r N:M' instead of '-r N -r M'"));
2026
return EXIT_ERROR(err);
2507
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2508
_("Multiple revision arguments encountered; "
2509
"try '-r N:M' instead of '-r N -r M'"));
2028
2511
if (svn_opt_parse_revision(&(opt_state.start_revision),
2029
2512
&(opt_state.end_revision),
2030
2513
opt_arg, pool) != 0)
2032
err = svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg,
2515
SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
2036
err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2517
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2037
2518
_("Syntax error in revision argument '%s'"),
2039
return EXIT_ERROR(err);
2076
2556
opt_state.uuid_action = svn_repos_load_uuid_force;
2078
2558
case svnadmin__pre_1_4_compatible:
2079
opt_state.pre_1_4_compatible = TRUE;
2559
opt_state.compatible_version = apr_pcalloc(pool, sizeof(svn_version_t));
2560
opt_state.compatible_version->major = 1;
2561
opt_state.compatible_version->minor = 3;
2081
2563
case svnadmin__pre_1_5_compatible:
2082
opt_state.pre_1_5_compatible = TRUE;
2564
opt_state.compatible_version = apr_pcalloc(pool, sizeof(svn_version_t));
2565
opt_state.compatible_version->major = 1;
2566
opt_state.compatible_version->minor = 4;
2084
2568
case svnadmin__pre_1_6_compatible:
2085
opt_state.pre_1_6_compatible = TRUE;
2569
opt_state.compatible_version = apr_pcalloc(pool, sizeof(svn_version_t));
2570
opt_state.compatible_version->major = 1;
2571
opt_state.compatible_version->minor = 5;
2087
2573
case svnadmin__compatible_version:
2111
2596
compatible_version->minor,
2112
2597
compatible_version->patch))
2114
err = svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
2115
_("Cannot guarantee compatibility "
2116
"beyond the current running version "
2119
return EXIT_ERROR(err);
2599
return svn_error_createf(SVN_ERR_UNSUPPORTED_FEATURE, NULL,
2600
_("Cannot guarantee compatibility "
2601
"beyond the current running version "
2122
2606
opt_state.compatible_version = compatible_version;
2609
case svnadmin__keep_going:
2610
opt_state.keep_going = TRUE;
2612
case svnadmin__check_normalization:
2613
opt_state.check_normalization = TRUE;
2615
case svnadmin__metadata_only:
2616
opt_state.metadata_only = TRUE;
2125
2618
case svnadmin__fs_type:
2126
SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));
2619
SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.fs_type, opt_arg, pool));
2128
2621
case svnadmin__parent_dir:
2129
SVN_INT_ERR(svn_utf_cstring_to_utf8(&opt_state.parent_dir, opt_arg,
2622
SVN_ERR(svn_utf_cstring_to_utf8(&opt_state.parent_dir, opt_arg,
2131
2624
opt_state.parent_dir
2132
2625
= svn_dirent_internal_style(opt_state.parent_dir, pool);
2236
2735
if (os->ind >= os->argc)
2238
err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2239
_("Repository argument required"));
2240
return EXIT_ERROR(err);
2737
return svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2738
_("Repository argument required"));
2243
if ((err = svn_utf_cstring_to_utf8(&repos_path,
2244
os->argv[os->ind++], pool)))
2246
return EXIT_ERROR(err);
2741
SVN_ERR(svn_utf_cstring_to_utf8(&repos_path, os->argv[os->ind++], pool));
2249
2743
if (svn_path_is_url(repos_path))
2251
err = svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2252
_("'%s' is a URL when it should be a "
2253
"local path"), repos_path);
2254
return EXIT_ERROR(err);
2745
return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
2746
_("'%s' is a URL when it should be a "
2747
"local path"), repos_path);
2257
2750
opt_state.repository_path = svn_dirent_internal_style(repos_path, pool);