Skip to content

Commit 891b739

Browse files
authored
Add force=true kwarg to revise(mod::Module) (#847)
Fixes #839 Fixes #842
1 parent d368547 commit 891b739

File tree

2 files changed

+13
-4
lines changed

2 files changed

+13
-4
lines changed

Project.toml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name = "Revise"
22
uuid = "295af30f-e4ad-537b-8983-00126c2a3abe"
3-
version = "3.5.18"
3+
version = "3.6.0"
44

55
[deps]
66
CodeTracking = "da1fd8a2-8d9e-5ec2-8556-3022fb5608a2"

src/packagedef.jl

+12-3
Original file line numberDiff line numberDiff line change
@@ -849,15 +849,24 @@ end
849849
revise(backend::REPL.REPLBackend) = revise()
850850

851851
"""
852-
revise(mod::Module)
852+
revise(mod::Module; force::Bool=true)
853853
854-
Reevaluate every definition in `mod`, whether it was changed or not. This is useful
854+
Revise all files that define `mod`.
855+
856+
If `force=true`, reevaluate every definition in `mod`, whether it was changed or not. This is useful
855857
to propagate an updated macro definition, or to force recompiling generated functions.
858+
Be warned, however, that this invalidates all the compiled code in your session that depends on `mod`,
859+
and can lead to long recompilation times.
856860
"""
857-
function revise(mod::Module)
861+
function revise(mod::Module; force::Bool=true)
858862
mod == Main && error("cannot revise(Main)")
859863
id = PkgId(mod)
860864
pkgdata = pkgdatas[id]
865+
for file in pkgdata.info.files
866+
push!(revision_queue, (pkgdata, file))
867+
end
868+
revise()
869+
force || return true
861870
for (i, file) in enumerate(srcfiles(pkgdata))
862871
fi = fileinfo(pkgdata, i)
863872
for (mod, exsigs) in fi.modexsigs

0 commit comments

Comments
 (0)