Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do I find/search/grep an SVN repository history?

Tags:

grep

search

svn

I need to search through all revisions of a Subversion repository to find file names and revision numbers that contain a particular string. I know that this will find occurrences in a dump:

svnadmin dump $REPO_PATH | grep -i "Verdana"

but the output is too cryptic. The output will include chunks of binary files that match.

I have been using commands like this to search for strings in the current working copy of a project:

find . -name "*.css" -print0 | xargs -0 grep "Verdana"

The format of the output is useful, it give both filename and the line in which the string occurred:

./css/forms.css: font       : 12px Verdana;

Is there any way to search all revisions of an SVN repository for say, all .css files that contain a search string? And not just a word but a string with wildcards or a regular expression like grep?

Note: I have root access to the Linux server with the repository on it.

Also note: I do not wish to search a working copy, I need to search all revisions.

like image 242
Liam Avatar asked Sep 13 '10 15:09

Liam


People also ask

How do I view svn history?

To find information about the history of a file or directory, use the svn log command. svn log will provide you with a record of who made changes to a file or directory, at what revision it changed, the time and date of that revision, and, if it was provided, the log message that accompanied the commit.

Where is svn history stored?

They are stored in the svn:log property. You can add the --revprop flag to the various property commands to view & edit this property.

How do I find previous versions in svn?

Use the revision log dialog Select the file or folder in which you need to revert the changes. If you want to revert all changes, this should be the top level folder. Select TortoiseSVN → Show Log to display a list of revisions. You may need to use Show All or Next 100 to show the revision(s) you are interested in.

How do I list all svn repositories?

svn list is most useful if you want to see what files a repository has without downloading a working copy: $ svn list http://svn.red-bean.com/repos/test/support README. txt INSTALL examples/ … For further details, see the earlier section the section called “Listing versioned directories”.


1 Answers

The easiest (and most effective I've found) way to do this, and it takes a little time investment up front - clone the svn repository into git, then use gitk to search the repository.

Since the entire repository is on your local system, it makes searching infinitely faster!

I used to manage a large subversion repository for roughly 30 developers, they'd often come to my desk asking, "can you find this change..", etc. I'd just fire up gitk!

svn log is horrendously slow as it has to hit the server. Also, if you have access to the server, you'll likely have to contrive some | grep -v or similar to weed out all the .svn directories.

like image 115
quickshiftin Avatar answered Sep 22 '22 03:09

quickshiftin