Skip to content

Commit

Permalink
Use relpath in manual track (fixes #316)
Browse files Browse the repository at this point in the history
  • Loading branch information
timholy committed Nov 16, 2019
1 parent 1891f88 commit 017fedc
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 1 deletion.
2 changes: 1 addition & 1 deletion src/Revise.jl
Original file line number Diff line number Diff line change
Expand Up @@ -680,7 +680,7 @@ function track(mod::Module, file::AbstractString; kwargs...)
if !haskey(CodeTracking._pkgfiles, id)
CodeTracking._pkgfiles[id] = pkgdata.info
end
push!(pkgdata, file=>FileInfo(fm))
push!(pkgdata, relpath(file, pkgdata)=>FileInfo(fm))
init_watching(pkgdata, (file,))
end
end
Expand Down
37 changes: 37 additions & 0 deletions test/runtests.jl
Original file line number Diff line number Diff line change
Expand Up @@ -1822,6 +1822,43 @@ end
end
yry()
@test p() == 0

# Non-included dependency (issue #316)
testdir = newtestdir()
dn = joinpath(testdir, "LikePlots", "src"); mkpath(dn)
open(joinpath(dn, "LikePlots.jl"), "w") do io
println(io, """
module LikePlots
plot() = 0
backend() = include(joinpath(@__DIR__, "backends/backend.jl"))
end
""")
end
sd = joinpath(dn, "backends"); mkpath(sd)
open(joinpath(sd, "backend.jl"), "w") do io
println(io, """
f() = 1
""")
end
sleep(mtimedelay)
@eval using LikePlots
@test LikePlots.plot() == 0
@test_throws UndefVarError LikePlots.f()
sleep(mtimedelay)
Revise.track(LikePlots, joinpath(sd, "backend.jl"))
LikePlots.backend()
@test LikePlots.f() == 1
sleep(2*mtimedelay)
open(joinpath(sd, "backend.jl"), "w") do io
println(io, """
f() = 2
""")
end
yry()
@test LikePlots.f() == 2
@test joinpath("src", "backends", "backend.jl") Revise.srcfiles(Revise.pkgdatas[Base.PkgId(LikePlots)])

rm_precompile("LikePlots")
end

@testset "Auto-track user scripts" begin
Expand Down

0 comments on commit 017fedc

Please sign in to comment.