Skip to content

Commit bc7b9b7

Browse files
committed
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. git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1932858 13f79535-47bb-0310-9956-ffa450edef68
1 parent fafc167 commit bc7b9b7

3 files changed

Lines changed: 16 additions & 13 deletions

File tree

subversion/svnbrowse/model.c

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -129,28 +129,19 @@ svn_browse__model_move_selection(svn_browse__model_t *model, int delta)
129129

130130
svn_error_t *
131131
svn_browse__model_create(svn_browse__model_t **model_p,
132+
svn_client_ctx_t *ctx,
132133
const char *url,
133134
svn_revnum_t revision,
134135
apr_pool_t *result_pool,
135136
apr_pool_t *scratch_pool)
136137
{
137138
svn_browse__model_t *model = apr_pcalloc(result_pool, sizeof(*model));
138-
svn_auth_baton_t *auth;
139-
svn_client_ctx_t *client;
140139
svn_ra_session_t *session;
141140
apr_pool_t *state_pool;
142141
svn_browse__state_t *state;
143142
const char *root, *relpath;
144143

145-
/* Set up Authentication stuff. */
146-
SVN_ERR(svn_cmdline_create_auth_baton2(&auth, FALSE, NULL, NULL, NULL, FALSE,
147-
FALSE, FALSE, FALSE, FALSE, FALSE,
148-
NULL, NULL, NULL, result_pool));
149-
150-
SVN_ERR(svn_client_create_context2(&client, NULL, result_pool));
151-
client->auth_baton = auth;
152-
153-
SVN_ERR(svn_client_open_ra_session2(&session, url, NULL, client, result_pool,
144+
SVN_ERR(svn_client_open_ra_session2(&session, url, NULL, ctx, result_pool,
154145
scratch_pool));
155146

156147
SVN_ERR(svn_ra_get_repos_root2(session, &root, scratch_pool));
@@ -165,7 +156,7 @@ svn_browse__model_create(svn_browse__model_t **model_p,
165156

166157
model->root = apr_pstrdup(result_pool, root);
167158
model->revision = revision;
168-
model->client = client;
159+
model->client = ctx;
169160
model->session = session;
170161
model->current = state;
171162
model->pool = result_pool;

subversion/svnbrowse/svnbrowse.c

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -218,6 +218,8 @@ static svn_error_t *
218218
sub_main(int *code, int argc, const char *argv[], apr_pool_t *pool)
219219
{
220220
const char *url;
221+
svn_client_ctx_t *client;
222+
svn_auth_baton_t *auth;
221223
svn_browse__model_t *ctx;
222224
svn_browse__view_t *view;
223225
svn_browse__opt_state_t opt_state = { 0 };
@@ -327,7 +329,16 @@ sub_main(int *code, int argc, const char *argv[], apr_pool_t *pool)
327329

328330
SVN_ERR(svn_config_ensure(opt_state.config_dir, pool));
329331

330-
SVN_ERR(svn_browse__model_create(&ctx, url, SVN_INVALID_REVNUM, pool, pool));
332+
/* Set up Authentication stuff. */
333+
SVN_ERR(svn_cmdline_create_auth_baton2(&auth, FALSE, NULL, NULL, NULL, FALSE,
334+
FALSE, FALSE, FALSE, FALSE, FALSE,
335+
NULL, NULL, NULL, pool));
336+
337+
SVN_ERR(svn_client_create_context2(&client, NULL, pool));
338+
client->auth_baton = auth;
339+
340+
SVN_ERR(svn_browse__model_create(&ctx, client, url, SVN_INVALID_REVNUM, pool,
341+
pool));
331342

332343
/* init the display */
333344
initscr();

subversion/svnbrowse/svnbrowse.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,7 @@ svn_browse__model_move_selection(svn_browse__model_t *model,
124124

125125
svn_error_t *
126126
svn_browse__model_create(svn_browse__model_t **model_p,
127+
svn_client_ctx_t *ctx,
127128
const char *url,
128129
svn_revnum_t revision,
129130
apr_pool_t *result_pool,

0 commit comments

Comments
 (0)