Quantcast

Tip: grepping a pattern across all jenkinsci sources

classic Classic list List threaded Threaded
5 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Tip: grepping a pattern across all jenkinsci sources

Jesse Glick-4
If you find yourself needing to look for a certain pattern among all sources files in Jenkins and its plugins - anything in https://github.com/jenkinsci - try cloning
http://git.jenkins-ci.org/all.git and then running this handy one-liner in it (replace the "basic"-syntax regexp with whatever you need):

git branch -a | xargs git grep 'SomeClass\.staticMethod' | perl -n -e 'print "$repo/$fname: $text\n" if ($repo, $fname, $text) =
/^remotes\/origin\/(.+)\/master:([^:]+):(?:[ \t]*)(.+)$/'

(This greps files as of the tip of the master branch only. Checking historical versions is much slower.)
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Tip: grepping a pattern across all jenkinsci sources

Kohsuke Kawaguchi
Administrator
Any chance you can capture this in an Wiki page?

2012/8/22 Jesse Glick <[hidden email]>:

> If you find yourself needing to look for a certain pattern among all sources
> files in Jenkins and its plugins - anything in https://github.com/jenkinsci
> - try cloning http://git.jenkins-ci.org/all.git and then running this handy
> one-liner in it (replace the "basic"-syntax regexp with whatever you need):
>
> git branch -a | xargs git grep 'SomeClass\.staticMethod' | perl -n -e 'print
> "$repo/$fname: $text\n" if ($repo, $fname, $text) =
> /^remotes\/origin\/(.+)\/master:([^:]+):(?:[ \t]*)(.+)$/'
>
> (This greps files as of the tip of the master branch only. Checking
> historical versions is much slower.)



--
Kohsuke Kawaguchi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Tip: grepping a pattern across all jenkinsci sources

nicolas de loof-2

Is this "all" git repo automaticaly maintained as new plugins are.created / forked on github ?

Le 22 août 2012 01:36, "Kohsuke Kawaguchi" <[hidden email]> a écrit :
Any chance you can capture this in an Wiki page?

2012/8/22 Jesse Glick <[hidden email]>:
> If you find yourself needing to look for a certain pattern among all sources
> files in Jenkins and its plugins - anything in https://github.com/jenkinsci
> - try cloning http://git.jenkins-ci.org/all.git and then running this handy
> one-liner in it (replace the "basic"-syntax regexp with whatever you need):
>
> git branch -a | xargs git grep 'SomeClass\.staticMethod' | perl -n -e 'print
> "$repo/$fname: $text\n" if ($repo, $fname, $text) =
> /^remotes\/origin\/(.+)\/master:([^:]+):(?:[ \t]*)(.+)$/'
>
> (This greps files as of the tip of the master branch only. Checking
> historical versions is much slower.)



--
Kohsuke Kawaguchi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Tip: grepping a pattern across all jenkinsci sources

Kohsuke Kawaguchi
Administrator
Yes. It's updated weekly by
http://ci.jenkins-ci.org/view/Infrastructure/job/infra_backend-merge-all-repo/

2012/8/22 nicolas de loof <[hidden email]>:

> Is this "all" git repo automaticaly maintained as new plugins are.created /
> forked on github ?
>
> Le 22 août 2012 01:36, "Kohsuke Kawaguchi" <[hidden email]> a écrit :
>
>> Any chance you can capture this in an Wiki page?
>>
>> 2012/8/22 Jesse Glick <[hidden email]>:
>> > If you find yourself needing to look for a certain pattern among all
>> > sources
>> > files in Jenkins and its plugins - anything in
>> > https://github.com/jenkinsci
>> > - try cloning http://git.jenkins-ci.org/all.git and then running this
>> > handy
>> > one-liner in it (replace the "basic"-syntax regexp with whatever you
>> > need):
>> >
>> > git branch -a | xargs git grep 'SomeClass\.staticMethod' | perl -n -e
>> > 'print
>> > "$repo/$fname: $text\n" if ($repo, $fname, $text) =
>> > /^remotes\/origin\/(.+)\/master:([^:]+):(?:[ \t]*)(.+)$/'
>> >
>> > (This greps files as of the tip of the master branch only. Checking
>> > historical versions is much slower.)
>>
>>
>>
>> --
>> Kohsuke Kawaguchi



--
Kohsuke Kawaguchi
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Tip: grepping a pattern across all jenkinsci sources

Jesse Glick-4
In reply to this post by nicolas de loof-2
Kohsuke Kawaguchi wrote:
> Any chance you can capture this in an Wiki page?

Good idea. https://wiki.jenkins-ci.org/display/JENKINS/Grepping+all+sources
Loading...