Auto History Extension in Visual Studio 2013
Have you ever found yourself wishing you could roll back a few hours to a piece of code you had working but have made changes to? You were “in the flow” and you haven’t checked anything in to your source control system (or perhaps weren’t using source code control on your project)?
We are pleased to announce the availability of an early preview of an extension on the Visual Studio Gallery to give you automatic, no-configuration history tracking for your local machine. Just install the extension, and whatever you do to your projects and solutions, it silently and efficiently tracks the changes you make to any files that you have opened in the Visual Studio Editor. Then, when you find yourself in need of back-tracking to an earlier version of one or more of your files, you can find your way back to it.
Check out this video to see the extension in action or Channel 9 Toolbox video for full details.
Finding your way back…
Once the extension is installed, you simply work as you normally would. There’s nothing more for you to configure. Later on, when you need to find your way back, simply bring up the Auto History tool window (it will open automatically when you first install the extension, but if you’ve closed it you can easily bring it back by clicking View..Other Windows…Auto History):
Snapshots – Your file activities, captured
The extension automatically captures a “Snapshot”, which is an image of all the files in your solution that you have opened in the editor at a particular point in time, every time you save, open, close, or reload a file. A snapshot is also automatically triggered every 5 minutes (a little like the “Auto Save” feature in programs like Microsoft Word), and you can force a snapshot to be taken by pressing the “Take Snapshot” Button.
The Extension’s window gives a view of all the snapshots which have been captured from your activity. By default the list is filtered to show snapshots only from the currently open solution. The left hand side of the window shows a set of tick marks (one for each event that led to snapshot being captured), from which you can select a range (indicated by the shaded rectangle overlaid on the tick marks) to make comparisons between the snapshots
In the screenshot above you can see that between now and a point yesterday, I made changes to two files in my solution (Program.cs and Utilities.cs). If I want to see details of the changes I can just double click on any of the files in the list, to see a view of changes to that file. Let’s take a look at program.cs:
In this diff, I can easily see the changes I made since the earlier snapshot – and quickly copy and paste any old code I want to from the difference view. I never checked in to a source control system, but Auto History took care of letting me get back to my earlier code with ease!
Note that although you will most likely want to make comparisons between a past and current state, the extension also allows you to compare two distinct points in the past; you can do this by dragging the top part of the shaded rectangle over the tick marks down from the “Now” indicator to your chosen end point.
In future releases of the extension we’re considering more automatic roll back features, and we’re interested to hear from you about the sort of roll-backs you’d find most useful.
Filtering down the list of changed files
By default the Auto History window shows a view filtered to your current solution. There are times when you might want to use other filters, available in the top of the window:
All Files – this filter lets you see ANY file that has been edited in Visual Studio on the current machine – this can be useful if you want to see changes you made in another project but apply the changes to your current one, or if you’re not quite sure which solution held the change you’re looking for.
Current File – if you know that the older code you’re after is in the file you currently have open in the editor, you can use this filter to simplify the history down to only that file
Searching by filename – when your changed file list is long, you’ll probably find it helpful to be able to filter down using a filename search. Just enter a complete or partial filename into the box and the list of files will narrow down according to that search term.
Note that the filters you choose will also affect the Snapshot ticks shown in the extension’s window – so if you filter down to a particular file for instance, you can expect to see only tickmarks for those snapshots where that file changed from the previous snapshot. This helps you focus in on only the parts of the history you are interested in.
How does this work with Source Code Control Systems?
The extension doesn’t have any direct interaction with Source Code Control Systems, and doesn’t require you to be using one, nor to change the way you work with one you might already be using. For a source code control user, the extension is useful because it keeps a history of your files between Source Code Control checkins
If you are using a Source Code Control System, events that cause filesystem changes (such as checkins, which require a save) will show up in the extension’s snapshot list.
Get the extension now, and give us your feedback!
This extension is a work in progress, and we’re very keen to hear your feedback – whether it’s useful to you and any capabilities you’d like it to have. Go grab the extension from the Visual Studio Gallery and tell us what you think!