From 10ef01e3746bf4c7cc129ca2665a19e345d77f9c Mon Sep 17 00:00:00 2001 From: kshyatt Date: Sun, 8 Jan 2017 13:56:57 -0800 Subject: [PATCH] Deprecate GitAnyObject -> GitUnknownObject --- base/deprecated.jl | 3 +++ base/libgit2/libgit2.jl | 4 ++-- base/libgit2/reference.jl | 2 +- base/libgit2/repository.jl | 6 +++--- base/libgit2/tree.jl | 2 +- base/libgit2/types.jl | 44 +++++++++++++++++++------------------- 6 files changed, 32 insertions(+), 29 deletions(-) diff --git a/base/deprecated.jl b/base/deprecated.jl index a265fef82d2d8..e93f19fbf7013 100644 --- a/base/deprecated.jl +++ b/base/deprecated.jl @@ -1512,4 +1512,7 @@ unsafe_wrap(::Type{String}, p::Cstring, own::Bool=false) = unsafe_wrap(String, c unsafe_wrap(::Type{String}, p::Cstring, len::Integer, own::Bool=false) = unsafe_wrap(String, convert(Ptr{UInt8}, p), len, own) +# Rename LibGit2.GitAnyObject to LibGit2.GitUnknownObject (part of #19839) +eval(LibGit2, :(Base.@deprecate_binding GitAnyObject GitUnknownObject)) + # End deprecations scheduled for 0.6 diff --git a/base/libgit2/libgit2.jl b/base/libgit2/libgit2.jl index e419b29cb39a9..9231b52808d96 100644 --- a/base/libgit2/libgit2.jl +++ b/base/libgit2/libgit2.jl @@ -284,7 +284,7 @@ function checkout!(repo::GitRepo, commit::AbstractString = ""; end # search for commit to get a commit object - obj = get(GitAnyObject, repo, Oid(commit)) + obj = get(GitUnknownObject, repo, Oid(commit)) obj === nothing && return try peeled = peel(obj, Consts.OBJ_COMMIT) @@ -341,7 +341,7 @@ end """ git reset [--soft | --mixed | --hard] """ function reset!(repo::GitRepo, commit::Oid, mode::Cint = Consts.RESET_MIXED) - obj = get(GitAnyObject, repo, commit) + obj = get(GitUnknownObject, repo, commit) # object must exist for reset obj === nothing && throw(GitError(Error.Object, Error.ERROR, "Commit `$(string(commit))` object not found")) try diff --git a/base/libgit2/reference.jl b/base/libgit2/reference.jl index b3513f568d0fc..14d3be466c377 100644 --- a/base/libgit2/reference.jl +++ b/base/libgit2/reference.jl @@ -108,7 +108,7 @@ function peel{T <: GitObject}(::Type{T}, ref::GitReference) return Oid() elseif err != Int(Error.GIT_OK) if obj_ptr_ptr[] != C_NULL - finalize(GitAnyObject(obj_ptr_ptr[])) + finalize(GitUnknownObject(obj_ptr_ptr[])) end throw(Error.GitError(err)) end diff --git a/base/libgit2/repository.jl b/base/libgit2/repository.jl index ea81c04fe499c..6893e32cb1d39 100644 --- a/base/libgit2/repository.jl +++ b/base/libgit2/repository.jl @@ -74,7 +74,7 @@ function revparse(repo::GitRepo, objname::AbstractString) err = ccall((:git_revparse_single, :libgit2), Cint, (Ptr{Ptr{Void}}, Ptr{Void}, Cstring), obj_ptr_ptr, repo.ptr, objname) err != 0 && return nothing - return GitAnyObject(obj_ptr_ptr[]) + return GitUnknownObject(obj_ptr_ptr[]) end """ Returns id of a found object """ @@ -104,7 +104,7 @@ function get{T <: GitObject}(::Type{T}, r::GitRepo, oid::Oid, oid_size::Int=OID_ return nothing elseif err != Int(Error.GIT_OK) if obj_ptr_ptr[] != C_NULL - finalize(GitAnyObject(obj_ptr_ptr[])) + finalize(GitUnknownObject(obj_ptr_ptr[])) end throw(Error.GitError(err)) end @@ -134,7 +134,7 @@ function peel(obj::GitObject, obj_type::Cint) return Oid() elseif err != Int(Error.GIT_OK) if peeled_ptr_ptr[] != C_NULL - finalize(GitAnyObject(peeled_ptr_ptr[])) + finalize(GitUnknownObject(peeled_ptr_ptr[])) end throw(Error.GitError(err)) end diff --git a/base/libgit2/tree.jl b/base/libgit2/tree.jl index 321bd83708d2c..755a2655425f9 100644 --- a/base/libgit2/tree.jl +++ b/base/libgit2/tree.jl @@ -32,5 +32,5 @@ function object(repo::GitRepo, te::GitTreeEntry) @check ccall((:git_tree_entry_to_object, :libgit2), Cint, (Ptr{Ptr{Void}}, Ptr{Void}, Ref{Void}), obj_ptr_ptr, repo.ptr, te.ptr) - return GitAnyObject(obj_ptr_ptr[]) + return GitUnknownObject(obj_ptr_ptr[]) end diff --git a/base/libgit2/types.jl b/base/libgit2/types.jl index 34ea1ffd425a0..3445455a873c8 100644 --- a/base/libgit2/types.jl +++ b/base/libgit2/types.jl @@ -407,24 +407,24 @@ end # Common types for (typ, ref, sup, fnc) in ( - (:GitRemote, :Void, :AbstractGitObject, :(:git_remote_free)), - (:GitRevWalker, :Void, :AbstractGitObject, :(:git_revwalk_free)), - (:GitConfig, :Void, :AbstractGitObject, :(:git_config_free)), - (:GitReference, :Void, :AbstractGitObject, :(:git_reference_free)), - (:GitDiff, :Void, :AbstractGitObject, :(:git_diff_free)), - (:GitIndex, :Void, :AbstractGitObject, :(:git_index_free)), - (:GitRepo, :Void, :AbstractGitObject, :(:git_repository_free)), - (:GitAnnotated, :Void, :AbstractGitObject, :(:git_annotated_commit_free)), - (:GitRebase, :Void, :AbstractGitObject, :(:git_rebase_free)), - (:GitStatus, :Void, :AbstractGitObject, :(:git_status_list_free)), - (:GitBranchIter, :Void, :AbstractGitObject, :(:git_branch_iterator_free)), - (:GitTreeEntry, :Void, :AbstractGitObject, :(:git_tree_entry_free)), - (:GitSignature, :SignatureStruct, :AbstractGitObject, :(:git_signature_free)), - (:GitAnyObject, :Void, :GitObject, nothing), - (:GitCommit, :Void, :GitObject, nothing), - (:GitBlob, :Void, :GitObject, nothing), - (:GitTree, :Void, :GitObject, nothing), - (:GitTag, :Void, :GitObject, nothing) + (:GitRemote, :Void, :AbstractGitObject, :(:git_remote_free)), + (:GitRevWalker, :Void, :AbstractGitObject, :(:git_revwalk_free)), + (:GitConfig, :Void, :AbstractGitObject, :(:git_config_free)), + (:GitReference, :Void, :AbstractGitObject, :(:git_reference_free)), + (:GitDiff, :Void, :AbstractGitObject, :(:git_diff_free)), + (:GitIndex, :Void, :AbstractGitObject, :(:git_index_free)), + (:GitRepo, :Void, :AbstractGitObject, :(:git_repository_free)), + (:GitAnnotated, :Void, :AbstractGitObject, :(:git_annotated_commit_free)), + (:GitRebase, :Void, :AbstractGitObject, :(:git_rebase_free)), + (:GitStatus, :Void, :AbstractGitObject, :(:git_status_list_free)), + (:GitBranchIter, :Void, :AbstractGitObject, :(:git_branch_iterator_free)), + (:GitTreeEntry, :Void, :AbstractGitObject, :(:git_tree_entry_free)), + (:GitSignature, :SignatureStruct, :AbstractGitObject, :(:git_signature_free)), + (:GitUnknownObject, :Void, :GitObject, nothing), + (:GitCommit, :Void, :GitObject, nothing), + (:GitBlob, :Void, :GitObject, nothing), + (:GitTree, :Void, :GitObject, nothing), + (:GitTag, :Void, :GitObject, nothing) ) @eval type $typ <: $sup @@ -486,8 +486,8 @@ function getobjecttype{T<:GitObject}(::Type{T}) Consts.OBJ_BLOB elseif T == GitTag Consts.OBJ_TAG - elseif T == GitAnyObject - Consts.OBJ_ANY + elseif T == GitUnknownObject + Consts.OBJ_ANY # this name comes from the header else throw(GitError(Error.Object, Error.ENOTFOUND, "Type $T is not supported")) end @@ -502,8 +502,8 @@ function getobjecttype(obj_type::Cint) GitBlob elseif obj_type == Consts.OBJ_TAG GitTag - elseif obj_type == Consts.OBJ_ANY - GitAnyObject + elseif obj_type == Consts.OBJ_ANY #this name comes from the header + GitUnknownObject else throw(GitError(Error.Object, Error.ENOTFOUND, "Object type $obj_type is not supported")) end