To find the revision number where a particular string appears in the revision log, you can use grep and hope there's enough context for you to see the revision header. Or you could do this:
svn log svn_url | perl -e '$/="-"x72;while(<STDIN>){print"$r\n"if((($
+r)=split)&&/@ARGV/)}' search_term
Where svn_url is the repository path you're interested in, and search_term is the thing to search for. Basically, it just remembers the last revision number to have appeared before your search term, and prints it. Will break if for some reason you are fond of putting horizontal rules (i.e. 72 consecutive - characters) in your commit messages.
Note that search_term will be interpolated as a regex, so while you can use e.g. foo\|bar, if you use special characters (such as .) they will have their special meanings unless escaped.
I would rather do -n than while (<STDIN>) {...}, but perl then treats my search term as a file to be processed, which makes me sad. Suggestions for improvements are welcome.
-
Are you posting in the right place? Check out Where do I post X? to know for sure.
-
Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
<code> <a> <b> <big>
<blockquote> <br /> <dd>
<dl> <dt> <em> <font>
<h1> <h2> <h3> <h4>
<h5> <h6> <hr /> <i>
<li> <nbsp> <ol> <p>
<small> <strike> <strong>
<sub> <sup> <table>
<td> <th> <tr> <tt>
<u> <ul>
-
Snippets of code should be wrapped in
<code> tags not
<pre> tags. In fact, <pre>
tags should generally be avoided. If they must
be used, extreme care should be
taken to ensure that their contents do not
have long lines (<70 chars), in order to prevent
horizontal scrolling (and possible janitor
intervention).
-
Want more info? How to link
or How to display code and escape characters
are good places to start.
|