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

Re: svn commit: r27323 - trunk/subversion/libsvn_client

From: David Glasser <glasser_at_davidglasser.net>
Date: 2007-10-23 20:12:35 CEST

On 10/23/07, cmpilato@tigris.org <cmpilato@tigris.org> wrote:
> Author: cmpilato
> Date: Tue Oct 23 07:43:13 2007
> New Revision: 27323
>
> Log:
> * subversion/libsvn_client/revisions.c
> (svn_client__get_revision_number): Rework this as a switch statement.
>
>
>
> Modified:
> trunk/subversion/libsvn_client/revisions.c
>
> Modified: trunk/subversion/libsvn_client/revisions.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_client/revisions.c?pathrev=27323&r1=27322&r2=27323
> ==============================================================================
> --- trunk/subversion/libsvn_client/revisions.c (original)
> +++ trunk/subversion/libsvn_client/revisions.c Tue Oct 23 07:43:13 2007
> @@ -38,71 +38,81 @@
> const char *path,
> apr_pool_t *pool)
> {
> - /* ### When revision->kind == svn_opt_revision_date, is there an
> - optimization such that we can compare revision->value->date with
> - the committed-date in the entries file (or rather, with some
> - range of which committed-date is one endpoint), and sometimes
> - avoid a trip over the RA layer? The only optimizations I can
> - think of involve examining other entries to build a timespan
> - across which committed-revision is known to be the head, but it
> - doesn't seem worth it. -kff */
> -
> - /* Sanity check. */
> - if (ra_session == NULL
> - && ((revision->kind == svn_opt_revision_date)
> - || (revision->kind == svn_opt_revision_head)))
> + switch (revision->kind)
> {
> - return svn_error_create
> - (SVN_ERR_CLIENT_RA_ACCESS_REQUIRED, NULL, NULL);
> + case svn_opt_revision_unspecified:
> + *revnum = SVN_INVALID_REVNUM;
> + break;
> +
> + case svn_opt_revision_number:
> + *revnum = revision->value.number;
> + break;
> +
> + case svn_opt_revision_head:
> + if (! ra_session)
> + return svn_error_create(SVN_ERR_CLIENT_RA_ACCESS_REQUIRED, NULL, NULL);
> + SVN_ERR(svn_ra_get_latest_revnum(ra_session, revnum, pool));
> + break;
> +
> + case svn_opt_revision_committed:
> + case svn_opt_revision_working:
> + case svn_opt_revision_base:
> + case svn_opt_revision_previous:
> + {
> + svn_wc_adm_access_t *adm_access; /* ### FIXME local */

Did you meant to leave that in?

> + const svn_wc_entry_t *ent;
> +
> + /* Sanity check. */
> + if (path == NULL)
> + return svn_error_create(SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED,
> + NULL, NULL);
> +
> + SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, path, FALSE,
> + 0, NULL, NULL, pool));
> + SVN_ERR(svn_wc__entry_versioned(&ent, path, adm_access, FALSE, pool));
> + SVN_ERR(svn_wc_adm_close(adm_access));
> +
> + if ((revision->kind == svn_opt_revision_base)
> + || (revision->kind == svn_opt_revision_working))
> + {
> + *revnum = ent->revision;
> + }
> + else
> + {
> + if (! SVN_IS_VALID_REVNUM(ent->cmt_rev))
> + return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,
> + _("Path '%s' has no committed "
> + "revision"), path);
> + *revnum = ent->cmt_rev;
> + if (revision->kind == svn_opt_revision_previous)
> + (*revnum)--;
> + }
> + }
> + break;
> +
> + case svn_opt_revision_date:
> + /* ### When revision->kind == svn_opt_revision_date, is there an
> + ### optimization such that we can compare
> + ### revision->value->date with the committed-date in the
> + ### entries file (or rather, with some range of which
> + ### committed-date is one endpoint), and sometimes avoid a
> + ### trip over the RA layer? The only optimizations I can
> + ### think of involve examining other entries to build a
> + ### timespan across which committed-revision is known to be
> + ### the head, but it doesn't seem worth it. -kff */
> + if (! ra_session)
> + return svn_error_create(SVN_ERR_CLIENT_RA_ACCESS_REQUIRED, NULL, NULL);
> + SVN_ERR(svn_ra_get_dated_revision(ra_session, revnum,
> + revision->value.date, pool));
> + break;
> +
> + default:
> + return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,
> + _("Unrecognized revision type requested for "
> + "'%s'"),
> + svn_path_local_style(path, pool));
> }
> -
> - if (revision->kind == svn_opt_revision_number)
> - *revnum = revision->value.number;
> - else if (revision->kind == svn_opt_revision_date)
> - SVN_ERR(svn_ra_get_dated_revision(ra_session, revnum,
> - revision->value.date, pool));
> - else if (revision->kind == svn_opt_revision_head)
> - SVN_ERR(svn_ra_get_latest_revnum(ra_session, revnum, pool));
> - else if (revision->kind == svn_opt_revision_unspecified)
> - *revnum = SVN_INVALID_REVNUM;
> - else if ((revision->kind == svn_opt_revision_committed)
> - || (revision->kind == svn_opt_revision_working)
> - || (revision->kind == svn_opt_revision_base)
> - || (revision->kind == svn_opt_revision_previous))
> - {
> - svn_wc_adm_access_t *adm_access; /* ### FIXME local */
> - const svn_wc_entry_t *ent;
> -
> - /* Sanity check. */
> - if (path == NULL)
> - return svn_error_create
> - (SVN_ERR_CLIENT_VERSIONED_PATH_REQUIRED, NULL, NULL);
> -
> - SVN_ERR(svn_wc_adm_probe_open3(&adm_access, NULL, path, FALSE,
> - 0, NULL, NULL, pool));
> - SVN_ERR(svn_wc__entry_versioned(&ent, path, adm_access, FALSE, pool));
> - SVN_ERR(svn_wc_adm_close(adm_access));
> -
> - if ((revision->kind == svn_opt_revision_base)
> - || (revision->kind == svn_opt_revision_working))
> - *revnum = ent->revision;
> - else
> - {
> - if (! SVN_IS_VALID_REVNUM(ent->cmt_rev))
> - return svn_error_createf(SVN_ERR_CLIENT_BAD_REVISION, NULL,
> - _("Path '%s' has no committed revision"),
> - path);
> - *revnum = ent->cmt_rev;
> - if (revision->kind == svn_opt_revision_previous)
> - (*revnum)--;
> - }
> - }
> - else
> - return svn_error_createf
> - (SVN_ERR_CLIENT_BAD_REVISION, NULL,
> - _("Unrecognized revision type requested for '%s'"),
> - svn_path_local_style(path, pool));
> -
> +
> return SVN_NO_ERROR;
> }
>
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: svn-unsubscribe@subversion.tigris.org
> For additional commands, e-mail: svn-help@subversion.tigris.org
>
>

-- 
David Glasser | glasser_at_davidglasser.net | http://www.davidglasser.net/
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Received on Tue Oct 23 20:12:52 2007

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.