Skip to content

Commit c79c2ba

Browse files
REPL history: instructive warning for old-style history files.
1 parent 85b954e commit c79c2ba

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

base/REPL.jl

+6-2
Original file line numberDiff line numberDiff line change
@@ -264,13 +264,17 @@ REPLHistoryProvider(mode_mapping) =
264264
REPLHistoryProvider(String[], nothing, 0, -1, IOBuffer(),
265265
nothing, mode_mapping, Uint8[])
266266

267+
const invalid_history_message = """
268+
Invalid history format. If you have a ~/.julia_history file left over from an older version of Julia, try renaming or deleting it.
269+
"""
270+
267271
function hist_from_file(hp, file)
268272
hp.history_file = file
269273
seek(file, 0)
270274
while !eof(file)
271275
mode = :julia
272276
line = utf8(readline(file))
273-
line[1] == '#' || error("invalid history entry")
277+
line[1] == '#' || error(invalid_history_message)
274278
while true
275279
m = match(r"^#\s*(\w+)\s*:\s*(.*?)\s*$", line)
276280
m == nothing && break
@@ -279,7 +283,7 @@ function hist_from_file(hp, file)
279283
end
280284
line = utf8(readline(file))
281285
end
282-
line[1] == '\t' || error("invalid history entry")
286+
line[1] == '\t' || error(invalid_history_message)
283287
lines = UTF8String[]
284288
while true
285289
push!(lines, chomp(line[2:end]))

0 commit comments

Comments
 (0)