You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by ju...@apache.org on 2018/09/21 08:15:34 UTC
svn commit: r1841552 - in /subversion/branches/1.11.x: ./ STATUS
subversion/svn/cl.h subversion/svn/info-cmd.c subversion/svn/svn.c
Author: julianfoad
Date: Fri Sep 21 08:15:34 2018
New Revision: 1841552
URL: http://svn.apache.org/viewvc?rev=1841552&view=rev
Log:
Merge r1841272 from trunk:
* r1841272
'svn info --x-viewspec': Expose both output backends.
Justification:
Expose both output forms while the API is experimental to get better
feedback. (Or possibly just fall prey to the sunk cost fallacy.)
Depends: r1841098
Votes:
+1: danielsh, jamessan, julianfoad
Modified:
subversion/branches/1.11.x/ (props changed)
subversion/branches/1.11.x/STATUS
subversion/branches/1.11.x/subversion/svn/cl.h
subversion/branches/1.11.x/subversion/svn/info-cmd.c
subversion/branches/1.11.x/subversion/svn/svn.c
Propchange: subversion/branches/1.11.x/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Fri Sep 21 08:15:34 2018
@@ -99,4 +99,4 @@
/subversion/branches/verify-at-commit:1462039-1462408
/subversion/branches/verify-keep-going:1439280-1546110
/subversion/branches/wc-collate-path:1402685-1480384
-/subversion/trunk:1841098
+/subversion/trunk:1841098,1841272
Modified: subversion/branches/1.11.x/STATUS
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/STATUS?rev=1841552&r1=1841551&r2=1841552&view=diff
==============================================================================
--- subversion/branches/1.11.x/STATUS (original)
+++ subversion/branches/1.11.x/STATUS Fri Sep 21 08:15:34 2018
@@ -58,12 +58,3 @@ Veto-blocked changes:
Approved changes:
=================
-
- * r1841272
- 'svn info --x-viewspec': Expose both output backends.
- Justification:
- Expose both output forms while the API is experimental to get better
- feedback. (Or possibly just fall prey to the sunk cost fallacy.)
- Depends: r1841098
- Votes:
- +1: danielsh, jamessan, julianfoad
Modified: subversion/branches/1.11.x/subversion/svn/cl.h
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/subversion/svn/cl.h?rev=1841552&r1=1841551&r2=1841552&view=diff
==============================================================================
--- subversion/branches/1.11.x/subversion/svn/cl.h (original)
+++ subversion/branches/1.11.x/subversion/svn/cl.h Fri Sep 21 08:15:34 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/branches/1.11.x/subversion/svn/info-cmd.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/subversion/svn/info-cmd.c?rev=1841552&r1=1841551&r2=1841552&view=diff
==============================================================================
--- subversion/branches/1.11.x/subversion/svn/info-cmd.c (original)
+++ subversion/branches/1.11.x/subversion/svn/info-cmd.c Fri Sep 21 08:15:34 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/branches/1.11.x/subversion/svn/svn.c
URL: http://svn.apache.org/viewvc/subversion/branches/1.11.x/subversion/svn/svn.c?rev=1841552&r1=1841551&r2=1841552&view=diff
==============================================================================
--- subversion/branches/1.11.x/subversion/svn/svn.c (original)
+++ subversion/branches/1.11.x/subversion/svn/svn.c Fri Sep 21 08:15:34 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