Re: problem with SVNWCClient doAdd method

View: New views
2 Messages — Rating Filter:   Alert me  

Parent Message unknown Re: problem with SVNWCClient doAdd method

by Alexander Sinyushkin :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello, Archana.

First of all I would like to ask you to write such questions to our
mailing list (svnkit-users@...), not personally to one of us.

The second note: when reporting a problem, please, try to be more
concrete in explaining your troubles. For example, if you get an
exception, attach a stack trace for this exception. A debug log will
be appreciated, too (http://svnkit.com/kb/user-guide-debug-logs.html).

Now concerning your problem. In your code I see that you are trying to
add a file although at the same time you set 'mkdir' flag to true.
Why that? This flag must be used for directories only.

>  File f = new File("C:/check/hi.txt");
>  clientManager.getWCClient().doAdd(f, false, true, true,false);

So, I think you get this exception telling you where the problem is.

org.tmatesoft.svn.core.SVNException: svn: Cannot create new directory 'G:\test1\newT.txt'
        at org.tmatesoft.svn.core.internal.wc.SVNErrorManager.error(SVNErrorManager.java:49)
        at org.tmatesoft.svn.core.wc.SVNWCClient.doAdd(SVNWCClient.java:983)
        at org.tmatesoft.svn.core.wc.SVNWCClient.doAdd(SVNWCClient.java:910)
        at Test.main(Test.java:97)

       
--
Alexander Sinyushkin,
TMate Software,
http://svnkit.com/ - Java [Sub]Versioning Library!


Chennai wrote:

   
 
 
> Hello sir,
 
>  
 
> I’m having a problem with the new svncli.jar SVNWCClient doAdd method.
 
> I had no problem with the old javasvn jar which I was using earlier.
 
>  I’m sending my code and the two jars.
 
> Is there any change that has been made in the new jar ..
 
> I’m sending the code so can you point out the error in my code.
 
>  
 
> try {
 
>             DAVRepositoryFactory.setup();
 
>             SVNRepositoryFactoryImpl.setup();
 
>       SVNRepository repository =
> SVNRepositoryFactory.create(SVNURL.parseURIEncoded("http://localhost/svn/testrepos"));
 
>             ISVNAuthenticationManager authManager = SVNWCUtil
 
>                     .createDefaultAuthenticationManager("mdad", "mdad");
 
>             repository.setAuthenticationManager(authManager);
 
>             repository.testConnection();
 
>             ISVNOptions options =
> SVNWCUtil.createDefaultOptions(true);
 
>             SVNClientManager clientManager =
> SVNClientManager.newInstance(options, "mdad", "mdad");
 
>             File f = new File("C:/check/hi.txt");
 
>             clientManager.getWCClient().doAdd(f, false, true, true,false);
 
>         } catch (Exception e) {
 
>             e.printStackTrace();
 
>         }
 
>  
 
> Thanking You!
 
> Regards,
 
> Archana
 
>  
 
 
>     DISCLAIMER:
>
> -----------------------------------------------------------------------------------------------------------------------
 

>  The contents of this e-mail and any attachment(s) are
> confidential and intended for the named recipient(s) only.
>  It shall not attach any liability on the originator or HCL or
> its affiliates. Any views or opinions presented in
>  this email are solely those of the author and may not
> necessarily reflect the opinions of HCL or its affiliates.
>  Any form of reproduction, dissemination, copying, disclosure,
> modification, distribution and / or publication of
>  this message without the prior written consent of the author of
> this e-mail is strictly prohibited. If you have
>  received this email in error please delete it and notify the
> sender immediately. Before opening any mail and
>  attachments please check them for viruses and defect.
 
>
> -----------------------------------------------------------------------------------------------------------------------
   



---------------------------------------------------------------------
To unsubscribe, e-mail: svnkit-users-unsubscribe@...
For additional commands, e-mail: svnkit-users-help@...


Re: problem with SVNWCClient doAdd method

by quadelirus :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

I think this problem might be partly due to the documentation at http://svn4j.org/javadoc/org/tmatesoft/svn/core/wc/SVNWCClient.html#doAdd(java.io.File,%20boolean,%20boolean,%20boolean,%20org.tmatesoft.svn.core.SVNDepth,%20boolean,%20boolean)

Notice that a quick reading of the documentation for doAdd has this line:

mkdir - does not throw exceptions on already-versioned items

A more careful reading, of course, reveals that the mkdir documentation has just been misplaced:

force - if true
mkdir - does not throw exceptions on already-versioned items

and the mkdir explanation above is actually for the force parameter.

It is quite confusing, however, and I had the same error as the original poster before finding this post via google and then reading the documentation a little more carefully to recognize the error.

I would submit that this documentation needs to be fixed.