I've been using TortiseSVN for a few years now so thought it would be a good idea to list some useful bits and pieces I've found out in that time. It's also a good excuse to have a poke around and look for any other useful features I've missed.
Reverted files go into your recycle bin
Reverted files go into your recycle bin, there's not much else to say. It's incredibly handy if you revert by accident (it can happen). I tend to use AnhkSVN in Visual Studio and annoyingly it doesn't have this feature.
The small downside is that reverts take longer. If you are bothered just turn it off.
TortoiseSVN -> Settings -> General -> Dialogs 1 -> Use recycle bin when reverting.
Recycle bin settings |
The context menu is configurable
The context menu is the menu you get when you right click on a file or folder in File Explorer. I use the SVN show log view all the time so I want it visible without having to click into a sub menu.
TortoiseSVN -> Settings -> General -> Context Menu
Updated context menu |
Show merged revisions in the log viewer
Ever wanted to see what revisions were included in a merge? Easy. Just tick the include merged revisions checkbox in the log viewer.
Include merged revisions checkbox in the log viewer |
Repair move
Have you every moved or renamed a file without using the appropriate TortiseSVN command? That's me pretty much every time. Turns out there's an easy way to fix this from the commit dialog box. Simply select the two files you're interested in by Ctrl clicking, right click one of the files and select "Repair move". You must select exactly two files and their statuses must be missing and non-versioned otherwise the repair move command will not be visible.
Quick select multiple revisions to merge
In the merge dialog click the first revision to be included in the merge then shift click the last revision to select a block. You must click somewhere to the right of the checkboxes. Confusingly shift clicking on a checkbox doesn't work.
Block selecting multiple revisions |
Automatic merge commit messages
When committing a merge if you click on the "Recent messages" button it's auto populated with a message containing the revision numbers you chose plus all their commit messages.
Recent messages |
The commit message includes all revision numbers and commit messages from the merged revisions.
Visual Studio integration without a 3rd party plugin
It's possible to add some TortoiseSVN commands to Visual Studio without a plugin. If you use Visual SVN or AnkhSVN then most of the features you can get won't be very useful. I use AnkhSVN and one handy feature you don't get integrated into Visual Studio is blame (update: my colleague told me it is actually available but is called annotate and it isn't quite as helpful as the TortoiseSVN blame view). This guide shows how to add commands like blame, diff and log to the document context menu.
Context menu |
One step the guide misses is that there's no need for trial and error when adding the external command to the Tools menu, which is nice as I had over twenty. Simply add External Tool X where X is the postion of the blame tool in the External Tools list as shown below. In this case it was 3.
Avoid using reintegrate a branch
This has probably caught out quite a few people including myself; reintegrate a branch is a one time operation. The only time you want to use reintegrate a branch is when you have finished work on your branch and are ready to merge it back into trunk. After this no more work should be carried out on that branch, if you do bad times will ensue. Ninety nine percent of the time merge a range of revisions is what you want.
Shortcuts
If you use one repository, like I do, most of the time then setting up log viewer and commit shortcuts is really useful. There's is almost certainly more than one way to do it but I like using AutoHotkey. It's an incredibly useful app that allows you to create shortcuts for almost anything. You simply create a script specifying the shortcut keys and the programme you want to run. This Stack Overflow post shows the steps to setup the shortcut.
Shelving (kind of)
As far as I'm aware shelving is not possible in SVN. Shelving allows you to put some work to one side without committing it, then come back to it later. Very handy if you're in the middle of something and your boss asks you to fix a production bug ASAP. It helps reduce the risk of accidentally committing the wrong files.
While shelving is not possible, like in Git or Mercurial, you can kind of fake it by creating a patch. Instead of committing, in the TortoiseSVN context menu select create patch which creates a patch file that encapsulates all your changes. You can then revert your uncommitted files, do whatever work that needs doing, commit, then apply the patch file again by selecting TortoiseSVN -> Apply patch and continue where you left off.