Skip to content

Commit

Permalink
fix: migrate repo from IPM 0.9 as well
Browse files Browse the repository at this point in the history
  • Loading branch information
isc-shuliu committed Nov 10, 2024
1 parent 2b2d97c commit ade7b95
Showing 1 changed file with 35 additions and 0 deletions.
35 changes: 35 additions & 0 deletions src/cls/IPM/Utils/Migration.cls
Original file line number Diff line number Diff line change
Expand Up @@ -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()
}
Expand Down Expand Up @@ -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
}

}

0 comments on commit ade7b95

Please sign in to comment.