Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move LibGit2 to stdlib #25706

Merged
merged 2 commits into from
Feb 5, 2018
Merged

Move LibGit2 to stdlib #25706

merged 2 commits into from
Feb 5, 2018

Conversation

KristofferC
Copy link
Member

@KristofferC KristofferC commented Jan 23, 2018

Made on top of #25705.

I have a few comments inline.

There was some problems with the documentation generation locally, so we will see what happens here.

@@ -212,6 +212,8 @@ function url(m::Method)
return "https://github.com/JuliaLang/julia/tree/$(Base.GIT_VERSION_INFO.commit)/base/$file#L$line"
end
else
return fileurl(file)
#=
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Need to figure out what to do with this one url(::Method)...

test/docs.jl Outdated
end

let x = Binding(Iterators, :enumerate)
@test defined(x) == true
@test @var(enumerate) == x
@test @var(Base.enumerate) == x
@test @var(Iterators.enumerate) == x
@test @var(Base.Pkg.Dir.enumerate) == x
# @test @var(Base.Pkg.Dir.enumerate) == x
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure exactly what this is testing, perhaps just a deep nesting.

@KristofferC KristofferC added libgit2 The libgit2 library or the LibGit2 stdlib module excision Removal of code from Base or the repository stdlib Julia's standard library labels Jan 23, 2018
@@ -243,19 +243,6 @@ DEPRECATED: use @__MODULE__ instead
end
export current_module

# PR #22062
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These deprecations were made during the 0.7 cycle so they need to use @deprecate_moved or @deprecate_stdlib after #25692

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm, the behavior right now is:

julia> Base.LibGit2.prompt("Hello?")
WARNING: Base.LibGit2 is deprecated, run `import LibGit2` instead.
 in module Base
┌ Warning: `LibGit2.prompt(msg::AbstractString; default::AbstractString="", password::Bool=false)` is deprecated, use `result = Base.prompt(msg, default=default, password=password); result === nothing ? "" : result` instead.
│   caller = top-level scope
└ @ Core :0
Hello?:yes
"yes"

Isn't that ok?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I didn't think that would happen. Neat. You get a deprecation warning for Base.LibGit2 and then a separate one for prompt. So as long as non of these were exported everything should be ok.

@omus
Copy link
Member

omus commented Jan 23, 2018

Is it possible to move out the libgit2 C library with this? It would be nice to be able to update the revision of the shared library during 1.0.

@@ -3,8 +3,8 @@
Julia has a built-in package manager for installing add-on functionality written in Julia. It
can also install external libraries using your operating system's standard system for doing so,
or by compiling from source. The list of registered Julia packages can be found at [http://pkg.julialang.org](http://pkg.julialang.org).
All package manager commands are found in the `Pkg` module, included in Julia's `Base`
install.
All package manager commands are found in the `Pkg` standard library, it becomes available after using
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggestion: "it becomes" --> "which becomes", to avoid a comma splice.

@StefanKarpinski
Copy link
Member

Is it possible to move out the libgit2 C library with this? It would be nice to be able to update the revision of the shared library during 1.0.

1.0 API stability definitely does not include never changing versions of libraries that we depend on.

@JeffBezanson JeffBezanson added this to the 1.0 milestone Jan 23, 2018
@KristofferC
Copy link
Member Author

So this causes the documentation warnings:

 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.GitRevWalker' in devdocs/libgit2.md
 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.GitHash' in devdocs/libgit2.md
 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.push_head!' in devdocs/libgit2.md
 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.GitRevWalker' in devdocs/libgit2.md
 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.GitHash' in devdocs/libgit2.md
 !! Invalid local link: unresolved path
    '../../devdocs/libgit2/#Base.LibGit2.push_head!' in devdocs/libgit2.md

to turn into:

 !! No doc found for reference '[`GitRevWalker`](@ref)'. [src/base/collections.md]
 !! No doc found for reference '[`GitHash`](@ref)'. [src/base/collections.md]
 !! No doc found for reference '[`push_head!`](@ref)'. [src/base/collections.md]
 !! No doc found for reference '[`GitRevWalker`](@ref)'. [src/base/collections.md]
 !! No doc found for reference '[`GitHash`](@ref)'. [src/base/collections.md]
 !! No doc found for reference '[`push_head!`](@ref)'. [src/base/collections.md]

which apparently fails the documentation build... I have no idea how to fix it but I temporarily turned off strict documentation build to see if the other tests pass.

@KristofferC
Copy link
Member Author

KristofferC commented Jan 31, 2018

CI straight flush. 🎉

So what is left to do here is:

  • Figure out what to do with url(::Method) when the Method is defined in a package:

    julia/base/methodshow.jl

    Lines 215 to 232 in 0f95988

    try
    d = dirname(file)
    return LibGit2.with(LibGit2.GitRepoExt(d)) do repo
    LibGit2.with(LibGit2.GitConfig(repo)) do cfg
    u = LibGit2.get(cfg, "remote.origin.url", "")
    u = match(LibGit2.GITHUB_REGEX,u).captures[1]
    commit = string(LibGit2.head_oid(repo))
    root = LibGit2.path(repo)
    if startswith(file, root) || startswith(realpath(file), root)
    "https://github.com/$u/tree/$commit/"*file[length(root)+1:end]*"#L$line"
    else
    fileurl(file)
    end
    end
    end
    catch
    return fileurl(file)
    end
    I suggest that we simply delete it since it assumed that packages are git repos which will not be the case.

  • Figure out how to get documentation to pass with strict = true (see Move LibGit2 to stdlib #25706 (comment)). I have no idea about this, to be honest. These errors come when trying to reference LibGit2 docstrings from Base.map so one way would be to not have LibGit2 extend Base.map and instead define its own (similar to how it was done with push!).

Opinions?

@JeffBezanson
Copy link
Member

I certainly wouldn't want to lose method URLs in jupyter; it's a cool feature.

@KristofferC
Copy link
Member Author

Is bbf2224 acceptable as a way out of this deadlock?

@JeffBezanson
Copy link
Member

Sure, let's do that for now.

@KristofferC KristofferC merged commit 9e36e01 into master Feb 5, 2018
@fredrikekre fredrikekre deleted the kc/excise_libgit2 branch March 2, 2018 09:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
excision Removal of code from Base or the repository libgit2 The libgit2 library or the LibGit2 stdlib module stdlib Julia's standard library
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants