Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Things works like they should, at least in svn 1.6.11 and higher. However, a build process is quite likely to leave behind unrevisioned files. Those may be transparent on "svn status" due to SVNIGNORE settings. This may cause troubles when one expects svn to remove the whole directory.</p> <p>I did some testing - I set up a new and empty repository, made a trunk and tags directories there, added one and one file while tagging it. (the code sections below does not include the output and errors thrown by SVN, you're encouraged to copy it into a terminal window and see if you can duplicate the behaviour).</p> <pre><code>mkdir /tmp/workdir/ cd /tmp/workdir svnadmin create /tmp/foobar svn checkout file:///tmp/foobar/ svn mkdir foobar/tags svn mkdir foobar/trunk cd foobar svn commit -m "trunk and tags" ## NOTE: in svn 1.8 and higher, it's needed with a --ignore-ancestry option below svn switch file:///tmp/foobar/trunk </code></pre> <p>(and here we can already see that it's doing the right thing - deleting the tags and trunk subdirectories)</p> <pre><code>touch file1 svn add file1 svn commit -m "added file1" svn cp -m "file1 in tag1" . file:///tmp/foobar/tags/tag1 </code></pre> <p>And then again ...</p> <pre><code>touch file2 svn add file2 svn commit -m "added file2" svn cp -m "file2 in tag2" . file:///tmp/foobar/tags/tag2 </code></pre> <p>Let's explicitly delete file1 from tag3</p> <pre><code>svn rm file1 svn commit -m "deleted file1" svn cp -m "file1 removed from tag3" file:///tmp/foobar/trunk/ file:///tmp/foobar/tags/tag3/ </code></pre> <p>... and a new directory as well ...</p> <pre><code>svn mkdir dir1 touch dir1/file3 svn add dir1/file3 svn commit -m "added dir1/file3" svn cp -m "dir1/file3 in tag4" file:///tmp/foobar/trunk file:///tmp/foobar/tags/tag4/ </code></pre> <p>... and let's delete it in tag5 ...</p> <pre><code>svn rm dir1 svn commit -m "removed dir1/file3" svn cp -m "dir1/file3 removed in tag5" file:///tmp/foobar/trunk file:///tmp/foobar/tags/tag5/ </code></pre> <p>... and let's check how switching works ...</p> <pre><code>svn switch file:///tmp/foobar/tags/tag1 svn switch file:///tmp/foobar/tags/tag2 svn switch file:///tmp/foobar/tags/tag3 svn switch file:///tmp/foobar/tags/tag4 svn switch file:///tmp/foobar/tags/tag5 svn switch file:///tmp/foobar/tags/tag4 </code></pre> <p>... no problems whatsoever. But, say that I modified dir1/file3 with emacs - it would typically make a backup file:</p> <pre><code>touch dir1/file3~ </code></pre> <p>This doesn't show up on "svn status" due to default SVNIGNORE settings ...</p> <pre><code>svn status </code></pre> <p>But it's sufficient to break things:</p> <pre><code>svn switch file:///tmp/foobar/tags/tag5 svn status svn switch file:///tmp/foobar/tags/tag4 </code></pre> <p>The first command indicates that dir1 is deleted, but due to the unrevisioned file the directory gets standing.</p> <p>"svn revert" unfortunately doesn't remove unrevisioned files ...</p> <pre><code>svn revert -R . svn switch file:///tmp/foobar/tags/tag5 svn status svn switch file:///tmp/foobar/tags/tag4 </code></pre> <p>"make clean" may and may not work, depending on the environment. One could of course make a script to remove it, i.e. like this:</p> <pre><code>rm -rf $(svn status --no-ignore | grep -E '^\?' | awk ' { print $2 ; }') svn switch file:///tmp/foobar/tags/tag4 </code></pre> <p>Please note that the command above may do Bad Things when encountering file names with spaces.</p> <p>One may also avoid some error messages above by using "--force":</p> <pre><code>touch dir1/file3~ svn switch --force file:///tmp/foobar/tags/tag5 svn switch --force file:///tmp/foobar/tags/tag4 </code></pre> <p>Note that mydir1/file3~ never gets deleted, but that the last switch won't fail</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload