2014-05-06 221 views
1

下面是从工作副本(祖先文件夹)中排除文件夹的一些代码。当我在该行中断时,“r”显示System.InvalidOperationException。排除工作吗?使用SharpSVN .NET库时,我可以选择什么选项。对于任何其他深度类型,我都没有遇到与排除有关的任何问题。SharpSVN:SvnDepth.Exclude抛出异常

  SvnUpdateArgs updateArgs2 = new SvnUpdateArgs(); 
      updateArgs2.Depth = SvnDepth.Exclude; 
      SvnUpdateResult r = null; 
      client.Update(path, updateArgs2, out r); 
      string x = r.ToString(); 

r.GetType().GenericParemeterAttributes= “ 'r.GetType()。GenericParameterAttributes' 扔 'System.InvalidOperationException' 类型的异常”

r.GetType().GenericParemeterAttributes.base=“方法可以仅被称为上的键入,其Type.IsGenericParameter为true“。

我不确定它指的是哪种类型。

===========

编辑:

这个工作!

SvnUpdateArgs updateArgs2 = new SvnUpdateArgs(); 
       updateArgs2.Depth = SvnDepth.Exclude; 
       updateArgs2.KeepDepth = true; 
       SvnUpdateResult r = null; 
       client.Update(path, updateArgs2, out r); 

回答

1

要看你的具体异常,我真的需要一个堆栈跟踪,而不仅仅是一些上下文错误。

要排除路径,您应该将SvnUpdateArgs上的.KeepDepth设置为true。

没有.KeepDepth你的代码就相当于

$ svn up --depth exclude PATH 

这将产生一个错误。

与.KeepDepth这将是

$ svn up --set-depth exclude PATH 

,您尝试应用。

在SharpSvn更容易使用稍微低的水平

SvnClient.CropWorkingCopy(PATH, SvnDepth.Excluded) 

因为这使得它更清楚你试图做什么。

+0

当我使用此代码时,出现此错误:“您只能裁剪节点到空和文件之间的深度。参数名称:toDepth ...实际值为Exclude。” – MacGyver

+0

添加“KeepDepth = true”为原始代码工作!非常感谢你!! – MacGyver

+0

你知道我可以在哪里下载SharpSVN的实际源代码吗?什么网站是该图书馆的来源? – MacGyver