Add file using SharpSVN
Posted
by jan
on Stack Overflow
See other posts from Stack Overflow
or by jan
Published on 2009-06-08T13:20:59Z
Indexed on
2010/06/07
23:02 UTC
Read the original article
Hit count: 897
Hi,
I would like to add all unversioned files under a directory to SVN using SharpSVN.
I tried regular svn commands on the command line first:
C:\temp\CheckoutDir> svn status -v
I see all subdirs, all the files that are already checked in, a few new files labeled "?", nothing with the "L" lock indication
C:\temp\CheckoutDir> svn add . --force
This results in all new files in the subdirs ,that are already under version control themselves, to be added.
I'd like to do the same using SharpSVN. I copy a few extra files into the same directory and run this code:
...
using ( SharpSvn.SvnClient svn = new SvnClient() )
{
SvnAddArgs saa = new SvnAddArgs();
saa.Force = true;
saa.Depth = SvnDepth.Infinity;
try
{
svn.Add(@"C:\temp\CheckoutDir\." , saa);
}
catch (SvnException exc)
{
Log(@"SVN Exception: " + exc.Message + " - " + exc.File);
}
}
But an SvnException is raised:
- SvnException.Message: Working copy 'C:\temp\CheckoutDir' locked
- SvnException.File: ..\..\..\subversion\libsvn_wc\lock.c"
No other svnclient instance is running in my code, I also tried calling
svn.cleanup()
right before the Add, but to no avail.
Since the documentation is rather vague ;), I was wondering if anyone here knew the answer.
Thanks in advance!
Jan
© Stack Overflow or respective owner