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

Re: [trunk/merge tracking] Merge test #17

From: Daniel Rall <dlr_at_collab.net>
Date: 2006-09-25 21:28:22 CEST

On Fri, 22 Sep 2006, Daniel Rall wrote:
...
> Add a generic error handler to routine to the WC walker API, adding
> the ability to modify or squelch errors which occur while walking the
> WC tree.

I committed this change to trunk in r21628.

...
> On the merge-tracking branch: Ignore missing paths when collecting the
> values for a property.

I ported the previous change to the branch, then committed this change
to the branch in r21629.

...
> * subversion/libsvn_client/prop_commands.c
> (wc_walker_error_handler): Add error handler to squelch ERR by
> returning SVN_NO_ERROR if ERR is casued by a missing path.
...
> I'd follow these two patches up by adding some type of error chain
> interrogation API to trunk to cleanup the FIXME in
> wc_walker_error_handler(). Alternately, we could just call
> svn_io_check_path() (along the lines of the patch I posted in the
> previous message in this thread).

Does this seem unreasonable to anyone?

Index: subversion/include/svn_error.h
===================================================================
--- subversion/include/svn_error.h (revision 21630)
+++ subversion/include/svn_error.h (working copy)
@@ -148,6 +148,13 @@
  */
 void svn_error_compose(svn_error_t *chain, svn_error_t *new_err);
 
+/** Return whether @a apr_err exists as a cause of an error in @a
+ * err's chain (e.g. it or its children).
+ *
+ * @since New in 1.5.
+ */
+svn_boolean_t svn_error_chain_contains(svn_error_t *err, apr_status_t apr_err);
+
 /** Create a new error that is a deep copy of @a err and return it.
  *
  * @since New in 1.2.
Index: subversion/libsvn_subr/error.c
===================================================================
--- subversion/libsvn_subr/error.c (revision 21630)
+++ subversion/libsvn_subr/error.c (working copy)
@@ -226,6 +226,20 @@
   apr_pool_destroy(oldpool);
 }
 
+svn_boolean_t
+svn_error_chain_contains(svn_error_t *err, apr_status_t apr_err)
+{
+ while (err)
+ {
+ if (err->apr_err == apr_err)
+ return TRUE;
+
+ err = err->child;
+ }
+
+ return FALSE;
+}
+
 svn_error_t *
 svn_error_dup(svn_error_t *err)
 {
Index: subversion/libsvn_client/prop_commands.c
===================================================================
--- subversion/libsvn_client/prop_commands.c (revision 21630)
+++ subversion/libsvn_client/prop_commands.c (working copy)
@@ -25,6 +25,7 @@
 #define APR_WANT_STRFUNC
 #include <apr_want.h>
 
+#include "svn_error.h"
 #include "svn_client.h"
 #include "client.h"
 #include "svn_path.h"
@@ -597,16 +598,9 @@
                         void *walk_baton,
                         apr_pool_t *pool)
 {
- if (err)
- {
- /* Suppress errors from missing paths. */
- /* ### FIXME: Knowing where this check occurs in the error chain
- ### violates proper encapsulation. */
- if (!err->child || err->child->apr_err != SVN_ERR_WC_PATH_NOT_FOUND)
- return err;
- }
-
- return SVN_NO_ERROR;
+ /* Suppress errors from missing paths. */
+ return (svn_error_chain_contains(err, SVN_ERR_WC_PATH_NOT_FOUND) ?
+ SVN_NO_ERROR : err);
 }
 
 svn_error_t *

  • application/pgp-signature attachment: stored
Received on Mon Sep 25 21:29:49 2006

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.