11.07.2015 Views

Version Control with Subversion - Login

Version Control with Subversion - Login

Version Control with Subversion - Login

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

Branching and Mergingand bug fixes. You can accomplish this by selectively backdating files or directories to particularrevisions (using svn update <strong>with</strong> the -r option liberally), by switching files and directoriesto particular branches (making use of svn switch), or even just by making abunch of local changes. When you're done, your working copy is a hodgepodge of repositorylocations from different revisions. But after testing, you know it's the precise combinationof data you need to tag.Time to make a snapshot. Copying one URL to another won't work here. In this case, youwant to make a snapshot of your exact working copy arrangement and store it in the repository.Luckily, svn copy actually has four different uses (which you can read about inChapter 9, <strong>Subversion</strong> Complete Reference), including the ability to copy a working copytree to the repository:$ lsmy-working-copy/$ svn copy my-working-copy \http://svn.example.com/repos/calc/tags/mytag \-m "Tag my existing working copy state."Committed revision 940.Now there is a new directory in the repository, /calc/tags/mytag, which is an exactsnapshot of your working copy—mixed revisions, URLs, local changes, and all.Other users have found interesting uses for this feature. Sometimes there are situationswhere you have a bunch of local changes made to your working copy, and you'd like a collaboratorto see them. Instead of running svn diff and sending a patch file (which won'tcapture directory, symlink, or property changes), you can use svn copy to “upload” yourworking copy to a private area of the repository. Your collaborator can then either checkout a verbatim copy of your working copy or use svn merge to receive your exactchanges.While this is a nice method for uploading a quick snapshot of your working copy, note thatthis is not a good way to initially create a branch. Branch creation should be an event untoitself, and this method conflates the creation of a branch <strong>with</strong> extra changes to files, all<strong>with</strong>in a single revision. This makes it very difficult (later on) to identify a single revisionnumber as a branch point.Branch MaintenanceYou may have noticed by now that <strong>Subversion</strong> is extremely flexible. Because it implementsbranches and tags <strong>with</strong> the same underlying mechanism (directory copies), and becausebranches and tags appear in normal filesystem space, many people find <strong>Subversion</strong> intimidating.It's almost too flexible. In this section, we'll offer some suggestions for arrangingand managing your data over time.Repository LayoutThere are some standard, recommended ways to organize a repository. Most people createa trunk directory to hold the “main line” of development, a branches directory to containbranch copies, and a tags directory to contain tag copies. If a repository holds onlyone project, often people create these top-level directories:/trunk/branches/tagsIf a repository contains multiple projects, admins typically index their layout by project (see112

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

Saved successfully!

Ooh no, something went wrong!