Subversion Labels (SVN-Label) provides Subversion revision number aliases. It provides wrappers that allow people to give revision numbers more meaningful labels (e.g. rev-1.0 rather than having to remember r1372). It was written because in Subversion, a tag is really a branch, and a lot of people who used CVS previously disliked this approach. Allowing people to give revision numbers aliases ("labels") is a relatively easy way to emulate the old CVS Tag behavior, but so far no-one had implemented it.
Quite a few people who have used CVS previously dislike Subversion's idea that making a Tag is done by making a Branch, and calling it a Tag. It has its merits, but a lot of people who came from CVS find this unintuitive. Allowing people to give revision numbers aliases as been floated as a near equivalent to old CVS Tags, for various reasons the suggestion never seemed to get implemented.
This program is a wrapper (and server-side hook) that implements revision number aliasing. The wrapper rewrites the Subversion command-line, replacing labels (aliases) with the equivalent revision numbers. Subversion server hooks are used so that the label mappings are kept on the server and are accessed via the Subversion connection.
· This program was developed on Linux. I think all the system calls are POSIX ones so they should be available on all modern Unix variants (I've not tested it on my FreeBSD box yet).
· MySQL (and zlib, which is a dependency of MySQL) are needed to build the server-side hook program. Apart from that, only the usual development programs (gcc, gmake, etc) are required. Subversion developmental files are not required for building, though a Subversion server and client is needed to use this program.
Building & Installing
If your MySQL development (include/lib) files are not listed in the standard search paths, you'll meed to modify the makefile to explicitly reference them. Otherwise, simply run 'make'.
setlabel.sh, listlabels.sh and svnwrapper need to be placed somewhere that is listed on your search path ($PATH in bash) such as /usr/bin or /usr/local/bin. pre-revprop-change needs to be placed in the hooks directory within the repository on your server.
To setup the MySLQ tables run the following command (if you don't know your MySQL root password, you'll have to make the database/user/table specified in tables.sql manually):
mysql -u root -p < tables.sql
If you are concerned about the security of the username/password, you can change them, but you will also need to change line XXX in pre-revprop-change.c to use the correct username/password.
Implements the server-side lookup hook. Requires MySQL.
Sets a label. It is a BASH shell script.
Lists label assignments. It is a BASH shell script.
The wrapper that surrounds svn. In a later release, the functionality of listlabels.sh and setlabel.sh will be added to this wrapper.
Label (Tags in CVS terminology) storage is done by attaching an (unversioned) revision property (svnlabel:tag) to the revision being tagged. Because Subversion doesn't support searching for revision properties, the pre-revprop-change hook is used to intercept the relevant tags and (after some checks) store them in a database.
Searching exploits the feature that if a hook returns an error code, any output is sent back to the Subversion client for displaying to the user. In order to implement label listing (and searching), some revision properties are treated as commands, and the relevant data is sent back as an 'error' message. Bit of a hack, but it works.
· If you already use pre-prevprop-change for other things, you will need to rename the one included with this program and then reference it from your existing pre-prevprop-change scripts.
What's New in This Release:
· The server-side component was rewritten to use BerkeleyDB so that a separate database server is no longer required.