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.

Advanced TopicsUpdated to revision 1.$ svn update --set-depth empty mom-empty/daughterA mom-empty/daughterUpdated to revision 1.$ svn update --set-depth infinity mom-empty/daughter/granddaughter1A mom-empty/daughter/granddaughter1A mom-empty/daughter/granddaughter1/bunny1.txtA mom-empty/daughter/granddaughter1/bunny2.txtUpdated to revision 1.$LockingFortunately, having a complex collection of ambient depths in a single working copydoesn't complicate the way you interact <strong>with</strong> that working copy. You can still make, revert,display, and commit local modifications in your working copy <strong>with</strong>out providing any new options(including --depth and --set-depth) to the relevant subcommands. Even svnupdate works as it does elsewhere when no specific depth is provided—it updates theworking copy targets that are present while honoring their sticky depths.You might at this point be wondering, “So what? When would I use this?” One scenariowhere this feature finds utility is tied to a particular repository layout, specifically where youhave many related or codependent projects or software modules living as siblings in asingle repository location (trunk/project1, trunk/project2, trunk/project3,etc.). In such scenarios, it might be the case that you personally care about only a handfulof those projects—maybe some primary project and a few other modules on which it depends.You can check out individual working copies of all of these things, but those workingcopies are disjoint and, as a result, it can be cumbersome to perform operations acrossseveral or all of them at the same time. The alternative is to use the sparse directories feature,building out a single working copy that contains only the modules you care about.You'd start <strong>with</strong> an empty-depth checkout of the common parent directory of the projects,and then update <strong>with</strong> infinite depth only the items you wish to have, like we demonstratedin the previous example. Think of it like an opt-in system for working copy citizens.<strong>Subversion</strong> 1.5's implementation of shallow checkouts is good but does not support acouple of interesting behaviors. First, you cannot de-telescope a working copy item. Runningsvn update --set-depth empty in an infinite-depth working copy will not havethe effect of discarding everything but the topmost directory—it will simply error out.Second, there is no depth value to indicate that you wish an item to be explicitly excluded.You have to do implicit exclusion of an item by including everything else.<strong>Subversion</strong>'s copy-modify-merge version control model lives and dies on its data mergingalgorithms—specifically on how well those algorithms perform when trying to resolve conflictscaused by multiple users modifying the same file concurrently. <strong>Subversion</strong> itselfprovides only one such algorithm: a three-way differencing algorithm that is smart enoughto handle data at a granularity of a single line of text. <strong>Subversion</strong> also allows you to supplementits content merge processing <strong>with</strong> external differencing utilities (as described in thesection called “External diff3”), some of which may do an even better job, perhaps providinggranularity of a word or a single character of text. But common among those algorithmsis that they generally work only on text files. The landscape starts to look pretty grim whenyou start talking about content merges of nontextual file formats. And when you can't find atool that can handle that type of merging, you begin to run into problems <strong>with</strong> the copymodify-mergemodel.Let's look at a real-life example of where this model runs aground. Harry and Sally are bothgraphic designers working on the same project, a bit of marketing collateral for an automobilemechanic. Central to the design of a particular poster is an image of a car in needof some bodywork, stored in a file using the PNG image format. The poster's layout is almostfinished, and both Harry and Sally are pleased <strong>with</strong> the particular photo they chosefor their damaged car—a baby blue 1967 Ford Mustang <strong>with</strong> an unfortunate bit of crumplingon the left front fender.62

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

Saved successfully!

Ooh no, something went wrong!