326
326
function update_versions_file (pkg:: Project ,
327
327
versions_file:: AbstractString ,
328
328
versions_data:: Dict{String, Any} ,
329
- tree_hash:: AbstractString )
329
+ tree_hash:: AbstractString ;
330
+ commit_hash:: Union{AbstractString,Nothing} = nothing ,
331
+ tag_hash:: Union{AbstractString,Nothing} = nothing ,
332
+ tag_name:: Union{AbstractString,Nothing} = nothing ,
333
+ subdir:: AbstractString = " " ,
334
+ )
330
335
version_info = Dict {String, Any} (" git-tree-sha1" => string (tree_hash))
336
+ if ! isnothing (commit_hash)
337
+ version_info[" git-commit-sha1" ] = commit_hash
338
+ end
339
+ if ! isnothing (tag_hash)
340
+ version_info[" git-tag-sha1" ] = tag_hash
341
+ end
342
+ if ! isnothing (tag_name)
343
+ version_info[" git-tag-name" ] = tag_name
344
+ end
345
+ if subdir != " "
346
+ version_info[" git-tree-path" ] = subdir
347
+ end
331
348
versions_data[string (pkg. version)] = version_info
332
349
333
350
open (versions_file, " w" ) do io
@@ -341,10 +358,18 @@ function update_versions_file(pkg::Project,
341
358
else
342
359
if x == " git-tree-sha1"
343
360
return 1
344
- elseif x == " yanked "
361
+ elseif x == " git-commit-sha1 "
345
362
return 2
346
- else
363
+ elseif x == " git-tag-sha1 "
347
364
return 3
365
+ elseif x == " git-tag-name"
366
+ return 4
367
+ elseif x == " git-tree-path"
368
+ return 5
369
+ elseif x == " yanked"
370
+ return 100
371
+ else
372
+ return 200
348
373
end
349
374
end
350
375
end
528
553
529
554
function check_and_update_registry_files (pkg:: Project , package_repo, tree_hash,
530
555
registry_path, registry_deps_paths,
531
- status; subdir = " " )
556
+ status;
557
+ commit_hash = nothing , tag_hash = nothing , tag_name = nothing , subdir = " " )
532
558
# find package in registry
533
559
@debug (" find package in registry" )
534
560
registry_file = joinpath (registry_path, " Registry.toml" )
@@ -548,7 +574,7 @@ function check_and_update_registry_files(pkg::Project, package_repo, tree_hash,
548
574
versions_file, versions_data = get_versions_file (package_path)
549
575
old_versions = check_versions! (pkg, versions_data, status)
550
576
haserror (status) && return
551
- update_versions_file (pkg, versions_file, versions_data, tree_hash)
577
+ update_versions_file (pkg, versions_file, versions_data, tree_hash; commit_hash, tag_hash, tag_name, subdir )
552
578
553
579
# update package data: deps file
554
580
@debug (" update package data: deps file" )
@@ -586,7 +612,10 @@ errors or warnings that occurred.
586
612
* `registry_fork::AbstractString=registry: the git repository URL for a fork of the registry
587
613
* `registry_deps::Vector{String}=[]`: the git repository URLs for any registries containing
588
614
packages depended on by `pkg`
589
- * `subdir::AbstractString=""`: path to package within `package_repo`
615
+ * `commit_hash::Union{AbstractString, Nothing}`: commit hash of the package revision (optional)
616
+ * `tag_hash::Union{AbstractString, Nothing}`: tag hash of the package revision (optional)
617
+ * `tag_name::Union{AbstractString, Nothing}`: tag name of the package revision (optional)
618
+ * `subdir::AbstractString=""`: path to package tree within `package_repo`
590
619
* `push::Bool=false`: whether to push a registration branch to `registry` for consideration
591
620
* `gitconfig::Dict=Dict()`: dictionary of configuration options for the `git` command
592
621
"""
@@ -595,6 +624,9 @@ function register(
595
624
registry:: AbstractString = DEFAULT_REGISTRY_URL,
596
625
registry_fork:: AbstractString = registry,
597
626
registry_deps:: Vector{<:AbstractString} = AbstractString[],
627
+ commit_hash:: Union{AbstractString,Nothing} = nothing ,
628
+ tag_hash:: Union{AbstractString,Nothing} = nothing ,
629
+ tag_name:: Union{AbstractString,Nothing} = nothing ,
598
630
subdir:: AbstractString = " " ,
599
631
checks_triggering_error = registrator_errors,
600
632
push:: Bool = false ,
@@ -643,7 +675,8 @@ function register(
643
675
644
676
check_and_update_registry_files (pkg, package_repo, tree_hash,
645
677
registry_path, registry_deps_paths,
646
- status, subdir = subdir)
678
+ status;
679
+ commit_hash, tag_hash, tag_name, subdir)
647
680
haserror (status) && return set_metadata! (regbr, status)
648
681
649
682
regtreesha = get_registrator_tree_sha ()
0 commit comments