Skip to content

Commit 87bbab5

Browse files
committed
svnbrowse: Reparent session to the root URL of the repository so we can go
upper than a directory we intially started browsing with. * subversion/svnbrowse/svnbrowse.c (model_create): Implement reparenting. Don't forget to split the URL and put the part relative to root into model->relpath (in the right pool). git-svn-id: https://svn.apache.org/repos/asf/subversion/trunk@1932747 13f79535-47bb-0310-9956-ffa450edef68
1 parent c590aa1 commit 87bbab5

1 file changed

Lines changed: 9 additions & 3 deletions

File tree

subversion/svnbrowse/svnbrowse.c

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,7 @@ model_create(svn_browse__model_t **model_p,
138138
svn_ra_session_t *session;
139139
apr_pool_t *state_pool;
140140
svn_browse__state_t *state;
141+
const char *root, *relpath;
141142

142143
/* Set up Authentication stuff. */
143144
SVN_ERR(svn_cmdline_create_auth_baton2(&auth, FALSE, NULL, NULL, NULL, FALSE,
@@ -150,12 +151,17 @@ model_create(svn_browse__model_t **model_p,
150151
SVN_ERR(svn_client_open_ra_session2(&session, url, NULL, client, result_pool,
151152
scratch_pool));
152153

154+
SVN_ERR(svn_ra_get_repos_root2(session, &root, scratch_pool));
155+
SVN_ERR(svn_ra_reparent(session, root, scratch_pool));
156+
157+
relpath = svn_uri_skip_ancestor(root, url, scratch_pool);
158+
153159
/* the state should be in a separate pool so it's safe to free it */
154160
state_pool = svn_pool_create(result_pool);
155-
SVN_ERR(state_create(&state, session, "", revision, state_pool,
161+
SVN_ERR(state_create(&state, session, relpath, revision, state_pool,
156162
scratch_pool));
157-
/* TODO: we must use the repository root URL */
158-
SVN_ERR(svn_ra_get_session_url(session, &model->root, result_pool));
163+
164+
model->root = apr_pstrdup(result_pool, root);
159165
model->revision = revision;
160166
model->client = client;
161167
model->session = session;

0 commit comments

Comments
 (0)