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

Re: svn commit: r39338 - trunk/subversion/libsvn_wc

From: Greg Stein <gstein_at_gmail.com>
Date: Tue, 15 Sep 2009 13:54:39 -0400

from IRC, in case you miss that:

gstein: Bert: svn_path_is_empty() in the new temp function seems a bit
silly. wc_db defines relpath=="" as "this directory". there is no need
for a function just to test for "". these are not some arbitrary path
subject to local operating system varieties.
[1:52pm] gstein: Bert: the temp function should also take a flag on
whether to call flush_entries() or not. right now, if somebody calls
it on its own, you'll get a stale entries hash. only __entry_remove()
properly handles it.
[1:52pm] gstein: Bert: also consider using the navigate_to_parent()
function rather than parse_local_abspath() again.
[1:53pm] gstein: Bert: and when navigating to the parent, no need for
a join. by definition, current_relpath=="", so the new current_relpath
is simply the basename.

On Tue, Sep 15, 2009 at 11:56, Bert Huijben <rhuijben_at_sharpsvn.net> wrote:
> Author: rhuijben
> Date: Tue Sep 15 08:56:27 2009
> New Revision: 39338
>
> Log:
> Rewrite one of the most common entries read and then write operations to
> use the working copy database directly.
>
> * subversion/libsvn_wc/entries.c
>  (svn_wc__entry_remove): Use svn_wc__db_temp_op_remove_entry instead of
>    writing all entries.
> * subversion/libsvn_wc/wc-metadata.sql
>  (STMT_DELETE_BASE_NODE, STMT_DELETE_WORKING_NODE,
>   STMT_DELETE_ACTUAL_NODE): New statements
>
> * subversion/libsvn_wc/wc_db.c
>  (includes): Include svn_path.h
>  (svn_wc__db_temp_op_remove_entry): New function.
>
> * subversion/libsvn_wc/wc_db.h
>  (svn_wc__db_temp_op_remove_entry): New function.
>
> Modified:
>   trunk/subversion/libsvn_wc/entries.c
>   trunk/subversion/libsvn_wc/wc-metadata.sql
>   trunk/subversion/libsvn_wc/wc_db.c
>   trunk/subversion/libsvn_wc/wc_db.h
>
> Modified: trunk/subversion/libsvn_wc/entries.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/entries.c?pathrev=39338&r1=39337&r2=39338
> ==============================================================================
> --- trunk/subversion/libsvn_wc/entries.c        Tue Sep 15 08:54:13 2009        (r39337)
> +++ trunk/subversion/libsvn_wc/entries.c        Tue Sep 15 08:56:27 2009        (r39338)
> @@ -2608,18 +2608,24 @@ svn_wc__entry_remove(svn_wc__db_t *db,
>                      apr_pool_t *scratch_pool)
>  {
>   svn_wc_adm_access_t *adm_access;
> -  apr_hash_t *entries;
>   const char *name;
>   const char *parent_dir;
>
> +/* First: Update the entry cache */
>   svn_dirent_split(local_abspath, &parent_dir, &name, scratch_pool);
>   adm_access = svn_wc__adm_retrieve_internal2(db, parent_dir, scratch_pool);
>
> -  SVN_ERR(svn_wc_entries_read(&entries, adm_access, TRUE, scratch_pool));
> -  apr_hash_set(entries, name, APR_HASH_KEY_STRING, NULL);
> +  if (adm_access != NULL)
> +    {
> +      apr_hash_t *entries = svn_wc__adm_access_entries(adm_access);
>
> -  return svn_error_return(
> -    entries_write(entries, db, parent_dir, scratch_pool));
> +      if (entries != NULL)
> +        apr_hash_set(entries, name, APR_HASH_KEY_STRING, NULL);
> +    }
> +
> +  /* And then remove it from the database */
> +  return svn_error_return(svn_wc__db_temp_op_remove_entry(db, local_abspath,
> +                                                          scratch_pool));
>  }
>
>
>
> Modified: trunk/subversion/libsvn_wc/wc-metadata.sql
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc-metadata.sql?pathrev=39338&r1=39337&r2=39338
> ==============================================================================
> --- trunk/subversion/libsvn_wc/wc-metadata.sql  Tue Sep 15 08:54:13 2009        (r39337)
> +++ trunk/subversion/libsvn_wc/wc-metadata.sql  Tue Sep 15 08:56:27 2009        (r39338)
> @@ -775,6 +775,17 @@ insert into actual_node (
>   wc_id, local_relpath, changelist)
>  values (?1, ?2, ?3);
>
> +-- STMT_DELETE_BASE_NODE
> +delete from base_node
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_DELETE_WORKING_NODE
> +delete from working_node
> +where wc_id = ?1 and local_relpath = ?2;
> +
> +-- STMT_DELETE_ACTUAL_NODE
> +delete from actual_node
> +where wc_id = ?1 and local_relpath = ?2;
>
>  /* ------------------------------------------------------------------------- */
>
>
> Modified: trunk/subversion/libsvn_wc/wc_db.c
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.c?pathrev=39338&r1=39337&r2=39338
> ==============================================================================
> --- trunk/subversion/libsvn_wc/wc_db.c  Tue Sep 15 08:54:13 2009        (r39337)
> +++ trunk/subversion/libsvn_wc/wc_db.c  Tue Sep 15 08:56:27 2009        (r39338)
> @@ -28,6 +28,7 @@
>  #include "svn_types.h"
>  #include "svn_error.h"
>  #include "svn_dirent_uri.h"
> +#include "svn_path.h"
>  #include "svn_wc.h"
>  #include "svn_checksum.h"
>  #include "svn_pools.h"
> @@ -2742,6 +2743,57 @@ svn_wc__db_op_read_tree_conflict(svn_wc_
>   return SVN_NO_ERROR;
>  }
>
> +svn_error_t *
> +svn_wc__db_temp_op_remove_entry(svn_wc__db_t *db,
> +                                const char *local_abspath,
> +                                apr_pool_t *scratch_pool)
> +{
> +  svn_wc__db_pdh_t *pdh;
> +  svn_sqlite__stmt_t *stmt;
> +  svn_sqlite__db_t *sdb;
> +  wcroot_t *wcroot;
> +  const char *current_relpath;
> +
> +  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
> +
> +  SVN_ERR(parse_local_abspath(&pdh, &current_relpath, db, local_abspath,
> +                              svn_sqlite__mode_readwrite,
> +                              scratch_pool, scratch_pool));
> +  VERIFY_USABLE_PDH(pdh);
> +
> +  /* Check if we should remove it from the parent db instead */
> +  if (svn_path_is_empty(current_relpath))
> +    {
> +      SVN_ERR(parse_local_abspath(&pdh, &current_relpath, db,
> +                                  svn_dirent_dirname(local_abspath,
> +                                                     scratch_pool),
> +                                  svn_sqlite__mode_readwrite,
> +                                  scratch_pool, scratch_pool));
> +
> +      VERIFY_USABLE_PDH(pdh);
> +      current_relpath = svn_dirent_join(current_relpath,
> +                                        svn_dirent_basename(local_abspath,
> +                                                            NULL),
> +                                        scratch_pool);
> +    }
> +
> +  wcroot = pdh->wcroot;
> +  sdb = wcroot->sdb;
> +
> +  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_BASE_NODE));
> +  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
> +  SVN_ERR(svn_sqlite__step_done(stmt));
> +
> +  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_WORKING_NODE));
> +  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
> +  SVN_ERR(svn_sqlite__step_done(stmt));
> +
> +  SVN_ERR(svn_sqlite__get_statement(&stmt, sdb, STMT_DELETE_ACTUAL_NODE));
> +  SVN_ERR(svn_sqlite__bindf(stmt, "is", wcroot->wc_id, current_relpath));
> +
> +  return svn_error_return(svn_sqlite__step_done(stmt));
> +}
> +
>
>  svn_error_t *
>  svn_wc__db_read_info(svn_wc__db_status_t *status,
>
> Modified: trunk/subversion/libsvn_wc/wc_db.h
> URL: http://svn.collab.net/viewvc/svn/trunk/subversion/libsvn_wc/wc_db.h?pathrev=39338&r1=39337&r2=39338
> ==============================================================================
> --- trunk/subversion/libsvn_wc/wc_db.h  Tue Sep 15 08:54:13 2009        (r39337)
> +++ trunk/subversion/libsvn_wc/wc_db.h  Tue Sep 15 08:56:27 2009        (r39338)
> @@ -1709,6 +1709,13 @@ svn_wc__db_temp_is_dir_deleted(svn_boole
>                                const char *local_abspath,
>                                apr_pool_t *scratch_pool);
>
> +/* Removes all references of LOCAL_ABSPATH from its working copy
> +   using DB. */
> +svn_error_t *
> +svn_wc__db_temp_op_remove_entry(svn_wc__db_t *db,
> +                                const char *local_abspath,
> +                                apr_pool_t *scratch_pool);
> +
>
>  /* ### temp function. return the FORMAT for the directory LOCAL_ABSPATH.  */
>  svn_error_t *
>
> ------------------------------------------------------
> http://subversion.tigris.org/ds/viewMessage.do?dsForumId=495&dsMessageId=2395141
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=462&dsMessageId=2395187
Received on 2009-09-15 19:54:56 CEST

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.