Created
January 16, 2015 11:57
-
-
Save xanthalas/f0348d809bc2c641f040 to your computer and use it in GitHub Desktop.
Retrieve log of recent subversion commits for given user
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########################################################################################## | |
| # Program: mycommits # | |
| # Author : Xanthalas # | |
| # : Retrieves all the commit messages from the repository referenced in the # | |
| # : mycommits.ini file. # | |
| ########################################################################################## | |
| def parseMessages(messages, user) | |
| output = Array.[] | |
| saving_lines = false | |
| messages.lines.each {|line| | |
| if line =~ /^----/ | |
| output.push line if saving_lines | |
| saving_lines = false | |
| next | |
| end | |
| if line =~ /^r\d{0,5}/ | |
| saving_lines = true if line.include? user | |
| end | |
| output.push line if saving_lines | |
| } | |
| return output | |
| end | |
| ################################################################################ | |
| # Main code starts here # | |
| ################################################################################ | |
| path = File.dirname(__FILE__) + "/mycommits.ini" | |
| svncommand = "svn log " + File.read(path) | |
| contents = `#{svncommand}` | |
| results = parseMessages(contents, 'xanthalas') | |
| puts results | |
| ################################################################################ | |
| # mycommits.ini should contain a single line which will be concatenated to the # | |
| # svn log command. For example: # | |
| # http://cssbedsub/svn/rummage/branches/2015-release -l 200 # | |
| ################################################################################ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment