Author: rhuijben
Date: Wed Dec 11 17:52:47 2013
New Revision: 1550206
URL: http://svn.apache.org/r1550206
Log:
Add support for walking externals to the api behind 'svn info', like how this
is implemented for 'svn status'.
* subversion/include/svn_client.h
(svn_client_info4): New function.
(svn_client_info3): Deprecate function.
* subversion/include/svn_wc.h
(svn_wc_notify_action_t): Add svn_wc_notify_info_external value.
* subversion/libsvn_client/deprecated.c
(svn_client_info3): New function.
* subversion/libsvn_client/info.c
(includes): Put in understandable order. Add svn_sorts.h.
(do_external_info): New function.
(svn_client_info3): Rename to ...
(svn_client_info4): ... this. Add argument. Handle externals for local info.
* subversion/svn/info-cmd.c
(svn_cl__info): Update caller.
* subversion/svn/notify.c
(notify): Add notification for svn_wc_notify_info_external.
* subversion/svn/svn.c
("info"): Support opt_include_externals.
Suggested by: schabi
Modified:
subversion/trunk/subversion/include/svn_client.h
subversion/trunk/subversion/include/svn_wc.h
subversion/trunk/subversion/libsvn_client/deprecated.c
subversion/trunk/subversion/libsvn_client/info.c
subversion/trunk/subversion/svn/info-cmd.c
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/svn/svn.c
Modified: subversion/trunk/subversion/include/svn_client.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_client.h?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_client.h (original)
+++ subversion/trunk/subversion/include/svn_client.h Wed Dec 11 17:52:47 2013
@@ -6265,6 +6265,9 @@ typedef svn_error_t *(*svn_client_info_r
* is TRUE also send nodes that don't exist as versioned but are still
* tree conflicted.
*
+ * If @a include_externals is @c TRUE, recurse into externals and report about
+ * them as well.
+ *
* @a changelists is an array of <tt>const char *</tt> changelist
* names, used as a restrictive filter on items whose info is
* reported; that is, don't report info about any item unless
@@ -6274,6 +6277,27 @@ typedef svn_error_t *(*svn_client_info_r
* @since New in 1.7.
*/
svn_error_t *
+svn_client_info4(const char *abspath_or_url,
+ const svn_opt_revision_t *peg_revision,
+ const svn_opt_revision_t *revision,
+ svn_depth_t depth,
+ svn_boolean_t fetch_excluded,
+ svn_boolean_t fetch_actual_only,
+ svn_boolean_t include_externals,
+ const apr_array_header_t *changelists,
+ svn_client_info_receiver2_t receiver,
+ void *receiver_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool);
+
+
+/** Similar to svn_client_info4, but doesn't support walking externals.
+ *
+ * @since New in 1.7.
+ * @deprecated Provided for backward compatibility with the 1.8 API.
+ */
+SVN_DEPRECATED
+svn_error_t *
svn_client_info3(const char *abspath_or_url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
Modified: subversion/trunk/subversion/include/svn_wc.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/include/svn_wc.h?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/include/svn_wc.h (original)
+++ subversion/trunk/subversion/include/svn_wc.h Wed Dec 11 17:52:47 2013
@@ -1264,7 +1264,11 @@ typedef enum svn_wc_notify_action_t
/** The operation failed because the operation (E.g. commit) is only valid
* if the operation includes this path.
* @since New in 1.9. */
- svn_wc_notify_failed_requires_target
+ svn_wc_notify_failed_requires_target,
+
+ /** Running info on an external module.
+ * @since New in 1.9. */
+ svn_wc_notify_info_external
} svn_wc_notify_action_t;
Modified: subversion/trunk/subversion/libsvn_client/deprecated.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/deprecated.c?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/deprecated.c (original)
+++ subversion/trunk/subversion/libsvn_client/deprecated.c Wed Dec 11 17:52:47
2013
@@ -2524,6 +2524,32 @@ svn_client_checkout(svn_revnum_t *result
/*** From info.c ***/
+svn_error_t *
+svn_client_info3(const char *abspath_or_url,
+ const svn_opt_revision_t *peg_revision,
+ const svn_opt_revision_t *revision,
+ svn_depth_t depth,
+ svn_boolean_t fetch_excluded,
+ svn_boolean_t fetch_actual_only,
+ const apr_array_header_t *changelists,
+ svn_client_info_receiver2_t receiver,
+ void *receiver_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *pool)
+{
+ return svn_error_trace(
+ svn_client_info4(abspath_or_url,
+ peg_revision,
+ revision,
+ depth,
+ fetch_excluded,
+ fetch_actual_only,
+ FALSE /* include_externals */,
+ changelists,
+ receiver, receiver_baton,
+ ctx, pool));
+}
+
svn_info_t *
svn_info_dup(const svn_info_t *info, apr_pool_t *pool)
{
Modified: subversion/trunk/subversion/libsvn_client/info.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_client/info.c?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_client/info.c (original)
+++ subversion/trunk/subversion/libsvn_client/info.c Wed Dec 11 17:52:47 2013
@@ -26,10 +26,11 @@
#include "svn_private_config.h"
#include "client.h"
#include "svn_client.h"
-#include "svn_pools.h"
#include "svn_dirent_uri.h"
-#include "svn_path.h"
#include "svn_hash.h"
+#include "svn_pools.h"
+#include "svn_sorts.h"
+
#include "svn_wc.h"
#include "private/svn_fspath.h"
@@ -57,6 +58,78 @@ svn_client_info2_dup(const svn_client_in
return new_info;
}
+/* Handle externals for svn_client_info4() */
+
+static svn_error_t *
+do_external_info(apr_hash_t *external_map,
+ svn_depth_t depth,
+ svn_boolean_t fetch_excluded,
+ svn_boolean_t fetch_actual_only,
+ const apr_array_header_t *changelists,
+ svn_client_info_receiver2_t receiver,
+ void *receiver_baton,
+ svn_client_ctx_t *ctx,
+ apr_pool_t *scratch_pool)
+{
+ apr_pool_t *iterpool = svn_pool_create(scratch_pool);
+ apr_array_header_t *externals;
+ int i;
+
+ externals = svn_sort__hash(external_map, svn_sort_compare_items_lexically,
+ scratch_pool);
+
+ /* Loop over the hash of new values (we don't care about the old
+ ones). This is a mapping of versioned directories to property
+ values. */
+ for (i = 0; i < externals->nelts; i++)
+ {
+ svn_node_kind_t external_kind;
+ svn_sort__item_t item = APR_ARRAY_IDX(externals, i, svn_sort__item_t);
+ const char *local_abspath = item.key;
+ const char *defining_abspath = item.value;
+ svn_opt_revision_t opt_rev;
+ svn_node_kind_t kind;
+
+ svn_pool_clear(iterpool);
+
+ /* Obtain information on the expected external. */
+ SVN_ERR(svn_wc__read_external_info(&external_kind, NULL, NULL, NULL,
+ &opt_rev.value.number,
+ ctx->wc_ctx, defining_abspath,
+ local_abspath, FALSE,
+ iterpool, iterpool));
+
+ if (external_kind != svn_node_dir)
+ continue;
+
+ SVN_ERR(svn_io_check_path(local_abspath, &kind, iterpool));
+ if (kind != svn_node_dir)
+ continue;
+
+ /* Tell the client we're starting an external info. */
+ if (ctx->notify_func2)
+ ctx->notify_func2(
+ ctx->notify_baton2,
+ svn_wc_create_notify(local_abspath,
+ svn_wc_notify_info_external,
+ iterpool), iterpool);
+
+ SVN_ERR(svn_client_info4(local_abspath,
+ NULL /* peg_revision */,
+ NULL /* revision */,
+ depth,
+ fetch_excluded,
+ fetch_actual_only,
+ TRUE /* include_externals */,
+ changelists,
+ receiver, receiver_baton,
+ ctx, iterpool));
+ }
+
+ svn_pool_destroy(iterpool);
+ return SVN_NO_ERROR;
+}
+
/* Set *INFO to a new info struct built from DIRENT
and (possibly NULL) svn_lock_t LOCK, all allocated in POOL.
Pointer fields are copied by reference, not dup'd. */
@@ -247,12 +320,13 @@ wc_info_receiver(void *baton,
}
svn_error_t *
-svn_client_info3(const char *abspath_or_url,
+svn_client_info4(const char *abspath_or_url,
const svn_opt_revision_t *peg_revision,
const svn_opt_revision_t *revision,
svn_depth_t depth,
svn_boolean_t fetch_excluded,
svn_boolean_t fetch_actual_only,
+ svn_boolean_t include_externals,
const apr_array_header_t *changelists,
svn_client_info_receiver2_t receiver,
void *receiver_baton,
@@ -281,11 +355,26 @@ svn_client_info3(const char *abspath_or_
b.client_receiver_func = receiver;
b.client_receiver_baton = receiver_baton;
- return svn_error_trace(
- svn_wc__get_info(ctx->wc_ctx, abspath_or_url, depth,
- fetch_excluded, fetch_actual_only, changelists,
- wc_info_receiver, &b,
- ctx->cancel_func, ctx->cancel_baton, pool));
+ SVN_ERR(svn_wc__get_info(ctx->wc_ctx, abspath_or_url, depth,
+ fetch_excluded, fetch_actual_only, changelists,
+ wc_info_receiver, &b,
+ ctx->cancel_func, ctx->cancel_baton, pool));
+
+ if (include_externals && SVN_DEPTH_IS_RECURSIVE(depth))
+ {
+ apr_hash_t *external_map;
+
+ SVN_ERR(svn_wc__externals_defined_below(&external_map,
+ ctx->wc_ctx, abspath_or_url,
+ pool, pool));
+
+ SVN_ERR(do_external_info(external_map,
+ depth, fetch_excluded, fetch_actual_only,
+ changelists,
+ receiver, receiver_baton, ctx, pool));
+ }
+
+ return SVN_NO_ERROR;
}
/* Go repository digging instead. */
Modified: subversion/trunk/subversion/svn/info-cmd.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/info-cmd.c?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/info-cmd.c (original)
+++ subversion/trunk/subversion/svn/info-cmd.c Wed Dec 11 17:52:47 2013
@@ -643,9 +643,12 @@ svn_cl__info(apr_getopt_t *os,
SVN_ERR(svn_dirent_get_absolute(&truepath, truepath, subpool));
}
- err = svn_client_info3(truepath,
+ err = svn_client_info4(truepath,
&peg_revision, &(opt_state->start_revision),
- opt_state->depth, TRUE, TRUE,
+ opt_state->depth,
+ TRUE /* fetch_excluded */,
+ TRUE /* fetch_actual_only */,
+ opt_state->include_externals,
opt_state->changelists,
receiver, (void *) path_prefix,
ctx, subpool);
Modified: subversion/trunk/subversion/svn/notify.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Wed Dec 11 17:52:47 2013
@@ -808,6 +808,13 @@ notify(void *baton, const svn_wc_notify_
goto print_error;
break;
+ case svn_wc_notify_info_external:
+ if ((err = svn_cmdline_printf(
+ pool, _("\nPerforming info on external item at '%s':\n"),
+ path_local)))
+ goto print_error;
+ break;
+
case svn_wc_notify_status_completed:
if (SVN_IS_VALID_REVNUM(n->revision))
if ((err = svn_cmdline_printf(pool,
Modified: subversion/trunk/subversion/svn/svn.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/svn.c?rev=1550206&r1=1550205&r2=1550206&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/svn.c (original)
+++ subversion/trunk/subversion/svn/svn.c Wed Dec 11 17:52:47 2013
@@ -660,7 +660,8 @@ const svn_opt_subcommand_desc2_t svn_cl_
" Print information about each TARGET (default: '.').\n"
" TARGET may be either a working-copy path or URL. If specified, REV\n"
" determines in which revision the target is first looked up.\n"),
- {'r', 'R', opt_depth, opt_targets, opt_incremental, opt_xml,
opt_changelist}
+ {'r', 'R', opt_depth, opt_targets, opt_incremental, opt_xml,
+ opt_changelist, opt_include_externals}
},
{ "list", svn_cl__list, {"ls"}, N_