Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
branch: master
Fetching contributors…

Cannot retrieve contributors at this time

executable file 61 lines (47 sloc) 1.527 kB
#!/usr/bin/env ruby
#
# post-commit - a hook to talk to the svnwatch rbot plugin
#
# This file should be placed in the repository's hooks directory
#
# Copyright (c) 2005, Ben Bleything and Robby Russell
# Released under the terms of the MIT License
#
require 'drb'
# Configuration Options
@conf = {
:port => '7666', # 7666 (you will need this to be the same in post-commit)
:host => 'localhost' # localhost, don't set to remote ip unless you know what you are doing
}
# Okay. So we get two args from svn.
#
# [1] - repo path
# [2] - revision number
#
# We then use this information to gather relevant data about the commit
# and do with it as we please.
path = ARGV[0]
rev = ARGV[1]
if (path.nil? || rev.nil?)
puts "Usage: post-commit <repo path> <rev number>"
exit
end
path = File.expand_path(path)
DRb.start_service
bot = DRbObject.new(nil, "druby://#{@conf[:host]}:#{@conf[:port]}")
# The array contains this data:
# [0]: committer
# [1]: timestamp of commit
# [2]: Size of log entry, in bytes
# [3]: Log message
info_array = `svnlook info --revision #{rev} #{path}`.strip.split(/\n/, 4)
# dumb idea, it would wrap too many lines if multiple files...
#changed = `svnlook changed -r #{rev} #{path}`.strip
# guess what the repository name is
repos = path.split(/\//).last
commit_info = { :author => info_array[0],
:revision => rev,
:repository => repos,
:log => info_array[3].gsub(/\n/, ' ')
}
bot.svn_commit commit_info
Jump to Line
Something went wrong with that request. Please try again.