On Thu, Sep 15, 2011 at 16:05, Julian Foad <julian.f...@wandisco.com> wrote: > Thanks for the feedback, everyone. Looks like the principle of re-using > connections is sound but this implementation is way wrong :-) > > I'm not working much on this right now and will come back to it later, > but here's a dump of my current brain state. > > [...]
> > Hi Julian, Thanks for great discussion summary. I still think that we need to implement explicit call function, to use it in functions like svn_client__get_repos_root(): [[[ svn_ra_session_t *ra_session; /* If PATH_OR_URL is a local path we can fetch the repos root locally. */ if (!svn_path_is_url(abspath_or_url)) { SVN_ERR(svn_wc__node_get_repos_info(repos_root, NULL, ctx->wc_ctx, abspath_or_url, result_pool, scratch_pool)); return SVN_NO_ERROR; } /* If PATH_OR_URL was a URL, we use the RA layer to look it up. */ SVN_ERR(svn_client__open_ra_session_internal(&ra_session, NULL, abspath_or_url, NULL, NULL, FALSE, TRUE, ctx, scratch_pool)); SVN_ERR(svn_ra_get_repos_root2(ra_session, repos_root, result_pool)); ]]] And callers use pattern like this: [[[ /* Determine the working copy target's repository root URL. */ SVN_ERR(svn_client__get_repos_root(&wc_repos_root, target_abspath, ctx, scratch_pool, scratch_pool)); /* Determine the source's repository root URL. */ SVN_ERR(svn_client__get_repos_root(&source_repos_root, url2, ctx, scratch_pool, scratch_pool)); ]] Creating subpools for each call to such function is not inconvenient, but I agree that we can add explicit close any time. -- Ivan Zhakov