Hello,

As I understand you want to export a file from a remote repository, so I assume 
that you have

SVNURL fileUrl; // URL of the file to export

SVNKit has 2 client level APIs: the old one based on SVNXXXClient classes and 
the new one
based on SvnOperationFactory class. I would recommend you to use the new one, 
as it is simplier and 
more extendable to the future SVN features (but both APIs are operational and 
work with all working 
copy formats 1.4-1.7).

To export a file from 'fileUrl' to 

final File file = new File("c:/temp/xyz.components.war"); //always prefer '/' 
separator in SVNKit 
because it is easy to forget that one should use  '\\' instead of '\' in paths

final SvnOperationFactory svnOperationFactory = new SvnOperationFactory();
try{
    final SvnExport export = svnOperationFactory.createExport();
    export.setSource(SvnTarget.fromURL(fileUrl));
    export.setSingleTarget(SvnTarget.fromFile(file));
    export.setForce(true); //overwrite an existing file
    final Long revisionExported = export.run();
} finally {
    svnOperationFactory.dispose(); //close connection pool associted with this 
object
}

But if you really want to use the old API, use this code:

final long revisionExported = updateClient.doExport(fileUrl, file, 
SVNRevision.HEAD, SVNRevision.HEAD, 
null, true, SVNDepth.INFINITY);

doExport(Flie, File, ...) is also possible to export from a working copy, but I 
don't know any real 
life use-case for it. So I think this and single '\' that was treated as tab 
character ('\t') caused 
the exception.

--
Dmitry Pavlenko,
TMate Software,
http://subgit.com/ - git-svn bridge

> Hi folks,
> 
> I'm a little new to subversion and SVNKit, so apologies for the noob
> posting.  I'm currently looking to access a remote SVN repository and
> export a copy of a given file on a release branch to my local drive.  My
> research suggests that I can use SVNUpdateClient.doExport() for this, but
> I'm not getting a result and I suspect I'm missing something.  The syntax
> I'm using is:
> 
> long svnStatus = updateClient.doExport( new
> File("rootDir/trunk/ADF/deploy/xyz.components.war"), new
> File("c:\temp\xyz.components.war"), SVNRevision.create(latestRevision),
> SVNRevision.create(latestRevision),null, true, SVNDepth.INFINITY);
> 
> Instead of returning a value, it is throwing an exception that I can't get
> any details for.
> 
> I've stripped out most of the code because I'm calling it from server-side
> javascript in IBM XPages which allows you to call the java classes from
> within javascript, and the syntax would be confusing.  I can verify that I
> can access the reporitory and get the revision number, so SVNKit is
> installed and working.
> 
> Am I doing it wrong?  Any help would be greatly appreciated.
> 
> Cheers,
> 
> Brendan
> 
> 
> 
> 
> 
> --
> View this message in context:
> http://subversion.1072662.n5.nabble.com/doExport-to-copy-single-file-help-
> with-syntax-tp176609.html Sent from the SVNKit - Users mailing list archive
> at Nabble.com.

Reply via email to