[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

[PATCH] Fix for issue 3787

From: Noorul Islam K M <noorul_at_collab.net>
Date: Thu, 10 Mar 2011 16:49:32 +0530

From issue tracker
(http://subversion.tigris.org/issues/show_bug.cgi?id=3787)

It would be ever-so-helpful to folks looking to capture and replicate a working
copy sparse checkouts configuration if 'svn info -R' would show exclude items,
if only optionally, and even then if only just with minimal info:

   Path: some/excluded-path
   Depth: exclude

Today you cannot look at 'svn info -R' output and get a complete picture of what
is and isn't in the sparse configuration.
--------------------------------------------------------------------------------

I added new option "--show-exclude" to 'svn info' subcommand. When this
option is passed to info command along with '-R', it will include nodes
with depth 'exclude' also for displaying information. This issue is
related to 3792 which is already fixed.

Log

[[[

Fix for issue 3787. Make 'svn info' accept new option --show-exclude
along with recursive option (-R) and display minimal information about
nodes with depth exclude in the tree.

* subversion/svn/cl.h
  (svn_cl__opt_state_t): New show_exclude member.

* subversion/svn/main.c
  (svn_cl__longopt_t): Add opt_show_exclude member.
  (svn_cl__options): Document the show_exclude flag.
  (svn_cl__cmd_table): Accept show-exclude for info operations.
  (main): If given --show-exclude, set the option flag to TRUE. Display
    error message if '-R' is not passed along with --show-exclude.

* subversion/include/svn_client.h
  (svn_client_info3): Add new parameter.

* subversion/libsvn_client/deprecated.c
  (svn_client_info2): Pass FALSE as default argument for svn_client_info3.

* subversion/libsvn_client/info.c
  (crawl_entries): Add new parameter. Pass this new argument to
    svn_wc__node_walk_children.
  (svn_client_info3): Add new parameter. Pass this to crawl_entries.

* subversion/svn/info-cmd.c
  (svn_cl__info): Pass show_exclude option to svn_client_info3.

* subversion/tests/cmdline/depth_tests.py
  (info_show_exclude): New test.
  (test_list): Run it.

Patch by: Noorul Islam K M <noorul{_AT_}collab.net>
]]]

Thanks and Regards
Noorul

Index: subversion/tests/cmdline/depth_tests.py
===================================================================
--- subversion/tests/cmdline/depth_tests.py (revision 1080113)
+++ subversion/tests/cmdline/depth_tests.py (working copy)
@@ -2811,7 +2811,39 @@
                                         None, None, None, None, None, False,
                                         '--parents', omega_path)
 
+@Issue(3787)
+def info_show_exclude(sbox):
+ "tests 'info -R --show-exclude'"
 
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', A_path)
+
+ expected_info = [{
+ 'Path' : '.',
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+ }]
+
+ expected_info.append({
+ 'Path' : 'A',
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+ 'Depth' : 'exclude',
+ })
+
+ expected_info.append({
+ 'Path' : re.escape("iota"),
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : svntest.actions.get_wc_uuid(wc_dir),
+ })
+
+ os.chdir(wc_dir)
+ svntest.actions.run_and_verify_info(expected_info, '-R',
+ '--show-exclude')
+
 #----------------------------------------------------------------------
 # list all tests here, starting with None:
 test_list = [ None,
@@ -2858,6 +2890,7 @@
               update_excluded_path_sticky_depths,
               update_depth_empty_root_of_infinite_children,
               sparse_update_with_dash_dash_parents,
+ info_show_exclude,
               ]
 
 if __name__ == "__main__":
Index: subversion/svn/cl.h
===================================================================
--- subversion/svn/cl.h (revision 1080113)
+++ subversion/svn/cl.h (working copy)
@@ -230,6 +230,7 @@
   svn_boolean_t internal_diff; /* override diff_cmd in config file */
   svn_boolean_t use_git_diff_format; /* Use git's extended diff format */
   svn_boolean_t allow_mixed_rev; /* Allow operation on mixed-revision WC */
+ svn_boolean_t show_exclude; /* Show info of node with depth 'exclude' */
 } svn_cl__opt_state_t;
 
 
Index: subversion/svn/main.c
===================================================================
--- subversion/svn/main.c (revision 1080113)
+++ subversion/svn/main.c (working copy)
@@ -123,6 +123,7 @@
   opt_internal_diff,
   opt_use_git_diff_format,
   opt_allow_mixed_revisions,
+ opt_show_exclude,
 } svn_cl__longopt_t;
 
 
@@ -338,6 +339,8 @@
                        "Use of this option is not recommended!\n"
                        " "
                        "Please run 'svn update' instead.")},
+ {"show-exclude", opt_show_exclude, 0,
+ N_("Show nodes with depth exclude (but only with -R)")},
 
   /* Long-opt Aliases
    *
@@ -594,7 +597,8 @@
      " 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_show_exclude}
   },
 
   { "list", svn_cl__list, {"ls"}, N_
@@ -2024,6 +2028,9 @@
       case opt_allow_mixed_revisions:
         opt_state.allow_mixed_rev = TRUE;
         break;
+ case opt_show_exclude:
+ opt_state.show_exclude = TRUE;
+ break;
       default:
         /* Hmmm. Perhaps this would be a good place to squirrel away
            opts that commands like svn diff might need. Hmmm indeed. */
@@ -2436,6 +2443,16 @@
         }
     }
 
+ /* --show-exclude can only be used with -R */
+ if (opt_state.show_exclude &&
+ opt_state.depth != SVN_DEPTH_INFINITY_OR_FILES(TRUE))
+ {
+ err = svn_error_create(SVN_ERR_CL_ARG_PARSING_ERROR, NULL,
+ _("--show-exclude requires "
+ "-R"));
+ return svn_cmdline_handle_exit_error(err, pool, "svn: ");
+ }
+
   /* Update auto-props-enable option, and populate the MIME types map,
      for add/import commands */
   if (subcommand->cmd_func == svn_cl__add
Index: subversion/svn/info-cmd.c
===================================================================
--- subversion/svn/info-cmd.c (revision 1080113)
+++ subversion/svn/info-cmd.c (working copy)
@@ -564,7 +564,8 @@
       err = svn_client_info3(truepath,
                              &peg_revision, &(opt_state->start_revision),
                              receiver, (void *) path_prefix, opt_state->depth,
- opt_state->changelists, ctx, subpool);
+ opt_state->changelists, opt_state->show_exclude,
+ ctx, subpool);
 
       if (err)
         {
Index: subversion/include/svn_client.h
===================================================================
--- subversion/include/svn_client.h (revision 1080113)
+++ subversion/include/svn_client.h (working copy)
@@ -5262,6 +5262,8 @@
  * it's a member of one of those changelists. If @a changelists is
  * empty (or altogether @c NULL), no changelist filtering occurs.
  *
+ * @a show_exclude forces to show info of nodes with depth exclude.
+ *
  * @since New in 1.7.
  */
 svn_error_t *
@@ -5272,6 +5274,7 @@
                  void *receiver_baton,
                  svn_depth_t depth,
                  const apr_array_header_t *changelists,
+ svn_boolean_t show_exclude,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *scratch_pool);
 
Index: subversion/libsvn_client/deprecated.c
===================================================================
--- subversion/libsvn_client/deprecated.c (revision 1080113)
+++ subversion/libsvn_client/deprecated.c (working copy)
@@ -2038,6 +2038,7 @@
                            &rb,
                            depth,
                            changelists,
+ FALSE,
                            ctx,
                            pool));
 
Index: subversion/libsvn_client/info.c
===================================================================
--- subversion/libsvn_client/info.c (revision 1080113)
+++ subversion/libsvn_client/info.c (working copy)
@@ -403,6 +403,7 @@
               void *receiver_baton,
               svn_depth_t depth,
               apr_hash_t *changelist_hash,
+ svn_boolean_t show_exclude,
               svn_client_ctx_t *ctx,
               apr_pool_t *pool)
 {
@@ -414,7 +415,7 @@
   fe_baton.receiver_baton = receiver_baton;
   fe_baton.wc_ctx = ctx->wc_ctx;
 
- err = svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, FALSE,
+ err = svn_wc__node_walk_children(ctx->wc_ctx, local_abspath, show_exclude,
                                    info_found_node_callback, &fe_baton, depth,
                                    ctx->cancel_func, ctx->cancel_baton, pool);
 
@@ -505,6 +506,7 @@
                  void *receiver_baton,
                  svn_depth_t depth,
                  const apr_array_header_t *changelists,
+ svn_boolean_t show_exclude,
                  svn_client_ctx_t *ctx,
                  apr_pool_t *pool)
 {
@@ -537,7 +539,7 @@
 
       return svn_error_return(
         crawl_entries(abspath_or_url, receiver, receiver_baton,
- depth, changelist_hash, ctx, pool));
+ depth, changelist_hash, show_exclude, ctx, pool));
     }
 
   /* Go repository digging instead. */
Received on 2011-03-10 12:20:09 CET

This is an archived mail posted to the Subversion Dev mailing list.