SharpSvn:无法获取有关网络共享上的 SVN 工作副本的信息
我正在尝试获取 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;
我在 < strong>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 一起使用的更好方法吗?
I'm trying to get repository URL of working copy of SVN repository, which is located on network share: \\host\D\directory\
Following code is being executed:
SvnClient svnClient = new SharpSvn.SvnClient();
SvnInfoEventArgs svnInfo;
svnClient.GetInfo(SvnTarget.FromString("\\\\host\\D\\directory\\"), out svnInfo);
Uri repositoryUrl = svnInfo.Uri;
And I got this error on GetInfo() method:
'\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
Stack Trace:
[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
Do you know when error lies or maybe you know some better method to use with SharpSvn?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
这个“不是工作副本”异常的原因可能是您的 svn 客户端的设置使用 _svn 而不是 .svn 目录。
检查您在 svn 客户端设置下是否使用了正确的扩展。
The cause of this 'not a working copy' exception may be that the setting of your svn client is using _svn instead of .svn directories.
Check that you are using the right extension under your svn client settings.
Subversion 1.6 自动将某些代码路径中的 \path\subpath\ 规范化为 \path\subpath。这使得无法在 UNC 路径和/或驱动器根目录中使用工作副本。
在 Subversion 1.7 中,这些问题已得到解决,并且现在完全支持这两种情况。 (但出于性能原因,我们仍然建议在本地硬盘上使用工作副本)
Subversion 1.6 automatically normalized \path\subpath\ to \path\subpath in some of its code paths. This made it impossible to use working copies on UNC paths and/or in the root of a drive.
In Subversion 1.7 these issues were resolved and both scenarios are now fully supported. (But for performance reasons we still recommend using working copies on a local harddisk)
这是 SVN 特定异常 (SvnInvalidNodeKindException),而不是 Tortoise 异常。但如果你安装了 Tortoise,或者使用 SharpSVN .NET 库与 SVN 集成,你可能会得到这个。
问题是您提交的路径太长。有两种奇怪的行为。如果您的本地工作副本的 Windows 长度太长,SVN 将检出无效文件(不确定是否总是),但您不会收到异常。您将看到的另一个行为是,如果您尝试通过提交来替换文件,SVN 将抛出此异常 (SvnInvalidNodeKindException) 并会说
['\\folder\\folder\\' is not aworking复制
并且不会提交任何内容。解决方案:
缩短路径。我不知道最大值是多少,但我想它与基于 Windows API 的文件路径上的最大长度相同。微软从未解决过这个问题,并且至今仍然是一个问题。我很早以前就在 Windows 中发布过有关此问题的帖子,但找不到该帖子。
This is an SVN specific exception (SvnInvalidNodeKindException), not a Tortoise exception. But if you install Tortoise, or use SharpSVN library for .NET to integrate with SVN, you may get this.
The problem is that the path in which you are committing is too long in length. There are two odd behaviors. If your local working copy has a Windows length that is too long, SVN will check out an invalid file (not sure about always) but you won't get an exception. The other behavior you'll see is that if you try to replace the file by doing a commit, SVN will throw this exception (SvnInvalidNodeKindException) and will say
['\\folder\\folder\\' is not a working copy
and won't commit anything.Solution:
Shorten the path to something shorter. I don't know what the max is, but I imagine it's the same max length on a file path based on the Windows API. Microsoft never fixed this, and is still an issue today. I posted about this issue in Windows a long time ago, but can't find the post.