Tagging in Subversion

Tagging works a little differently in Subversion than in other version control systems. Whereas in CVS or ClearCase, you'd make a label and apply that label to a directory tree, in Subversion you make a copy of your directory into a special place. Then, assuming you never actually check out the "special place" directory and edit within it, you have a permanent "checkpoint" of the state of your directory. This works well because in Subversion, copies are O(1) efficiency, i.e. constant-time operations regardless of the size of the directory.

Also, note that you can put in place some server-side "hooks" that would prevent anyone from committing in a "special place" directory. However, out-of-the-box, there isn't anything but good sense preventing you from changing a release in-place.

So, first create the tags directory:

   svn mkdir svn+ssh://daystrom/opt/public/svn/software/cedar-backup/tags

then create a copy of the trunk (or whatever) in the tags directory:

   svn copy svn+ssh://daystrom/opt/public/svn/software/pycross/trunk \
            svn+ssh://daystrom/opt/public/svn/software/pycross/tags/wordutils-0.7.2 \
            -m "Tagging the 0.7.2 release of WordUtils."

To compare it to something I might do at work in ClearCase, there's no reason that I couldn't call the directory something more like a label, i.e.

   svn copy svn+ssh://daystrom/opt/public/svn/software/pycross/trunk \
            svn+ssh://daystrom/opt/public/svn/software/pycross/tags/WORDUTILS_V0.7.2 \
            -m "Tagging the 0.7.2 release of WordUtils."

It's all just arbitrary, anyway.

At this point, you can use the new URL for comparisons, or even to check the directory out and look at it.

If I screw up a release, I remove it before re-adding it:

   svn remove svn+ssh://daystrom/opt/public/svn/software/pycross/tags/wordutils-0.7.2

Don't worry, though: Subversion actually knows that you did this, and you can go back and look at your two different versions of that directory, if you need to for some reason.

Note that you can't really re-tag something without removing it first. You don't get what you expect (in fact, if you don't read the results carefully, you might even think it worked).

By the way, I do still tend to find this confusing. I still have to look at my notes each time to get it right. Plus, I need to get used to sort of standard "flow of control" so that I don't make a release before I'm really ready for it. For projects like Cedar Backup, I wrote a "release" script that would do it for me, so it would be right every time.

SubversionTagging (last edited 2008-07-09 06:21:57 by localhost)