From 6ddb8ce8f7ccddb4446d7f2edbe4067fd960a9e0 Mon Sep 17 00:00:00 2001 From: Chris Foster Date: Sun, 3 Sep 2017 15:32:21 +1000 Subject: [PATCH] Convert libgit2 to use new logging --- base/libgit2/libgit2.jl | 2 +- base/libgit2/merge.jl | 8 ++++---- base/libgit2/types.jl | 18 ------------------ 3 files changed, 5 insertions(+), 23 deletions(-) diff --git a/base/libgit2/libgit2.jl b/base/libgit2/libgit2.jl index af865cc9203680..3e0a5012e071a7 100644 --- a/base/libgit2/libgit2.jl +++ b/base/libgit2/libgit2.jl @@ -409,7 +409,7 @@ function branch!(repo::GitRepo, branch_name::AbstractString, set!(cfg, "branch.$branch_name.merge", name(Base.get(branch_ref))) end catch - warn("Please provide remote tracking for branch '$branch_name' in '$(path(repo))'") + @warn "Please provide remote tracking for branch \"$branch_name\"" repo end end diff --git a/base/libgit2/merge.jl b/base/libgit2/merge.jl index 91556476a581aa..b0350d9901e6ad 100644 --- a/base/libgit2/merge.jl +++ b/base/libgit2/merge.jl @@ -143,7 +143,7 @@ function merge!(repo::GitRepo, anns::Vector{GitAnnotated}; Ptr{MergeOptions}, Ptr{CheckoutOptions}), repo.ptr, map(x->x.ptr, anns), anns_size, Ref(merge_opts), Ref(checkout_opts)) - info("Review and commit merged changes.") + @info "Review and commit merged changes." return true end @@ -206,7 +206,7 @@ function merge!(repo::GitRepo, anns::Vector{GitAnnotated}, fastforward::Bool; merge_result = if ffpref == Consts.MERGE_PREFERENCE_NONE if isset(ma, Cint(Consts.MERGE_ANALYSIS_FASTFORWARD)) if length(anns) > 1 - warn("Unable to perform Fast-Forward merge with mith multiple merge heads.") + @warn "Unable to perform Fast-Forward merge with mith multiple merge heads." repo false else ffmerge!(repo, anns[1]) @@ -219,13 +219,13 @@ function merge!(repo::GitRepo, anns::Vector{GitAnnotated}, fastforward::Bool; elseif ffpref == Consts.MERGE_PREFERENCE_FASTFORWARD_ONLY if isset(ma, Cint(Consts.MERGE_ANALYSIS_FASTFORWARD)) if length(anns) > 1 - warn("Unable to perform Fast-Forward merge with mith multiple merge heads.") + @warn "Unable to perform Fast-Forward merge with mith multiple merge heads." repo false else ffmerge!(repo, anns[1]) end else - warn("Cannot perform fast-forward merge.") + @warn "Cannot perform fast-forward merge." repo false end elseif ffpref == Consts.MERGE_PREFERENCE_NO_FASTFORWARD diff --git a/base/libgit2/types.jl b/base/libgit2/types.jl index 6a8ade8e76cd31..41860c51db9484 100644 --- a/base/libgit2/types.jl +++ b/base/libgit2/types.jl @@ -1003,24 +1003,6 @@ end with(f::Function, ::Type{T}, args...) where {T} = with(f, T(args...)) -""" - with_warn(f::Function, ::Type{T}, args...) - -Resource management helper function. Apply `f` to `args`, first constructing -an instance of type `T` from `args`. Makes sure to call `close` on the resulting -object after `f` successfully returns or throws an error. Ensures that -allocated git resources are finalized as soon as they are no longer needed. If an -error is thrown by `f`, a warning is shown containing the error. -""" -function with_warn(f::Function, ::Type{T}, args...) where T - obj = T(args...) - try - with(f, obj) - catch err - warn("$(string(T)) thrown exception: $err") - end -end - """ LibGit2.Consts.OBJECT(::Type{T}) where T<:GitObject