You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/04/19 21:51:18 UTC
svn commit: r1095181 - in /subversion/trunk/subversion: svn/notify.c
svn/propdel-cmd.c tests/cmdline/prop_tests.py
Author: hwright
Date: Tue Apr 19 19:51:18 2011
New Revision: 1095181
URL: http://svn.apache.org/viewvc?rev=1095181&view=rev
Log:
Ah, the foibles of youth.
Two years ago, I committed r875310 which fixed issue #2220:
"'svn propdel' returns success on deleting a non-existent prop". It turns out
that my younger, less-experienced self was just making life hard for the
slightly more gray-haired and battle-hardened self I am today (no doubt caused
by code such as this).
So, in homage to the ever-continuing course of self-improvement (and in an
effort to over-use and even abuse the punctuation mark know as the hyphen), I
give you this revision, which simplifies, clarifies, and improve-ifies the
non-existent property deletion notification.
Just use the standard notification infrastructure to when we attempt to
delete a nonexistent property.
* subversion/tests/cmdline/prop_tests.py
(invalid_propnames, perms_on_symlink, delete_nonexistent_property):
Update test expectations.
* subversion/svn/propdel-cmd.c
(notify_wrapper_baton, notify_wrapper): Remove.
(svn_cl__propdel): Remove the notification wrappers and post-process check.
* subversion/svn/notify.c
(notify): Handle the svn_wc_notify_property_deleted_nonexistent case.
Modified:
subversion/trunk/subversion/svn/notify.c
subversion/trunk/subversion/svn/propdel-cmd.c
subversion/trunk/subversion/tests/cmdline/prop_tests.py
Modified: subversion/trunk/subversion/svn/notify.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/notify.c?rev=1095181&r1=1095180&r2=1095181&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/notify.c (original)
+++ subversion/trunk/subversion/svn/notify.c Tue Apr 19 19:51:18 2011
@@ -913,6 +913,15 @@ notify(void *baton, const svn_wc_notify_
goto print_error;
break;
+ case svn_wc_notify_property_deleted_nonexistent:
+ err = svn_cmdline_printf(pool,
+ _("Attempting to delete nonexistent "
+ "property '%s' on '%s'\n"), n->prop_name,
+ path_local);
+ if (err)
+ goto print_error;
+ break;
+
case svn_wc_notify_revprop_set:
err = svn_cmdline_printf(pool,
_("property '%s' set on repository revision %ld\n"),
Modified: subversion/trunk/subversion/svn/propdel-cmd.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/svn/propdel-cmd.c?rev=1095181&r1=1095180&r2=1095181&view=diff
==============================================================================
--- subversion/trunk/subversion/svn/propdel-cmd.c (original)
+++ subversion/trunk/subversion/svn/propdel-cmd.c Tue Apr 19 19:51:18 2011
@@ -41,25 +41,6 @@
/*** Code. ***/
-struct notify_wrapper_baton
-{
- void *real_baton;
- svn_wc_notify_func2_t real_func;
- svn_boolean_t found_deleted_nonexistent;
-};
-
-/* This checks for deleted_nonexistent before calling the notification function.
- This implements `svn_wc_notify_func2_t'. */
-static void
-notify_wrapper(void *baton, const svn_wc_notify_t *n, apr_pool_t *pool)
-{
- struct notify_wrapper_baton *nwb = baton;
-
- nwb->found_deleted_nonexistent |=
- (n->action == svn_wc_notify_property_deleted_nonexistent);
- nwb->real_func(nwb->real_baton, n, pool);
-}
-
/* This implements the `svn_opt_subcommand_t' interface. */
svn_error_t *
svn_cl__propdel(apr_getopt_t *os,
@@ -70,7 +51,6 @@ svn_cl__propdel(apr_getopt_t *os,
svn_client_ctx_t *ctx = ((svn_cl__cmd_baton_t *) baton)->ctx;
const char *pname, *pname_utf8;
apr_array_header_t *args, *targets;
- struct notify_wrapper_baton nwb = { 0 };
/* Get the property's name (and a UTF-8 version of that name). */
SVN_ERR(svn_opt_parse_num_args(&args, os, 1, pool));
@@ -87,15 +67,6 @@ svn_cl__propdel(apr_getopt_t *os,
/* Add "." if user passed 0 file arguments */
svn_opt_push_implicit_dot_target(targets, pool);
-
- if (! opt_state->quiet)
- {
- nwb.real_func = ctx->notify_func2;
- nwb.real_baton = ctx->notify_baton2;
- ctx->notify_func2 = notify_wrapper;
- ctx->notify_baton2 = &nwb;
- }
-
SVN_ERR(svn_cl__eat_peg_revisions(&targets, targets, pool));
if (opt_state->revprop) /* operate on a revprop */
@@ -147,10 +118,6 @@ svn_cl__propdel(apr_getopt_t *os,
SVN_ERR_UNVERSIONED_RESOURCE,
SVN_ERR_ENTRY_NOT_FOUND,
SVN_NO_ERROR));
- if (nwb.found_deleted_nonexistent)
- return svn_error_createf(SVN_ERR_CLIENT_PROPERTY_NAME, NULL,
- _("Attempting to delete nonexistent property '%s'"),
- pname);
}
svn_pool_destroy(subpool);
}
Modified: subversion/trunk/subversion/tests/cmdline/prop_tests.py
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/tests/cmdline/prop_tests.py?rev=1095181&r1=1095180&r2=1095181&view=diff
==============================================================================
--- subversion/trunk/subversion/tests/cmdline/prop_tests.py (original)
+++ subversion/trunk/subversion/tests/cmdline/prop_tests.py Tue Apr 19 19:51:18 2011
@@ -1439,9 +1439,9 @@ def invalid_propnames(sbox):
propname = chr(8)
propval = 'foo'
- expected_stderr = (".*Attempting to delete nonexistent property "
+ expected_stdout = (".*Attempting to delete nonexistent property "
"'%s'.*" % (propname,))
- svntest.actions.run_and_verify_svn(None, None, expected_stderr,
+ svntest.actions.run_and_verify_svn(None, expected_stdout, [],
'propdel', propname)
expected_stderr = (".*'%s' is not a valid Subversion"
' property name' % (propname,))
@@ -1484,9 +1484,9 @@ def perms_on_symlink(sbox):
old_mode = os.stat('newdir')[stat.ST_MODE]
# The only property on 'symlink' is svn:special, so attempting to remove
# 'svn:executable' should result in an error
- expected_stderr = (".*Attempting to delete nonexistent property "
+ expected_stdout = (".*Attempting to delete nonexistent property "
"'svn:executable'.*")
- svntest.actions.run_and_verify_svn(None, None, expected_stderr, 'propdel',
+ svntest.actions.run_and_verify_svn(None, expected_stdout, [], 'propdel',
'svn:executable', 'symlink')
new_mode = os.stat('newdir')[stat.ST_MODE]
if not old_mode == new_mode:
@@ -1711,8 +1711,8 @@ def delete_nonexistent_property(sbox):
wc_dir = sbox.wc_dir
# Remove one property
- expected_stderr = ".*Attempting to delete nonexistent property 'yellow'.*"
- svntest.actions.run_and_verify_svn(None, None, expected_stderr,
+ expected_stdout = ".*Attempting to delete nonexistent property 'yellow'.*"
+ svntest.actions.run_and_verify_svn(None, expected_stdout, [],
'propdel', 'yellow',
os.path.join(wc_dir, 'A', 'D', 'G'))
Re: svn commit: r1095181 - in /subversion/trunk/subversion:
svn/notify.c svn/propdel-cmd.c tests/cmdline/prop_tests.py
Posted by Daniel Shahaf <d....@daniel.shahaf.name>.
Coming back to this three weeks later: I wanted to understand what the
change was, and the first three paragraphs don't tell me that.
hwright@apache.org wrote on Tue, Apr 19, 2011 at 19:51:18 -0000:
> Author: hwright
> Date: Tue Apr 19 19:51:18 2011
> New Revision: 1095181
>
> URL: http://svn.apache.org/viewvc?rev=1095181&view=rev
> Log:
> Ah, the foibles of youth.
>
> Two years ago, I committed r875310 which fixed issue #2220:
> "'svn propdel' returns success on deleting a non-existent prop". It turns out
> that my younger, less-experienced self was just making life hard for the
> slightly more gray-haired and battle-hardened self I am today (no doubt caused
> by code such as this).
>
> So, in homage to the ever-continuing course of self-improvement (and in an
> effort to over-use and even abuse the punctuation mark know as the hyphen), I
> give you this revision, which simplifies, clarifies, and improve-ifies the
> non-existent property deletion notification.
>
> Just use the standard notification infrastructure to when we attempt to
> delete a nonexistent property.
>
> * subversion/tests/cmdline/prop_tests.py