Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: Find svn log revisions with log message matching a given string

by hossman (Prior)
on Jan 27, 2010 at 02:30 UTC ( #819831=note: print w/ replies, xml ) Need Help??


in reply to Find svn log revisions with log message matching a given string

Will break if for some reason you are fond of putting horizontal rules (i.e. 72 consecutive - characters) in your commit messages.

You're depending on some implementation specific markup that won't necessarily exist for every client. The XML format (svn log --xml {url}) is a bit more standard if you want to parse it with tools (or you might consider using SVN::Client)

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.

That's because you are reading from @ARGV after the <> operator (generated by -n) is. Try something like...

perl -ne 'BEGIN{$/="-"x72; $re = shift} print"$r\n"if((($r)=split)&&/$ +re/)' search_term

...or...

perl -lne 'BEGIN{$/="-"x72; $re = shift} /$re/ and ($_)=split and prin +t' search_term


Comment on Re: Find svn log revisions with log message matching a given string
Select or Download Code
Replies are listed 'Best First'.
Re^2: Find svn log revisions with log message matching a given string
by bellaire (Hermit) on Jan 27, 2010 at 12:55 UTC
      You're depending on some implementation specific markup that won't necessarily exist for every client. The XML format (svn log --xml {url}) is a bit more standard if you want to parse it with tools (or you might consider using SVN::Client)

    Good point, that's true, but parsing XML properly is more of a full script than this. Once I've gone that far I'd want to include more features... beyond the intended scope of this solution. I have no problem with the fact that this method is limited to clients that produce output in this particular format.

      That's because you are reading from @ARGV after the <> operator (generated by -n) is. Try something like...

    Great, that's what I needed to know. :) I like the use of -l for the cleaner split and print as well.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://819831]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others exploiting the Monastery: (13)
As of 2015-07-29 21:48 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls