Searching subversion history (full text)

前端 未结 16 1285
慢半拍i
慢半拍i 2020-11-29 16:29

Is there a way to perform a full text search of a subversion repository, including all the history?

For example, I\'ve written a feature that I used somewhere, but t

相关标签:
16条回答
  • 2020-11-29 17:08

    I have been looking for something similar. The best I have come up with is OpenGrok. I have not tried to implement it yet, but sounds promising.

    0 讨论(0)
  • 2020-11-29 17:10

    I just ran into this problem and

    svnadmin dump <repo location> |grep -i <search term>
    

    did the job for me. Returned the revision of the first occurrence and quoted the line I was looking for.

    0 讨论(0)
  • 2020-11-29 17:13

    I'm using a small shellscript, but this only works for a single file. You can ofcourse combine this with find to include more files.

    #!/bin/bash
    for REV in `svn log $1 | grep ^r[0-9] | awk '{print $1}'`; do 
      svn cat $1 -r $REV | grep -q $2
      if [ $? -eq 0 ]; then 
        echo "$REV"
      fi 
    done
    

    If you really want to search everything, use the svnadmin dump command and grep through that.

    0 讨论(0)
  • 2020-11-29 17:13
    svn log -v [repository] > somefile.log
    

    for diff you can use the --diff option

    svn log -v --diff [repository] > somefile.log
    

    then use vim or nano or whatever you like using, and do a search for what you're looking for. You'll find it pretty quickly.

    It's not a fancy script or anything automated. But it works.

    0 讨论(0)
  • 2020-11-29 17:16
    git svn clone <svn url>
    
    git log -G<some regex>
    
    0 讨论(0)
  • 2020-11-29 17:16

    The best way that I've found to do this is with less:

    svn log --verbose | less

    Once less comes up with output, you can hit / to search, like VIM.

    Edit:

    According to the author, he wants to search more than just the messages and the file names. In which case you will be required to ghetto-hack it together with something like:

    svn diff -r0:HEAD | less
    

    You can also substitute grep or something else to do the searching for you. If you want to use this on a sub-directory of the repository, you will need to use svn log to discern the first revision in which that directory existed, and use that revision instead of 0.

    0 讨论(0)
提交回复
热议问题