有没有好的软件可以让我搜索我的SVN代码片段?我找到了“FishEye”,但是它的价格为1,200美元,远超出我的预算。
有没有好的软件可以让我搜索我的SVN代码片段?我找到了“FishEye”,但是它的价格为1,200美元,远超出我的预算。
如果你只想查找文件名,请使用:
svn list -R file:///subversion/repository | grep filename
Windows:
svn list -R file:///subversion/repository | findstr filename
否则,请检出并进行文件系统搜索:
egrep -r _code_ .
这里有一个sourceforge.net/projects/svn-search。
此外,还有来自SVN官方的Windows应用程序,名为SvnQuery,可以直接在http://svnquery.tigris.org上获取。
VisualSVN Server 5.0通过内容和历史记录实现了全文本仓库搜索。在演示服务器上尝试新的全文本搜索功能。
VisualSVN Server 4.2支持在Web界面中查找文件和文件夹。在一个演示服务器库上试用这个新功能吧!
请查看版本4.2发布说明,并从主下载页面下载VisualSVN Server 4.2.0。
旧回答
从Subversion 1.8开始,您可以使用svn log
命令的--search
选项。请注意,该命令不会在仓库内执行全文本搜索,它仅考虑以下数据:
svn:author
未版本化属性),svn:date
未版本化属性),svn:log
未版本化属性),这是关于这些新搜索选项的帮助页面:
If the --search option is used, log messages are displayed only if the
provided search pattern matches any of the author, date, log message
text (unless --quiet is used), or, if the --verbose option is also
provided, a changed path.
The search pattern may include "glob syntax" wildcards:
? matches any single character
* matches a sequence of arbitrary characters
[abc] matches any of the characters listed inside the brackets
If multiple --search options are provided, a log message is shown if
it matches any of the provided search patterns. If the --search-and
option is used, that option's argument is combined with the pattern
from the previous --search or --search-and option, and a log message
is shown only if it matches the combined search pattern.
If --limit is used in combination with --search, --limit restricts the
number of log messages searched, rather than restricting the output
to a particular number of matching log messages.
git-svn
镜像。git log -S'我的代码行'
或在gitk
中执行相同操作。优点是您可以在本地进行多次搜索,而无需加载服务器和网络连接。
这个例子将整个仓库的内容导入到一个文件中,然后你可以在编辑器中快速搜索文件名:
svn list -R svn://svn > filelist.txt
如果仓库相对静态且需要进行快速搜索而不必反复从SVN服务器加载所有内容,则此功能非常有用。
http
作为协议(svn list -R http://repo/svn/etc
)。 - Charles Wood我很喜欢TRAC - 这个插件可能对你的任务有帮助:http://trac-hacks.org/wiki/RepoSearchPlugin
如果您要搜索单个文件或小型代码库的历史记录,svn log 和 svn cat 的组合可以实现,但速度非常缓慢(且实现粗糙):
svn log filetosearch |
grep '^r' |
cut -f1 -d' ' |
xargs -i bash -c "echo '{}'; svn cat filetosearch -'{}'"
将输出每个更改文件的修订号。您可以将每个修订版本复制到不同的文件中,然后搜索更改。
附注:向任何能够向我展示如何正确完成此操作的人投票!
git-svn
命令。Git 内置了搜索提交历史中代码的功能。但是你需要下载整个提交历史才能使用 git-svn
。 - Vi.
svn log --search
选项,对于寻找简单仓库历史记录搜索的人可能会很方便。 - bahrep