0
votes

I want to add a file to SVN. I am doing it from a java code as below

ourClientManager.getWCClient().doAdd(file, false, false, true , true);

using SVNWCClient.

the file is already there in svn, so i get an error "is already under version control".

Is there any method available which will say that the file is already there in svn...somehting like isAlreadyUnderVersionControl(file).

2
You could place your call within a try-catch block and catch the exception that is thrown if the file is already added to the repository.Till Helge

2 Answers

1
votes

I tried the below code, and it seems to be working.

final SVNStatus info = ourClientManager.getStatusClient().doStatus(file, false); 
if (!info.isVersioned()) {
    //call doAdd
} 
0
votes

I'm not familiar with that library, but it sounds like the doInfo() method might tell you what you need (it throws an exception if the path is not under version control).