java - How to delete files from SVN using SVN kit jar -


i need delete file in svn repository using svn kit jar.

i tried

svnfileutil.deletefile(new file("url"));

it not throw error. not able delete file given in url.

my code:

       repository = svnrepositoryfactory.create(svnurl.parseuridecoded(url));         //create authentication data         isvnauthenticationmanager authmanager =            svnwcutil.createdefaultauthenticationmanager(                    prop.getproperty("svnusername"),                     prop.getproperty("svnpassword"));               repository.setauthenticationmanager(authmanager);          //need identify latest revision         long latestrevision = repository.getlatestrevision();         system.out.println("repository latest revision: " + latestrevision);          //create client manager , set authentication         svnclientmanager ourclientmanager = svnclientmanager.newinstance();         ourclientmanager.setauthenticationmanager(authmanager);         //use svnupdateclient export         svncommitclient commitclient = ourclientmanager.getcommitclient();         commitclient.setignoreexternals(false);    svnfileutil.deletefile(new file(urln));        svncommitclient client = new svncommitclient(authmanager, null);         svncommitinfo info; 

@manuelcr right, , alternatively can use high level code:

    final svnoperationfactory svnoperationfactory = new svnoperationfactory();     try {         final svnremotedelete remotedelete = svnoperationfactory.createremotedelete();         remotedelete.setsingletarget(svntarget.fromurl(fileurl));         remotedelete.setcommitmessage("delete file repository");         final svncommitinfo commitinfo = remotedelete.run();         if (commitinfo != null) {             final long newrevision = commitinfo.getnewrevision();             system.out.println("removed file, revision " + newrevision + " created");         }     } {         svnoperationfactory.dispose();     } 

Comments

Popular posts from this blog

basic authentication with http post params android -

vb.net - Virtual Keyboard commands -

How to get multiresult with multicondition in Sql Server -