Subversion Version Control. Using The Subversion Version Control System in Development Projects

4.7. Creating a Tag

It's hard to improve upon perfection, so you decide that it's time to release your Hello World application so that others can bask in its glory. You would, however, like to be able to continue work on version 2.0 of Hello World (with many new features) after you release version 1.0. To ensure that you always have access to exactly what you released as version 1.0 (in case, for example, you later find a bug that you want to fix), it would be handy to mark the revision of the repository that made up the version 1.0 release. You could do this by writing down the revision number somewhere, but the easier (and more reliable) way to keep track of the version 1.0 release is to create a tag.

Subversion has no explicit concept of a "tag." Instead, it simply uses lightweight copies of the files being tagged. So, to create a tag, you just have to use the svn copy command to create a copy of the files included in the release in the tags directory that you created when you made the initial repository. In order to avoid the expense of actually making a copy of the files in the directory (as opposed to just marking them as copied), and because you never checked out the tags directory into your working copy, it is best to perform the copy entirely in the repository, by running the following command.

[View full width]

$ svn copy --message "Tagged version 1.0 release" file:///home/bill/my_repository/trunk/ file:///home/bill/my_repository/tags/version_1_0/ Committed revision 3.

This performs the copy inside the repository immediately, and creates a new revision. You can see that the copy occurred by using the svn list command to see the contents of the repository.

$ svn list file:///home/bill/my_repository/tags version_1_0/ $ svn list file:///home/bill/my_repository/tags/version_1_0 Makefile hello.c

    Категории