Skip to content

Commit

Permalink
🤖 Automatically format the source code files
Browse files Browse the repository at this point in the history
  • Loading branch information
bors[bot] authored Mar 14, 2023
1 parent a477046 commit 857f7e8
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
17 changes: 12 additions & 5 deletions src/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,20 @@ function clone_all_registries(f::Function, registry_list::Vector{Pkg.RegistrySpe
@mock git_clone(registry.url, local_registry_path)
end

registries = RegistryInstances.reachable_registries(; depots = tmp_dir)
registries = RegistryInstances.reachable_registries(; depots=tmp_dir)

f(registries)

@mock rm(tmp_dir; force=true, recursive=true)

nothing
return nothing
end

function get_latest_version!(deps::Set{DepInfo}, registries::Vector{RegistryInstances.RegistryInstance}; options::Options)
function get_latest_version!(
deps::Set{DepInfo},
registries::Vector{RegistryInstances.RegistryInstance};
options::Options,
)
for registry_instance in registries
packages = registry_instance.pkgs

Expand All @@ -86,7 +90,10 @@ function get_latest_version!(deps::Set{DepInfo}, registries::Vector{RegistryInst

if uuid in keys(packages)
pkginfo = RegistryInstances.registry_info(packages[uuid])
versions = [k for (k, v) in pkginfo.version_info if options.include_yanked || !v.yanked]
versions = [
k for
(k, v) in pkginfo.version_info if options.include_yanked || !v.yanked
]

max_version = maximum(versions)
dep.latest_version = _max(dep.latest_version, max_version)
Expand All @@ -96,7 +103,7 @@ function get_latest_version!(deps::Set{DepInfo}, registries::Vector{RegistryInst
end

function get_existing_registries!(deps::Set{DepInfo}, depot::String; options::Options)
registries = RegistryInstances.reachable_registries(; depots = depot)
registries = RegistryInstances.reachable_registries(; depots=depot)
get_latest_version!(deps, registries; options)

return deps
Expand Down
4 changes: 2 additions & 2 deletions test/dependencies.jl
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,8 @@
end

@testset "clone_all_registries" begin
registry_1_url, registry_1_name = "https://github.com/JuliaRegistries/General", "General"
registry_1_url, registry_1_name = "https://github.com/JuliaRegistries/General",
"General"
registry_2_url, registry_2_name = "https://github.com/JuliaRegistries/Test", "Test"

# Use temporary DEPOT_PATH
Expand All @@ -45,7 +46,6 @@ end
Pkg.RegistrySpec(; name=registry_1_name, url=registry_1_url),
Pkg.RegistrySpec(; name=registry_2_name, url=registry_2_url),
]) do registries

@test length(registries) == 2
@test contains(registry_1_name, registries[1].name)
@test contains(registry_2_name, registries[2].name)
Expand Down

0 comments on commit 857f7e8

Please sign in to comment.