* use the built-in push_hook_functions to register the netsync hooks,
this way additional hooks which need these notifications as well do not override earlier hooks * optionally include an additional hooks.lua file at the very end in which custom hooks can be defined
This commit is contained in:
parent
c807c4b734
commit
8a55952204
@ -34,22 +34,23 @@ end
|
||||
-- let IDF know of new arriving revisions to fill its timeline
|
||||
--
|
||||
_idf_revs = {}
|
||||
function note_netsync_start(session_id)
|
||||
push_hook_functions({
|
||||
["start"] = function (session_id)
|
||||
_idf_revs[session_id] = {}
|
||||
end
|
||||
|
||||
function note_netsync_revision_received(new_id, revision, certs, session_id)
|
||||
return "continue",nil
|
||||
end,
|
||||
["revision_received"] = function (new_id, revision, certs, session_id)
|
||||
table.insert(_idf_revs[session_id], new_id)
|
||||
end
|
||||
|
||||
function note_netsync_end (session_id, ...)
|
||||
return "continue",nil
|
||||
end,
|
||||
["end"] = function (session_id, ...)
|
||||
if table.getn(_idf_revs[session_id]) == 0 then
|
||||
return
|
||||
return "continue",nil
|
||||
end
|
||||
|
||||
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
|
||||
if pid == -1 then
|
||||
print("could execute %%MTNPOSTPUSH%%")
|
||||
print("could not execute %%MTNPOSTPUSH%%")
|
||||
return
|
||||
end
|
||||
|
||||
@ -59,5 +60,11 @@ function note_netsync_end (session_id, ...)
|
||||
pin:close()
|
||||
|
||||
wait(pid)
|
||||
return "continue",nil
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
-- Load additional local hooks, in case they exist
|
||||
--
|
||||
include(get_confdir() .. "/hooks.lua")
|
||||
|
@ -31,7 +31,8 @@ function get_remote_automate_permitted(key_identity, command, options)
|
||||
"leaves", "ancestry_difference", "toposort", "erase_ancestors",
|
||||
"descendents", "ancestors", "heads", "get_file_of", "get_file",
|
||||
"interface_version", "get_attributes", "content_diff",
|
||||
"file_merge", "show_conflicts", "certs", "keys"
|
||||
"file_merge", "show_conflicts", "certs", "keys", "get_file_size",
|
||||
"get_extended_manifest_of"
|
||||
}
|
||||
|
||||
for _,v in ipairs(read_only_commands) do
|
||||
@ -47,22 +48,23 @@ end
|
||||
-- let IDF know of new arriving revisions to fill its timeline
|
||||
--
|
||||
_idf_revs = {}
|
||||
function note_netsync_start(session_id)
|
||||
push_hook_functions({
|
||||
["start"] = function (session_id)
|
||||
_idf_revs[session_id] = {}
|
||||
end
|
||||
|
||||
function note_netsync_revision_received(new_id, revision, certs, session_id)
|
||||
return "continue",nil
|
||||
end,
|
||||
["revision_received"] = function (new_id, revision, certs, session_id)
|
||||
table.insert(_idf_revs[session_id], new_id)
|
||||
end
|
||||
|
||||
function note_netsync_end (session_id, ...)
|
||||
return "continue",nil
|
||||
end,
|
||||
["end"] = function (session_id, ...)
|
||||
if table.getn(_idf_revs[session_id]) == 0 then
|
||||
return
|
||||
return "continue",nil
|
||||
end
|
||||
|
||||
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
|
||||
if pid == -1 then
|
||||
print("could execute %%MTNPOSTPUSH%%")
|
||||
print("could not execute %%MTNPOSTPUSH%%")
|
||||
return
|
||||
end
|
||||
|
||||
@ -72,4 +74,11 @@ function note_netsync_end (session_id, ...)
|
||||
pin:close()
|
||||
|
||||
wait(pid)
|
||||
return "continue",nil
|
||||
end
|
||||
})
|
||||
|
||||
--
|
||||
-- Load additional local hooks, in case they exist
|
||||
--
|
||||
include(get_confdir() .. "/hooks.lua")
|
||||
|
Loading…
Reference in New Issue
Block a user