subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From julianf...@apache.org
Subject svn commit: r959723 - in /subversion/trunk/subversion/libsvn_wc: log.c wc-queries.sql wc_db.c wc_db.h
Date Thu, 01 Jul 2010 16:55:26 GMT
Author: julianfoad
Date: Thu Jul  1 16:55:26 2010
New Revision: 959723

URL: http://svn.apache.org/viewvc?rev=959723&view=rev
Log:
Make "svn cleanup" clean up unreferenced pristine texts.

* subversion/libsvn_wc/log.c
  (cleanup_internal): Call svn_wc__db_pristine_cleanup().

* subversion/libsvn_wc/wc_db.h,
  subversion/libsvn_wc/wc_db.c
  (svn_wc__db_pristine_cleanup): New function.

* subversion/libsvn_wc/wc-queries.sql
  (STMT_SELECT_PRISTINE_ROWS): New query.

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

Modified: subversion/trunk/subversion/libsvn_wc/log.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/log.c?rev=959723&r1=959722&r2=959723&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Thu Jul  1 16:55:26 2010
@@ -812,6 +812,9 @@ cleanup_internal(svn_wc__db_t *db,
      of being useful. */
   SVN_ERR(svn_wc__adm_cleanup_tmp_area(db, adm_abspath, iterpool));
 
+  /* Remove unreferenced pristine texts */
+  SVN_ERR(svn_wc__db_pristine_cleanup(db, adm_abspath, iterpool));
+
   /* All done, toss the lock */
   SVN_ERR(svn_wc__db_wclock_remove(db, adm_abspath, iterpool));
 

Modified: subversion/trunk/subversion/libsvn_wc/wc-queries.sql
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc-queries.sql?rev=959723&r1=959722&r2=959723&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc-queries.sql (original)
+++ subversion/trunk/subversion/libsvn_wc/wc-queries.sql Thu Jul  1 16:55:26 2010
@@ -329,6 +329,10 @@ SELECT checksum
 FROM pristine
 WHERE md5_checksum = ?1
 
+-- STMT_SELECT_PRISTINE_ROWS
+SELECT checksum
+FROM pristine
+
 -- STMT_SELECT_ANY_PRISTINE_REFERENCE
 SELECT 1 FROM base_node
   WHERE checksum = ?1 OR checksum = ?2

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=959723&r1=959722&r2=959723&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Thu Jul  1 16:55:26 2010
@@ -2538,6 +2538,45 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
 
 
 svn_error_t *
+svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            apr_pool_t *scratch_pool)
+{
+  svn_wc__db_pdh_t *pdh;
+  const char *local_relpath;
+  svn_sqlite__stmt_t *stmt;
+
+  SVN_ERR_ASSERT(svn_dirent_is_absolute(wri_abspath));
+
+  SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &local_relpath, db,
+                              wri_abspath, svn_sqlite__mode_readonly,
+                              scratch_pool, scratch_pool));
+  VERIFY_USABLE_PDH(pdh);
+
+  /* Find the pristines in the DB */
+  SVN_ERR(svn_sqlite__get_statement(&stmt, pdh->wcroot->sdb,
+                                    STMT_SELECT_PRISTINE_ROWS));
+  while (1)
+    {
+      svn_boolean_t have_row;
+      const svn_checksum_t *checksum;
+
+      SVN_ERR(svn_sqlite__step(&have_row, stmt));
+      if (! have_row)
+        break;
+
+      SVN_ERR(svn_sqlite__column_checksum(&checksum, stmt, 0,
+                                          scratch_pool));
+      SVN_ERR(svn_wc__db_pristine_remove(db, wri_abspath, checksum,
+                                         scratch_pool));
+    }
+  SVN_ERR(svn_sqlite__reset(stmt));
+
+  return SVN_NO_ERROR;
+}
+
+
+svn_error_t *
 svn_wc__db_pristine_check(svn_boolean_t *present,
                           svn_wc__db_t *db,
                           const char *wri_abspath,

Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=959723&r1=959722&r2=959723&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Thu Jul  1 16:55:26 2010
@@ -995,6 +995,13 @@ svn_wc__db_pristine_remove(svn_wc__db_t 
                            apr_pool_t *scratch_pool);
 
 
+/* Remove all unreferenced pristines belonging to WRI_ABSPATH in DB. */
+svn_error_t *
+svn_wc__db_pristine_cleanup(svn_wc__db_t *db,
+                            const char *wri_abspath,
+                            apr_pool_t *scratch_pool);
+
+
 /* ### check for presence, according to the given mode (on how hard we
    ### should examine things)
 */



Mime
View raw message