Author: rinrab
Date: Sun Apr 5 17:31:07 2026
New Revision: 1932858
Log:
svnbrowse: Move client initialization away from the model; it will work with an
already pre-set client and *be* the same layer as the libsvn_client API.
We would like to provide more specific configuration to how our client behaves
based on the information we have only in the command-line parser. Like handling
--username and --password.
* subversion/svnbrowse/model.c
(svn_browse__model_create): Add ctx to parameters, remove client
initialization.
* subversion/svnbrowse/svnbrowse.c
(sub_main): Initialize client and the auth baton.
* subversion/svnbrowse/svnbrowse.h
(svn_browse__model_create): Add ctx to parameters.
Modified:
subversion/trunk/subversion/svnbrowse/model.c
subversion/trunk/subversion/svnbrowse/svnbrowse.c
subversion/trunk/subversion/svnbrowse/svnbrowse.h
Modified: subversion/trunk/subversion/svnbrowse/model.c
==============================================================================
--- subversion/trunk/subversion/svnbrowse/model.c Sun Apr 5 17:02:57 2026 (r1932857)
+++ subversion/trunk/subversion/svnbrowse/model.c Sun Apr 5 17:31:07 2026 (r1932858)
@@ -129,28 +129,19 @@ svn_browse__model_move_selection(svn_bro
svn_error_t *
svn_browse__model_create(svn_browse__model_t **model_p,
+ svn_client_ctx_t *ctx,
const char *url,
svn_revnum_t revision,
apr_pool_t *result_pool,
apr_pool_t *scratch_pool)
{
svn_browse__model_t *model = apr_pcalloc(result_pool, sizeof(*model));
- svn_auth_baton_t *auth;
- svn_client_ctx_t *client;
svn_ra_session_t *session;
apr_pool_t *state_pool;
svn_browse__state_t *state;
const char *root, *relpath;
- /* Set up Authentication stuff. */
- SVN_ERR(svn_cmdline_create_auth_baton2(&auth, FALSE, NULL, NULL, NULL, FALSE,
- FALSE, FALSE, FALSE, FALSE, FALSE,
- NULL, NULL, NULL, result_pool));
-
- SVN_ERR(svn_client_create_context2(&client, NULL, result_pool));
- client->auth_baton = auth;
-
- SVN_ERR(svn_client_open_ra_session2(&session, url, NULL, client, result_pool,
+ SVN_ERR(svn_client_open_ra_session2(&session, url, NULL, ctx, result_pool,
scratch_pool));
SVN_ERR(svn_ra_get_repos_root2(session, &root, scratch_pool));
@@ -165,7 +156,7 @@ svn_browse__model_create(svn_browse__mod
model->root = apr_pstrdup(result_pool, root);
model->revision = revision;
- model->client = client;
+ model->client = ctx;
model->session = session;
model->current = state;
model->pool = result_pool;
Modified: subversion/trunk/subversion/svnbrowse/svnbrowse.c
==============================================================================
--- subversion/trunk/subversion/svnbrowse/svnbrowse.c Sun Apr 5 17:02:57 2026 (r1932857)
+++ subversion/trunk/subversion/svnbrowse/svnbrowse.c Sun Apr 5 17:31:07 2026 (r1932858)
@@ -218,6 +218,8 @@ static svn_error_t *
sub_main(int *code, int argc, const char *argv[], apr_pool_t *pool)
{
const char *url;
+ svn_client_ctx_t *client;
+ svn_auth_baton_t *auth;
svn_browse__model_t *ctx;
svn_browse__view_t *view;
svn_browse__opt_state_t opt_state = { 0 };
@@ -327,7 +329,16 @@ sub_main(int *code, int argc, const char
SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
- SVN_ERR(svn_browse__model_create(&ctx, url, SVN_INVALID_REVNUM, pool, pool));
+ /* Set up Authentication stuff. */
+ SVN_ERR(svn_cmdline_create_auth_baton2(&auth, FALSE, NULL, NULL, NULL, FALSE,
+ FALSE, FALSE, FALSE, FALSE, FALSE,
+ NULL, NULL, NULL, pool));
+
+ SVN_ERR(svn_client_create_context2(&client, NULL, pool));
+ client->auth_baton = auth;
+
+ SVN_ERR(svn_browse__model_create(&ctx, client, url, SVN_INVALID_REVNUM, pool,
+ pool));
/* init the display */
initscr();
Modified: subversion/trunk/subversion/svnbrowse/svnbrowse.h
==============================================================================
--- subversion/trunk/subversion/svnbrowse/svnbrowse.h Sun Apr 5 17:02:57 2026 (r1932857)
+++ subversion/trunk/subversion/svnbrowse/svnbrowse.h Sun Apr 5 17:31:07 2026 (r1932858)
@@ -124,6 +124,7 @@ svn_browse__model_move_selection(svn_bro
svn_error_t *
svn_browse__model_create(svn_browse__model_t **model_p,
+ svn_client_ctx_t *ctx,
const char *url,
svn_revnum_t revision,
apr_pool_t *result_pool,
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.