Skip to content

Commit

Permalink
Remove LibGit2 deprecations. (#28460)
Browse files Browse the repository at this point in the history
  • Loading branch information
Sacha0 authored and JeffBezanson committed Aug 6, 2018
1 parent 5d43217 commit f7d9a8b
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 63 deletions.
12 changes: 3 additions & 9 deletions stdlib/LibGit2/src/LibGit2.jl
Original file line number Diff line number Diff line change
Expand Up @@ -268,16 +268,14 @@ Equivalent to `git fetch [<remoteurl>|<repo>] [<refspecs>]`.
function fetch(repo::GitRepo; remote::AbstractString="origin",
remoteurl::AbstractString="",
refspecs::Vector{<:AbstractString}=AbstractString[],
payload::Creds=nothing,
credentials::Creds=payload,
credentials::Creds=nothing,
callbacks::Callbacks=Callbacks())
rmt = if isempty(remoteurl)
get(GitRemote, repo, remote)
else
GitRemoteAnon(repo, remoteurl)
end

deprecate_payload_keyword(:fetch, "repo", payload)
cred_payload = reset!(CredentialPayload(credentials), GitConfig(repo))
if !haskey(callbacks, :credentials)
callbacks[:credentials] = (credentials_cb(), cred_payload)
Expand Down Expand Up @@ -326,16 +324,14 @@ function push(repo::GitRepo; remote::AbstractString="origin",
remoteurl::AbstractString="",
refspecs::Vector{<:AbstractString}=AbstractString[],
force::Bool=false,
payload::Creds=nothing,
credentials::Creds=payload,
credentials::Creds=nothing,
callbacks::Callbacks=Callbacks())
rmt = if isempty(remoteurl)
get(GitRemote, repo, remote)
else
GitRemoteAnon(repo, remoteurl)
end

deprecate_payload_keyword(:push, "repo", payload)
cred_payload = reset!(CredentialPayload(credentials), GitConfig(repo))
if !haskey(callbacks, :credentials)
callbacks[:credentials] = (credentials_cb(), cred_payload)
Expand Down Expand Up @@ -559,10 +555,8 @@ function clone(repo_url::AbstractString, repo_path::AbstractString;
branch::AbstractString="",
isbare::Bool = false,
remote_cb::Ptr{Cvoid} = C_NULL,
payload::Creds=nothing,
credentials::Creds=payload,
credentials::Creds=nothing,
callbacks::Callbacks=Callbacks())
deprecate_payload_keyword(:clone, "repo_url, repo_path", payload)
cred_payload = reset!(CredentialPayload(credentials))
if !haskey(callbacks, :credentials)
callbacks[:credentials] = (credentials_cb(), cred_payload)
Expand Down
54 changes: 0 additions & 54 deletions stdlib/LibGit2/src/deprecated.jl
Original file line number Diff line number Diff line change
@@ -1,55 +1 @@
# This file is a part of Julia. License is MIT: https://julialang.org/license

# BEGIN 0.7 deprecations

# PR #22062
function set_remote_url(repo::LibGit2.GitRepo, url::AbstractString; remote::AbstractString="origin")
Base.depwarn(string(
"`LibGit2.set_remote_url(repo, url; remote=remote)` is deprecated, use ",
"`LibGit2.set_remote_url(repo, remote, url)` instead."), :set_remote_url)
set_remote_url(repo, remote, url)
end

function set_remote_url(path::AbstractString, url::AbstractString; remote::AbstractString="origin")
Base.depwarn(string(
"`LibGit2.set_remote_url(path, url; remote=remote)` is deprecated, use ",
"`LibGit2.set_remote_url(path, remote, url)` instead."), :set_remote_url)
set_remote_url(path, remote, url)
end

function prompt(msg::AbstractString; default::AbstractString="", password::Bool=false)
Base.depwarn(string(
"`LibGit2.prompt(msg::AbstractString; default::AbstractString=\"\", password::Bool=false)` is deprecated, use ",
"`result = Base.prompt(msg, default=default, password=password); result === nothing ? \"\" : result` instead."), :prompt)
something(Base.prompt(msg, default=default, password=password), "")
end

# PR #26437
# when this deprecation is deleted, remove all calls to it, and remove the keyword of:
# `payload` from "src/LibGit2.jl"
function deprecate_payload_keyword(f, sig, payload)
if payload !== nothing
Base.depwarn(string(
"`LibGit2.$f($sig; payload=cred)` is deprecated, use ",
"`LibGit2.$f($sig; credentials=cred)` instead."), f)
end
end

@deprecate get_creds!(cache::CachedCredentials, credid, default) get!(cache, credid, default)

@eval Base @deprecate merge!(repo::$(GitRepo), args...; kwargs...) $(LibGit2.merge!)(repo, args...; kwargs...)
@eval Base @deprecate push!(w::$(GitRevWalker), arg) $(LibGit2.push!)(w, arg)
@eval Base @deprecate count(diff::$(GitDiff)) $(LibGit2.count)(diff)
@eval Base @deprecate count(idx::$(GitIndex)) $(LibGit2.count)(idx)
@eval Base @deprecate count(rb::$(GitRebase)) $(LibGit2.count)(rb)
@eval Base @deprecate count(tree::$(GitTree)) $(LibGit2.count)(tree)
@eval Base @deprecate count(f::Function, walker::$(GitRevWalker); kwargs...) $(LibGit2.count)(f, walker; kwargs...)
@eval Base @deprecate map(f::Function, walker::$(GitRevWalker); kwargs...) $(LibGit2.map)(f, walker; kwargs...)

# PR #24594
@deprecate AbstractCredentials AbstractCredential false
@deprecate UserPasswordCredentials UserPasswordCredential false
@deprecate SSHCredentials SSHCredential false

@deprecate hex(id::LibGit2.GitHash) string(id)
@deprecate hex(id::LibGit2.GitShortHash) string(id)

0 comments on commit f7d9a8b

Please sign in to comment.