SVN Reference

Page 350

Appendix B. Subversion for CVS Users This appendix is a guide for CVS users new to Subversion. It's essentially a list of differences between the two systems as “viewed from 10,000 feet”. For each section, we provide backreferences to relevant chapters when possible. Although the goal of Subversion is to take over the current and future CVS user base, some new features and design changes were required to fix certain “broken” behaviors that CVS had. This means that, as a CVS user, you may need to break habits—ones that you forgot were odd to begin with.

Revision Numbers Are Different Now In CVS, revision numbers are per-file. This is because CVS stores its data in RCS files; each file has a corresponding RCS file in the repository, and the repository is roughly laid out according to the structure of your project tree. In Subversion, the repository looks like a single filesystem. Each commit results in an entirely new filesystem tree; in essence, the repository is an array of trees. Each of these trees is labeled with a single revision number. When someone talks about “revision 54”, they're talking about a particular tree (and indirectly, the way the filesystem looked after the 54th commit). Technically, it's not valid to talk about “revision 5 of foo.c”. Instead, one would say “foo.c as it appears in revision 5”. Also, be careful when making assumptions about the evolution of a file. In CVS, revisions 5 and 6 of foo.c are always different. In Subversion, it's most likely that foo.c did not change between revisions 5 and 6. Similarly, in CVS a tag or branch is an annotation on the file, or on the version information for that individual file, whereas in Subversion a tag or branch is a copy of an entire tree (by convention, into the /branches or /tags directories that appear at the top level of the repository, beside /trunk). In the repository as a whole, many versions of each file may be visible: the latest version on each branch, every tagged version, and of course the latest version on the trunk itself. So, to refine the terms even further, one would often say “foo.c as it appears in / branches/REL1 in revision 5.” For more details on this topic, see the section called “Revisions”.

Directory Versions Subversion tracks tree structures, not just file contents. It's one of the biggest reasons Subversion was written to replace CVS. Here's what this means to you, as a former CVS user: • The svn add and svn delete commands work on directories now, just as they work on files. So do svn copy and svn move. However, these commands do not cause any kind of immediate change in the repository. Instead, the working items are simply “scheduled” for addition or deletion. No repository changes happen until you run svn commit. • Directories aren't dumb containers anymore; they have revision numbers like files. (Or more properly, it's correct to talk about “directory foo/ in revision 5”.)

328


Issuu converts static files into: digital portfolios, online yearbooks, online catalogs, digital photo albums and more. Sign up and create your flipbook.