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.

Guided Tour<br />

In this case, someone else checked in modifications to both foo.c <strong>and</strong> bar.c since the last time you<br />

updated, <strong>and</strong> <strong>Subversion</strong> has updated your working copy to include those changes.<br />

Let's examine the output of svn update a bit more. When the server sends changes to your working<br />

copy, a letter code is displayed next to each item to let you know what actions <strong>Subversion</strong> performed to<br />

bring your working copy up-to-date:<br />

U foo<br />

File foo was Updated (received changes from the server).<br />

A foo<br />

File or directory foo was Added to your working copy.<br />

D foo<br />

File or directory foo was Deleted from your working copy.<br />

R foo<br />

File or directory foo was Replaced in your working copy; that is, foo was deleted, <strong>and</strong> a new item <strong>with</strong> the<br />

same name was added. While they may have the same name, the repository considers them to be distinct objects<br />

<strong>with</strong> distinct histories.<br />

G foo<br />

File foo received new changes from the repository, but your local copy of the file had your modifications.<br />

Either the changes did not intersect, or the changes were exactly the same as your local modifications, so <strong>Subversion</strong><br />

has successfully merGed the repository's changes into the file <strong>with</strong>out a problem.<br />

C foo<br />

File foo received Conflicting changes from the server. The changes from the server directly overlap your own<br />

changes to the file. No need to panic, though. This overlap needs to be resolved by a human (you); we discuss<br />

this situation later in this chapter.<br />

Make Changes to Your Working Copy<br />

Now you can get to work <strong>and</strong> make changes in your working copy. It's usually most convenient to decide<br />

on a particular change (or set of changes) to make, such as writing a new feature, fixing a bug, etc.<br />

The <strong>Subversion</strong> comm<strong>and</strong>s that you will use here are svn add, svn delete, svn copy, <strong>and</strong> svn move.<br />

However, if you are merely editing files that are already in <strong>Subversion</strong>, you may not need to use any of<br />

these comm<strong>and</strong>s until you commit. Changes you can make to your working copy:<br />

File changes<br />

This is the simplest sort of change. You don't need to tell <strong>Subversion</strong> that you intend to change a file; just make<br />

your changes. <strong>Subversion</strong> will be able to automatically detect which files have been changed.<br />

Tree changes<br />

You can ask <strong>Subversion</strong> to “mark” files <strong>and</strong> directories for scheduled removal, addition, copying, or moving.<br />

While these changes may take place immediately in your working copy, no additions or removals will happen in<br />

the repository until you commit them.<br />

To make file changes, use your text editor, word processor, graphics program, or whatever tool you<br />

would normally use. <strong>Subversion</strong> h<strong>and</strong>les binary files just as easily as it h<strong>and</strong>les text files—<strong>and</strong> just as efficiently<br />

too.<br />

26

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

Saved successfully!

Ooh no, something went wrong!