How can I search if a file named foo.txt was ever committed to my svn repository (in any revision)?
- I guess the short answer is "search the log". How you accomplish that depends on how you interface with SVN, hence Martijn's and my differing answers.Adam Bellaire– Adam Bellaire2008-12-24 16:23:08 +00:00Commented Dec 24, 2008 at 16:23
- Well put Adam :) i was replying with a coded answer at first as well but then noticed the rather explicit tortoiseSVN tag.Martijn Laarman– Martijn Laarman2008-12-24 16:44:10 +00:00Commented Dec 24, 2008 at 16:44
- 1Right, I missed that. Still, I'll leave my answer around, someone might be interested.Adam Bellaire– Adam Bellaire2008-12-24 16:46:42 +00:00Commented Dec 24, 2008 at 16:46
4 Answers
Right click on the checked out folder's root > TortoiseSVN > Show Log
You can enter file names just as well there.
5 Comments
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 Comments
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:authorunversioned property), - date (
svn:dateunversioned property), - log message text (
svn:logunversioned 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.