04.08.2013 Views

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

Version Control with Subversion - Electrical and Computer ...

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.

Chapter 3. Guided Tour<br />

Help!<br />

Import<br />

Now we will go into the details of using <strong>Subversion</strong>. By the time you reach the end of this chapter, you<br />

will be able to perform almost all the tasks you need to use <strong>Subversion</strong> in a normal day's work. You'll<br />

start <strong>with</strong> an initial checkout of your code, <strong>and</strong> walk through making changes <strong>and</strong> examining those<br />

changes. You'll also see how to bring changes made by others into your working copy, examine them,<br />

<strong>and</strong> work through any conflicts that might arise.<br />

Note that this chapter is not meant to be an exhaustive list of all <strong>Subversion</strong>'s comm<strong>and</strong>s—rather, it's a<br />

conversational introduction to the most common <strong>Subversion</strong> tasks you'll encounter. This chapter assumes<br />

that you've read <strong>and</strong> understood Chapter 2, Basic Concepts <strong>and</strong> are familiar <strong>with</strong> the general model<br />

of <strong>Subversion</strong>. For a complete reference of all comm<strong>and</strong>s, see Chapter 9, <strong>Subversion</strong> Complete Reference.<br />

Before reading on, here is the most important comm<strong>and</strong> you'll ever need when using <strong>Subversion</strong>: svn<br />

help. The <strong>Subversion</strong> comm<strong>and</strong>-line client is self-documenting—at any time, a quick svn help<br />

will describe the syntax, switches, <strong>and</strong> behavior of the subcomm<strong>and</strong>.<br />

You use svn import to import a new project into a <strong>Subversion</strong> repository. While this is most likely the<br />

very first thing you will do when you set up your <strong>Subversion</strong> server, it's not something that happens very<br />

often. For a detailed description of import, see the section called “svn import” later in this chapter.<br />

Revisions: Numbers, Keywords, <strong>and</strong> Dates, Oh<br />

My!<br />

Before we go on, you should know a bit about how to identify a particular revision in your repository.<br />

As you learned in the section called “Revisions”, a revision is a “snapshot” of the repository at a particular<br />

moment in time. As you continue to commit <strong>and</strong> grow your repository, you need a mechanism for<br />

identifying these snapshots.<br />

You specify these revisions by using the --revision (-r) switch plus the revision you want (svn -<br />

-revision REV) or you can specify a range by separating two revisions <strong>with</strong> a colon (svn --revision<br />

REV1:REV2). And <strong>Subversion</strong> lets you refer to these revisions by number, keyword, or date.<br />

Revision Numbers<br />

When you create a new <strong>Subversion</strong> repository, it begins its life at revision zero <strong>and</strong> each successive<br />

commit increases the revision number by one. After your commit completes, the <strong>Subversion</strong> client informs<br />

you of the new revision number:<br />

$ svn commit --message "Corrected number of cheese slices."<br />

Sending s<strong>and</strong>wich.txt<br />

Transmitting file data .<br />

Committed revision 3.<br />

If at any point in the future you want to refer to that revision (we'll see how <strong>and</strong> why we might want to<br />

20

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

Saved successfully!

Ooh no, something went wrong!