tags:

views:

854

answers:

4

I know how to use tags in subversion. I create a tag every time I get to a release milestone.

What I don't quite understand is how they work.

Is a tag just a copy, made from what ever revision I specify? Or is a tag more like a reference, where internally subversion just says GO TO /trunk/project/ Revision 5 or whatever.

The command to create a tag (svn copy) seems to imply that it's a copy, but I've seen other people write that subversion doesn't really copy anything.

Say I dump just the HEAD revision of a repository. I don't care about any history except the tags. Are those tags dumped along with the rest of the Head revision?

Finally, is all this just programming magic that I don't really want to know.

+1  A: 

Right, a tag is just a copy:

svn copy trunk tags/BLAH

When people say SVN doesn't really copy anything, they mean that the repository doesn't need to duplicate the data. It uses something akin to symbolic links to keep track of the copies.

Chris Conway
A: 

A tag is a reference to the set of revision numbers at the time the tag was taken- it's the same thing as a branch or a copy, internally.

Tim Howland
+1  A: 

The Subversion book is online in a complete and free form: http://svnbook.red-bean.com/en/1.4/svn-book.html#svn.branchmerge.tags

And yes, you basically do an svn copy. Subversion is smart enough to do a copy-on-write style mechanism to save space and minimize transfer time.

nsanders
+4  A: 

Yes, a svn copy (whether you are thinking of it as a tag, a branch, or copying a file in trunk) is all the same. SVN will internally create a pointer to the source location at that revision. If you then make changes to the copy (which you are likely to do if it is a branch or a copied file in trunk, but shouldn't do for tags), SVN will only store what was changed, rather than creating a whole new copy.

pkaeding