[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: svn_repos_fs_commit_txn error

From: Bert Huijben <bert_at_qqmail.nl>
Date: Tue, 24 Nov 2015 11:01:00 +0100

> -----Original Message-----
> From: Branko Čibej [mailto:brane_at_apache.org]
> Sent: dinsdag 24 november 2015 06:13
> To: users_at_subversion.apache.org
> Subject: Re: svn_repos_fs_commit_txn error
>
> On 23.11.2015 21:01, Ren Wang wrote:
> > I got an error for creating a new directory to the repository. Strange to me
> > is that enve the code failed at the svn_repos_fs_commit_txn, but the
> > directory got created:
> >
> >
> >
> >
> >
> > 1) Open repository, repos
> >
> > 2) Get the latest revision, youngest
> >
> > 3) Do the following:
> >
> > svn_fs_txn_t *txn;
> >
> > svn_fs_root_t *txn_root;
> >
> > apr_pool_t *subpool = svn_pool_create(pool);
> >
> > SVN_ERR(svn_repos_fs_begin_txn_for_commit(&txn, &repos,
> youngest_rev,
> > "UncleYinan", "log msg", subpool));
> >
> > SVN_ERR(svn_fs_txn_root(&txn_root, txn, subpool));
> >
> > SVN_ERR(svn_fs_make_dir(txn_root, directoryPath, subpool));
> >
> > SVN_ERR(svn_repos_fs_commit_txn(NULL, c->repos, &youngest_rev, txn,
> > subpool)); -- failed here

This may be 100% expected... see the documentation of this function.
Especially the part
[[
* A successful commit is indicated by a valid revision value in @a
 * *new_rev, not if svn_fs_commit_txn() returns an error, which can
 * occur during its post commit FS processing. If the transaction was
 * not committed, then return the associated error and do not execute
 * the post-commit hook.
]]

For completeness I copied the documentation from svn_repos.h here:

/** Like svn_fs_commit_txn(), but invoke the @a repos' pre- and
 * post-commit hooks around the commit. Use @a pool for any necessary
 * allocations.
 *
 * If the pre-commit hook fails, do not attempt to commit the
 * transaction and throw the original error to the caller.
 *
 * A successful commit is indicated by a valid revision value in @a
 * *new_rev, not if svn_fs_commit_txn() returns an error, which can
 * occur during its post commit FS processing. If the transaction was
 * not committed, then return the associated error and do not execute
 * the post-commit hook.
 *
 * If the commit succeeds the post-commit hook is executed. If the
 * post-commit hook returns an error, always wrap it with
 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED; this allows the caller to
 * find the post-commit hook error in the returned error chain. If
 * both svn_fs_commit_txn() and the post-commit hook return errors,
 * then svn_fs_commit_txn()'s error is the parent error and the
 * SVN_ERR_REPOS_POST_COMMIT_HOOK_FAILED wrapped error is the child
 * error.
 *
 * @a conflict_p, @a new_rev, and @a txn are as in svn_fs_commit_txn().
 */
svn_error_t *
svn_repos_fs_commit_txn(const char **conflict_p,
                        svn_repos_t *repos,
                        svn_revnum_t *new_rev,
                        svn_fs_txn_t *txn,
                        apr_pool_t *pool);

--
    Bert
Received on 2015-11-24 11:01:15 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.