Version Control with Subversion, 2nd Edition
by C. Michael Pilato, Ben Collins-Sussman, Brian W. Fitzpatrick
Tags
Another common version control concept is a tag. A tag is just a “snapshot” of a project in time. In Subversion, this idea already seems to be everywhere. Each repository revision is exactly that—a snapshot of the filesystem after each commit.
However, people often want to give more human-friendly names to
tags, such as release-1.0. And they
want to make snapshots of smaller subdirectories of the filesystem.
After all, it’s not so easy to remember that release 1.0 of a piece of
software is a particular subdirectory of revision 4822.
Creating a Simple Tag
Once again, svn copy comes to
the rescue. If you want to create a snapshot of /calc/trunk exactly as it looks in the
HEAD revision, make a copy of
it:
$ svn copy http://svn.example.com/repos/calc/trunk \
http://svn.example.com/repos/calc/tags/release-1.0 \
-m "Tagging the 1.0 release of the 'calc' project."
Committed revision 902.
This example assumes that a /calc/tags directory already exists. (If it
doesn’t, you can create it using svn
mkdir.) After the copy completes, the new release-1.0 directory is forever a snapshot
of how the /trunk directory looked
in the HEAD revision at the time you
made the copy. Of course, you might want to be more precise about
exactly which revision you copy, in case somebody else may have
committed changes to the project when you weren’t looking. So if you
know that revision 901 of /calc/trunk is exactly the snapshot you want,
you can specify it by passing -r 901 to the svn copy command.
But wait ...