如何使用SharpSVN编程将文件夹添加到忽略列表?
编辑:尝试:
这是我尝试过的
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);但是我不知道如何获得BaseRevision (我可以手动获得它,这是可行的,但是我尝试过的所有GetProperty组合似乎都没有提供给我)。
解决方案:基于伯特的答案
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);发布于 2010-02-24 12:36:55
忽略列表存储在父目录中包含要忽略的文件/目录的‘svn:忽略’属性中。(见颠覆书或svn help propset)
因此,要添加一个项,您必须获得原始属性值(如果存在的话),然后添加用空格分隔的额外项。SvnClient上的函数是GetProperty和SetProperty()。
https://stackoverflow.com/questions/2315557
复制相似问题