Skip to content

Instantly share code, notes, and snippets.

@xanthalas
Created January 16, 2015 11:57
Show Gist options
  • Select an option

  • Save xanthalas/f0348d809bc2c641f040 to your computer and use it in GitHub Desktop.

Select an option

Save xanthalas/f0348d809bc2c641f040 to your computer and use it in GitHub Desktop.
Retrieve log of recent subversion commits for given user
##########################################################################################
# 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