<?xml version="1.0" encoding="UTF-8" standalone="no"?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /><title>Sometimes You Just Need to Clean Up</title><link rel="stylesheet" href="styles.css" type="text/css" /><meta name="generator" content="DocBook XSL Stylesheets V1.73.2" /><link rel="start" href="index.html" title="Version Control with Subversion" /><link rel="up" href="svn.tour.html" title="Chapter 2. Basic Usage" /><link rel="prev" href="svn.tour.history.html" title="Examining History" /><link rel="next" href="svn.tour.summary.html" title="Summary" /></head><body><div class="navheader"><table width="100%" summary="Navigation header"><tr><th colspan="3" align="center">Sometimes You Just Need to Clean Up</th></tr><tr><td width="20%" align="left"><a accesskey="p" href="svn.tour.history.html">Prev</a> </td><th width="60%" align="center">Chapter 2. Basic Usage</th><td width="20%" align="right"> <a accesskey="n" href="svn.tour.summary.html">Next</a></td></tr></table><hr /></div><div class="sect1" lang="en" xml:lang="en"><div class="titlepage"><div><div><h2 class="title" style="clear: both"><a id="svn.tour.cleanup"></a>Sometimes You Just Need to Clean Up</h2></div></div></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="svn.tour.cleanup.disposal"></a>Disposing of a Working Copy</h3></div></div></div><p>Subversion doesn't track either the state or existence of working copies on the server, so there's no server overhead to keeping working copies around. Likewise, there's no need to let the server know that you're going to delete a working copy.</p><p>If you're likely to use a working copy again, there's nothing wrong with just leaving it on disk until you're ready to use it again, at which point all it takes is an <span class="command"><strong>svn update</strong></span> to bring it up to date and ready for use.</p><p>However, if you're definitely not going to use a working copy again, you can safely delete the entire thing, but you'd be well served to take a look through the working copy for unversioned files. To find these files, run <span class="command"><strong>svn status</strong></span> and review any files that are prefixed by a <code class="literal">?</code> to make certain that they're not of importance. After you're done reviewing, you can safely delete your working copy.</p></div><div class="sect2" lang="en" xml:lang="en"><div class="titlepage"><div><div><h3 class="title"><a id="svn.tour.cleanup.interruption"></a>Recovering From an Interruption</h3></div></div></div><p>When Subversion modifies your working copy (or any information within <code class="filename">.svn</code>), it tries to do so as safely as possible. Before changing the working copy, Subversion writes its intentions to a log file. Next it executes the commands in the log file to apply the requested change, holding a lock on the relevant part of the working copy while it works—to prevent other Subversion clients from accessing the working copy in mid-change. Finally, Subversion removes the log file. Architecturally, this is similar to a journaled filesystem. If a Subversion operation is interrupted (if the process is killed, or if the machine crashes, for example), the log files remain on disk. By re-executing the log files, Subversion can complete the previously started operation, and your working copy can get itself back into a consistent state.</p><p>And this is exactly what <span class="command"><strong>svn cleanup</strong></span> does: it searches your working copy and runs any leftover logs, removing working copy locks in the process. If Subversion ever tells you that some part of your working copy is “<span class="quote">locked</span>”, then this is the command that you should run. Also, <span class="command"><strong>svn status</strong></span> will display an <code class="literal">L</code> next to locked items:</p><pre class="screen"> $ svn status L somedir M somedir/foo.c $ svn cleanup $ svn status M somedir/foo.c </pre><p>Don't confuse these working copy locks with the ordinary locks that Subversion users create when using the “<span class="quote">lock-modify-unlock</span>” model of concurrent version control; see <a class="xref" href="svn.advanced.locking.html#svn.advanced.locking.meanings" title="The three meanings of “lock”">The three meanings of “<span class="quote">lock</span>”</a> for clarification.</p></div></div><div class="navfooter"><hr /><table width="100%" summary="Navigation footer"><tr><td width="40%" align="left"><a accesskey="p" href="svn.tour.history.html">Prev</a> </td><td width="20%" align="center"><a accesskey="u" href="svn.tour.html">Up</a></td><td width="40%" align="right"> <a accesskey="n" href="svn.tour.summary.html">Next</a></td></tr><tr><td width="40%" align="left" valign="top">Examining History </td><td width="20%" align="center"><a accesskey="h" href="index.html">Home</a></td><td width="40%" align="right" valign="top"> Summary</td></tr></table></div></body></html>