PHP Objects, Patterns and Practice (3rd edition)

(Barry) #1
CHAPTER 17 ■ VERSION CONTROL WITH SUBVERSION

Removing Directories


As you might expect, you can remove directories with the remove subcommand. Here, I profoundly
disagree with Bob’s decision to add a resources directory.


$ svn remove resources/


D resources/blah.gif
D resources


Notice again that the subcommand works recursively. You’ll need to run commit in order for the
changes to be applied, though.


Tagging and Exporting a Release


All being well, a project will eventually reach a state of readiness, and you will want to ship it or deploy it.
Subversion can help you here in two ways. First, you can generate a version of the project that does not
contain Subversion metadata. Second, you can freeze this moment in your project’s development so
that you can always return to it later on.


Tagging a Project


Other version control systems have the concept of a tag built in at the command level. For Subversion
though, a tag is really just a copy. It doesn’t have any special qualities. Its status as a snapshot, a
reference copy, is a purely a matter of user convention. Remember the directories I created when I first
imported my project? There was trunk, which is where I’ve been working. There were also branch and
tags. To create a tag, I simply ask Subversion to copy my current project into the tags directory.
How do I do that though? I checked out the trunk directory, so I don’t have the other directories
available locally right now. In fact I can order Subversion to make the copy within the repository.


$ svn copy svn+ssh://localhost/var/local/svn/megaquiz/trunk \
svn+ssh://localhost/var/local/svn/megaquiz/tags/megaquiz-release1.0.0 \
-m'release branch'


Committed revision 9.


Because I’m dealing solely in URLs here, this is strictly a server operation, so you need to be sure you’ve
committed everything you want included before running the copy command in this way. You can also
run copy within a working copy, and supply file paths rather than URLs. This is a somewhat more
expensive operation though, and it requires you to maintain your tags and branches locally.
Notice that I named my tag as part of the copy operation. I copied trunk to tags/megaquiz-release1.0.0.
I can double-check this with the list command:


$ svn list svn+ssh://localhost/var/local/svn/megaquiz/tags/


megaquiz-release1.0.0/

Free download pdf