Skip to content

Commit

Permalink
Add force=true kwarg to revise(mod::Module) (#847)
Browse files Browse the repository at this point in the history
Fixes #839
Fixes #842
  • Loading branch information
timholy authored Sep 24, 2024
1 parent d368547 commit 891b739
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Project.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
name = "Revise"
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
version = "3.5.18"
version = "3.6.0"

[deps]
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"
Expand Down
15 changes: 12 additions & 3 deletions src/packagedef.jl
Original file line number Diff line number Diff line change
Expand Up @@ -849,15 +849,24 @@ end
revise(backend::REPL.REPLBackend) = revise()

"""
revise(mod::Module)
revise(mod::Module; force::Bool=true)
Reevaluate every definition in `mod`, whether it was changed or not. This is useful
Revise all files that define `mod`.
If `force=true`, reevaluate every definition in `mod`, whether it was changed or not. This is useful
to propagate an updated macro definition, or to force recompiling generated functions.
Be warned, however, that this invalidates all the compiled code in your session that depends on `mod`,
and can lead to long recompilation times.
"""
function revise(mod::Module)
function revise(mod::Module; force::Bool=true)
mod == Main && error("cannot revise(Main)")
id = PkgId(mod)
pkgdata = pkgdatas[id]
for file in pkgdata.info.files
push!(revision_queue, (pkgdata, file))
end
revise()
force || return true
for (i, file) in enumerate(srcfiles(pkgdata))
fi = fileinfo(pkgdata, i)
for (mod, exsigs) in fi.modexsigs
Expand Down

0 comments on commit 891b739

Please sign in to comment.