Module: display_revisions.lua
Author: RichardLevitte
Included in monotone: no
Compatible with monotone version 0.41 and on
Description
This is a toy lua hook for monotone the revisions received through a
push
or a sync
.
Source
-- Lua snippet to display the revisions that came into the database.
-- /Richard Levitte
--
-- Released as public domain
do
notifier = {
revision_received =
function(rev_id, rev_text, rev_certs, session_id)
for _,cert in ipairs(rev_certs) do
if cert["name"] == "branch" then
branch = cert["value"]
elseif cert["name"] == "date" then
date = cert["value"]
elseif cert["name"] == "author" then
author = cert["value"]
elseif cert["name"] == "changelog" then
changelog = cert["value"]
end
end
print("\n========================================\n" ..
"Date: " .. date .. "\n" ..
"Branch: " .. branch .. "\n" ..
"Author: " .. author .. "\n" ..
"Changelog:\n" ..
"----------\n" ..
changelog .. "\n" ..
"----------\n" ..
rev_text .. "\n")
return "continue",nil
end
}
local v,m = push_hook_functions(notifier)
if not v then
error(m)
elseif m then
io.stderr:write("Warning: ",m,"\n")
end
end
Installation
Just download the source (display_revisions.lua
) and include it from
your monotonerc
with the
include
command