subversion-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From as...@apache.org
Subject svn commit: r1387394 - in /subversion/branches/compressed-pristines/subversion/libsvn_wc: upgrade.c wc_db.c wc_db.h wc_db_private.h wc_db_wcroot.c
Date Tue, 18 Sep 2012 22:08:53 GMT
Author: ashod
Date: Tue Sep 18 22:08:53 2012
New Revision: 1387394

URL: http://svn.apache.org/viewvc?rev=1387394&view=rev
Log:
Pristine DB created during WC install and closed gracefully.
Broke some tests.

Modified:
    subversion/branches/compressed-pristines/subversion/libsvn_wc/upgrade.c
    subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c
    subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.h
    subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_private.h
    subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_wcroot.c

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/upgrade.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/upgrade.c?rev=1387394&r1=1387393&r2=1387394&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/upgrade.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/upgrade.c Tue Sep 18 22:08:53
2012
@@ -1564,6 +1564,7 @@ bump_to_30(void *baton, svn_sqlite__db_t
 
 struct upgrade_data_t {
   svn_sqlite__db_t *sdb;
+  svn_sqlite__db_t *pdb;
   const char *root_abspath;
   apr_int64_t repos_id;
   apr_int64_t wc_id;
@@ -2129,7 +2130,7 @@ svn_wc_upgrade(svn_wc_context_t *wc_ctx,
   SVN_ERR(svn_wc__ensure_directory(root_adm_abspath, scratch_pool));
 
   /* Create an empty sqlite database for this directory and store it in DB. */
-  SVN_ERR(svn_wc__db_upgrade_begin(&data.sdb,
+  SVN_ERR(svn_wc__db_upgrade_begin(&data.sdb, &data.pdb,
                                    &data.repos_id, &data.wc_id,
                                    db, data.root_abspath,
                                    this_dir->repos, this_dir->uuid,

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c?rev=1387394&r1=1387393&r2=1387394&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.c Tue Sep 18 22:08:53
2012
@@ -1424,7 +1424,7 @@ does_node_exist(svn_boolean_t *exists,
 
 /*
  * ** COMPRESSED PRISTINE **
- * TODO: moved into separate file.
+ * TODO: Move into separate file.
  */
 
 /* Create a pristine sqlite database at DIR_ABSPATH/PDB_FNAME and
@@ -1613,7 +1613,7 @@ svn_wc__db_init(svn_wc__db_t *db,
   /* Create the WCROOT for this directory.  */
   SVN_ERR(svn_wc__db_pdh_create_wcroot(&wcroot,
                         apr_pstrdup(db->state_pool, local_abspath),
-                        sdb, wc_id, FORMAT_FROM_SDB,
+                        sdb, pdb, wc_id, FORMAT_FROM_SDB,
                         FALSE /* auto-upgrade */,
                         FALSE /* enforce_empty_wq */,
                         db->state_pool, scratch_pool));
@@ -11553,6 +11553,7 @@ svn_wc__db_scan_deletion(const char **ba
 
 svn_error_t *
 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
+                         svn_sqlite__db_t **pdb,
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
                          svn_wc__db_t *wc_db,
@@ -11568,10 +11569,14 @@ svn_wc__db_upgrade_begin(svn_sqlite__db_
                     NULL, SVN_INVALID_REVNUM, svn_depth_unknown,
                     wc_db->state_pool, scratch_pool));
 
+  /* Create the PDB. */
+  SVN_ERR(create_pristine_db(pdb, dir_abspath, repos_root_url,
+                    PDB_FILE, wc_db->state_pool, scratch_pool));
+
   SVN_ERR(svn_wc__db_pdh_create_wcroot(&wcroot,
                                        apr_pstrdup(wc_db->state_pool,
                                                    dir_abspath),
-                                       *sdb, *wc_id, FORMAT_FROM_SDB,
+                                       *sdb, *pdb, *wc_id, FORMAT_FROM_SDB,
                                        FALSE /* auto-upgrade */,
                                        FALSE /* enforce_empty_wq */,
                                        wc_db->state_pool, scratch_pool));

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.h
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.h?rev=1387394&r1=1387393&r2=1387394&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db.h Tue Sep 18 22:08:53
2012
@@ -2682,6 +2682,7 @@ svn_wc__db_scan_deletion(const char **ba
    Perform temporary allocations in SCRATCH_POOL. */
 svn_error_t *
 svn_wc__db_upgrade_begin(svn_sqlite__db_t **sdb,
+                         svn_sqlite__db_t **pdb,
                          apr_int64_t *repos_id,
                          apr_int64_t *wc_id,
                          svn_wc__db_t *wc_db,

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_private.h
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_private.h?rev=1387394&r1=1387393&r2=1387394&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_private.h (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_private.h Tue Sep
18 22:08:53 2012
@@ -119,6 +119,7 @@ svn_error_t *
 svn_wc__db_pdh_create_wcroot(svn_wc__db_wcroot_t **wcroot,
                              const char *wcroot_abspath,
                              svn_sqlite__db_t *sdb,
+                             svn_sqlite__db_t *pdb,
                              apr_int64_t wc_id,
                              int format,
                              svn_boolean_t auto_upgrade,

Modified: subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_wcroot.c
URL: http://svn.apache.org/viewvc/subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_wcroot.c?rev=1387394&r1=1387393&r2=1387394&view=diff
==============================================================================
--- subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_wcroot.c (original)
+++ subversion/branches/compressed-pristines/subversion/libsvn_wc/wc_db_wcroot.c Tue Sep 18
22:08:53 2012
@@ -36,6 +36,7 @@
 
 /* ### Same values as wc_db.c */
 #define SDB_FILE  "wc.db"
+#define PDB_FILE  "pristine.db"
 #define UNKNOWN_WC_ID ((apr_int64_t) -1)
 #define FORMAT_FROM_SDB (-1)
 
@@ -172,21 +173,16 @@ close_wcroot(void *data)
   err_sdb = svn_sqlite__close(wcroot->sdb);
   wcroot->sdb = NULL;
 
-  if (wcroot->pdb != NULL)
+  err_pdb = svn_sqlite__close(wcroot->pdb);
+  wcroot->pdb = NULL;
+
+  if (err_pdb)
     {
-      /*FIXME: Should remove this when CP is complete. */
-      SVN_ERR_ASSERT_NO_RETURN(wcroot->pdb != NULL);
-      err_pdb = svn_sqlite__close(wcroot->pdb);
-      wcroot->pdb = NULL;
- 
-      if (err_pdb)
-        {
-          apr_status_t result = err_pdb->apr_err;
-          svn_error_clear(err_pdb);
-          return result;
-        }
+      apr_status_t result = err_pdb->apr_err;
+      svn_error_clear(err_pdb);
+      return result;
     }
-
+  
   if (err_sdb)
     {
       apr_status_t result = err_sdb->apr_err;
@@ -251,6 +247,7 @@ svn_error_t *
 svn_wc__db_pdh_create_wcroot(svn_wc__db_wcroot_t **wcroot,
                              const char *wcroot_abspath,
                              svn_sqlite__db_t *sdb,
+                             svn_sqlite__db_t *pdb,
                              apr_int64_t wc_id,
                              int format,
                              svn_boolean_t auto_upgrade,
@@ -316,7 +313,7 @@ svn_wc__db_pdh_create_wcroot(svn_wc__db_
 
   (*wcroot)->abspath = wcroot_abspath;
   (*wcroot)->sdb = sdb;
-  (*wcroot)->pdb = NULL;
+  (*wcroot)->pdb = pdb;
   (*wcroot)->wc_id = wc_id;
   (*wcroot)->format = format;
   /* 8 concurrent locks is probably more than a typical wc_ng based svn client
@@ -385,6 +382,7 @@ svn_wc__db_wcroot_parse_local_abspath(sv
   svn_wc__db_wcroot_t *found_wcroot = NULL;
   const char *scan_abspath;
   svn_sqlite__db_t *sdb;
+  svn_sqlite__db_t *pdb;
   svn_boolean_t moved_upwards = FALSE;
   svn_boolean_t always_check = FALSE;
   int wc_format = 0;
@@ -507,7 +505,14 @@ svn_wc__db_wcroot_parse_local_abspath(sv
               SVN_ERR(svn_sqlite__exec_statements(sdb,
                                                   STMT_VERIFICATION_TRIGGERS));
 #endif
-              break;
+              /* Open the Pristine DB. */
+              err = svn_wc__db_util_open_db(&pdb, local_abspath, PDB_FILE,
+                                            svn_sqlite__mode_readwrite, NULL,
+                                            db->state_pool, scratch_pool);
+              if (err == NULL)
+                {
+                  break;
+                }
             }
           if (err->apr_err != SVN_ERR_SQLITE_ERROR
               && !APR_STATUS_IS_ENOENT(err->apr_err))
@@ -617,7 +622,7 @@ try_symlink_as_dir:
 
       SVN_ERR(svn_wc__db_pdh_create_wcroot(wcroot,
                             apr_pstrdup(db->state_pool, local_abspath),
-                            sdb, wc_id, FORMAT_FROM_SDB,
+                            sdb, pdb, wc_id, FORMAT_FROM_SDB,
                             db->auto_upgrade, db->enforce_empty_wq,
                             db->state_pool, scratch_pool));
     }
@@ -626,7 +631,7 @@ try_symlink_as_dir:
       /* We found a wc-1 working copy directory.  */
       SVN_ERR(svn_wc__db_pdh_create_wcroot(wcroot,
                             apr_pstrdup(db->state_pool, local_abspath),
-                            NULL, UNKNOWN_WC_ID, wc_format,
+                            NULL, NULL, UNKNOWN_WC_ID, wc_format,
                             db->auto_upgrade, db->enforce_empty_wq,
                             db->state_pool, scratch_pool));
     }



Mime
View raw message