【发布时间】:2015-11-13 21:46:05
【问题描述】:
我们在 Windows 2012 上运行 VisualSVN。我的任务是防止锁被盗。我想使用预解锁挂钩。首先,我想将锁拥有者的姓名与开锁用户的姓名进行比较。我可以通过svnlook在服务器上找到锁拥有者:
svnlook lock C:\Repositories\DIT_TEST time-for-a-sandwich.txt
这给了我一个包含所有者的信息的小列表。凉爽的。
我想在 SharpSVN 中复制它。到目前为止,这是我所拥有的:
using (SvnClient client = new SvnClient())
{
StringBuilder sbLockOwner = new StringBuilder();
Collection<SvnListEventArgs> col;
if (client.GetList(new Uri("https://dit-visualsvn/svn/DIT_TEST"), out col))
{
foreach (SvnListEventArgs svnListEventArg in col)
{
sbLockOwner.Append(svnListEventArg.Lock.Owner.ToString());
}
}
}
当我尝试释放锁时,我得到了错误:
Unable to connect to a repository at URL 'https://dit-visualsvn/svn/DIT_TEST' --->
Access to '/svn/DIT_TEST' forbidden.
我已验证我的用户对存储库具有读/写权限,并且我已尝试使用 client.Authentication.ForceCredentials("login", "pswd"); 解决方案。仍然不允许。
如何使用 SharpSVN 获取锁拥有者的姓名?
更多信息:如果我将代码更改为this SO 上的响应,我仍然看到访问被禁止。
【问题讨论】:
标签: svn tortoisesvn sharpsvn