You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by Luke Mauldin <lu...@icloud.com> on 2021/11/29 15:10:17 UTC

Full text search

Is there a recommended way to do a full text search of commits that include changed text. For example if I wanted “svn log” to show me all of that commits that have an added or deleted line that contains “foo”, is that possible? Git has similar functionality in “git log -S foo”
Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me the lines that changed and not the commit that they changed.

Re: Full text search

Posted by Thorsten <tg...@freigmbh.de>.
I think he wants to search for file content, not for a commit message. 
So for example "Was our supersecret password <admin1234> ever commited 
to code anywhere?"

I do not think svn has a build in function to do that easily/fast. You 
can write a script that counts up, gets the diff from svn for that 
revision and run grep or awk on it. Might take ages.

There are (paid) thirdparty tools whicht can index your repository and 
provide fast search (fisheye for example)

Building an index also can take ages.

Best regards,

Thorsten

Am 29/11/2021 um 16:10 schrieb Luke Mauldin:
> Is there a recommended way to do a full text search of commits that include changed text. For example if I wanted “svn log” to show me all of that commits that have an added or deleted line that contains “foo”, is that possible? Git has similar functionality in “git log -S foo”
> Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me the lines that changed and not the commit that they changed.

Re: Full text search

Posted by Nathan Hartman <ha...@gmail.com>.
On Mon, Nov 29, 2021 at 10:10 AM Luke Mauldin <lu...@icloud.com>
wrote:

> Is there a recommended way to do a full text search of commits that
> include changed text. For example if I wanted “svn log” to show me all of
> that commits that have an added or deleted line that contains “foo”, is
> that possible? Git has similar functionality in “git log -S foo”
> Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me
> the lines that changed and not the commit that they changed.


'svn log' has a --diff option. Together with a revision range, that will
output commit log together with the changes in that commit (though be aware
if server access is slow and you request a large range it could be slow).

Perhaps 'svn blame' will be helpful in addition or instead?

Nathan

Re: Full text search

Posted by Luke Mauldin <lu...@icloud.com>.
We have hound setup and it is nice but it only indexes the HEAD commit and so it isn’t useful for searching history.

> On Nov 29, 2021, at 5:30 PM, Mark Phippard <ma...@gmail.com> wrote:
> 
> On Mon, Nov 29, 2021 at 10:19 AM Luke Mauldin <lu...@icloud.com> wrote:
>> 
>> I saw the —search argument but that only searches commit metadata.  I would like to do a search of the changed text of the files in the commit.
> 
> Ah, I missed that in your original post. I would suggest using a code
> search tool like OpenGrok or Hound:
> 
> https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
> https://github.com/hound-search/hound
> 
> Mark

Re: Full text search

Posted by Mark Phippard <ma...@gmail.com>.
On Mon, Nov 29, 2021 at 10:19 AM Luke Mauldin <lu...@icloud.com> wrote:
>
> I saw the —search argument but that only searches commit metadata.  I would like to do a search of the changed text of the files in the commit.

Ah, I missed that in your original post. I would suggest using a code
search tool like OpenGrok or Hound:

https://github.com/oracle/opengrok/wiki/How-to-setup-OpenGrok
https://github.com/hound-search/hound

Mark

Re: Full text search

Posted by Luke Mauldin <lu...@icloud.com>.
I saw the —search argument but that only searches commit metadata.  I would like to do a search of the changed text of the files in the commit.

> On Nov 29, 2021, at 9:14 AM, Mark Phippard <ma...@gmail.com> wrote:
> 
> On Mon, Nov 29, 2021 at 10:10 AM Luke Mauldin <lu...@icloud.com> wrote:
>> 
>> Is there a recommended way to do a full text search of commits that include changed text. For example if I wanted “svn log” to show me all of that commits that have an added or deleted line that contains “foo”, is that possible? Git has similar functionality in “git log -S foo”
>> Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me the lines that changed and not the commit that they changed.
> 
> With newer versions of SVN, the log command has a --search argument:
> 
> https://svnbook.red-bean.com/nightly/en/svn.ref.svn.html#svn.ref.svn.sw.search
> https://subversion.apache.org/docs/release-notes/1.8.html#svn-log-search
> 
> Mark


Re: Full text search

Posted by Mark Phippard <ma...@gmail.com>.
On Mon, Nov 29, 2021 at 10:10 AM Luke Mauldin <lu...@icloud.com> wrote:
>
> Is there a recommended way to do a full text search of commits that include changed text. For example if I wanted “svn log” to show me all of that commits that have an added or deleted line that contains “foo”, is that possible? Git has similar functionality in “git log -S foo”
> Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me the lines that changed and not the commit that they changed.

With newer versions of SVN, the log command has a --search argument:

https://svnbook.red-bean.com/nightly/en/svn.ref.svn.html#svn.ref.svn.sw.search
https://subversion.apache.org/docs/release-notes/1.8.html#svn-log-search

Mark

Re: Full text search

Posted by Daniel Sahlberg <da...@gmail.com>.
Den mån 29 nov. 2021 kl 16:10 skrev Luke Mauldin <lu...@icloud.com>:

> Is there a recommended way to do a full text search of commits that
> include changed text. For example if I wanted “svn log” to show me all of
> that commits that have an added or deleted line that contains “foo”, is
> that possible? Git has similar functionality in “git log -S foo”
> Using “svn diff -r:HEAD | grep foo” gets me close but that just gives me
> the lines that changed and not the commit that they changed.


I'm not familiar with git, but I guess you are looking for a search in the
commit message. Have you tried svn log --search?

Kind regards,
Daniel