Indefero

Indefero Commit Details


Date:2010-10-28 12:45:45 (14 years 1 month ago)
Author:Thomas Keller
Branch:develop, feature-issue_links, feature.better-home, feature.content-md5, feature.diff-whitespace, feature.download-md5, feature.issue-links, feature.issue-of-others, feature.issue-summary, feature.search-filter, feature.webrepos, feature.wiki-default-page, master, release-1.1, release-1.2, release-1.3
Commit:8a55952204ba29f0cab49b38cea79661d9d10cb8
Parents: c807c4b7347434d25b1677ca444ace3d9ac27fc8
Message:* 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

Changes:

File differences

src/IDF/Plugin/SyncMonotone/monotonerc-auth.tpl
3434
3535
3636
37
38
39
37
38
39
40
41
42
43
44
45
46
47
48
49
4050
41
42
43
51
52
53
54
55
4456
45
46
47
48
49
50
51
52
53
54
57
58
59
60
5561
56
57
62
63
5864
59
60
61
62
65
6366
67
68
69
70
-- let IDF know of new arriving revisions to fill its timeline
--
_idf_revs = {}
function note_netsync_start(session_id)
_idf_revs[session_id] = {}
end
push_hook_functions({
["start"] = function (session_id)
_idf_revs[session_id] = {}
return "continue",nil
end,
["revision_received"] = function (new_id, revision, certs, session_id)
table.insert(_idf_revs[session_id], new_id)
return "continue",nil
end,
["end"] = function (session_id, ...)
if table.getn(_idf_revs[session_id]) == 0 then
return "continue",nil
end
function note_netsync_revision_received(new_id, revision, certs, session_id)
table.insert(_idf_revs[session_id], new_id)
end
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
if pid == -1 then
print("could not execute %%MTNPOSTPUSH%%")
return
end
function note_netsync_end (session_id, ...)
if table.getn(_idf_revs[session_id]) == 0 then
return
end
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
if pid == -1 then
print("could execute %%MTNPOSTPUSH%%")
return
end
for _,r in ipairs(_idf_revs[session_id]) do
pin:write(r .. "\n")
end
pin:close()
for _,r in ipairs(_idf_revs[session_id]) do
pin:write(r .. "\n")
wait(pid)
return "continue",nil
end
pin:close()
wait(pid)
end
})
--
-- Load additional local hooks, in case they exist
--
include(get_confdir() .. "/hooks.lua")
src/IDF/Plugin/SyncMonotone/monotonerc-noauth.tpl
3131
3232
3333
34
34
35
3536
3637
3738
......
4748
4849
4950
50
51
52
53
54
55
56
51
52
53
54
55
56
57
58
59
60
61
62
63
5764
58
59
60
61
65
66
67
68
69
6270
63
64
65
66
67
71
72
73
74
6875
69
70
76
77
7178
72
79
7380
74
75
81
82
83
84
"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
-- let IDF know of new arriving revisions to fill its timeline
--
_idf_revs = {}
function note_netsync_start(session_id)
_idf_revs[session_id] = {}
end
function note_netsync_revision_received(new_id, revision, certs, session_id)
table.insert(_idf_revs[session_id], new_id)
end
push_hook_functions({
["start"] = function (session_id)
_idf_revs[session_id] = {}
return "continue",nil
end,
["revision_received"] = function (new_id, revision, certs, session_id)
table.insert(_idf_revs[session_id], new_id)
return "continue",nil
end,
["end"] = function (session_id, ...)
if table.getn(_idf_revs[session_id]) == 0 then
return "continue",nil
end
function note_netsync_end (session_id, ...)
if table.getn(_idf_revs[session_id]) == 0 then
return
end
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
if pid == -1 then
print("could not execute %%MTNPOSTPUSH%%")
return
end
local pin,pout,pid = spawn_pipe("%%MTNPOSTPUSH%%", "%%PROJECT%%");
if pid == -1 then
print("could execute %%MTNPOSTPUSH%%")
return
end
for _,r in ipairs(_idf_revs[session_id]) do
pin:write(r .. "\n")
end
pin:close()
for _,r in ipairs(_idf_revs[session_id]) do
pin:write(r .. "\n")
wait(pid)
return "continue",nil
end
pin:close()
})
wait(pid)
end
--
-- Load additional local hooks, in case they exist
--
include(get_confdir() .. "/hooks.lua")

Archive Download the corresponding diff file

Page rendered in 0.08885s using 13 queries.