You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by hw...@apache.org on 2011/05/16 02:14:39 UTC

svn commit: r1103582 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c

Author: hwright
Date: Mon May 16 00:14:39 2011
New Revision: 1103582

URL: http://svn.apache.org/viewvc?rev=1103582&view=rev
Log:
When populating the targets list, don't bother calculating the parent_relpath,
when we already have that information in the database.

We also have to relax the constraint slightly, since NULL parent relpaths are
acceptable (and documented as such).

* subversion/libsvn_wc/wc-queries.sql
  (STMT_CREATE_TARGETS_LIST): Don't require a non-NULL parent relpath.
  (STMT_INSERT_TARGET): Use the existing parent_relpath, rather than
    a bound parameter.

* subversion/libsvn_wc/wc_db.c
  (populate_targets_tree): Remove parent_relpath computation and binding.

Modified:
    subversion/trunk/subversion/libsvn_wc/wc-queries.sql
    subversion/trunk/subversion/libsvn_wc/wc_db.c

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=1103582&r1=1103581&r2=1103582&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon May 16 00:14:39 2011
@@ -432,7 +432,7 @@ ORDER BY wc_id, local_relpath
 DROP TABLE IF EXISTS targets_list;
 CREATE TEMPORARY TABLE targets_list (
   local_relpath TEXT NOT NULL,
-  parent_relpath TEXT NOT NULL,
+  parent_relpath TEXT,
   kind TEXT NOT NULL
   );
 CREATE INDEX targets_list_kind
@@ -443,7 +443,8 @@ DROP TABLE IF EXISTS targets_list;
 
 -- STMT_INSERT_TARGET
 INSERT INTO targets_list(local_relpath, parent_relpath, kind)
-SELECT ?2, ?3, kind FROM nodes_current WHERE wc_id = ?1 AND local_relpath = ?2
+SELECT ?2, parent_relpath, kind
+FROM nodes_current WHERE wc_id = ?1 AND local_relpath = ?2
 
 -- STMT_INSERT_TARGET_WITH_CHANGELIST
 INSERT INTO targets_list(local_relpath, parent_relpath, kind)

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=1103582&r1=1103581&r2=1103582&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Mon May 16 00:14:39 2011
@@ -4962,9 +4962,6 @@ populate_targets_tree(svn_wc__db_wcroot_
                       apr_pool_t *scratch_pool)
 {
   svn_sqlite__stmt_t *stmt;
-  const char *parent_relpath;
-
-  parent_relpath = svn_relpath_dirname(local_relpath, scratch_pool);
 
   SVN_ERR(svn_sqlite__exec_statements(wcroot->sdb,
                                       STMT_CREATE_TARGETS_LIST));
@@ -5005,8 +5002,8 @@ populate_targets_tree(svn_wc__db_wcroot_
             /* Insert this single path. */
             SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
                                               STMT_INSERT_TARGET));
-            SVN_ERR(svn_sqlite__bindf(stmt, "iss", wcroot->wc_id,
-                                      local_relpath, parent_relpath));
+            SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id,
+                                      local_relpath));
             SVN_ERR(svn_sqlite__step_done(stmt));
             break;
 



Re: svn commit: r1103582 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c

Posted by Hyrum K Wright <hy...@hyrumwright.org>.
On Tue, May 17, 2011 at 8:11 AM, Greg Stein <gs...@gmail.com> wrote:
> On May 16, 2011 2:15 AM, <hw...@apache.org> wrote:
>>
>> Author: hwright
>> Date: Mon May 16 00:14:39 2011
>> New Revision: 1103582
>>
>> URL: http://svn.apache.org/viewvc?rev=1103582&view=rev
>> Log:
>> When populating the targets list, don't bother calculating the
> parent_relpath,
>> when we already have that information in the database.
>>
>> We also have to relax the constraint slightly, since NULL parent relpaths
> are
>> acceptable (and documented as such).
>
> Not really true. parent_relpath of NULL implies the wcroot. You can't delete
> that, nor apply a changelist on it. Maybe when we define what a changelist
> on a directory means, but not any time soon.

True, but as this technique is intended to be generalizable, I don't
think we should constrain ourselves to non-changelist-able nodes.

>
>>...
>> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon May 16
> 00:14:39 2011
>> @@ -432,7 +432,7 @@ ORDER BY wc_id, local_relpath
>>  DROP TABLE IF EXISTS targets_list;
>>  CREATE TEMPORARY TABLE targets_list (
>>   local_relpath TEXT NOT NULL,
>> -  parent_relpath TEXT NOT NULL,
>> +  parent_relpath TEXT,
>>   kind TEXT NOT NULL
>>   );
>>  CREATE INDEX targets_list_kind
>> @@ -443,7 +443,8 @@ DROP TABLE IF EXISTS targets_list;
>>
>>  -- STMT_INSERT_TARGET
>>  INSERT INTO targets_list(local_relpath, parent_relpath, kind)
>> -SELECT ?2, ?3, kind FROM nodes_current WHERE wc_id = ?1 AND local_relpath
> = ?2
>> +SELECT ?2, parent_relpath, kind
>> +FROM nodes_current WHERE wc_id = ?1 AND local_relpath = ?2
>
> Strictly speaking, you could SELECT local_relpath since it is equivalent,
> given the WHERE clause.

Correct.  The current code does this.

-Hyrum

Re: svn commit: r1103582 - in /subversion/trunk/subversion/libsvn_wc: wc-queries.sql wc_db.c

Posted by Greg Stein <gs...@gmail.com>.
On May 16, 2011 2:15 AM, <hw...@apache.org> wrote:
>
> Author: hwright
> Date: Mon May 16 00:14:39 2011
> New Revision: 1103582
>
> URL: http://svn.apache.org/viewvc?rev=1103582&view=rev
> Log:
> When populating the targets list, don't bother calculating the
parent_relpath,
> when we already have that information in the database.
>
> We also have to relax the constraint slightly, since NULL parent relpaths
are
> acceptable (and documented as such).

Not really true. parent_relpath of NULL implies the wcroot. You can't delete
that, nor apply a changelist on it. Maybe when we define what a changelist
on a directory means, but not any time soon.

>...
> +++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Mon May 16
00:14:39 2011
> @@ -432,7 +432,7 @@ ORDER BY wc_id, local_relpath
>  DROP TABLE IF EXISTS targets_list;
>  CREATE TEMPORARY TABLE targets_list (
>   local_relpath TEXT NOT NULL,
> -  parent_relpath TEXT NOT NULL,
> +  parent_relpath TEXT,
>   kind TEXT NOT NULL
>   );
>  CREATE INDEX targets_list_kind
> @@ -443,7 +443,8 @@ DROP TABLE IF EXISTS targets_list;
>
>  -- STMT_INSERT_TARGET
>  INSERT INTO targets_list(local_relpath, parent_relpath, kind)
> -SELECT ?2, ?3, kind FROM nodes_current WHERE wc_id = ?1 AND local_relpath
= ?2
> +SELECT ?2, parent_relpath, kind
> +FROM nodes_current WHERE wc_id = ?1 AND local_relpath = ?2

Strictly speaking, you could SELECT local_relpath since it is equivalent,
given the WHERE clause.

>...

Cheers,
-g