You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@subversion.apache.org by Bert Huijben <be...@qqmail.nl> on 2011/03/10 16:50:13 UTC

RE: svn commit: r1080253 - in /subversion/trunk/subversion/libsvn_wc: revision_status.c wc_db.c wc_db.h

> -----Original Message-----
> From: stsp@apache.org [mailto:stsp@apache.org]
> Sent: donderdag 10 maart 2011 16:43
> To: commits@subversion.apache.org
> Subject: svn commit: r1080253 - in /subversion/trunk/subversion/libsvn_wc:
> revision_status.c wc_db.c wc_db.h
> 
> Author: stsp
> Date: Thu Mar 10 15:43:22 2011
> New Revision: 1080253
> 
> URL: http://svn.apache.org/viewvc?rev=1080253&view=rev
> Log:
> Move code detecting whether the working copy is switched from a given
> TRAIL_URL from svn_wc_revision_status2() into
> svn_wc__db_revision_status().
> 
> * subversion/libsvn_wc/revision_status.c
>   (svn_wc__db_revision_status2): Pass TRAIL_URL to
> svn_wc__db_revision_status(),
>    instead of evaluating it here.
> 
> * subversion/libsvn_wc/wc_db.c
>   (svn_wc__db_revision_status): Accept TRAIL_URL argument, and use it
>    to check whether the working copy is switched.
> 
> * subversion/libsvn_wc/wc_db.h
>   (svn_wc__db_revision_status): Update declaration and docstring.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/revision_status.c
>     subversion/trunk/subversion/libsvn_wc/wc_db.c
>     subversion/trunk/subversion/libsvn_wc/wc_db.h
> 

<snip>

> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_
> db.c?rev=1080253&r1=1080252&r2=1080253&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Mar 10 15:43:22
> 2011
> @@ -9082,6 +9082,7 @@ svn_wc__db_revision_status(svn_revnum_t
>                             svn_boolean_t *is_switched,
>                             svn_wc__db_t *db,
>                             const char *local_abspath,
> +                           const char *trail_url,
>                             svn_boolean_t committed,
>                             apr_pool_t *scratch_pool)
>  {
> @@ -9221,6 +9222,28 @@ svn_wc__db_revision_status(svn_revnum_t
>    *is_switched = have_row;
>    SVN_ERR(svn_sqlite__reset(stmt));
> 
> +  if (! *is_switched && trail_url != NULL)
> +    {
> +      const char *url;
> +
> +      /* If the trailing part of the URL of the working copy directory
> +         does not match the given trailing URL then the whole working
> +         copy is switched. */
> +      SVN_ERR(svn_wc__internal_node_get_url(&url, db, local_abspath,
> +                                            scratch_pool, scratch_pool));

I don't think the DB api implementation should call into the higher layer APIs which abstract the DB api. Can you replace this call by one or more calls to the wc_db api?

	Bert 



Re: svn commit: r1080253 - in /subversion/trunk/subversion/libsvn_wc: revision_status.c wc_db.c wc_db.h

Posted by Stefan Sperling <st...@elego.de>.
On Thu, Mar 10, 2011 at 04:50:13PM +0100, Bert Huijben wrote:
> > -----Original Message-----
> > From: stsp@apache.org [mailto:stsp@apache.org]
> > Sent: donderdag 10 maart 2011 16:43
> > To: commits@subversion.apache.org
> > Subject: svn commit: r1080253 - in /subversion/trunk/subversion/libsvn_wc:
> > revision_status.c wc_db.c wc_db.h
> > 
> > Author: stsp
> > Date: Thu Mar 10 15:43:22 2011
> > New Revision: 1080253
> > 
> > URL: http://svn.apache.org/viewvc?rev=1080253&view=rev
> > Log:
> > Move code detecting whether the working copy is switched from a given
> > TRAIL_URL from svn_wc_revision_status2() into
> > svn_wc__db_revision_status().
> > 
> > * subversion/libsvn_wc/revision_status.c
> >   (svn_wc__db_revision_status2): Pass TRAIL_URL to
> > svn_wc__db_revision_status(),
> >    instead of evaluating it here.
> > 
> > * subversion/libsvn_wc/wc_db.c
> >   (svn_wc__db_revision_status): Accept TRAIL_URL argument, and use it
> >    to check whether the working copy is switched.
> > 
> > * subversion/libsvn_wc/wc_db.h
> >   (svn_wc__db_revision_status): Update declaration and docstring.
> > 
> > Modified:
> >     subversion/trunk/subversion/libsvn_wc/revision_status.c
> >     subversion/trunk/subversion/libsvn_wc/wc_db.c
> >     subversion/trunk/subversion/libsvn_wc/wc_db.h
> > 
> 
> <snip>
> 
> > Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> > URL:
> > http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_
> > db.c?rev=1080253&r1=1080252&r2=1080253&view=diff
> > ==========================================================
> > ====================
> > --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> > +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Mar 10 15:43:22
> > 2011
> > @@ -9082,6 +9082,7 @@ svn_wc__db_revision_status(svn_revnum_t
> >                             svn_boolean_t *is_switched,
> >                             svn_wc__db_t *db,
> >                             const char *local_abspath,
> > +                           const char *trail_url,
> >                             svn_boolean_t committed,
> >                             apr_pool_t *scratch_pool)
> >  {
> > @@ -9221,6 +9222,28 @@ svn_wc__db_revision_status(svn_revnum_t
> >    *is_switched = have_row;
> >    SVN_ERR(svn_sqlite__reset(stmt));
> > 
> > +  if (! *is_switched && trail_url != NULL)
> > +    {
> > +      const char *url;
> > +
> > +      /* If the trailing part of the URL of the working copy directory
> > +         does not match the given trailing URL then the whole working
> > +         copy is switched. */
> > +      SVN_ERR(svn_wc__internal_node_get_url(&url, db, local_abspath,
> > +                                            scratch_pool, scratch_pool));
> 
> I don't think the DB api implementation should call into the higher layer APIs which abstract the DB api.

I agree.

> Can you replace this call by one or more calls to the wc_db api?

Not easily. There is no equivalent API at the lower layer yet.
Doing this now in svn_wc__db_revision_status() would duplicate a lot of
scanning for URLs of added nodes etc.

We should provide an wc_db-internal API that is equivalent to
svn_wc__internal_node_get_url(), but callable with a wcroot/relpath
pair. Then we svn_wc__db_revision_status() can use that.

I'll add a comment about the layering violation and will try to
look at this later.