Subversion plugin cheat sheet
This document is a work in progress, I will try to cover here the most FAQ for the Subversion plugin as it's a very important part of CodeLite for any developer who uses svn in his daily work.
The svn tab is located in the Workspace View. If you can't see its tab click on the little arrow button and select it or expand the workspace view pane width
By default, the svn view will display the output of the command
svn status --xml in a tree view. The root folder is selected based on the workspace location, however you can select a different location
by clicking on the folder icon at the top of the SVN view tab
Appearance of the Subversion view
In order to work with the Subversion plugin, you will need to install the svn command line tool for your OS.
It is recommended to use svn client 1.6.X and up, since some of the switches used by codelite were introduced in version 1.6 (although older versions will work as well).
- Windows - download the latest binary from here
sudo apt-get install subversion
yum install subversion
- MacOSX - it should be installed by default or with the XCode installation
Integrating build number
The latest Subversion plugin offers a simple but very useful option to add a preprocessor definition into your compilation line which will contain the current revision number as a string.
To enable the build integration, open the svn settings dialog and select the 'Integration' tab and enable that page:
Integrating an external diff viewer
To integrate an external diff viewer, open the Subversion settings dialog (either from subversion toolbar, or from the Plugins > Subversion2 > Subversion Options menu) and select 'External Diff' tab.
Check the 'Use external diff viewer' checkbox, and select your tool of choice.
One of the most popular tools around (under Windows at least) is the open source tool WinMerge. Follow these steps to integrate WinMerge with codelite's subversion plugin:
- Create a small batch script named "winmergesvn.bat" with the following content, and save it on your disk
start "WinMerge" /B /WAIT "C:\Program Files\WinMerge\WinMergeU.exe" /e /ub /dl %3 /dr %5 %6 %7
- Next, open the subversion plugin settings dialog and select this batch script to become your diff tool.
Another great tool (my favourite), however it is not a free tool, but very powerful.
To make Araxis your default diff viewer:
- Open the subversion settings dialog and select executable named 'AraxisSVNDiff.exe' as your diff tool
Same as Araxis:
- Open the subversion settings dialog and set kdiff3 as your diff tool
Bug Tracker integration
Bug-tracking and subversion are two different beasts.
However, subversion offers a way to run 'post-commit' hooks by parsing the developer log message and perform actions based on the message content. (for example: the subversion server can search for the pattern #NUMBER and then close the issue with the given NUMBER in the tracker)
This is fragile and very error-prone (e.g. it depends on the user to know the exact message format that the server is expecting).
With all this in mind, we put together a list of goals we wanted to address:
- Reduce the likelihood of user errors when writing the commit log message. Don't rely on the user to know the specific format but provide the format in the client somehow.
- If possible, validate the format of the commit log message directly in the client to reduce possible 'reject' errors from the server hook script.
- Show in the client the issue IDs which get assigned to a commit (e.g. in the change log). If possible, provide a link to the issue tracker.
To implement all the above, codelite's subversion plugin defines four properties (as shown in the following image):
'Bug URL Pattern'
Enter here the URL to a BUG page in the BUG tracker. Instead of an using a specific BUGID, use the macro $(BUGID) as shown below.
Codelite will then use the URL pattern to provide a clickable link in the change log.
'Bug Message Pattern'
Enter here the message to be added to the log. This message may contain the macros $(BUGID) and $(BUG_URL).
- $(BUGID) is the bug ID as provided by the user in the 'commit' dialog
- $(BUG_URL) expands to the URL provided in the previous property ('Bug URL Pattern')
'Feature URL Pattern'
Some trackers use a different link for the 'Feature Request' tracker. Use this property to provide the Feature Request Tracker URL
'Feature Message Pattern'
Provide here the message to be added to the log. The message may contain the macros $(FRID) and $(FRID_URL).
- $(FRID) is the bug ID as provided by the user in the 'commit' dialog
- $(FRID_URL) expands to the URL provided in the previous property ('Bug URL Pattern')
The Commit Dialog
Two new fields were added to the 'Commit Dialog':
- Bug ID - holds the value for $(BUGID)
- Feature Request ID - holds the value for $(FRID)
To enter multiple BUGIDs or FRIDs, separate the items with commas (',').