How do I use SharpSVN to programatically “add to ignore list” for a folder

StackOverflow https://stackoverflow.com/questions/2315557

  •  22-09-2019
  •  | 
  •  

문제

How do I use SharpSVN to programatically to add a folder to the ignore list?

EDIT: Attempted:
Here's what I've tried

svnClient.GetProperty(new SvnUriTarget("svn://svn.foo.com/" + DatabaseName + "/"), SvnPropertyNames.SvnIgnore, out ignores);
ignores += " Artifacts";
var args = new SvnSetPropertyArgs() { BaseRevision = ???, LogMessage = "update ignore list" };
svnClient.SetProperty(new Uri("svn://svn.foo.com/" + DatabaseName + "/"), SvnPropertyNames.SvnIgnore, ignores, args);

But I don't know how to get the BaseRevision (I can get it manually, and that works, but all the combinations of GetProperty I tried don't seem to give it to me.)

SOLUTION: Based on Bert's Answer

SvnGetPropertyArgs getArgs = new SvnGetPropertyArgs(){};
string ignores = "Artifacts";
string result;
if(svnClient.GetProperty(new SvnUriTarget("svn://svn.foo.com/" + ProjectName + "/trunk/"), SvnPropertyNames.SvnIgnore,out result))
{
    ignores = result + " Artifacts"; //TODO: check for existing & tidy formatting.
}
svnClient.SetProperty(UncPath.TrimEnd('\\'), SvnPropertyNames.SvnIgnore, ignores);
SvnCommit(svnClient);
도움이 되었습니까?

해결책

The ignore list is stored in the 'svn:ignores' property on the parent directory that contains the to be ignored file/directory. (See the Subversion book or svn help propset)

So to add an item you have to get the original property value (if one exists) and then add the extra item separated with whitespace. The functions on SvnClient for this are GetProperty and SetProperty().

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top