svn_error_t * svn_sqlite__with_lock(svn_sqlite__db_t *db, svn_sqlite__transaction_callback_t cb_func, void *cb_baton, apr_pool_t *scratch_pool /* NULL allowed */) { SVN_SQLITE__WITH_LOCK(cb_func(cb_baton, db, scratch_pool), db); return SVN_NO_ERROR; }
static svn_error_t * tree_dump(const char *path, apr_pool_t *scratch_pool) { struct directory_walk_baton bt; svn_sqlite__db_t *sdb; svn_wc__db_t *db; bt.prefix_path = path; /* Obtain an access baton to allow re-using the same wc_db for all access */ SVN_ERR(svn_wc_adm_open3(&bt.adm_access, NULL, path, FALSE, 0, NULL, NULL, scratch_pool)); db = svn_wc__adm_get_db(bt.adm_access); SVN_ERR(svn_wc__context_create_with_db(&bt.wc_ctx, NULL, db, scratch_pool)); SVN_ERR(svn_dirent_get_absolute(&bt.root_abspath, path, scratch_pool)); /* And now get us a transaction on the database to avoid obtaining and releasing locks all the time */ SVN_ERR(svn_wc__db_temp_borrow_sdb(&sdb, bt.wc_ctx->db, bt.root_abspath, scratch_pool)); SVN_SQLITE__WITH_LOCK( svn_wc__internal_walk_children(db, bt.root_abspath, FALSE, NULL, tree_dump_dir, &bt, svn_depth_infinity, NULL, NULL, scratch_pool), sdb); /* And close everything we've opened */ SVN_ERR(svn_wc_context_destroy(bt.wc_ctx)); SVN_ERR(svn_wc_adm_close2(bt.adm_access, scratch_pool)); return SVN_NO_ERROR; }