You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2018/09/18 22:49:10 UTC
svn commit: r1841272 - in /subversion/trunk/subversion/svn: cl.h info-cmd.c
svn.c
Author: danielsh
Date: Tue Sep 18 22:49:10 2018
New Revision: 1841272
URL: http://svn.apache.org/viewvc?rev=1841272&view=rev
Log:
'svn info --x-viewspec': Expose both output backends.
* subversion/svn/cl.h
(svn_cl__opt_state_t::viewspec): Change from boolean to three-valued enum.
* subversion/svn/svn.c
(svn_cl__options."x-viewspec": Update arity and docstring.
(viewspec_from_word): New.
(sub_main): Parse new argument.
* subversion/svn/info-cmd.c
(cl_layout_list): Update signature. Add docstring.
(svn_cl__info): Percolate new argument.
Modified:
subversion/trunk/subversion/svn/cl.h
subversion/trunk/subversion/svn/info-cmd.c
subversion/trunk/subversion/svn/svn.c
Modified: subversion/trunk/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/cl.h?rev=1841272&r1=1841271&r2=1841272&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/cl.h (original)
+++ subversion/trunk/subversion/svn/cl.h Tue Sep 18 22:49:10 2018
@@ -257,7 +257,11 @@ typedef struct svn_cl__opt_state_t
svn_boolean_t adds_as_modification; /* update 'add vs add' no tree conflict */
svn_boolean_t vacuum_pristines; /* remove unreferenced pristines */
svn_boolean_t drop; /* drop shelf after successful unshelve */
- svn_boolean_t viewspec;
+ enum svn_cl__viewspec_t {
+ svn_cl__viewspec_unspecified = 0 /* default */,
+ svn_cl__viewspec_classic,
+ svn_cl__viewspec_svn11
+ } viewspec; /* value of --x-viewspec */
} svn_cl__opt_state_t;
/* Conflict stats for operations such as update and merge. */
Modified: subversion/trunk/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1841272&r1=1841271&r2=1841272&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Tue Sep 18 22:49:10 2018
@@ -242,8 +242,13 @@ output_svn_viewspec_py(void *layout_bato
return SVN_NO_ERROR;
}
+/*
+ * Call svn_client_layout_list(), using a receiver function decided
+ * by VIEWSPEC.
+ */
static svn_error_t *
cl_layout_list(apr_array_header_t *targets,
+ enum svn_cl__viewspec_t viewspec,
void *baton,
svn_client_ctx_t *ctx,
apr_pool_t *scratch_pool)
@@ -269,22 +274,26 @@ cl_layout_list(apr_array_header_t *targe
llb.target_abspath = list_abspath;
llb.with_revs = TRUE;
- if (TRUE)
+ switch (viewspec)
{
+ case svn_cl__viewspec_classic:
/* svn-viewspec.py format */
llb.vs_py_format = 2;
SVN_ERR(svn_client_layout_list(list_abspath,
output_svn_viewspec_py, &llb,
ctx, scratch_pool));
- }
- else
- {
+ break;
+ case svn_cl__viewspec_svn11:
/* svn command-line format */
SVN_ERR(svn_client_layout_list(list_abspath,
output_svn_command_line, &llb,
ctx, scratch_pool));
+ break;
+ default:
+ SVN_ERR_MALFUNCTION();
}
+
return SVN_NO_ERROR;
}
@@ -1181,7 +1190,7 @@ svn_cl__info(apr_getopt_t *os,
if (opt_state->viewspec)
{
- SVN_ERR(cl_layout_list(targets, baton, ctx, pool));
+ SVN_ERR(cl_layout_list(targets, opt_state->viewspec, baton, ctx, pool));
return SVN_NO_ERROR;
}
Modified: subversion/trunk/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1841272&r1=1841271&r2=1841272&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Tue Sep 18 22:49:10 2018
@@ -480,8 +480,10 @@ const apr_getopt_option_t svn_cl__option
{"drop", opt_drop, 0,
N_("drop shelf after successful unshelve")},
- {"x-viewspec", opt_viewspec, 0,
- N_("print the working copy layout")},
+ {"x-viewspec", opt_viewspec, 1,
+ N_("print the working copy layout, formatted according\n"
+ " "
+ "to ARG: 'classic' or 'svn11'")},
/* Long-opt Aliases
*
@@ -2160,6 +2162,22 @@ add_search_pattern_to_latest_group(svn_c
APR_ARRAY_PUSH(group, const char *) = pattern;
}
+/* Parse the argument to the --x-viewspec option. */
+static svn_error_t *
+viewspec_from_word(enum svn_cl__viewspec_t *viewspec,
+ const char *utf8_opt_arg)
+{
+ if (!strcmp(utf8_opt_arg, "classic"))
+ *viewspec = svn_cl__viewspec_classic;
+ else if (!strcmp(utf8_opt_arg, "svn11"))
+ *viewspec = svn_cl__viewspec_svn11;
+ else
+ return svn_error_createf(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("'%s' is not a valid --x-viewspec value"),
+ utf8_opt_arg);
+ return SVN_NO_ERROR;
+}
+
/*** Main. ***/
@@ -2769,6 +2787,8 @@ sub_main(int *exit_code, int argc, const
break;
case opt_viewspec:
opt_state.viewspec = TRUE;
+ SVN_ERR(svn_utf_cstring_to_utf8(&utf8_opt_arg, opt_arg, pool));
+ SVN_ERR(viewspec_from_word(&opt_state.viewspec, utf8_opt_arg));
break;
default:
/* Hmmm. Perhaps this would be a good place to squirrel away