Tag

Still mourning the loss of his email code, Harry creates a tag so he can more easily access it later.

lottery harry$ mkdir tags

lottery harry$ svn add tags
A         tags

Subversion implements tag through the use of its “cheap copy” mechanism, which is also used for branch. The idea is that Subversion can make a copy of any object in the tree without duplicating all the data. The new copy is simply a link to the other one, but as the two items change, they diverge while sharing their history. In Subversion, a tag is a branch which nobody intends to modify.

lottery harry$ svn copy --revision=10 trunk \
                                      tags/just_before_sally_deleted_my_email_code

lottery harry$ svn st
A       tags
A  +    tags/just_before_sally_deleted_my_email_code

lottery harry$ svn commit -m "tag snapshot in case I need the email code"
Adding         tags
Adding         tags/just_before_sally_deleted_my_email_code

Committed revision 13.

Sally sees Harry gloating in the company chat room about his beloved tag, so she does an update.

trunk sally$ svn update
At revision 13.

She doesn’t get the tag. But Sally didn’t just fall off the turnip truck. She notices that she executed that command from the trunk directory. She needs to cd up one level and try again.

Note that with Subversion, most commands take effect from the current directory and recurse down. Everything else is ignored. This contrasts with some other VCS tools where most commands work on the entire tree.

trunk sally$ cd ..

lottery sally$ svn update
A    tags
A    tags/just_before_sally_deleted_my_email_code
...
Updated to revision 13.

Sally sees Harry’s tag and rolls her eyes. Fine. Whatever.