Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
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.


In reply to Find svn log revisions with log message matching a given string by bellaire

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • 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.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (6)
As of 2024-04-19 10:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found