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 Dec 24 '08 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 Dec 24 '08 at 16:44
-
1Right, I missed that. Still, I'll leave my answer around, someone might be interested. – Adam Bellaire Dec 24 '08 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.

- 1,299
- 1
- 11
- 14

- 13,476
- 44
- 63
-
-
-
-
You don't necessarily have to 'check out' to search files. You can use repo-browser and then show log too. – Efreeto Feb 26 '15 at 19:03
-
This answer along with the comment from Efreet did the trick! Next 100 moved the date back for me. Thanks! – ScottyG Apr 01 '15 at 19:28
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. :)

- 108,003
- 19
- 148
- 163
-
That'd work. You could filter for the first occurrence with 'svn ... | grep /foo.txt | head -1' – orip Dec 24 '08 at 16:34
-
1Thanks, could you please help in getting revisions numbers with those logs? – linuxeasy Oct 10 '12 at 06:25
-
When you say REPOSITORY_PATH do you mean the path on the file system or the url of the location in the repository? – Alan Smith Jan 24 '13 at 14:30
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.

- 29,961
- 12
- 103
- 150
-
Note you can specify a repo path with: svn log $REPOSITORY_PATH -v --search "foo.txt" – riskyc123 Jun 05 '19 at 16:23
I use powershell and the command svn list -R
to search the repo recursively and then pipe the results into findstr
or similar, like:
svn list -r HEAD -R | findstr /R /I "\/obj\$/ \/bin\/$"

- 4,469
- 6
- 37
- 36