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

Re: [PATCH] Re: [Issue 816] - Silent failure in svn log -r

From: Philip Martin <philip_at_codematters.co.uk>
Date: 2002-07-27 15:39:47 CEST

Kieran <kieran@esperi.demon.co.uk> writes:

> Third cut at the patch below :)

Could you include a log message please? See the HACKING file.

>
> Regards
>
> Kieran
>
>
> Index: subversion/libsvn_client/log.c
> ===================================================================
> --- subversion/libsvn_client/log.c
> +++ subversion/libsvn_client/log.c Sat Jul 27 00:53:27 2002
> @@ -62,9 +62,11 @@
> const char *URL;
> const char *base_name = NULL;
> apr_array_header_t *condensed_targets;
> - svn_revnum_t start_revnum, end_revnum;
> + svn_revnum_t start_revnum, end_revnum, head_revnum;
> svn_error_t *err;
> + svn_client_revision_t head;
>
> + head.kind = svn_client_revision_head;
> if ((start->kind == svn_client_revision_unspecified)
> || (end->kind == svn_client_revision_unspecified))
> {
> @@ -73,7 +75,7 @@
> "svn_client_log: caller failed to supply revision");
> }
>
> - start_revnum = end_revnum = SVN_INVALID_REVNUM;
> + start_revnum = end_revnum = head_revnum = SVN_INVALID_REVNUM;
>
> path = (APR_ARRAY_IDX(targets, 0, const char *));
>
> @@ -151,7 +153,60 @@
> (&start_revnum, ra_lib, session, start, base_name, pool));
> SVN_ERR (svn_client__get_revision_number
> (&end_revnum, ra_lib, session, end, base_name, pool));
> + SVN_ERR (svn_client__get_revision_number
> + (&head_revnum, ra_lib, session, &head, base_name, pool));
> +
> + /* Here, we check that the versions input were valid. If not, we
> + return an error */
> + if (start_revnum > head_revnum && end_revnum > head_revnum)
> + {
> + err = svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, 0, NULL,
> pool,

Something (your mail client?) is wrapping lines. Can you fix it, and
if not then send the patch as an attachment.

> + "Both revision numbers too high: %"
> SVN_REVNUM_T_FMT
> + " and %" SVN_REVNUM_T_FMT ". Head is %"
> + SVN_REVNUM_T_FMT ".",
> + start_revnum, end_revnum, head_revnum);
> + return err;
> + }
> +
> + if (start_revnum > head_revnum || end_revnum > head_revnum)
> + {
> + err = svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, 0, NULL,
> pool,
> + "Revision number too high: %"
> SVN_REVNUM_T_FMT
> + ". Head is %" SVN_REVNUM_T_FMT ".",
> + (start_revnum>end_revnum)?
> start_revnum:end_revnum,
> + head_revnum);
> + return err;
> + }
>
> + if (start_revnum < 0 && end_revnum < 0)
> + {
> + err = svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, 0, NULL,
> pool,
> + "Both revision numbers are negative: %"
> SVN_REVNUM_T_FMT
> + " and %" SVN_REVNUM_T_FMT ". Negative
> revision number are not allowed.",
> + start_revnum, end_revnum);
> + return err;
> + }
> +
> + if (start_revnum < 0 || end_revnum < 0)
> + {
> + err = svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, 0, NULL,
> pool,
> + "Revision number negative: %"
> SVN_REVNUM_T_FMT
> + ". Negative revision numbers are not
> allowed.",
> + (start_revnum<end_revnum)?
> start_revnum:end_revnum);
> + return err;
> + }
> +
> +
> + /* Previous to this change, "svn log -r x:x" exitted silently. It
> will now give
> + diagnostic. */

No need to describe what the code used to do :-) This comment doesn't
really make sense when one is just looking at the complete file.

I've now looked at issue 816. I don't see why you think start==end
should be an error. Printing the log message for the single revision
looks like the right thing to do, so I'd just drop this bit.

> + if (start_revnum == end_revnum)
> + {
> + err = svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, 0, NULL,
> pool,
> + "Revision numbers cannot match: %"
> SVN_REVNUM_T_FMT
> + ", %" SVN_REVNUM_T_FMT ". Exitting",
> + start_revnum, end_revnum);
> + return err;
> + }
> err = ra_lib->get_log (session,
> condensed_targets,
> start_revnum,
> Index: subversion/include/svn_client.h
> ===================================================================
> --- subversion/include/svn_client.h
> +++ subversion/include/svn_client.h Sat Jul 27 00:45:29 2002
> @@ -556,6 +556,17 @@
> If START->kind or END->kind is svn_client_revision_unspecified,
> return the error SVN_ERR_CLIENT_BAD_REVISION.
>
> + If the version number returned after canonicalising either START or
> + FINISH is greater than that of head, return the error
> + SVN_ERR_CLIENT_BAD_REVISION
> +
> + If the version number returned after canonicalising either START or
> + FINISH is negative, return the error SVN_ERR_CLIENT_BAD_REVISION
> +
> +
> + If the version numbers returned from canonicalising START and FINISH
> + are equal, return SVN_ERR_CLIENT_BAD_REVISION
> +
> Use POOL for any temporary allocation.
>
> Special case for repositories at revision 0:
>
>

-- 
Philip Martin
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Sat Jul 27 15:40:20 2002

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.