/* Set up a new adm area for PATH, with REPOS_* as the repos info, and INITIAL_REV as the starting revision. The entries file starts out marked as 'incomplete. The adm area starts out locked; remember to unlock it when done. */ static svn_error_t * init_adm(svn_wc__db_t *db, const char *local_abspath, const char *repos_relpath, const char *repos_root_url, const char *repos_uuid, svn_revnum_t initial_rev, svn_depth_t depth, apr_pool_t *pool) { /* First, make an empty administrative area. */ SVN_ERR(svn_io_dir_make_hidden(svn_wc__adm_child(local_abspath, NULL, pool), APR_OS_DEFAULT, pool)); /** Make subdirectories. ***/ /* SVN_WC__ADM_PRISTINE */ SVN_ERR(make_adm_subdir(local_abspath, SVN_WC__ADM_PRISTINE, FALSE, pool)); /* ### want to add another directory? do a format bump to ensure that ### all existing working copies get the new directories. or maybe ### create-on-demand (more expensive) */ /** Init the tmp area. ***/ SVN_ERR(init_adm_tmp_area(local_abspath, pool)); /* Create the SDB. */ SVN_ERR(svn_wc__db_init(db, local_abspath, repos_relpath, repos_root_url, repos_uuid, initial_rev, depth, pool)); /* Stamp ENTRIES and FORMAT files for old clients. */ SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath, SVN_WC__ADM_ENTRIES, pool), SVN_WC__NON_ENTRIES_STRING, pool)); SVN_ERR(svn_io_file_create(svn_wc__adm_child(local_abspath, SVN_WC__ADM_FORMAT, pool), SVN_WC__NON_ENTRIES_STRING, pool)); return SVN_NO_ERROR; }
/* Set up a new adm area for PATH, with URL as the ancestor url, and INITIAL_REV as the starting revision. The entries file starts out marked as 'incomplete. The adm area starts out locked; remember to unlock it when done. */ static svn_error_t * init_adm(const char *path, const char *uuid, const char *url, const char *repos, svn_revnum_t initial_rev, svn_depth_t depth, apr_pool_t *pool) { svn_wc_adm_access_t *adm_access; /* First, make an empty administrative area. */ SVN_ERR(make_empty_adm(path, pool)); /* Lock it immediately. Theoretically, no compliant wc library would ever consider this an adm area until a README file were present... but locking it is still appropriately paranoid. */ SVN_ERR(svn_wc__adm_pre_open(&adm_access, path, pool)); /** Make subdirectories. ***/ /* SVN_WC__ADM_TEXT_BASE */ SVN_ERR(make_adm_subdir(path, SVN_WC__ADM_TEXT_BASE, FALSE, pool)); /* SVN_WC__ADM_PROP_BASE */ SVN_ERR(make_adm_subdir(path, SVN_WC__ADM_PROP_BASE, FALSE, pool)); /* SVN_WC__ADM_PROPS */ SVN_ERR(make_adm_subdir(path, SVN_WC__ADM_PROPS, FALSE, pool)); /** Init the tmp area. ***/ SVN_ERR(init_adm_tmp_area(adm_access, pool)); /** Initialize each administrative file. */ /* SVN_WC__ADM_ENTRIES */ /* THIS FILE MUST BE CREATED LAST: After this exists, the dir is considered complete. */ SVN_ERR(svn_wc__entries_init(path, uuid, url, repos, initial_rev, depth, pool)); /* Now unlock it. It's now a valid working copy directory, that just happens to be at revision 0. */ return svn_wc_adm_close2(adm_access, pool); }
svn_error_t * svn_wc__adm_cleanup_tmp_area(svn_wc__db_t *db, const char *adm_abspath, apr_pool_t *scratch_pool) { const char *tmp_path; SVN_ERR_ASSERT(svn_dirent_is_absolute(adm_abspath)); SVN_ERR(svn_wc__write_check(db, adm_abspath, scratch_pool)); /* Get the path to the tmp area, and blow it away. */ tmp_path = svn_wc__adm_child(adm_abspath, SVN_WC__ADM_TMP, scratch_pool); SVN_ERR(svn_io_remove_dir2(tmp_path, TRUE, NULL, NULL, scratch_pool)); /* Now, rebuild the tmp area. */ return svn_error_trace(init_adm_tmp_area(adm_abspath, scratch_pool)); }
svn_error_t * svn_wc__adm_cleanup_tmp_area(const svn_wc_adm_access_t *adm_access, apr_pool_t *scratch_pool) { const char *tmp_path; /* If the admin area doesn't even *exist*, then the temp area is definitely cleaned up. */ if (!svn_wc__adm_area_exists(adm_access, scratch_pool)) return SVN_NO_ERROR; SVN_ERR(svn_wc__adm_write_check(adm_access, scratch_pool)); /* Get the path to the tmp area, and blow it away. */ tmp_path = svn_wc__adm_child(svn_wc_adm_access_path(adm_access), SVN_WC__ADM_TMP, scratch_pool); SVN_ERR(svn_io_remove_dir2(tmp_path, TRUE, NULL, NULL, scratch_pool)); /* Now, rebuild the tmp area. */ return init_adm_tmp_area(adm_access, scratch_pool); }