monotone

monotone Mtn Source Tree

Root/contrib/monotone-buildbot-notification.lua

1-- The following hook informs the buildbot about a new revision received
2-- via netsync. This is done via the `buildbot sendchange` command here and
3-- with the PBChangeSource on the buildbot server side.
4--
5--
6-- Version history:
7-- ----------------
8--
9-- 0.1 (2007-07-10) Markus Schiltknecht <markus@bluegap.ch>
10-- - initial version
11--
12-- License: GPL
13--
14
15_buildbot_bin = "/usr/bin/buildbot"
16_buildbot_addr = "localhost:9989"
17
18function notify_buildbot(rev_id, revision, certs)
19 local author = ""
20 local changelog = ""
21 local branch = ""
22 for i,cert in pairs(certs) do
23 if cert["name"] == "changelog" then
24 changelog = changelog .. cert["value"] .. "\n"
25elseif cert["name"] == "author" then
26 -- we simply override the author, in case there are multiple
27 -- author certs.
28 author = cert["value"]
29elseif cert["name"] == "branch" then
30 -- likewise with the branch cert, which probably isn't that
31 -- clever...
32 branch = cert["value"]
33end
34 end
35
36 local touched_files = ""
37 for i,row in ipairs(parse_basic_io(revision)) do
38 local key = row["name"]
39if (key == 'delete') or (key == 'add_dir') or (key == 'add_file') or
40 (key == 'patch') then
41 local filename = row["values"][1]
42 touched_files = touched_files .. filename .. " "
43end
44 end
45
46 execute(_buildbot_bin, "sendchange",
47 "--master", _buildbot_addr,
48 "--username", author,
49 "--revision", rev_id,
50 "--comments", changelog,
51 "--branch", branch,
52 touched_files)
53end
54
55function note_commit (new_id, revision, certs)
56 notify_buildbot(new_id, revision, certs)
57end
58
59function note_netsync_revision_received(new_id, revision, certs, session_id)
60 notify_buildbot(new_id, revision, certs)
61end

Archive Download this file

Branches

Tags

Quick Links:     www.monotone.ca    -     Downloads    -     Documentation    -     Wiki    -     Code Forge    -     Build Status