SharpSvn:无法获取有关网络共享上SVN工作副本的信息

时间:2011-03-10 14:15:38

标签: .net sharpsvn

我正在尝试获取位于网络共享上的SVN存储库工作副本的存储库URL:\\host\D\directory\

正在执行以下代码:

SvnClient svnClient = new SharpSvn.SvnClient();
SvnInfoEventArgs svnInfo;
svnClient.GetInfo(SvnTarget.FromString("\\\\host\\D\\directory\\"), out svnInfo);
Uri repositoryUrl = svnInfo.Uri;

我在 GetInfo()方法上遇到了这个错误:

'\host\D' does not exist
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.

Exception Details: SharpSvn.SvnException: '\host\D' does not exist

堆栈追踪:

[SvnException: '\host\D' does not exist]

[SvnInvalidNodeKindException: '\host\D' is not a working copy]
   SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, SvnException error) +232
   SharpSvn.SvnClientArgs.HandleResult(SvnClientContext client, svn_error_t* error) +80
   SharpSvn.SvnClient.Info(SvnTarget target, SvnInfoArgs args, EventHandler`1 infoHandler) +443
   SharpSvn.SvnClient.GetInfo(SvnTarget target, SvnInfoEventArgs& info) +117

你知道错误何时或者你知道一些更好的方法与SharpSvn一起使用?

3 个答案:

答案 0 :(得分:0)

这个“非工作副本”异常的原因可能是您的svn客户端的设置是使用_svn而不是.svn目录。

检查您在svn客户端设置下是否使用了正确的扩展名。

答案 1 :(得分:0)

Subversion 1.6在其某些代码路径中自动将\ path \ subpath \规范化为\ path \ subpath。这使得无法在UNC路径和/或驱动器的根目录中使用工作副本。

在Subversion 1.7中,这些问题已得到解决,现在完全支持这两种方案。 (但出于性能原因,我们仍然建议在本地硬盘上使用工作副本)

答案 2 :(得分:0)

这是SVN特定的异常(SvnInvalidNodeKindException),而不是Tortoise异常。但是如果您安装Tortoise,或者使用SharpSVN库来与.NET集成SVN,您可能会得到这个。

问题是你提交的路径长度太长。有两种奇怪的行为。如果您的本地工作副本的Windows长度太长,SVN将检出无效文件(不确定是否总是如此),但您不会得到例外。您将看到的另一个行为是,如果您尝试通过提交替换文件,SVN将抛出此异常(SvnInvalidNodeKindException)并将说['\\folder\\folder\\' is not a working copy并且不会提交任何内容。

解决方案:

缩短通向更短的路径。我不知道最大值是多少,但我想它是基于Windows API的文件路径上的最大长度。微软从未解决这个问题,今天仍然是一个问题。我很久以前就在Windows上发布了这个问题,但找不到帖子。