monotone-commits-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Monotone-commits-diffs] net.venge.monotone: fd98d953ca93454c66a55aadf2a


From: code
Subject: [Monotone-commits-diffs] net.venge.monotone: fd98d953ca93454c66a55aadf2adbeb87de86f69
Date: Mon, 23 Sep 2013 21:12:44 +0200 (CEST)

revision:            fd98d953ca93454c66a55aadf2adbeb87de86f69
date:                2013-09-23T18:51:03
author:              address@hidden
branch:              net.venge.monotone
changelog:
Improve compatibility with Lua 5.2 compiled w/o LUA_COMPAT_*. By Thomas
Moschny, some adjustments by myself.

 * test/func-testsuite.lua, test/src/testlib.lua: define a global 'unpack',
   if not present.
 * test/func/*/__driver__.lua: replace maxn() with the #-operator.
 * src/std_hooks.lua, test/func-testsuite.lua: re-define possibly missing
   lua functions here for compatibility.

manifest:
format_version "1"

new_manifest [087d27d11e61e11dc965ba614927d971bce99e1f]

old_revision [8861f8555ef90a04a99404e9f8d5510b2ddb10e6]

patch "src/std_hooks.lua"
 from [7e694c8f47f34cc2491f078ce6cd514fa349755b]
   to [ec456adca8b257eb40e0a1b2e6f6e4111a3c892c]

patch "test/func/automate_stdio_band_output/__driver__.lua"
 from [9a5dbb7a13e37d8508bdc6393a684b76c4de6e32]
   to [7af74c6fd42ec204fa8c56d5101ded56ee7c5d95]

patch "test/func/serve-automate/__driver__.lua"
 from [1343490c3b79e3d936a5b72ba7561055239235f8]
   to [c9af22f561d05521bebbfd1c74e4074d533bc559]

patch "test/func-testsuite.lua"
 from [e53345adfd07d9e11ce929fc38b65b1a6dc37e1c]
   to [6cf7b034c825ec1c8f329c3112536fbcda504d8d]

patch "test/src/testlib.lua"
 from [445ed7ee75dfde94af676e7644e29e874aff58d7]
   to [394bc85a769cdda3b02b54e1b1a8f0ed9005fc54]
============================================================
--- src/std_hooks.lua	7e694c8f47f34cc2491f078ce6cd514fa349755b
+++ src/std_hooks.lua	ec456adca8b257eb40e0a1b2e6f6e4111a3c892c
@@ -10,6 +10,13 @@
 -- this is the standard set of lua hooks for monotone;
 -- user-provided files can override it or add to it.
 
+-- Since Lua 5.2, unpack and loadstrings are deprecated and are either moved
+-- to table.unpack() or replaced by load(). If lua was compiled without
+-- LUA_COMPAT_UNPACK and/or LUA_COMPAT_LOADSTRING, these two are not
+-- available and we add a similar compatibility layer, ourselves.
+unpack = unpack or table.unpack
+loadstring = loadstring or load
+
 function temp_file(namehint, filemodehint)
    local tdir
    tdir = os.getenv("TMPDIR")
@@ -1492,7 +1499,7 @@ do
       return true, warning
    end
    function push_hook_functions(functions)
-      local n = table.maxn(hook_functions) + 1
+      local n = #hook_functions + 1
       return add_hook_functions(functions, n)
    end
 
============================================================
--- test/func/automate_stdio_band_output/__driver__.lua	9a5dbb7a13e37d8508bdc6393a684b76c4de6e32
+++ test/func/automate_stdio_band_output/__driver__.lua	7af74c6fd42ec204fa8c56d5101ded56ee7c5d95
@@ -4,13 +4,13 @@ out = run_stdio("l8:bandtest4:infoe", 0,
 
 -- check informational messages, warnings and errors
 out = run_stdio("l8:bandtest4:infoe", 0, 0, "p")
-check(type(out) == "table" and table.maxn(out) == 1)
+check(type(out) == "table" and #out == 1)
 
 out = run_stdio("l8:bandtest7:warninge", 0, 0, "w")
-check(type(out) == "table" and table.maxn(out) == 1)
+check(type(out) == "table" and #out == 1)
 
 out = run_stdio("l8:bandtest5:errore", 2, 0, "e")
-check(type(out) == "table" and table.maxn(out) == 1)
+check(type(out) == "table" and #out == 1)
 
 -- check tickers
 tickers = run_stdio("l8:bandtest6:tickere", 0, 0, "t")
@@ -38,7 +38,7 @@ for _,tick in ipairs(tickers) do
 ticker_data = {}
 for _,tick in ipairs(tickers) do
     ticks = split(tick, ";")
-    check(table.maxn(ticks) > 0)
+    check(#ticks > 0)
     for _,mtick in ipairs(ticks) do
         if string.len(mtick) > 0 then
             local begin,End,short,ticktype,content =
@@ -78,6 +78,6 @@ end
 end
 
 -- finally check if all tickers are completed
-check(table.maxn(ticker_data) == 0)
+check(#ticker_data == 0)
 
 
============================================================
--- test/func/serve-automate/__driver__.lua	1343490c3b79e3d936a5b72ba7561055239235f8
+++ test/func/serve-automate/__driver__.lua	c9af22f561d05521bebbfd1c74e4074d533bc559
@@ -14,7 +14,7 @@ check(
 
 local errors = run_remote_stdio(server, "l17:interface_versione", 1, 0, "e")
 check(
-    table.maxn(errors) == 1 and
+    #errors == 1 and
     errors[1] == "misuse: sorry, you aren't allowed to do that."
 )
 
@@ -45,7 +45,7 @@ check(
 
 local errors = run_remote_stdio(server, "l5:stdioe", 1, 0, "e")
 check(
-    table.maxn(errors) == 1 and
+    #errors == 1 and
     errors[1] == "error: sorry, that can't be run remotely or over stdio"
 )
 
============================================================
--- test/func-testsuite.lua	e53345adfd07d9e11ce929fc38b65b1a6dc37e1c
+++ test/func-testsuite.lua	6cf7b034c825ec1c8f329c3112536fbcda504d8d
@@ -10,6 +10,13 @@ no_network_tests = false
 monotone_path = nil
 no_network_tests = false
 
+-- Since Lua 5.2, unpack and loadstrings are deprecated and are either moved
+-- to table.unpack() or replaced by load(). If lua was compiled without
+-- LUA_COMPAT_UNPACK and/or LUA_COMPAT_LOADSTRING, these two are not
+-- available and we add a similar compatibility layer, ourselves.
+unpack = unpack or table.unpack
+loadstring = loadstring or load
+
 function safe_mtn(...)
   if monotone_path == nil then
     monotone_path = os.getenv("mtn")
============================================================
--- test/src/testlib.lua	445ed7ee75dfde94af676e7644e29e874aff58d7
+++ test/src/testlib.lua	394bc85a769cdda3b02b54e1b1a8f0ed9005fc54
@@ -30,6 +30,13 @@ ostype = string.sub(get_ostype(), 1, str
 -- for convenience, this is the first word of what get_ostype() returns.
 ostype = string.sub(get_ostype(), 1, string.find(get_ostype(), " ")-1)
 
+-- Since Lua 5.2, unpack and loadstrings are deprecated and are either moved
+-- to table.unpack() or replaced by load(). If lua was compiled without
+-- LUA_COMPAT_UNPACK and/or LUA_COMPAT_LOADSTRING, these two are not
+-- available and we add a similar compatibility layer, ourselves.
+unpack = unpack or table.unpack
+loadstring = loadstring or load
+
 -- table of per-test values
 test = {}
 -- misc per-test values

reply via email to

[Prev in Thread] Current Thread [Next in Thread]