how can I search an svn repository for the existence of files in any revision

不想你离开。 提交于 2019-12-03 05:38:42

问题


How can I search if a file named foo.txt was ever committed to my svn repository (in any revision)?


回答1:


Right click on the checked out folder's root > TortoiseSVN > Show Log

You can enter file names just as well there.




回答2:


This should work for you:

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

This will give you the paths to the files and the state from the log. If you get any hits, you know it existed at some point. If you get no results, there is nothing matching anywhere in the repository at any revision. You'll also see the states from each log line, e.g.:

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

But I'm guessing the extra info isn't a problem for you. :)




回答3:


Use Subversion 1.8+ client and new --search and --search-and options become available for svn log command. These options do not allow perform full-text search inside a repository and looks up 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).

As far as I guess, you can search for "foo.txt" with the following command line:

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

Here is the complete help page about these new svn log 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.


来源:https://stackoverflow.com/questions/391718/how-can-i-search-an-svn-repository-for-the-existence-of-files-in-any-revision

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!