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 17:38:24 UTC

RE: svn commit: r1079897 - in /subversion/trunk/subversion/libsvn_wc: revision_status.c wc-queries.sql wc_db.c


> -----Original Message-----
> From: stsp@apache.org [mailto:stsp@apache.org]
> Sent: woensdag 9 maart 2011 18:24
> To: commits@subversion.apache.org
> Subject: svn commit: r1079897 - in /subversion/trunk/subversion/libsvn_wc:
> revision_status.c wc-queries.sql wc_db.c
> 
> Author: stsp
> Date: Wed Mar  9 17:23:39 2011
> New Revision: 1079897
> 
> URL: http://svn.apache.org/viewvc?rev=1079897&view=rev
> Log:
> Make svn_wc__db_revision_status() detect text and prop modifications,
> and remove the node walker from the revision status code.
> 
> * subversion/libsvn_wc/revision_status.c
>   (walk_baton, analyze_status): Remove.
>   (svn_wc_revision_status2): Stop using the node walker, since
>    svn_wc__db_revision_status() provides all needed information now.
> 
> * subversion/libsvn_wc/wc-queries.sql
>   (STMT_SELECT_CURRENT_NODES_RECURSIVE): New query. Returns all
> nodes
>    from the working tree beneath a LOCAL_RELPATH.
> 
> * subversion/libsvn_wc/wc_db.c
>   (svn_wc__db_revision_status): Check for property and text modifications
>    with help from the above new query.
> 
> Modified:
>     subversion/trunk/subversion/libsvn_wc/revision_status.c
>     subversion/trunk/subversion/libsvn_wc/wc-queries.sql
>     subversion/trunk/subversion/libsvn_wc/wc_db.c

> Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
> URL:
> http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_
> db.c?rev=1079897&r1=1079896&r2=1079897&view=diff
> ==========================================================
> ====================
> --- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
> +++ subversion/trunk/subversion/libsvn_wc/wc_db.c Wed Mar  9 17:23:39
> 2011
> @@ -9149,6 +9149,54 @@ svn_wc__db_revision_status(svn_revnum_t
>    *is_modified = have_row;
>    SVN_ERR(svn_sqlite__reset(stmt));
> 
> +  if (! *is_modified)
> +    {
> +      apr_pool_t *iterpool = NULL;
> +
> +      /* Check for text and prop modifications. */
> +      SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
> +                                        STMT_SELECT_CURRENT_NODES_RECURSIVE));
> +      SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id, local_relpath,
> +                                construct_like_arg(local_relpath,
> +                                                   scratch_pool)));
> +      SVN_ERR(svn_sqlite__step(&have_row, stmt));
> +      if (have_row)
> +        iterpool = svn_pool_create(scratch_pool);
> +      while (have_row)
> +        {
> +          const char *node_abspath;
> +          svn_wc__db_kind_t node_kind;
> +
> +          svn_pool_clear(iterpool);
> +
> +          node_abspath = svn_dirent_join(wcroot->abspath,
> +                                         svn_sqlite__column_text(stmt, 0,
> +                                                                 iterpool),
> +                                         iterpool);
> +
> +          SVN_ERR(svn_wc__props_modified(is_modified, db, node_abspath,
> +                                         iterpool));

Props modified can be detected via db apis. (If the properties in ACTUAL are not null, they are changed)

> +          if (*is_modified)
> +            break;
> +
> +          node_kind = svn_sqlite__column_token(stmt, 1, kind_map);
> +          if (node_kind == svn_wc__db_kind_file)
> +            {
> +              SVN_ERR(svn_wc__internal_text_modified_p(is_modified, db,
> +                                                       node_abspath,
> +                                                       FALSE, TRUE, iterpool));

I don't think you can avoid a non db api here, but maybe we should pass a callback instead and keep this outside wc_db.c?

(Internal text modified does several DB queries on its own; there are faster alternatives if you have the checksum, etc.)

	Bert