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

Re: [PATCH] Fix for issue 3787

From: Noorul Islam K M <noorul_at_collab.net>
Date: Tue, 05 Jul 2011 10:57:04 +0530

Noorul Islam K M <noorul_at_collab.net> writes:

> "Bert Huijben" <bert_at_qqmail.nl> writes:
>
>>> -----Original Message-----
>>> From: Noorul Islam K M [mailto:noorul_at_collab.net]
>>> Sent: maandag 4 juli 2011 18:05
>>> To: Daniel Shahaf
>>> Cc: Subversion
>>> Subject: Re: [PATCH] Fix for issue 3787
>>
>>> [[[
>>>
>>> Fix for issue 3787. Make 'svn info --depth' variants display minimal
>>> information about nodes with depth exclude in the tree.
>>>
>>> * subversion/libsvn_client/info.c
>>> (crawl_entries): Pass TRUE to svn_wc__node_walk_children() as
>>> show_hidden parameter value.
>>>
>>> * 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>
>>>
>>> ]]]
>>
>> (Please look in your irc log. We talked about this on IRC before)
>>
>> This simple fix makes that the code also gets not-present and server
>> excluded nodes. But the info api (and the output) don't handle these cases.
>>
>> Switching the 'show hidden' flag requires more work in the callback to hide
>> all unexpected hidden kinds.
>>
>> Bert
>
> In those cases build_info_for_entry() is throwing error. Is that not
> good enough?
>
> <code>
> else if (status == svn_wc__db_status_not_present
> || status == svn_wc__db_status_server_excluded)
> {
> return svn_error_createf(SVN_ERR_WC_PATH_NOT_FOUND, NULL,
> _("The node '%s' was not found."),
> svn_dirent_local_style(local_abspath,
> scratch_pool));
> }
> </code>
>

I updated the patch to filter out nodes with status
svn_wc__db_status_not_present and svn_wc__db_status_server_excluded in
the callback function itself.

Log

[[[

Fix for issue 3787. Make 'svn info --depth' variants display minimal
information about nodes with depth exclude in the tree.

* subversion/libsvn_client/info.c
  (crawl_entries): Pass TRUE to svn_wc__node_walk_children() as
    show_hidden parameter value.
  (info_found_node_callback): Filter out nodes with status
    svn_wc__db_status_not_present and svn_wc__db_status_server_excluded.

* 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 1142624)
+++ subversion/tests/cmdline/depth_tests.py (working copy)
@@ -2815,7 +2815,50 @@
                                         None, None, None, None, None, False,
                                         '--parents', omega_path)
 
+@Issue(3787)
+def info_show_exclude(sbox):
+ "tests 'info --depth' variants on excluded node"
 
+ sbox.build()
+ wc_dir = sbox.wc_dir
+
+ A_path = os.path.join(wc_dir, 'A')
+ iota = os.path.join(wc_dir, 'iota')
+ svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', A_path)
+ wc_uuid = svntest.actions.get_wc_uuid(wc_dir)
+
+ expected_info = []
+ expected_info = [{
+ 'Path' : '.',
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
+ }]
+
+ svntest.actions.run_and_verify_info(expected_info, '--depth', 'empty',
+ wc_dir)
+
+ expected_info = [{
+ 'Path' : 'A',
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
+ 'Depth' : 'exclude',
+ }]
+
+ svntest.actions.run_and_verify_info(expected_info, '--depth',
+ 'empty', A_path)
+ svntest.actions.run_and_verify_info(expected_info, '--depth',
+ 'infinity', A_path)
+ svntest.actions.run_and_verify_info(expected_info, '--depth',
+ 'immediates', A_path)
+
+ expected_info = [{
+ 'Path' : re.escape("iota"),
+ 'Repository Root' : sbox.repo_url,
+ 'Repository UUID' : wc_uuid,
+ }]
+ svntest.main.run_svn(None, 'up', '--set-depth', 'exclude', iota)
+ svntest.actions.run_and_verify_info(expected_info, '--depth', 'files', iota)
+
 #----------------------------------------------------------------------
 # list all tests here, starting with None:
 test_list = [ None,
@@ -2862,6 +2905,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/libsvn_wc/info.c
===================================================================
--- subversion/libsvn_wc/info.c (revision 1142624)
+++ subversion/libsvn_wc/info.c (working copy)
@@ -332,7 +332,25 @@
 {
   struct found_entry_baton *fe_baton = walk_baton;
   svn_wc__info2_t *info;
+ svn_wc__db_status_t status;
 
+ /* We are passing TRUE as value to show_hidden parameter of function
+ * svn_wc__internal_walk_children(). This will make this callback
+ * function to be called for nodes with status
+ * svn_wc__db_status_excluded, svn_wc__db_status_not_present and
+ * svn_wc__db_status_server_excluded. Since we need only excluded
+ * nodes, filter out others.
+ */
+ SVN_ERR(svn_wc__db_read_info(&status, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
+ fe_baton->db, local_abspath, pool, pool));
+
+ if (status == svn_wc__db_status_not_present
+ || status == svn_wc__db_status_server_excluded)
+ return SVN_NO_ERROR;
+
   SVN_ERR(build_info_for_entry(&info, fe_baton->db, local_abspath,
                                kind, pool, pool));
 
@@ -424,7 +442,7 @@
     }
 
   err = svn_wc__internal_walk_children(wc_ctx->db, local_abspath,
- FALSE /* show_hidden */,
+ TRUE /* show_hidden */,
                                        changelist_filter,
                                        info_found_node_callback,
                                        &fe_baton, depth,
Received on 2011-07-05 07:29:32 CEST

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

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.