27

我如何搜索一个名为的文件foo.txt是否曾经提交到我的 svn 存储库(在任何修订版中)?

4

4 回答 4

40

右键单击已签出文件夹的根 > TortoiseSVN > 显示日志

您也可以在那里输入文件名。

于 2008-12-24T16:15:44.687 回答
10

这应该适合你:

svn log -r 0:HEAD -v $REPOSITORY_PATH | grep "/foo.txt"

这将为您提供文件的路径和日志中的状态。如果你得到任何点击,你就知道它在某个时候存在。如果您没有得到任何结果,那么在任何版本的存储库中都没有匹配的内容。您还将看到每个日志行的状态,例如:

   /some/path/foo.txt
   D /some/path/foo.txt

但我猜额外的信息对你来说不是问题。:)

于 2008-12-24T16:10:51.107 回答
5

使用 Subversion 1.8+ 客户端,新的--search--search-and选项可用于svn logcommand。这些选项不允许在存储库中执行全文搜索,并且仅查找以下数据:

  • 修订的作者(svn:author未版本化的属性),
  • 日期(svn:date未版本化的属性),
  • 记录消息文本(svn:log未版本化的属性),
  • 更改的路径列表(即受特定修订影响的路径)。

据我猜测,您可以使用以下命令行搜索“foo.txt”:

svn log -v --search "foo.txt".

以下是有关这些新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.
于 2014-08-06T13:08:03.153 回答
0

我使用 powershell 和命令svn list -R递归地搜索 repo,然后将结果通过管道传输到findstr或类似的地方,例如:

svn list -r HEAD -R | findstr /R /I "\/obj\$/ \/bin\/$"

于 2021-02-16T12:39:33.903 回答