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

Re: How to create a branch/tag using the SVN API?

From: Jochen Hebbrecht <jochen_at_pipa.be>
Date: Wed, 28 Jul 2010 15:03:19 +0200

On 07/28/2010 02:52 PM, C. Michael Pilato wrote:
> Yes, you're trying to use a mutable tree (one based on a txn_root) as the
> source of a copy, which is disallowed. For the *source* root, you need to
> use svn_fs_revision_root(). (Keep doing as you are above, though, for the
> copy target root.)
>

Michael,

Thanks !!! Now it works! :-)

If somebody else is interested, this is the code!

-----------------
// init rep
$svn_repos = svn_repos_open("##PATH_TO_REPO##");
$svn_fs = svn_repos_fs($svn_repos);

// init from resource
$svn_fs_root = svn_fs_revision_root($svn_fs, svn_fs_youngest_rev($svn_fs));

// init to resource
$svn_tx = svn_fs_begin_txn2($svn_fs, svn_fs_youngest_rev($svn_fs));
$svn_tx_root = svn_fs_txn_root($svn_tx);

// execute copy command
svn_fs_copy( $svn_fs_root, "##FROM_PATH##", $svn_tx_root, "##TO_PATH##");

// commit
svn_repos_fs_commit_txn($svn_tx);
-----------------

Jochen
Received on 2010-07-28 15:04:01 CEST

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

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