如何在svn存储库中搜索任何修订版本中是否存在文件

时间:2008-12-24 15:55:04

标签: svn tortoisesvn

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

4 个答案:

答案 0 :(得分:36)

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

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

答案 1 :(得分:10)

这应该适合你:

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

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

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

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

答案 2 :(得分:5)

使用Subversion 1.8+客户端和new --search and --search-and options become available for svn log command。这些选项不允许在存储库中执行全文搜索,仅查找以下数据:

  • 修订版的作者(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.

答案 3 :(得分:0)

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

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