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

Re: [PATCH] fix svn cat to skip unversioned items V3.

From: Peter N. Lundblad <peter_at_famlundblad.se>
Date: 2005-05-31 08:27:27 CEST

On Mon, 30 May 2005 kfogel@collab.net wrote:

> <vivek@collab.net> writes:
> > Index: subversion/clients/cmdline/cat-cmd.c
> > ===================================================================
> > --- subversion/clients/cmdline/cat-cmd.c (revision 14823)
> > +++ subversion/clients/cmdline/cat-cmd.c (working copy)
> > @@ -42,6 +42,7 @@
> > int i;
> > svn_stream_t *out;
> > apr_pool_t *subpool = svn_pool_create (pool);
> > + svn_error_t *err;
> >
> > SVN_ERR (svn_opt_args_to_target_array2 (&targets, os,
> > opt_state->targets, pool));
> > @@ -65,9 +66,22 @@
> > SVN_ERR (svn_opt_parse_path (&peg_revision, &truepath, target,
> > subpool));
> >
> > - SVN_ERR (svn_client_cat2 (out, truepath, &peg_revision,
> > - &(opt_state->start_revision),
> > - ctx, subpool));
> > + err = svn_client_cat2 (out, truepath, &peg_revision,
> > + &(opt_state->start_revision),
> > + ctx, subpool);
> > + if (err)
> > + {
> > + if ((err->apr_err == SVN_ERR_ENTRY_NOT_FOUND)
> > + || (err->apr_err == SVN_ERR_UNVERSIONED_RESOURCE)
> > + || (err->apr_err == SVN_ERR_CLIENT_IS_DIRECTORY))
> > + {
> > + svn_handle_warning (stderr, err);
> > + svn_error_clear (err);
> > + continue;
> > + }
> > + else
> > + return err;
> > + }
> > }
>
> (If I could think of some way to make SVN_CL__TRY take an arbitrary
> number of errors to test for, that would be perfect. But variadic
> macros weren't added to C until C99, and even then they don't do quite
> what we'd need. Oh well.)
>
We could always supply an array of extra errors to accept. Maybe the
avoidance of code duplication is worth it.

> Don't forget to check opt_state->quiet before calling
> svn_handle_warning(). We don't want to emit warnings if the user
> specified --quiet on the command line.
>
Ha, that's my fault. I adviced against that since cat doesn't accept
--quiet. Maybe we want to add --quiet to cat for this case.

Regards,
//Peter

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue May 31 08:17:57 2005

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