0
0
mirror of https://github.com/Doodle3D/doodle3d-firmware.git synced 2024-12-22 11:03:48 +01:00

Resolving conflict

This commit is contained in:
peteruithoven 2014-03-19 16:44:09 +01:00
parent 349210a3fc
commit 9f754876f0

View File

@ -238,11 +238,7 @@ end
-- @p[opt=nil] noCommit If true, do not commit the uci configuration; this is more efficient when setting multiple values -- @p[opt=nil] noCommit If true, do not commit the uci configuration; this is more efficient when setting multiple values
-- @treturn bool|nil True if everything went well, false if validation error, nil in case of error. -- @treturn bool|nil True if everything went well, false if validation error, nil in case of error.
-- @treturn ?string Error message in case first return value is nil (invalid key). -- @treturn ?string Error message in case first return value is nil (invalid key).
<<<<<<< HEAD
function M.set(key, value)
=======
function M.set(key, value, noCommit) function M.set(key, value, noCommit)
>>>>>>> develop
log:info("settings:set: "..utils.dump(key).." to: "..utils.dump(value)) log:info("settings:set: "..utils.dump(key).." to: "..utils.dump(value))
key = replaceDots(key) key = replaceDots(key)
@ -255,13 +251,8 @@ function M.set(key, value, noCommit)
end end
local base = getBaseKeyTable(key) local base = getBaseKeyTable(key)
<<<<<<< HEAD
if not base then return nil,ERR_NO_SUCH_KEY end
=======
if not base then return false,ERR_NO_SUCH_KEY end if not base then return false,ERR_NO_SUCH_KEY end
>>>>>>> develop
--log:info(" base.type: "..utils.dump(base.type)) --log:info(" base.type: "..utils.dump(base.type))
if base.type == 'bool' then if base.type == 'bool' then
if value ~= "" then if value ~= "" then
@ -324,25 +315,6 @@ end
function M.resetAll() function M.resetAll()
log:info("settings:resetAll") log:info("settings:resetAll")
<<<<<<< HEAD
-- delete all uci sections but system
local allSections = uci:get_all(UCI_CONFIG_NAME)
for key,value in pairs(allSections) do
if key ~= "system" and not key:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway
uci:delete(UCI_CONFIG_NAME,key)
end
end
-- reset all to defaults
for k,_ in pairs(baseconfig) do
if not k:match('^[A-Z_]*$') then --TEMP: skip 'constants', which should be moved anyway
M.reset(k)
end
end
uci:commit(UCI_CONFIG_NAME)
=======
-- find all sections -- find all sections
local allSections, msg = uci:get_all(UCI_CONFIG_NAME) local allSections, msg = uci:get_all(UCI_CONFIG_NAME)
if not allSections and msg ~= nil then if not allSections and msg ~= nil then
@ -369,7 +341,6 @@ function M.resetAll()
M.reset(k,true) M.reset(k,true)
end end
end end
>>>>>>> develop
M.commit() M.commit()
return true return true
@ -379,15 +350,9 @@ end
-- @string key The key to reset. -- @string key The key to reset.
-- @p[opt=nil] noCommit If true, do not commit the uci configuration; this is more efficient when resetting multiple values -- @p[opt=nil] noCommit If true, do not commit the uci configuration; this is more efficient when resetting multiple values
-- @treturn bool|nil True if everything went well, nil in case of error. -- @treturn bool|nil True if everything went well, nil in case of error.
<<<<<<< HEAD
function M.reset(key)
log:info("settings:reset: "..utils.dump(key))
=======
function M.reset(key, noCommit) function M.reset(key, noCommit)
log:info("settings:reset: "..utils.dump(key)) log:info("settings:reset: "..utils.dump(key))
>>>>>>> develop
-- delete -- delete
key = replaceDots(key) key = replaceDots(key)
local base = getBaseKeyTable(key) local base = getBaseKeyTable(key)
@ -395,15 +360,6 @@ function M.reset(key, noCommit)
local section = UCI_CONFIG_SECTION; local section = UCI_CONFIG_SECTION;
if base.subSection ~= nil then if base.subSection ~= nil then
section = M.get(base.subSection) section = M.get(base.subSection)
<<<<<<< HEAD
end
uci:delete(UCI_CONFIG_NAME, section, key)
-- reuse get logic to retrieve default and set it.
M.set(key,M.get(key))
uci:commit(UCI_CONFIG_NAME)
=======
end end
local rv, msg = uci:delete(UCI_CONFIG_NAME, section, key) local rv, msg = uci:delete(UCI_CONFIG_NAME, section, key)
-- we can't respond to errors in general here because when a key isn't found -- we can't respond to errors in general here because when a key isn't found
@ -418,7 +374,6 @@ function M.reset(key, noCommit)
M.set(key,M.get(key),true) M.set(key,M.get(key),true)
if noCommit ~= true then uci:commit(UCI_CONFIG_NAME) end if noCommit ~= true then uci:commit(UCI_CONFIG_NAME) end
>>>>>>> develop
return true return true
end end