如何使用 SharpSVN 从带有空格的 SVN 路径读取日志?
我在存储库中有一个带有这样的空格的路径:
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技术交流群](/public/img/jiaqun_03.jpg)
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您应该将
"%20"
替换为"\ "
You should replace
"%20"
with"\ "