Hi,

I did the following and it works for me.

final SVNURL srcURL = SVNURL.parseURIEncoded(location + from);
            final SVNURL dstURL = SVNURL.parseURIEncoded(location + to);

            final SVNCopySource source = new SVNCopySource(SVNRevision.HEAD,
SVNRevision.HEAD, srcURL);
            copyClient.doCopy(new SVNCopySource[] { source }, dstURL, false,
false, true, "Create new Branch",
                              null);

Now, I am trying to do the reverse operation, merge a branch to trunk but I
did found how to do it

Regards
Ignacio


rapidrelease wrote:
> 
> 
> I want to create a branch from trunk on the fly using svnkit. Since the
> google did not return anything and the api is a bit hard to grasp i want
> to ask this here.
> 
> i wrote this copy method, but it doesnt really work.
> 
>       public void copySvnUrl(String sourceUrl, String destinationUrl) throws
> SVNException{
>               
>               DAVRepositoryFactory.setup();
>               ISVNOptions options = SVNWCUtil.createDefaultOptions(true);
>               SVNURL urlObj = SVNURL.parseURIDecoded(sourceUrl);
>               SVNURL toUrl =  SVNURL.parseURIDecoded(destinationUrl);
>               SVNRepository repository = SVNRepositoryFactory.create(urlObj);
>               
>               String password = propertyManager.getSvnPassword();
>               String user = propertyManager.getSvnUser();
>               
>               ISVNAuthenticationManager authManager =
> SVNWCUtil.createDefaultAuthenticationManager(user,password);
>               repository.setAuthenticationManager(authManager);
>               
>               SVNCopyClient copyClient = new SVNCopyClient(authManager, 
> options);
> 
>               SVNDirEntry entry = repository.info(sourceUrl, -1); 
>               SVNCopySource copySource = new 
> SVNCopySource(SVNRevision.UNDEFINED,
> SVNRevision.HEAD, entry.getURL());
>               
>               copyClient.doCopy(new SVNCopySource[] { copySource }, toUrl, 
> true, true,
> false,"", null);              
>       }
> 
> I get a nullpointerexception because this line returns null:
> SVNDirEntry entry = repository.info(sourceUrl, -1);
> 
> how can i get my method to work?
> 
> thanks!
> 

-- 
View this message in context: 
http://old.nabble.com/how-to-to-create-a-branch-from-trunk-on-the-fly-using-svnkit-tp32809839p32969729.html
Sent from the SVNKit - Users mailing list archive at Nabble.com.


Reply via email to