2013-10-31 19:13:19 +00:00
|
|
|
#!/usr/bin/env ruby
|
|
|
|
|
|
|
|
require 'xmpp4r'
|
|
|
|
require 'xmpp4r/muc/helper/simplemucclient'
|
|
|
|
|
2013-10-31 19:35:30 +00:00
|
|
|
input = gets
|
|
|
|
args = input.strip.split(/ /)
|
2013-10-31 19:24:06 +00:00
|
|
|
oldrev = args[0]
|
|
|
|
newrev = args[1]
|
|
|
|
refname = args[2]
|
2013-10-31 19:13:19 +00:00
|
|
|
user = ENV['GL_USER']
|
|
|
|
|
|
|
|
@jabber_id= "git@higgsboson.tk"
|
|
|
|
@password = "ZTA2NTlkMmNlYjNlZ"
|
|
|
|
|
|
|
|
robot = Jabber::Client::new(Jabber::JID::new(@jabber_id))
|
|
|
|
robot.connect
|
|
|
|
robot.auth(@password)
|
|
|
|
robot.send(Jabber::Presence.new.set_type(:available))
|
|
|
|
|
|
|
|
muc = Jabber::MUC::SimpleMUCClient.new(robot)
|
|
|
|
muc.join(Jabber::JID.new('lctp@muc.higgsboson.tk/git'))
|
|
|
|
|
|
|
|
revs = `git rev-list #{oldrev}..#{newrev}`.split("\n")
|
|
|
|
message = "#{user} has committed: "
|
|
|
|
revs.each do |rev|
|
|
|
|
commit = `git cat-file commit #{rev} | sed '1,/^$/d'`
|
|
|
|
message += "#{commit}\n"
|
|
|
|
end
|
|
|
|
|
2013-10-31 19:35:30 +00:00
|
|
|
puts message
|
|
|
|
sleep(1)
|
2013-10-31 19:13:19 +00:00
|
|
|
muc.say(message)
|