SVN存储库搜索[关闭]

问题描述 投票:153回答:14

是否有任何好的软件可以让我在SVN存储库中搜索代码段?我找到了“ FishEye”,但费用为1200,远远超出了我的预算。

svn search code-search-engine
14个回答
68
投票

如果仅搜索文件名,请使用:

svn list -R file:///subversion/repository | grep filename

Windows:

svn list -R file:///subversion/repository | findstr filename

否则签出并执行文件系统搜索:

egrep -r _code_ .

2
投票

[如果您真的很绝望,请对存储库进行转储(请参阅“ svnadmin dump”),然后通过grep对其进行遍历。它不是很漂亮,但是您可以在搜索结果中四处查找以找到指示文件和修订的元数据,然后对其进行检查以获得更好的外观。


1
投票

很多SVN仓库都是“简单的” HTTP站点,因此您可以考虑查看一些现成的“ Web爬行”搜索应用程序,您可以指向SVN根目录,它会为您提供基本功能。更新它可能会有些花招,也许某些SVN黑客检查可能会使索引变痒,以随您的需要放弃或重新索引更改。


1
投票

克鲁格和科德斯,但两者都很昂贵。两者都有Eclipse的ide插件。


1
投票

我开始使用此工具


0
投票

//编辑:在另一个答案中已经提到了该工具,因此,所有功劳归功于Kuryaki。


37
投票

sourceforge.net/projects/svn-search

也有直接来自SVN主页的Windows应用程序,名为SvnQuery,位于http://svnquery.tigris.org


12
投票

2020年1月更新

VisualSVN Server 4.2支持在Web界面中查找文件和文件夹。在demo server’s repositories之一上试用新功能!

请参见version 4.2 Release Notes,并从main download page下载VisualSVN Server 4.2.0。

enter image description here


旧答案

[从Subversion 1.8, you can use --search option with svn log command开始。请注意,该命令不会在存储库内执行全文搜索,它仅考虑以下数据:

  • 修订版的作者(--search未版本控制的属性,],>
  • 日期(svn log未版本化的属性),
  • 日志消息文本(svn:author非版本属性,],>
  • 已更改路径的列表(即受特定版本影响的路径)。
  • 这是有关这些新搜索选项的帮助页面:

svn:date

我们使用svn:log

  1. 创建该存储库的 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:http://opensolaris.org/os/project/opengrok/git-svn中的相同字符串中搜索添加或删除的字符串
  • 优点是您可以在本地进行许多搜索,而无需加载服务器和网络连接。

    此示例将存储库的完整内容通过管道传输到文件,然后您可以在编辑器中快速搜索文件名:

    git log -S'my line of code'

    如果存储库是相对静态的,并且您想进行快速搜索而不必重复从SVN服务器加载所有内容,则这很有用。

    我确实喜欢TRAC-此插件可能对您的任务有所帮助:gitk

    仅需注意,svn list -R svn://svn > filelist.txt (以及许多其他Atlassian产品)具有10美元的简化版,在FishEye的情况下,您可以使用5个存储库,最多可以访问10个提交者。在这种情况下,钱用于慈善事业。

    http://trac-hacks.org/wiki/RepoSearchPlugin

    非常缓慢(并且粗略实现),但是如果您正在搜索单个文件或小型存储库的历史记录,则可以将svn log和svn cat结合使用:

    FishEye

    将输出文件更改的每个修订号和文件。您总是可以将每个修订放入一个不同的文件中,然后使用grep进行更改。

    PS。向任何向我展示如何正确执行此操作的人进行大规模投票!

    [如果您真的很绝望,请对存储库进行转储(请参阅“ svnadmin dump”),然后通过grep对其进行遍历。它不是很漂亮,但是您可以在搜索结果中四处查找以找到指示文件和修订的元数据,然后对其进行检查以获得更好的外观。

    当然,这不是一个好的解决方案,但是它是免费的:) SVN不提供搜索过去签入(甚至过去的日志文件AFAIK)的功能。

    很多SVN仓库都是“简单的” HTTP站点,因此您可以考虑查看一些现成的“ Web爬行”搜索应用程序,您可以指向SVN根目录,它会为您提供基本功能。更新它可能会有些花招,也许某些SVN黑客检查可能会使索引变痒,以随您的需要放弃或重新索引更改。

    只是大声思考。

    克鲁格和科德斯,但两者都很昂贵。两者都有Eclipse的ide插件。

    我开始使用此工具

    www.atlassian.com/starter

    它缺少可视化的用户界面,但运行良好,但速度很快,并得到了一定程度的维护

    //编辑:在另一个答案中已经提到了该工具,因此,所有功劳归功于Kuryaki。

    刚刚发现svn log filetosearch | grep '^r' | cut -f1 -d' ' | xargs -i bash -c "echo '{}'; svn cat filetosearch -'{}'" ,这是一个基于Java的命令行工具,它可以扫描存储库以创建索引,然后可以回答某些类型的查询。我们仍在评估该工具,但看起来很有希望。值得一提的是,它对所有修订进行了完整索引,包括源代码文件和常见的Office格式。


    10
    投票

    我们使用svn:log


    9
    投票
    1. 创建该存储库的 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. 镜像。

    8
    投票

    此示例将存储库的完整内容通过管道传输到文件,然后您可以在编辑器中快速搜索文件名:


    4
    投票

    我确实喜欢TRAC-此插件可能对您的任务有所帮助:gitk


    4
    投票

    仅需注意,svn list -R svn://svn > filelist.txt (以及许多其他Atlassian产品)具有10美元的简化版,在FishEye的情况下,您可以使用5个存储库,最多可以访问10个提交者。在这种情况下,钱用于慈善事业。


    3
    投票

    非常缓慢(并且粗略实现),但是如果您正在搜索单个文件或小型存储库的历史记录,则可以将svn log和svn cat结合使用:

    © www.soinside.com 2019 - 2024. All rights reserved.