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.

Advanced Topicscopy holds the correct lock token:$ svn statusM K banana.jpg$ svn commit -m "Make banana more yellow"Sending banana.jpgTransmitting file data .Committed revision 2201.$ svn status$Notice that after the commit is finished, svn status shows that the lock token is no longerpresent in the working copy. This is the standard behavior of svn commit—it searches theworking copy (or list of targets, if you provide such a list) for local modifications and sendsall the lock tokens it encounters during this walk to the server as part of the commit transaction.After the commit completes successfully, all of the repository locks that were mentionedare released—even on files that weren't committed. This is meant to discourageusers from being sloppy about locking or from holding locks for too long. If Harry haphazardlylocks 30 files in a directory named images because he's unsure of which files heneeds to change, yet changes only four of those files, when he runs svn commit images,the process will still release all 30 locks.This behavior of automatically releasing locks can be overridden <strong>with</strong> the --no-unlockoption to svn commit. This is best used for those times when you want to commitchanges, but still plan to make more changes and thus need to retain existing locks. Youcan also make this your default behavior by setting the no-unlock runtime configurationoption (see the section called “Runtime Configuration Area”).Of course, locking a file doesn't oblige one to commit a change to it. The lock can be releasedat any time <strong>with</strong> a simple svn unlock command:$ svn unlock banana.c'banana.c' unlocked.Discovering LocksWhen a commit fails due to someone else's locks, it's fairly easy to learn about them. Theeasiest way is to run svn status --show-updates:$ svn status -uM 23 bar.cM O 32 raisin.jpg* 72 foo.hStatus against revision: 105$In this example, Sally can see not only that her copy of foo.h is out of date, but also thatone of the two modified files she plans to commit is locked in the repository. The O symbolstands for “Other,” meaning that a lock exists on the file and was created by somebodyelse. If she were to attempt a commit, the lock on raisin.jpg would prevent it. Sally isleft wondering who made the lock, when, and why. Once again, svn info has the answers:$ svn info http://svn.example.com/repos/project/raisin.jpgPath: raisin.jpgName: raisin.jpgURL: http://svn.example.com/repos/project/raisin.jpgRepository UUID: edb2f264-5ef2-0310-a47a-87b0ce17a8ec66

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

Saved successfully!

Ooh no, something went wrong!