3

Does Eclipse provide (possibly via a plug-in) the ability to search the local history?

E.g, I have a lot of history files and don't want to have to trawl through them all because I know that the version I want is the most recent which contains the string "slithy toves".


[Update] people answering similar questions on this site have not read the question – or it was badly phrased.

I am not looking to go to the local history (which do know how to find) and manually search through every entry, version by version. I want a single search function which will do that for me.


[Update++] the referenced question does not contain an acceptable answer. The only solution offered there involves creating a dummy project, which is more overehad than I care for.


Note: if it helps anyone, I found that the local history can be found in

Workspace\.metadata\.plugins\org.eclipse.core.resources\.history\

from which, I can use any file search tool of my choice

Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • Did you try the team > show local history or Replace With > Element from Local History? – crm86 Aug 16 '16 at 09:43
  • 1
    Possible duplicated with: http://stackoverflow.com/questions/7007666/eclipse-search-in-history – crm86 Aug 16 '16 at 09:49
  • Agreed - although that one is five years did not get an answer. Maybe I ought to offer a bonus on that? Or ask on http://softwarerecs.stackexchange.com/ if there is a plug-in? – Mawg says reinstate Monica Aug 16 '16 at 10:21

2 Answers2

1

I found that the local history can be found in

Workspace\.metadata\.plugins\org.eclipse.core.resources\.history\

from which, I can use any file search tool of my choice.

However, filenames all look like 001ad08cc7790016142da217e60cb1a5, so I can't search for widget.c :-(

There is also no index, since I searched for files containing 001ad08cc7790016142da217e60cb1a5, hoping to find maybe some XML which told me the original file name, with a reference to 001ad08cc7790016142da217e60cb1a5, but I found nothing :-(

Also, some of the saved files seem to be binary, and I can't see how to configure Eclipse to save only *.c and *.h

Mawg says reinstate Monica
  • 38,334
  • 103
  • 306
  • 551
  • 2
    I did some digging, and unfortunately mapping the original file name to the history file names is nontrivial. The mapping is contained in `\.metadata\.plugins\org.eclipse.core.resources\.projects\\.indexes\history.index`, which is a binary file containing a mapping from filenames to a list of (UUID, timestamp) pairs, with the UUIDs represented in binary format. The filenames in `\.metadata\.plugins\org.eclipse.core.resources\.history` are then hex character representations of the same UUIDs. – HighCommander4 Jan 03 '17 at 02:11
  • This is very useful information (+1). It could help to implement an applciation for searching the Eclipse history. Now, if only I had the time ... ;-) – Mawg says reinstate Monica Jan 03 '17 at 08:37
  • 1
    In case you decide to follow through with writing such an application: the code for reading the `history.index` file is in http://git.eclipse.org/c/platform/eclipse.platform.resources.git/plain/bundles/org.eclipse.core.resources/src/org/eclipse/core/internal/localstore/Bucket.java, in the `load()` method. Looking at that you should be able to figure out the exact file format. – HighCommander4 Jan 03 '17 at 22:49
1

Manualy search the local history

My answer to the question is "No, you cannot do that search from within Eclipse".

Nevertheless, in this answer to another question you can see the (linux) command line (and the explanation of what it does) to search the local history structure if you know specific code that was in the file you seek (like you indicated "slithy toves"):

fgrep -r -c "[slithy toves]" * | grep -v ":0" | cut -d : -f 1 | xargs ls -l
Community
  • 1
  • 1
manuelvigarcia
  • 1,696
  • 1
  • 22
  • 32
  • This looks like the core of a whole new app. Or a feature request to Eclipse – Mawg says reinstate Monica Jan 19 '17 at 16:45
  • 1
    @Mawg We needed to undo two days of local changes and this way worked. It was an one-off (and I hope it was an only-off) and expect everyone to have learned from it. Too easy recovery would mean we don't question our culture of "commit once a week". – manuelvigarcia Jan 23 '17 at 13:41