What actually are tags in subversion (SVN)? And what features does Subversion really offer built-in to make productive use of them?
I ask because I would like to label collections of files at a certain revision as a tag. This would make for more meaningful release naming. I would also like to retrieve exactly those files with that tag, no more no less, to build software from those files at a certain release.
In ClearCase tags are likely attibutes of a file, I believe. I get the worrying impression that tags aren't really anything special or core to Subversion, but instead they are an arbitrary concept, just a folder with a copy of the files at a certain revision, is this true? If so, it's not so much useful as the equivalent in, say, ClearCase.
Subversion is promoted as having tags as a feature, when it would appear that there is not really a notion core to the tool, so why say it's a feature? Not does it seem to be written about extensively in the literature, well at least enough to help me solve my problem.
I get the worrying impression that tags aren't really anything special or core to Subversion, but instead they are an arbitrary concept, just a folder with a copy of the files at a certain revision, is this true? If so, it's not so much useful as the equivalent in, say, ClearCase.
This is absolutely correct. And, so are branches. Branches too are simply a directory which is used for creating branches.
However, just because it's done that way doesn't mean they're useless. Tags are normally used to take a snapshot of your repository at a particular moment in time. For example, I want to do a build, and tag the files used in that build. Later on, when we decide to do a release, I want to tag those very same files with my release number. Subversion's method of tagging works just as well as it does in ClearCase.
In fact, tagging in Subversion is many ways better than it is in ClearCase. In ClearCase I first have to create the label type, and then apply that label type to the version of each file I want to mark. If you are tagging say 10,000 files, it might take you 20 or so minutes. In Subversion, tagging is instantaneous. Tagging 10,000 files takes less than a second. Tagging 100,000 or 1,000,000 files take no more time.
In Subversion, you can get a list of all tags by merely listing the contents of the tags
directory. Doing so gives you a listing of actual tags. In ClearCase, you can only do a lstype -type lbtype
which gives you the label types, but it doesn't necessarily mean any of those labels are actually on any files.
In Subversion tags and branches normally have different name spaces. In ClearCase, they share the same namespace, so you usually have to do something to distinguish tags from labels. The standard is that tags are uppercase and labels are lowercase.
In Subversion, you can also see when a tag was applied, and by whom. In Subversion, tags and branches have different namespaces. And, because tags are merely directories, the flexibility you can use for tagging is infinite:
tags
directory, and a special directory for obsolete_tags
. If a tag is no longer needed, it can be moved to the obsolete directory. This means listing the tags in the tags directory only lists relevant tags. However, developers can still see the obsolete tags.The big advantage ClearCase labels have is that ClearCase label types can be locked, so they can't be moved or applied without the owner of the label type unlocking the label type. However, there are many pre-commit hook scripts in Subversion that can do more or less the same thing. I have one that allows you to create a tag, but not modify it.
Other hook scripts go farther. Subversion files and directories can have properties set on them. I've seen hooks that allow the person who created that tag to place a "lock-tag" property on the directory to prevent it from being modified. Removign the "lock-tag" property allows the tag to be modified. This allows Subversion tags to mimic the behavior in ClearCase.
In Subversion, branches and tags are very visible to developers and are much easier to apply and use than their counter parts in ClearCase. Many other version control systems have emulated what Subversion has done with both tags and branches because it makes the whole system more visible than the older system found in ClearCase, CVS, and older version control systems where tags and branches are mere attributes attached on individual files.