-
Notifications
You must be signed in to change notification settings - Fork 128
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Make 'ml restore' behave the same for broken collections/inconsistent collections #329
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1017,6 +1017,7 @@ function M.getMTfromFile(self,tt) | |
local f = io.open(tt.fn,"r") | ||
local msg = tt.msg | ||
local collectionName = tt.name | ||
local force = tt.force | ||
if (not f) then | ||
LmodErrorExit() | ||
end | ||
|
@@ -1054,8 +1055,8 @@ function M.getMTfromFile(self,tt) | |
dbg.print{"sn: ",sn,", hash: ", t[sn], "\n"} | ||
end | ||
|
||
local force = true | ||
Purge(force) | ||
local forcepurge = true | ||
Purge(forcepurge) | ||
|
||
local savedBaseMPATH = l_mt.systemBaseMPATH | ||
dbg.print{"Saved baseMPATH: ",savedBaseMPATH,"\n"} | ||
|
@@ -1174,7 +1175,13 @@ function M.getMTfromFile(self,tt) | |
activeT = nil -- done with activeT | ||
if (#aa > 0) then | ||
sort(aa) | ||
LmodWarning{msg="w_Mods_Not_Loaded",module_list=concatTbl(aa," ")} | ||
if (force ~= true) then | ||
LmodWarning{msg="w_Missing_Coll", collectionName = collectionName, module_list = concatTbl(aa,"\", \"")} | ||
LmodErrorExit() | ||
return false | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is a change from the current behaviour? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed. And I considered that as a bug, Robert too as it seems :) |
||
else | ||
LmodWarning{msg="w_Missing_Coll_Forced", collectionName = collectionName, module_list = concatTbl(aa,"\", \"")} | ||
end | ||
end | ||
|
||
-------------------------------------------------------------------------- | ||
|
@@ -1191,9 +1198,13 @@ function M.getMTfromFile(self,tt) | |
|
||
if (#aa > 0) then | ||
sort(aa) | ||
LmodWarning{msg="w_Broken_Coll", collectionName = collectionName, module_list = concatTbl(aa,"\", \"")} | ||
if (collectionName ~= "default") then | ||
LmodErrorExit() | ||
if (force ~= true) then | ||
LmodWarning{msg="w_Broken_Coll", collectionName = collectionName, module_list = concatTbl(aa,"\", \"")} | ||
if (collectionName ~= "default") then | ||
LmodErrorExit() | ||
end | ||
else | ||
LmodWarning{msg="w_Broken_Coll_Forced", collectionName = collectionName, module_list = concatTbl(aa,"\", \"")} | ||
end | ||
return false | ||
end | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -527,7 +527,7 @@ end | |
-- state. If a user has a "default" then use that collection. | ||
-- Otherwise do a "Reset()" | ||
-- @param collection The user supplied collection name. If *nil* the use "default" | ||
function Restore(collection) | ||
function Restore(collection, force) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. add any new arguments to the doc string of the function. |
||
dbg.start{"Restore(",collection,")"} | ||
|
||
local msg | ||
|
@@ -565,6 +565,12 @@ function Restore(collection) | |
|
||
|
||
local masterTbl = masterTbl() | ||
local force | ||
if (masterTbl.force) then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. what's the point of this? local force = masterTbl.force does the same? And if you only need to pass it as an argument, do you really need a local variable? |
||
force = true | ||
else | ||
force = false | ||
end | ||
|
||
if (collection == "system" ) then | ||
msg = "system default" .. msgTail | ||
|
@@ -581,7 +587,7 @@ function Restore(collection) | |
Reset(msg) | ||
else | ||
local mt = FrameStk:singleton():mt() | ||
local results = mt:getMTfromFile{fn=path, name=myName, msg=msg} | ||
local results = mt:getMTfromFile{fn=path, name=myName, msg=msg, force=force} | ||
if (not results and collection == "default") then | ||
Reset(msg) | ||
end | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why not make this a
LmodError
if you exit anyway?