How to check if file is under source control in SharpSvn?

↘锁芯ラ 提交于 2019-11-30 12:18:37

This pretty well demonstrates how to do it using status

using(SvnClient client = new SvnClient())
{
    SvnStatusArgs sa = new SvnStatusArgs();
    sa.Depth = SvnDepth.Empty; // Adjust this to check direct files, or (recursive) directories etc

    Collection<SvnStatusEventArgs> statuses;
    client.GetStatus("c:\\somefile.txt", sa, out statuses); 

    Assert.That(statuses.Count, Is.EqualTo(1));
    Assert.That(SvnStatus.NotVersioned, Is.EqualTo(statuses[0].LocalContentStatus));
}
Bert Huijben

If you only want to know if the file is under source control you could use .Info() / .GetInfo(). That method is generally faster as it doesn't have to check if the file has changed since it was checked out.

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!