svnkit - How to get all files and directories from the SVN repository using java -
i have task complete. want connect svn repository , have download directories , files svn local system using java code. new , trying use example read single file content http://svnkit.com/kb/dev-guide-commit-operation.html giving exception error while fetching file contents , properties: svn: e170001: authentication required 'https://netspurt.unfuddle.com:443 unfuddle subversion repository'. please can explain detail
bellow code worked me:
private static svnclientmanager ourclientmanager; public void downloadworkingcopy(string svnlocation,string svnusername,string svnpassword){ string locationforsvnproj="c:\\svnloc"; defaultsvnoptions options = svnwcutil.createdefaultoptions(true); ourclientmanager = svnclientmanager.newinstance(options, svnusername, svnpassword); svnupdateclient updateclient = ourclientmanager.getupdateclient( ); updateclient.setignoreexternals( false ); svnrevision rev=svnrevision.head; file file=new file(locationforsvnproj); try{ long revision1=updateclient.docheckout( svnurl.parseuriencoded(svnlocation) ,file , rev , rev , true); }catch(exception e){e.printstacktrace();} }
"authentication required" problem means server requires authentication didn't provide correct isvnauthenticationmanager
implementation svnclientmanager
. svnkit supports different ways of authentication.
if know credentials are, , fixed, can use basicauthenticationmanager
implementation.
if want use credentials, stored in ~/.subversion
directory, use defaultsvnauthenticationmanager
implementation (there's convenient method construct it:svnwcutil.createdefaultauthenticationmanager()
note corresponds subversion commands --non-interactive
option). @ svncommandenvironment#createclientauthenticationmanager() implementation if need authentication manager allow enter password console.
and i'd notice svnclientmanager part of obsolete (though still supported). instead prefer svnoperationfactory class in answer, has setauthenticationmanager() setter.
i'm 1 of svnkit developers if matters.
Comments
Post a Comment