SVN 存储库搜索

发布于 2024-07-08 09:19:23 字数 1833 浏览 7 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(14

赏烟花じ飞满天 2024-07-15 09:19:23

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

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

Windows:

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

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

egrep -r _code_ .

If you're searching only for the filename, use:

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

Windows:

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

Otherwise checkout and do filesystem search:

egrep -r _code_ .
山有枢 2024-07-15 09:19:23

sourceforge.net/projects/svn-search

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

There is sourceforge.net/projects/svn-search.

There is also a Windows application directly from the SVN home called SvnQuery available at http://svnquery.tigris.org

魄砕の薆 2024-07-15 09:19:23

2022 年 4 月更新

VisualSVN Server 5.0 支持通过内容进行全文存储库搜索历史。 在 演示服务器上尝试新的全文搜索功能

2020 年 1 月更新

VisualSVN Server 4.2 支持在 Web 界面中查找文件和文件夹。 在演示服务器的存储库之一上尝试新功能!

请参阅版本 4.2 发行说明,并从 < a href="https://www.visualsvn.com/server/download/" rel="nofollow noreferrer">主下载页面。

输入图片这里的描述


旧答案

Subversion 1.8,您可以将 --search 选项与 svn log 命令一起使用。 请注意,该命令不会在存储库内执行全文搜索,它仅考虑以下数据:

  • 修订的作者(svn:author unversioned property)、
  • 日期(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.

Update April, 2022

VisualSVN Server 5.0 supports full-text repository search through the contents and history. Try out the new full-text search feature on the demo server.

Update January, 2020

VisualSVN Server 4.2 supports finding files and folders in the web interface. Try out the new feature on one of the demo server’s repositories!

See the version 4.2 Release Notes, and download VisualSVN Server 4.2.0 from the main download page.

enter image description here


Old answer

Beginning with Subversion 1.8, you can use --search option with svn log command. Note that the command does not perform full-text search inside a repository, it considers the following data only:

  • revision's author (svn:author unversioned property),
  • date (svn:date unversioned property),
  • log message text (svn:log unversioned property),
  • list of changed paths (i.e. paths affected by the particular revision).

Here is the help page about these new search options:

 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.
逆光飞翔i 2024-07-15 09:19:23
  1. 创建该存储库的 git-svn 镜像。
  2. 在 git 中搜索添加或删除的字符串: git log -S'my line of code' 或在 gitk 中进行相同的操作

优点是您可以在本地进行多次搜索,而无需加载服务器和网络连接。

  1. Create git-svn mirror of that repository.
  2. Search for added or removed strings inside git: git log -S'my line of code' or the same in gitk

The advantage is that you can do many searches locally, without loading the server and network connection.

死开点丶别碍眼 2024-07-15 09:19:23

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

svn list -R svn://svn > filelist.txt

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

This example pipes the complete contents of the repository to a file, which you can then quickly search for filenames within an editor:

svn list -R svn://svn > filelist.txt

This is useful if the repository is relatively static and you want to do rapid searches without having to repeatedly load everything from the SVN server.

扶醉桌前 2024-07-15 09:19:23

我确实喜欢 TRAC - 这个插件可能对您的任务有帮助: http://trac-hacks.org/维基/RepoSearchPlugin

I do like TRAC - this plugin might be helpful for your task: http://trac-hacks.org/wiki/RepoSearchPlugin

躲猫猫 2024-07-15 09:19:23

请注意,FishEye(以及许多其他Atlassian 产品)有 10 美元的入门版,就 FishEye 而言,它为您提供 5 个存储库,并可供最多 10 名提交者访问。
在这种情况下,这笔钱将捐给慈善机构。

www.atlassian.com/starter

Just a note, FishEye (and a lot of other Atlassian products) have a $10 Starter Editions, which in the case of FishEye gives you 5 repositories and access for up to 10 committers.
The money goes to charity in this case.

www.atlassian.com/starter

街角迷惘 2024-07-15 09:19:23

慢得令人痛苦(而且实现得很粗糙),但是如果您正在搜索单个文件或小型存储库的历史记录,则 svn log 和 svn cat 的组合可以工作:

svn log filetosearch |
    grep '^r' |
    cut -f1 -d' ' |
    xargs -i bash -c "echo '{}'; svn cat filetosearch -'{}'" 

将输出文件更改的每个修订号和文件。 您始终可以将每个修订版本放入不同的文件中,然后 grep 进行更改。

附言。 对向我展示如何正确执行此操作的任何人都给予大力支持!

Painfully slow (and crudely implemented) but a combination of svn log and svn cat works if you are searching the history of single files or small repositories:

svn log filetosearch |
    grep '^r' |
    cut -f1 -d' ' |
    xargs -i bash -c "echo '{}'; svn cat filetosearch -'{}'" 

will output each revision number where file changed and the file. You could always cat each revision into a different file and then grep for changes.

PS. Massive upvotes to anyone that shows me how to do this properly!

始于初秋 2024-07-15 09:19:23

如果您真的很绝望,请转储存储库(查看“svnadmin dump”),然后通过 grep 进行查找。 它并不漂亮,但您可以查看搜索结果以查找指示文件和修订版本的元数据,然后检查它以获得更好的外观。

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

If you're really desperate, do a dump of the repo (look at "svnadmin dump") and then grep through it. It's not pretty, but you can look around the search results to find the metadata that indicates the file and revision, then check it out for a better look.

Not a good solution, to be sure, but it is free :) SVN provides no feature for searching past checkins (or even past log files, AFAIK).

戒ㄋ 2024-07-15 09:19:23

许多 SVN 存储库都是“简单”的 HTTP 站点,因此您可能会考虑查看一些现成的“网络爬行”搜索应用程序,您可以指向 SVN 根目录,它将为您提供基本功能。 更新它可能会有点技巧,也许一些 SVN 检查黑客可以让索引丢弃或重新索引更改。

只是大声思考。

A lot of SVN repos are "simply" HTTP sites, so you might consider looking at some off the shelf "web crawling" search app that you can point at the SVN root and it will give you basic functionality. Updating it will probably be a bit of a trick, perhaps some SVN check in hackery can tickle the index to discard or reindex changes as you go.

Just thinking out loud.

失而复得 2024-07-15 09:19:23

有krugle和koders,但是都很贵。 两者都有 eclipse 的 ide 插件。

theres krugle and koders but both are expensive. Both have ide plugins for eclipse.

生寂 2024-07-15 09:19:23

我开始使用这个工具

http://www.supose.org/wiki/supose

它工作正常只是缺乏可视化用户界面,但速度很快并且得到了一定程度的维护

I started using this tool

http://www.supose.org/wiki/supose

It works fine just lacking a visual UI, but is fast and somewhat maintained

千柳 2024-07-15 09:19:23

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

刚刚发现 SupoSE 这是一个基于 java 的命令行工具,它扫描存储库以创建索引,然后能够回答某些类型的查询。 我们仍在评估该工具,但它看起来很有希望。 值得一提的是,它对所有修订版本进行了完整的索引,包括源代码文件和常见的办公格式。

// Edit: Tool was already mentioned in another answer, so give all credits to Kuryaki.

Just found SupoSE which is a java based command line tool which scans a repository to create an index and afterwards is able to answer certain kinds of queries. We're still evaluating the tool but it looks promising. It's worth to mention that it makes a full index of all revisions including source code files and common office formats.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文