You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by David Glasser <gl...@davidglasser.net> on 2007/10/23 18:12:35 UTC
Re: svn commit: r27323 - trunk/subversion/libsvn_client
On 10/23/07, cmpilato@tigris.org <cm...@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@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
Re: svn commit: r27323 - trunk/subversion/libsvn_client
Posted by Philip Martin <ph...@codematters.co.uk>.
"David Glasser" <gl...@davidglasser.net> writes:
> On 10/23/07, C. Michael Pilato <cm...@collab.net> wrote:
>> David Glasser wrote:
>> >> + 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?
>>
>> To be honest, I don't know what "FIXME local" even means. I didn't add it
>> myself, though.
>
> Oh, heh. I guess it's actually 5 years old. r27336.
I can explain... that was to remind me that having this function open
a local, i.e. temporary and read-only, view of the working copy is a
bit of a hack as it means that the information obtained could be
out-of-date even before the function returns, and also that if/when
the operation opens the working copy "for real" the same entries file
needs to be read a second time.
---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@subversion.tigris.org
For additional commands, e-mail: dev-help@subversion.tigris.org
Re: svn commit: r27323 - trunk/subversion/libsvn_client
Posted by David Glasser <gl...@davidglasser.net>.
On 10/23/07, C. Michael Pilato <cm...@collab.net> wrote:
> David Glasser wrote:
> >> + 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?
>
> To be honest, I don't know what "FIXME local" even means. I didn't add it
> myself, though.
Oh, heh. I guess it's actually 5 years old. r27336.
--dave
--
David Glasser | glasser@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
Re: svn commit: r27323 - trunk/subversion/libsvn_client
Posted by "C. Michael Pilato" <cm...@collab.net>.
David Glasser wrote:
>> + 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?
To be honest, I don't know what "FIXME local" even means. I didn't add it
myself, though.
--
C. Michael Pilato <cm...@collab.net>
CollabNet <> www.collab.net <> Distributed Development On Demand