From ade7b954654df13fb8d63a900b4f12e23e538ab8 Mon Sep 17 00:00:00 2001 From: Shuheng Liu Date: Sun, 10 Nov 2024 15:11:33 -0500 Subject: [PATCH] fix: migrate repo from IPM 0.9 as well --- src/cls/IPM/Utils/Migration.cls | 35 +++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/src/cls/IPM/Utils/Migration.cls b/src/cls/IPM/Utils/Migration.cls index 5681f1cd..32a37bdb 100644 --- a/src/cls/IPM/Utils/Migration.cls +++ b/src/cls/IPM/Utils/Migration.cls @@ -8,6 +8,7 @@ ClassMethod RunAll(verbose As %Boolean = 1) As %Status Set sc = $$$OK Try { Do ..MigrateZPMToIPM(verbose) + Do ..MigrateReposFromIPM09(verbose) } Catch e { Set sc = e.AsStatus() } @@ -206,4 +207,38 @@ ClassMethod MigrateOneRepo(oldId As %String, name As %String, verbose As %Boolea Write:verbose !,"done." } +ClassMethod MigrateReposFromIPM09(verbose As %Boolean = 1) As %Status +{ + If verbose { + Write !,"Starting IPM repo migration from IPM 0.9..." + } + Set tSC = $$$OK + Try { + If $Data(^IPM.Repo.DefinitionD) / 2 = 0 { + If verbose { + Write !,"No IPM repos found; nothing to migrate." + } + Quit + } + Set sub = "" + Set oldValue = "~%IPM.Repo.Remote.Definition~" + Set newValue = "~%IPM.Repo.Http.Definition~%IPM.Repo.Remote.Definition~" + For { + Set sub = $Order(^IPM.Repo.DefinitionD(sub)) + If sub = "" { + Quit + } + If ($Data(^IPM.Repo.DefinitionD(sub,"RepoDefinition"), list) # 2) && ($ListGet(list, 1) = oldValue){ + Set $List(^IPM.Repo.DefinitionD(sub, "RepoDefinition"), 1) = newValue + } + } + If verbose { + Write !,"Repos migrated from IPM 0.9." + } + } Catch e { + Set tSC = e.AsStatus() + } + Quit tSC +} + }