You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@subversion.apache.org by da...@apache.org on 2010/09/21 22:07:37 UTC
svn commit: r999587 -
/subversion/branches/atomic-revprop/subversion/svnsync/main.c
Author: danielsh
Date: Tue Sep 21 20:07:37 2010
New Revision: 999587
URL: http://svn.apache.org/viewvc?rev=999587&view=rev
Log:
On the atomic-revprop branch:
Factor out some common code.
While this isn't strictly necessary yet (but only for possible followup
commits), this commit serves the secondary purpose of testing ehu's
buildslave's configuration.
* subversion/svnsync/main.c
(open_target_session): New function.
(initialize_cmd, synchronize_cmd, copy_revprops_cmd, info_cmd):
Move code to open_target_session().
Modified:
subversion/branches/atomic-revprop/subversion/svnsync/main.c
Modified: subversion/branches/atomic-revprop/subversion/svnsync/main.c
URL: http://svn.apache.org/viewvc/subversion/branches/atomic-revprop/subversion/svnsync/main.c?rev=999587&r1=999586&r2=999587&view=diff
==============================================================================
--- subversion/branches/atomic-revprop/subversion/svnsync/main.c (original)
+++ subversion/branches/atomic-revprop/subversion/svnsync/main.c Tue Sep 21 20:07:37 2010
@@ -756,6 +756,11 @@ make_subcommand_baton(opt_baton_t *opt_b
return b;
}
+static svn_error_t *
+open_target_session(svn_ra_session_t **to_session_p,
+ subcommand_baton_t *baton,
+ apr_pool_t *pool);
+
/*** `svnsync init' ***/
@@ -895,9 +900,7 @@ initialize_cmd(apr_getopt_t *os, void *b
_("Path '%s' is not a URL"), from_url);
baton = make_subcommand_baton(opt_baton, to_url, from_url, 0, 0, pool);
- SVN_ERR(svn_ra_open4(&to_session, NULL, baton->to_url, NULL,
- &(baton->sync_callbacks), baton, baton->config, pool));
- SVN_ERR(check_if_session_is_at_repos_root(to_session, baton->to_url, pool));
+ SVN_ERR(open_target_session(&to_session, baton, pool));
if (opt_baton->disable_locking)
SVN_ERR(do_initialize(to_session, baton, pool));
else
@@ -977,6 +980,23 @@ open_source_session(svn_ra_session_t **f
return SVN_NO_ERROR;
}
+/* Set *TARGET_SESSION_P to an RA session associated with the target
+ * repository of the synchronization.
+ */
+static svn_error_t *
+open_target_session(svn_ra_session_t **target_session_p,
+ subcommand_baton_t *baton,
+ apr_pool_t *pool)
+{
+ svn_ra_session_t *target_session;
+ SVN_ERR(svn_ra_open4(&target_session, NULL, baton->to_url, NULL,
+ &(baton->sync_callbacks), baton, baton->config, pool));
+ SVN_ERR(check_if_session_is_at_repos_root(target_session, baton->to_url, pool));
+
+ *target_session_p = target_session;
+ return SVN_NO_ERROR;
+}
+
/* Replay baton, used during sychnronization. */
typedef struct {
svn_ra_session_t *from_session;
@@ -1395,9 +1415,7 @@ synchronize_cmd(apr_getopt_t *os, void *
}
baton = make_subcommand_baton(opt_baton, to_url, from_url, 0, 0, pool);
- SVN_ERR(svn_ra_open4(&to_session, NULL, baton->to_url, NULL,
- &(baton->sync_callbacks), baton, baton->config, pool));
- SVN_ERR(check_if_session_is_at_repos_root(to_session, baton->to_url, pool));
+ SVN_ERR(open_target_session(&to_session, baton, pool));
if (opt_baton->disable_locking)
SVN_ERR(do_synchronize(to_session, baton, pool));
else
@@ -1631,9 +1649,7 @@ copy_revprops_cmd(apr_getopt_t *os, void
baton = make_subcommand_baton(opt_baton, to_url, from_url,
start_rev, end_rev, pool);
- SVN_ERR(svn_ra_open4(&to_session, NULL, baton->to_url, NULL,
- &(baton->sync_callbacks), baton, baton->config, pool));
- SVN_ERR(check_if_session_is_at_repos_root(to_session, baton->to_url, pool));
+ SVN_ERR(open_target_session(&to_session, baton, pool));
if (opt_baton->disable_locking)
SVN_ERR(do_copy_revprops(to_session, baton, pool));
else
@@ -1675,9 +1691,7 @@ info_cmd(apr_getopt_t *os, void *b, apr_
/* Open an RA session to the mirror repository URL. */
baton = make_subcommand_baton(opt_baton, to_url, NULL, 0, 0, pool);
- SVN_ERR(svn_ra_open4(&to_session, NULL, baton->to_url, NULL,
- &(baton->sync_callbacks), baton, baton->config, pool));
- SVN_ERR(check_if_session_is_at_repos_root(to_session, baton->to_url, pool));
+ SVN_ERR(open_target_session(&to_session, baton, pool));
/* Verify that the repos has been initialized for synchronization. */
SVN_ERR(svn_ra_rev_prop(to_session, 0, SVNSYNC_PROP_FROM_URL,