如何使用 SharpSVN 从带有空格的 SVN 路径读取日志?

发布于 2024-12-08 18:51:45 字数 1083 浏览 1 评论 0原文

我在存储库中有一个带有这样的空格的路径:

https://mysvnserver.local/svn/branches/2.7 Feature XYZ

现在我想使用 SharpSvn 从此路径读取日志。

我有这样的代码:

var client = new SvnClient();
client.Authentication.DefaultCredentials = new NetworkCredential(userName, password);

var logArguments = new SvnLogArgs(new SvnRevisionRange(startRevision, endRevision)) { RetrieveMergedRevisions = true };

var uri = new Uri(repoUrl);
Console.WriteLine("Absolute Uri: " + uri.AbsoluteUri);

Collection<SvnLogEventArgs> list;
client.GetLog(uri, logArguments, out list);

绝对 Uri 显示:(

https://mysvnserver.local/svn/branches/2.7%20Feature%20XYZ

据我理解)在 URI 中使用的转义是完全正确的,但是当

SvnFileSystemException - File not found: revision 1612, path ´/branches/2.7_Feature_XYZ´

调用 client.GetLog() 时我得到了一个。从错误消息来看,SharpSvn正在内部用下划线替换空格。

如何防止这种情况并从此路径读取日志消息?

编辑更新: 到目前为止,我尝试用 \%20+ 替换空格。没有任何效果。找不到路径。我还尝试为上面的所有替换传递带或不带尾部斜杠的 URI - 也没有效果。

I have a path in a repo with spaces like this:

https://mysvnserver.local/svn/branches/2.7 Feature XYZ

Now I want to read the log from this path using SharpSvn.

I have this code:

var client = new SvnClient();
client.Authentication.DefaultCredentials = new NetworkCredential(userName, password);

var logArguments = new SvnLogArgs(new SvnRevisionRange(startRevision, endRevision)) { RetrieveMergedRevisions = true };

var uri = new Uri(repoUrl);
Console.WriteLine("Absolute Uri: " + uri.AbsoluteUri);

Collection<SvnLogEventArgs> list;
client.GetLog(uri, logArguments, out list);

Absolute Uri displays:

https://mysvnserver.local/svn/branches/2.7%20Feature%20XYZ

which (for my understanding) is completely correct escaped for usage in the URI, but I then get an

SvnFileSystemException - File not found: revision 1612, path ´/branches/2.7_Feature_XYZ´

when the client.GetLog() is called. Telling from the error message, SharpSvn is replacing the spaces with underscores internally.

How can I prevent this and read the log messages from this path?

Edit Update:
Until now I tried to replace the space with \, %20 and +. With no effects. The path can't be found. I also tried to pass the URI both with and without the trailing slash for all replacments above - also no effect.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

挖个坑埋了你 2024-12-15 18:51:45

您应该将 "%20" 替换为 "\ "

You should replace "%20" with "\ "

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文