我想建立一个简单的库浏览器到Web应用程序,并一直在寻找到使用SharpSvn帮助。
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, like update, commit, that would actually make changes to the repository or a working copy but am struggling to find a way to query a repositories structure or contents.
有什么这样我可以读取存储库的结构,所以我可以在一个网页上显示一个简单的资源管理器一样的界面(即目录树视图以及文件的列表)?
Is there any way I can read the structure of the repository so I can display a simple explorer like interface in a web page (i.e. tree view of directories plus a list of files)?
推荐答案的 SharpSvn.SvnClient 类有一个的的GetList()函数作品真的很好:使用
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); } } }
一旦你的收藏,可以在该位置获得每一个项目的路径。您还可以使用Entry对象来获取有关每个项目的信息,包括是否是一个目录或文件,当它最后一次修改,等等。
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.
更多推荐
SharpSvn:获取库结构和单独的文件
发布评论