Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Remove duplicates when refilling readline history #1000

Closed
takluyver opened this Issue · 6 comments

4 participants

Thomas Kluyver Antoine Levitt Min RK Fernando Perez
Thomas Kluyver
Owner

Readline by default only keeps one copy of consecutive duplicates in history, but when we refill it from the history database, we push those duplicates multiple times. It should be an easy fix in refill_readline_hist.

Antoine Levitt

Are you saying that the way to fix this is to put duplicate lines in the history, but not refill readline's? Isn't it better to simply not add them in the first place?

Thomas Kluyver
Owner

Our history is supposed to be a record of what you've executed - for instance, running a += 1 three times is different from running it once. Also, it's numbered to correspond with the In [1]: prompt numbers you see in a session, so one history entry is stored each time that number is incremented.

Min RK
Owner

Right - we do not want to de-dupe the actual record of your actions, because then it is no longer accurate, and breaks reproducibility. We only want to de-dupe readline, so that we skip repeating entries when hitting the up arrow, etc.

Fernando Perez
Owner

Agreed. In fact, it used to work without the dupes a while back, I'm not exactly sure when it changed. Was it when we introduced the sqlite backend or later, do you guys know?

Thomas Kluyver
Owner

I don't think I accounted for it when I did the sqlite stuff initially, so my guess would be then. I can reproduce it in 0.11.

PR coming up in a few minutes.

Thomas Kluyver takluyver was assigned
Fernando Perez
Owner

Closed by #1003, I forgot to put that in the commit comment.

Fernando Perez fperez closed this
Michael Droettboom mdboom referenced this issue from a commit in mdboom/ipython
Thomas Kluyver takluyver Do not push consecutive duplicates when we refill readline history.
Closes gh-1000, earns t-shirt
a421824
Brian E. Granger ellisonbg referenced this issue from a commit
Commit has since been removed from the repository and is no longer available.
matthew von rocketstein mattvonrocketstein referenced this issue from a commit in mattvonrocketstein/ipython
Thomas Kluyver takluyver Do not push consecutive duplicates when we refill readline history.
Closes gh-1000, earns t-shirt
a5c79d7
Thomas Kluyver takluyver referenced this issue
Closed

issue 7000 #7000

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.