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.

Basic UsageLook Ma! No Network!You can use the commands svn status, svn diff, and svn revert <strong>with</strong>out any networkaccess even if your repository is across the network. This makes it easy to manageyour changes-in-progress when you are somewhere <strong>with</strong>out a network connection,such as traveling on an airplane, riding a commuter train, or hacking on thebeach. 2<strong>Subversion</strong> does this by keeping private caches of pristine versions of each versionedfile inside the .svn administrative areas. This allows <strong>Subversion</strong> to report—andrevert—local modifications to those files <strong>with</strong>out network access. Thiscache (called the “text-base”) also allows <strong>Subversion</strong> to send the user's local modificationsduring a commit to the server as a compressed delta (or “difference”) againstthe pristine version. Having this cache is a tremendous benefit—even if you have afast Internet connection, it's much faster to send only a file's changes rather than thewhole file to the server.<strong>Subversion</strong> has been optimized to help you <strong>with</strong> this task, and it is able to do many things<strong>with</strong>out communicating <strong>with</strong> the repository. In particular, your working copy contains a hiddencached “pristine” copy of each version-controlled file <strong>with</strong>in the .svn area. Because ofthis, <strong>Subversion</strong> can quickly show you how your working files have changed or even allowyou to undo your changes <strong>with</strong>out contacting the repository.See an overview of your changesTo get an overview of your changes, you'll use the svn status command. You'll probablyuse svn status more than any other <strong>Subversion</strong> command.CVS Users: Hold That Update!You're probably used to using cvs update to see what changes you've made to yourworking copy. svn status will give you all the information you need regarding whathas changed in your working copy—<strong>with</strong>out accessing the repository or potentially incorporatingnew changes published by other users.In <strong>Subversion</strong>, svn update does just that—it updates your working copy <strong>with</strong> anychanges committed to the repository since the last time you updated your workingcopy. You may have to break the habit of using the update command to see whatlocal modifications you've made.If you run svn status at the top of your working copy <strong>with</strong> no arguments, it will detect all fileand tree changes you've made. Here are a few examples of the most common statuscodes that svn status can return. (Note that the text following # is not actually printed bysvn status.)? scratch.c # file is not under version controlA stuff/loot/bloo.h # file is scheduled for additionC stuff/loot/lump.c # file has textual conflicts from an updateD stuff/fish.c # file is scheduled for deletionM bar.c # the content in bar.c has local modificationsIn this output format, svn status prints six columns of characters, followed by severalwhitespace characters, followed by a file or directory name. The first column tells the statusof a file or directory and/or its contents. The codes we listed are:2 And you don't have a WLAN card. Thought you got us, huh?23

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

Saved successfully!

Ooh no, something went wrong!