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 TopicsWeb 2.0 sites have similar mechanisms—consider the “tags” used by sites such as You-Tube [http://www.youtube.com/] and Flickr [http://www.flickr.com/], “categories” applied toblog posts, and so on. Folks understand today that organization of data is critical, but thathow that data is organized needs to be a flexible concept. The old files-and-foldersparadigm is too rigid for some applications.<strong>Subversion</strong>'s changelist support allows you to create changelists by applying labels to filesyou want to be associated <strong>with</strong> that changelist, remove those labels, and limit the scope ofthe files on which its subcommands operate to only those bearing a particular label. In thissection, we'll look in detail at how to do these things.Creating and Modifying ChangelistsYou can create, modify, and delete changelists using the svn changelist command. Moreaccurately, you use this command to set or unset the changelist association of a particularworking copy file. A changelist is effectively created the first time you label a file <strong>with</strong> thatchangelist; it is deleted when you remove that label from the last file that had it. Let's examinea usage scenario that demonstrates these concepts.Harry is fixing some bugs in the calculator application's mathematics logic. His work leadshim to change a couple of files:$ svn statusM integer.cM mathops.c$While testing his bug fix, Harry notices that his changes bring to light a tangentially relatedbug in the user interface logic found in button.c. Harry decides that he'll go ahead andfix that bug, too, as a separate commit from his math fixes. Now, in a small working copy<strong>with</strong> only a handful of files and few logical changes, Harry can probably keep his two logicalchange groupings mentally organized <strong>with</strong>out any problem. But today he's going to use<strong>Subversion</strong>'s changelists feature as a special favor to the authors of this book.Harry first creates a changelist and associates <strong>with</strong> it the two files he's already changed.He does this by using the svn changelist command to assign the same arbitrary changelistname to those files:$ svn changelist math-fixes integer.c mathops.cPath 'integer.c' is now a member of changelist 'math-fixes'.Path 'mathops.c' is now a member of changelist 'math-fixes'.$ svn status--- Changelist 'math-fixes':M integer.cM mathops.c$As you can see, the output of svn status reflects this new grouping.Harry now sets off to fix the secondary UI problem. Since he knows which file he'll be changing,he assigns that path to a changelist, too. Unfortunately, Harry carelessly assigns thisthird file to the same changelist as the previous two files:$ svn changelist math-fixes button.cPath 'button.c' is now a member of changelist 'math-fixes'.$ svn status--- Changelist 'math-fixes':button.c78

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

Saved successfully!

Ooh no, something went wrong!