Author: rhuijben
Date: Tue Jul 27 12:40:12 2010
New Revision: 979672
URL: http://svn.apache.org/viewvc?rev=979672&view=rev
Log:
Make 'svn cleanup' work for single-db.
* subversion/libsvn_wc/log.c
(cleanup_internal): Don't recurse for directories and only cleanup tmp
and pristine files if we have a lock on the entire working copy.
* subversion/libsvn_wc/wc_db.c
(svn_wc__db_get_wcroot): New function.
* subversion/libsvn_wc/wc_db.h
(svn_wc__db_get_wcroot): New function.
Modified:
subversion/trunk/subversion/libsvn_wc/log.c
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=979672&r1=979671&r2=979672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/log.c (original)
+++ subversion/trunk/subversion/libsvn_wc/log.c Tue Jul 27 12:40:12 2010
@@ -496,8 +496,12 @@ cleanup_internal(svn_wc__db_t *db,
apr_pool_t *scratch_pool)
{
int wc_format;
+#ifdef SVN_WC__SINGLE_DB
+ const char *cleanup_abspath;
+#else
const apr_array_header_t *children;
int i;
+#endif
apr_pool_t *iterpool = svn_pool_create(scratch_pool);
/* Check cancellation; note that this catches recursive calls too. */
@@ -516,6 +520,7 @@ cleanup_internal(svn_wc__db_t *db,
SVN_ERR(svn_wc__wq_run(db, adm_abspath, cancel_func, cancel_baton,
iterpool));
+#ifndef SVN_WC__SINGLE_DB
/* Recurse on versioned, existing subdirectories. */
SVN_ERR(svn_wc__db_read_children(&children, db, adm_abspath,
scratch_pool, iterpool));
@@ -541,20 +546,31 @@ cleanup_internal(svn_wc__db_t *db,
iterpool));
}
}
+#endif
-#ifndef SINGLE_DB
+#ifndef SVN_WC__SINGLE_DB
/* Purge the DAV props at and under ADM_ABSPATH. */
/* ### in single-db mode, we need do this purge at the top-level only. */
SVN_ERR(svn_wc__db_base_clear_dav_cache_recursive(db, adm_abspath,
iterpool));
-#endif
+#else
+ SVN_ERR(svn_wc__db_get_wcroot(&cleanup_abspath, db, adm_abspath,
+ iterpool, iterpool));
- /* Cleanup the tmp area of the admin subdir, if running the log has not
- removed it! The logs have been run, so anything left here has no hope
- of being useful. */
- SVN_ERR(svn_wc__adm_cleanup_tmp_area(db, adm_abspath, iterpool));
+ /* Perform these operations if we lock the entire working copy */
+ if (strcmp(cleanup_abspath, adm_abspath))
+ {
+#endif
- /* Remove unreferenced pristine texts */
- SVN_ERR(svn_wc__db_pristine_cleanup(db, adm_abspath, iterpool));
+ /* Cleanup the tmp area of the admin subdir, if running the log has not
+ removed it! The logs have been run, so anything left here has no hope
+ 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));
+#ifdef SVN_WC__SINGLE_DB
+ }
+#endif
/* All done, toss the lock */
SVN_ERR(svn_wc__db_wclock_release(db, adm_abspath, iterpool));
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.c
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.c?rev=979672&r1=979671&r2=979672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.c (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.c Tue Jul 27 12:40:12 2010
@@ -1486,6 +1486,33 @@ svn_wc__db_from_relpath(const char **loc
return SVN_NO_ERROR;
}
+svn_error_t *
+svn_wc__db_get_wcroot(const char **wcroot_abspath,
+ svn_wc__db_t *db,
+ const char *wri_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool)
+{
+ svn_wc__db_pdh_t *pdh;
+ const char *unused_relpath;
+
+ SVN_ERR(svn_wc__db_pdh_parse_local_abspath(&pdh, &unused_relpath, db,
+ wri_abspath, svn_sqlite__mode_readonly,
+ scratch_pool, scratch_pool));
+
+ /* Can't use VERIFY_USABLE_PDH, as this should be usable to detect
+ where call upgrade */
+
+ if (pdh->wcroot == NULL)
+ return svn_error_createf(SVN_ERR_WC_NOT_WORKING_COPY, NULL,
+ _("The node '%s' is not in a workingcopy."),
+ svn_dirent_local_style(wri_abspath,
+ scratch_pool));
+
+ *wcroot_abspath = apr_pstrdup(result_pool, pdh->wcroot->abspath);
+
+ return SVN_NO_ERROR;
+}
svn_error_t *
svn_wc__db_base_add_directory(svn_wc__db_t *db,
@@ -8048,6 +8075,7 @@ wclock_obtain_cb(void *baton,
if (!own_lock && !bt->steal_lock)
{
SVN_ERR(svn_sqlite__reset(stmt));
+ SVN_DBG(("Found on %s\n", lock_relpath));
err = svn_error_createf(SVN_ERR_WC_LOCKED, NULL,
_("'%s' is already locked."),
svn_dirent_local_style(lock_abspath,
@@ -8117,11 +8145,11 @@ wclock_obtain_cb(void *baton,
break;
lock_relpath = svn_relpath_dirname(lock_relpath, scratch_pool);
-
}
SVN_ERR(svn_sqlite__get_statement(&stmt, wcroot->sdb,
STMT_INSERT_WC_LOCK));
+ SVN_DBG(("Locking on %s\n", bt->local_relpath));
SVN_ERR(svn_sqlite__bindf(stmt, "isi", wcroot->wc_id,
bt->local_relpath,
(apr_int64_t) bt->levels_to_lock));
Modified: subversion/trunk/subversion/libsvn_wc/wc_db.h
URL:
http://svn.apache.org/viewvc/subversion/trunk/subversion/libsvn_wc/wc_db.h?rev=979672&r1=979671&r2=979672&view=diff
==============================================================================
--- subversion/trunk/subversion/libsvn_wc/wc_db.h (original)
+++ subversion/trunk/subversion/libsvn_wc/wc_db.h Tue Jul 27 12:40:12 2010
@@ -413,6 +413,15 @@ svn_wc__db_from_relpath(const char **loc
apr_pool_t *result_pool,
apr_pool_t *scratch_pool);
+/* Compute the working copy root WCROOT_ABSPATH for WRI_ABSPATH using DB.
+ */
+svn_error_t *
+svn_wc__db_get_wcroot(const char **wcroot_abspath,
+ svn_wc__db_t *db,
+ const char *wri_abspath,
+ apr_pool_t *result_pool,
+ apr_pool_t *scratch_pool);
+
/* @} */
/* Different kinds of trees