문제

how to (if even possible) search for a string in a file including all its revisions?

The reason to do so is that I know that some string was in my file foo.bar somewhere in past, but was removed since. There are lots of revisions on the file so manual search is time consuming. I need a tool that will download all revisions of the foo.bar file and search for my string in each revision.

If possible, I'd be great to search in a directory and not just single file (but also including all revisions). This is optional however.

The only solution I came with is to write a python script to export revision by revision and always read the file and search for the string using find().

도움이 되었습니까?

해결책

This might answer your question: https://groups.google.com/forum/?fromgroups#!topic/subversion-development/dFIFGBzKt9A

Possibly you can dump the diffs through the whole history (like git) and grep that file. But this requires svn 1.7.

If you do it via own script, going backwards revision by revision using svn-diff might be faster (I have not tried it though) and save on disk usage.

다른 팁

Have you tried this perl script: How do I search all revisions of a file in a SubVersion repository? It searches files from the svn repo starting with the most current revision for arbitrary strings.

I also come up with a Python solution

code = os.system("svn diff <file-name> -r r<n>:r<n+1> | grep <string-to-search>")

If matched, code is 0, else 256, which is 1 actually. Why system('exit 1') return 256`

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top