11.07.2015 Views

Version Control with Subversion - Login

Version Control with Subversion - Login

Version Control with Subversion - Login

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

Branching and Mergingthe section called “Planning Your Repository Organization” to read more about “projectroots”):/paint/trunk/paint/branches/paint/tags/calc/trunk/calc/branches/calc/tagsOf course, you're free to ignore these common layouts. You can create any sort of variation,whatever works best for you or your team. Remember that whatever you choose, it'snot a permanent commitment. You can reorganize your repository at any time. Becausebranches and tags are ordinary directories, the svn move command can move or renamethem however you wish. Switching from one layout to another is just a matter of issuing aseries of server-side moves; if you don't like the way things are organized in the repository,just juggle the directories around.Remember, though, that while moving directories may be easy to do, you need to be considerateof your users as well. Your juggling can be disorienting to users <strong>with</strong> existing workingcopies. If a user has a working copy of a particular repository directory, your svn moveoperation might remove the path from the latest revision. When the user next runs svn update,she will be told that her working copy represents a path that no longer exists, and theuser will be forced to svn switch to the new location.Data LifetimesAnother nice feature of <strong>Subversion</strong>'s model is that branches and tags can have finite lifetimes,just like any other versioned item. For example, suppose you eventually finish allyour work on your personal branch of the calc project. After merging all of your changesback into /calc/trunk, there's no need for your private branch directory to stick aroundanymore:$ svn delete http://svn.example.com/repos/calc/branches/my-calc-branch \-m "Removing obsolete branch of calc project."Committed revision 375.And now your branch is gone. Of course, it's not really gone: the directory is simply missingfrom the HEAD revision, no longer distracting anyone. If you use svn checkout, svnswitch, or svn list to examine an earlier revision, you'll still be able to see your old branch.If browsing your deleted directory isn't enough, you can always bring it back. Resurrectingdata is very easy in <strong>Subversion</strong>. If there's a deleted directory (or file) that you'd like to bringback into HEAD, simply use svn copy to copy it from the old revision:$ svn copy http://svn.example.com/repos/calc/branches/my-calc-branch@374 \http://svn.example.com/repos/calc/branches/my-calc-branch \-m "Restore my-calc-branch."Committed revision 376.In our example, your personal branch had a relatively short lifetime: you may have createdit to fix a bug or implement a new feature. When your task is done, so is the branch. In softwaredevelopment, though, it's also common to have two “main” branches running side byside for very long periods. For example, suppose it's time to release a stable version of thecalc project to the public, and you know it's going to take a couple of months to shakebugs out of the software. You don't want people to add new features to the project, but you113

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!