1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102
|
-- Copyright (C) 2006 Timothy Brownawell <tbrownaw@gmail.com>
--
-- This program is made available under the GNU GPL version 2.0 or
-- greater. See the accompanying file COPYING for details.
--
-- This program is distributed WITHOUT ANY WARRANTY; without even the
-- implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
-- PURPOSE.
-- this is the "testing" set of lua hooks for monotone
-- it's intended to support self-tests, not for use in
-- production. just defines some of the std hooks.
function get_passphrase(keyid)
return keyid.given_name
end
function accept_testresult_change(old_results, new_results)
for test,res in pairs(old_results)
do
if res == true and new_results[test] ~= true
then
return false
end
end
return true
end
function persist_phrase_ok()
return true
end
function get_author(branchname)
return "tester@test.net"
end
function get_date_format_spec()
return ""
end
function ignore_file(name)
if (string.find(name, "ts-std", 1, true)) then return true end
if (string.find(name, "testsuite.log")) then return true end
if (string.find(name, "test_hooks.lua")) then return true end
if (string.find(name, "keys")) then return true end
return false
end
function merge2(left_path, right_path, merged_path, left, right)
io.write("running merge2 hook\n")
return left
end
merge3 = nil
edit_comment = nil
if (attr_functions == nil) then
attr_functions = {}
end
attr_functions["test:test_attr"] =
function(filename, value)
io.write(string.format("test:test_attr:%s:%s\n", filename, value))
end
-- Ensure that the mtn:execute attr is set the same for all platforms,
-- since attrs are part of the manifest, and we need revids to be
-- invariant across platforms
if (attr_init_functions == nil) then
attr_init_functions = {}
end
attr_init_functions["mtn:execute"] =
function(filename)
return nil
end
function get_mtn_command(host)
return os.getenv("mtn")
end
function get_encloser_pattern(name)
return "^[[:alnum:]$_]"
end
do
local std_get_netsync_connect_command
= get_netsync_connect_command
function get_netsync_connect_command(uri, args)
local argv = std_get_netsync_connect_command(uri, args)
if argv and argv[1] then
table.insert(argv, "--confdir="..get_confdir())
table.insert(argv, "--rcfile="..get_confdir().."/test_hooks.lua")
local x = io.open("custom_test_hooks.lua", "rb")
if (x ~= nil) then
table.insert(argv, "--rcfile="..get_confdir().."/custom_test_hooks.lua")
x:close()
end
end
return argv;
end
end
|