SharpSvn: Getting repository structure and individual files

前端 未结 1 2037
Happy的楠姐
Happy的楠姐 2020-12-11 01:32

I am trying to build a simple repository browser into a web application and have been looking into using SharpSvn to help.

I can find all the usual physical commands

相关标签:
1条回答
  • 2020-12-11 01:55

    The SharpSvn.SvnClient class has a GetList() function that works really well:

    using (SvnClient svnClient = new SvnClient())
    {
       Collection<SvnListEventArgs> contents;
       List<string> files = new List<string>();
       if (svnClient.GetList(new Uri(svnUrl), out contents))
       {
          foreach(SvnListEventArgs item in contents)
          {
             files.Add(item.Path);
          }
       }
    }
    

    Once you have the collection, you can get the path of each item at the location. You can also use the Entry object to get information concerning each item, including whether it is a directory or a file, when it was last modified, etc.

    0 讨论(0)
提交回复
热议问题