"Hyrum K. Wright" <hyrum_wri...@mail.utexas.edu> writes: > On Nov 17, 2009, at 10:18 AM, Philip Martin wrote: > >> Philip Martin <philip.mar...@wandisco.com> writes: >> >> r879744 did this: >> >> - SVN_ERR(svn_wc__adm_open_in_context(&adm_access, wc_ctx, path, TRUE, -1, >> - cancel_func, cancel_baton, pool)); >> - err = svn_wc_remove_from_revision_control(adm_access, >> - SVN_WC_ENTRY_THIS_DIR, >> - TRUE, FALSE, >> - cancel_func, >> - cancel_baton, >> - pool); >> + SVN_ERR(svn_dirent_get_absolute(&local_abspath, path, pool)); >> + err = svn_wc_remove_from_revision_control2(wc_ctx, local_abspath, >> + TRUE, FALSE, >> + cancel_func, cancel_baton, >> + pool); >> >> The change was made to remove an access baton from the client code. >> However inside the remove function the database needs to have been >> opened and the code above fails because no open has taken place. >> Where does the responsibility for opening the database lie? Should >> the client do it before calling the wc function, or should the wc >> function do it on demand? Looking at the current wc-ng API there >> doesn't seem to be a suitable open function for the client to call, >> everything still seems to be geared to access batons. > > The client shouldn't even *know* about the wc_db. All the client > has is an opaque svn_wc_context_t which it uses to do working copy > operations.
So the answer to my question is that the wc library opens the databases as and when needed, on demand. > When you refer to "the database" are you talking about the sqlite > database or the wc_db? Only code within wc_db.c knows about the > sqlite database (with certain exceptions for upgrading to wc-ng). > libsvn_wc code external to that file should just use the similarly > opaque wc_db handle to do whatever actions it needs to. I was refering to the database associated with the working copy, I wasn't making any assumption about how it was implemented. There is a bit of a problem with the client not knowing about the database as it makes svn:externals a bit tricky. Consider the path "/path/to/wc/foo" where "foo" is an external of "wc". How does the function SVN_ERR(svn_wc_foo(wc_ctx, "/path/to/wc/foo", ...)); treat "foo", does it treat it as an external of "wc" or as the root of "foo"? In the old code the client could choose to open either "wc" or "foo" and that determined how foo got treated. -- Philip