# # # patch "lua/ldo.cc" # from [dfa3815380568d4ebd38d95e292c41926cf8b77b] # to [bab2499a724dfbddaf9c150d474b3c2a2d488e7e] # # patch "std_hooks.lua" # from [a0112255acd3f3073b4db111b292c7a52d03e302] # to [7b72a21724c6b709f94c73271e7ae9ca6202bd6a] # # patch "tester.cc" # from [3537152d89acd809d1286d38e2a208c4b023c062] # to [6b62c3e514471d72d806872114131c6fec366ee0] # # patch "tests/checkout_validates_target_directory/__driver__.lua" # from [99d066e1edbe5d34e4b41d4311a1634879e04d47] # to [bdfd6c99a8ebc76e7959ef79868a6373cfe30f54] # # patch "tests/clone_validates_target_directory/__driver__.lua" # from [45a73099cb011e786fe7072ea9d3a1dd7f498737] # to [7c920d5ae0b54336f15a81000fb5eaffa039a7cd] # # patch "tests/spawn_redirected_hook_helper/__driver__.lua" # from [7510e5e9d34dc9e063bbc33018ce2ea8e86f3c2a] # to [d7416130202dbb4f5098ae5b11f21ee21dd81edb] # # patch "tests/spawn_redirected_hook_helper/testhooks" # from [ca2591f01fbf45e890056734ef35209852b6d2fd] # to [a855ebc6a55c7058367d741c1c0b66ad40d588a0] # ============================================================ --- lua/ldo.cc dfa3815380568d4ebd38d95e292c41926cf8b77b +++ lua/ldo.cc bab2499a724dfbddaf9c150d474b3c2a2d488e7e @@ -54,6 +54,7 @@ void luaD_seterrorobj (lua_State *L, int setsvalue2s(L, oldtop, luaS_newliteral(L, MEMERRMSG)); break; } + case -1: case LUA_ERRERR: { setsvalue2s(L, oldtop, luaS_newliteral(L, "error in error handling")); break; @@ -365,7 +366,7 @@ int luaD_poscall (lua_State *L, StkId fi ** The arguments are on the stack, right after the function. ** When returns, all the results are on the stack, starting at the original ** function position. -*/ +*/ void luaD_call (lua_State *L, StkId func, int nResults) { if (++L->nCcalls >= LUAI_MAXCCALLS) { if (L->nCcalls == LUAI_MAXCCALLS) ============================================================ --- std_hooks.lua a0112255acd3f3073b4db111b292c7a52d03e302 +++ std_hooks.lua 7b72a21724c6b709f94c73271e7ae9ca6202bd6a @@ -19,7 +19,7 @@ end return file, name end -function execute(path, ...) +function execute(path, ...) local pid local ret = -1 pid = spawn(path, unpack(arg)) @@ -40,7 +40,7 @@ end -- returns immediately -- This is needed to work around some brokenness with some merge tools -- (e.g. on OS X) -function execute_confirm(path, ...) +function execute_confirm(path, ...) ret = execute(path, unpack(arg)) if (ret ~= 0) @@ -63,30 +63,30 @@ end attr_init_functions = {} end -attr_init_functions["mtn:execute"] = +attr_init_functions["mtn:execute"] = function(filename) - if (is_executable(filename)) then - return "true" - else - return nil - end + if (is_executable(filename)) then + return "true" + else + return nil + end end -attr_init_functions["mtn:manual_merge"] = +attr_init_functions["mtn:manual_merge"] = function(filename) - if (binary_file(filename)) then + if (binary_file(filename)) then return "true" -- binary files must be merged manually - else + else return nil - end + end end if (attr_functions == nil) then attr_functions = {} end -attr_functions["mtn:execute"] = - function(filename, value) +attr_functions["mtn:execute"] = + function(filename, value) if (value == "true") then make_executable(filename) end @@ -200,7 +200,7 @@ function binary_file(name) if string.find(lowname, pat) then return false end end - -- unknown - read file and use the guess-binary + -- unknown - read file and use the guess-binary -- monotone built-in function return guess_binary_file_contents(name) end @@ -211,7 +211,7 @@ function get_encloser_pattern(name) function get_encloser_pattern(name) -- texinfo has special sectioning commands if (string.find(name, "%.texi$")) then - -- sectioning commands in texinfo: @node, @chapter, @top, + -- sectioning commands in texinfo: @node, @chapter, @top, -- @((sub)?sub)?section, @unnumbered(((sub)?sub)?sec)?, -- @appendix(((sub)?sub)?sec)?, @(|major|chap|sub(sub)?)heading return ("^@(" @@ -285,7 +285,7 @@ function edit_comment(basetext, user_log if (tmp == nil) then os.remove(tname); return nil end local res = "" local line = tmp:read() - while(line ~= nil) do + while(line ~= nil) do if (not string.find(line, "^MTN:")) then res = res .. line .. "\n" end @@ -377,7 +377,7 @@ mergers.meld = { cmd = function (tbl) io.write (string.format("\nWARNING: 'meld' was choosen to perform external 3-way merge.\n".. "You should merge all changes to *CENTER* file due to limitation of program\n".. - "arguments.\n\n")) + "arguments.\n\n")) local path = "meld" local ret = execute(path, tbl.lfile, tbl.afile, tbl.rfile) if (ret ~= 0) then @@ -527,15 +527,21 @@ mergers.emacs = { emacs = "emacs" end local elisp = "(ediff-merge-files-with-ancestor \"%s\" \"%s\" \"%s\" nil \"%s\")" - local ret = execute(emacs, "--eval", - string.format(elisp, tbl.lfile, tbl.rfile, tbl.afile, tbl.outfile)) + -- Converting backslashes is necessary on Win32 MinGW; emacs + -- lisp string syntax says '\' is an escape. + local ret = execute(emacs, "--eval", + string.format(elisp, + string.gsub (tbl.lfile, "\\", "/"), + string.gsub (tbl.rfile, "\\", "/"), + string.gsub (tbl.afile, "\\", "/"), + string.gsub (tbl.outfile, "\\", "/"))) if (ret ~= 0) then io.write(string.format(gettext("Error running merger '%s'\n"), emacs)) return false end return tbl.outfile end, - available = + available = function () return program_exists_in_path("xemacs") or program_exists_in_path("emacs") @@ -555,12 +561,12 @@ mergers.xxdiff = { mergers.xxdiff = { cmd = function (tbl) local path = "xxdiff" - local ret = execute(path, + local ret = execute(path, "--title1", tbl.left_path, "--title2", tbl.right_path, "--title3", tbl.merged_path, - tbl.lfile, tbl.afile, tbl.rfile, - "--merge", + tbl.lfile, tbl.afile, tbl.rfile, + "--merge", "--merged-filename", tbl.outfile, "--exit-with-merge-status") if (ret ~= 0) then @@ -576,12 +582,12 @@ mergers.kdiff3 = { mergers.kdiff3 = { cmd = function (tbl) local path = "kdiff3" - local ret = execute(path, + local ret = execute(path, "--L1", tbl.anc_path, "--L2", tbl.left_path, "--L3", tbl.right_path, - tbl.afile, tbl.lfile, tbl.rfile, - "--merge", + tbl.afile, tbl.lfile, tbl.rfile, + "--merge", "--o", tbl.outfile) if (ret ~= 0) then io.write(string.format(gettext("Error running merger '%s'\n"), path)) @@ -613,8 +619,8 @@ function write_to_temporary_file(data, n function write_to_temporary_file(data, namehint) tmp, filename = temp_file(namehint) - if (tmp == nil) then - return nil + if (tmp == nil) then + return nil end; tmp:write(data) io.close(tmp) @@ -638,7 +644,7 @@ function read_contents_of_file(filename, end function read_contents_of_file(filename, mode) - tmp = io.open(filename, mode) + tmp = io.open(filename, mode) if (tmp == nil) then return nil end @@ -684,39 +690,39 @@ end end end -function merge3 (anc_path, left_path, right_path, merged_path, ancestor, left, right) +function merge3 (anc_path, left_path, right_path, merged_path, ancestor, left, right) local ret = nil local tbl = {} - - tbl.anc_path = anc_path - tbl.left_path = left_path - tbl.right_path = right_path - tbl.merged_path = merged_path - tbl.afile = nil - tbl.lfile = nil - tbl.rfile = nil - tbl.outfile = nil - tbl.meld_exists = false + tbl.anc_path = anc_path + tbl.left_path = left_path + tbl.right_path = right_path + + tbl.merged_path = merged_path + tbl.afile = nil + tbl.lfile = nil + tbl.rfile = nil + tbl.outfile = nil + tbl.meld_exists = false tbl.lfile = write_to_temporary_file (left, "left") tbl.afile = write_to_temporary_file (ancestor, "ancestor") tbl.rfile = write_to_temporary_file (right, "right") tbl.outfile = write_to_temporary_file ("", "merged") - - if tbl.lfile ~= nil and tbl.rfile ~= nil and tbl.afile ~= nil and tbl.outfile ~= nil - then + + if tbl.lfile ~= nil and tbl.rfile ~= nil and tbl.afile ~= nil and tbl.outfile ~= nil + then local cmd,mkey = get_preferred_merge3_command (tbl) - if cmd ~=nil - then + if cmd ~=nil + then io.write (string.format(gettext("executing external 3-way merge command\n"))) ret = cmd (tbl) if not ret then ret = nil else ret = read_contents_of_file (ret, "r") - if string.len (ret) == 0 - then - ret = nil + if string.len (ret) == 0 + then + ret = nil end end else @@ -733,14 +739,14 @@ function merge3 (anc_path, left_path, ri end end end - + os.remove (tbl.lfile) os.remove (tbl.rfile) os.remove (tbl.afile) os.remove (tbl.outfile) - + return ret -end +end -- expansion of values used in selector completion @@ -776,7 +782,7 @@ function expand_selector(str) then return ("d:" .. dtstr) end - + return nil end @@ -789,35 +795,35 @@ function expand_date(str) return (str) end - -- "now" + -- "now" if str == "now" then local t = os.time(os.date('!*t')) return os.date("%FT%T", t) end - + -- today don't uses the time # for xgettext's sake, an extra quote if str == "today" then local t = os.time(os.date('!*t')) return os.date("%F", t) end - + -- "yesterday", the source of all hangovers if str == "yesterday" then local t = os.time(os.date('!*t')) return os.date("%F", t - 86400) end - + -- "CVS style" relative dates such as "3 weeks ago" - local trans = { - minute = 60; - hour = 3600; - day = 86400; - week = 604800; - month = 2678400; - year = 31536000 + local trans = { + minute = 60; + hour = 3600; + day = 86400; + week = 604800; + month = 2678400; + year = 31536000 } local pos, len, n, type = string.find(str, "(%d+) ([minutehordaywk]+)s? ago") if trans[type] ~= nil @@ -826,11 +832,11 @@ function expand_date(str) if trans[type] <= 3600 then return os.date("%FT%T", t - (n * trans[type])) - else + else return os.date("%F", t - (n * trans[type])) end end - + return nil end @@ -935,8 +941,8 @@ function get_netsync_connect_command(uri local argv = nil - if uri["scheme"] == "ssh" - and uri["host"] + if uri["scheme"] == "ssh" + and uri["host"] and uri["path"] then argv = { "ssh" } @@ -949,7 +955,7 @@ function get_netsync_connect_command(uri table.insert(argv, uri["port"]) end - -- ssh://host/~/dir/file.mtn or + -- ssh://host/~/dir/file.mtn or -- ssh://host/~user/dir/file.mtn should be home-relative if string.find(uri["path"], "^/~") then uri["path"] = string.sub(uri["path"], 2) @@ -957,13 +963,13 @@ function get_netsync_connect_command(uri table.insert(argv, uri["host"]) end - + if uri["scheme"] == "file" and uri["path"] then argv = { } end - if uri["scheme"] == "ssh+ux" - and uri["host"] + if uri["scheme"] == "ssh+ux" + and uri["host"] and uri["path"] then argv = { "ssh" } @@ -976,7 +982,7 @@ function get_netsync_connect_command(uri table.insert(argv, uri["port"]) end - -- ssh://host/~/dir/file.mtn or + -- ssh://host/~/dir/file.mtn or -- ssh://host/~user/dir/file.mtn should be home-relative if string.find(uri["path"], "^/~") then uri["path"] = string.sub(uri["path"], 2) @@ -1010,7 +1016,7 @@ function use_transport_auth(uri) end function use_transport_auth(uri) - if uri["scheme"] == "ssh" + if uri["scheme"] == "ssh" or uri["scheme"] == "ssh+ux" or uri["scheme"] == "file" then return false ============================================================ --- tester.cc 3537152d89acd809d1286d38e2a208c4b023c062 +++ tester.cc 6b62c3e514471d72d806872114131c6fec366ee0 @@ -949,7 +949,7 @@ parse_command_line(int argc, char const } else if (int_option(argv[i], "-j", "--jobs=", jobs)) /* no action required */; - else if (argv[i][1] == '-') + else if (argv[i][0] == '-') { P(F("unrecognized option '%s'") % argv[i]); need_help = true; @@ -969,7 +969,7 @@ parse_command_line(int argc, char const E(!run_one || (!want_help && !debugging && !list_only && tests_to_run.size() == 3 && jobs == 0), - F("incorrect self-invocation")); + F("incorrect self-invocation; -r ")); if (tests_to_run.size() == 0) { ============================================================ --- tests/checkout_validates_target_directory/__driver__.lua 99d066e1edbe5d34e4b41d4311a1634879e04d47 +++ tests/checkout_validates_target_directory/__driver__.lua bdfd6c99a8ebc76e7959ef79868a6373cfe30f54 @@ -13,8 +13,11 @@ if existsonpath("chmod") and existsonpat check(mtn("--branch=testbranch", "checkout", "test_dir3"), 1, false, false) if existsonpath("chmod") and existsonpath("test") then - -- skip this part if run as root (hi Gentoo!) - if check({"test", "-O", "/"}, false, false, false) == 0 then + -- Skip this part if run as root (hi Gentoo!) + -- Also skip if on Windows, since these permissions are not enforced there + if check({"test", "-O", "/"}, false, false, false) == 0 or + ostype == "Windows" + then partial_skip = true else mkdir("test_dir4") ============================================================ --- tests/clone_validates_target_directory/__driver__.lua 45a73099cb011e786fe7072ea9d3a1dd7f498737 +++ tests/clone_validates_target_directory/__driver__.lua 7c920d5ae0b54336f15a81000fb5eaffa039a7cd @@ -16,7 +16,10 @@ if existsonpath("chmod") and existsonpat if existsonpath("chmod") and existsonpath("test") then -- skip this part if run as root (hi Gentoo!) - if check({"test", "-O", "/"}, false, false, false) == 0 then + -- Also skip if on Windows, since these permissions are not enforced there + if check({"test", "-O", "/"}, false, false, false) == 0 or + ostype == "Windows" + then partial_skip = true else mkdir("test_dir4") ============================================================ --- tests/spawn_redirected_hook_helper/__driver__.lua 7510e5e9d34dc9e063bbc33018ce2ea8e86f3c2a +++ tests/spawn_redirected_hook_helper/__driver__.lua d7416130202dbb4f5098ae5b11f21ee21dd81edb @@ -1,3 +1,14 @@ +skip_if(ostype == "Windows") +-- FIXME: this test broke on Windows when the change to running tests +-- in parallel was made. There appears to be a race condition in +-- waiting for the spawned test process; running under the debugger +-- with breaks after the spawn but before the wait makes the test work. +-- +-- FIXME: on top of that, the Lua mechanisms can't handle the error; +-- win32/tester-plaf.cc run_tests_in_children returns status -1 to +-- test_cleaner; that eventually gets passed to ldo.cc +-- luaD_seterrorobj, which doesn't handle a status of -1, and +-- tester.exe just exits. So xfail won't work here either. mtn_setup() ============================================================ --- tests/spawn_redirected_hook_helper/testhooks ca2591f01fbf45e890056734ef35209852b6d2fd +++ tests/spawn_redirected_hook_helper/testhooks a855ebc6a55c7058367d741c1c0b66ad40d588a0 @@ -13,7 +13,7 @@ function ignore_file (name) x:close() end end - + if ok then x = io.open("outfile", "w") x:close()