如何在颠覆服务器中搜索文件? [英] How to search for file in subversion server?
问题描述
有没有办法在 subversion 存储库中搜索文件?
Is there a way to search for a file in a subversion repository?
类似于 Unix 的 find
命令,通过它我可以找到存储库中文件的位置.
Something similar to Unix' find
command, with which I can find the location of a file in a repository.
我知道有 svn list
,但这给了我一个目录中所有文件的列表.我想找到一个文件所在的目录.
I know there is svn list
, but this gives me a list of all the files in a directory. I want to find the directory a file is in.
推荐答案
您可以在服务器上使用以下命令和 grep:
You can use the following command, together with a grep, on the server:
svnlook tree --full-paths <repository path> | grep <file>
如果您需要查看大型存储库,这是最快的选择.
That's the fastest option if you need to look into a big repository.
如果您只能访问客户端,请再次使用 grep:
If you only have access to the client side, again with a grep:
svn list -R <URL> | grep <file>
应该做你需要的.
两者都将通过目录进行递归,尽管您可以从存储库根目录以外的其他地方开始使用客户端,但由于信息必须通过网络(可能),因此速度会有些慢.
Both will recurse through the directories, with the client you may start elsewhere than the root of the repository though, but it will be somewhat slower as the information has to go through the network (possibly).
编辑:另外,两者都让您可以选择查看过去的修订(如果文件被删除):
Edit: Also, both gives you the option of looking into a past revision (should the file be deleted):
svn list -R -r <修订/修订范围><URL>
和svnlook tree -r <revision><路径>
.
只需键入 svn 帮助列表
或 svnlook 帮助树
以获取更多详细信息.
Simply type svn help list
or svnlook help tree
for further details.
这篇关于如何在颠覆服务器中搜索文件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!