[svn.haxx.se] · SVN Dev · SVN Users · SVN Org · TSVN Dev · TSVN Users · Subclipse Dev · Subclipse Users · this month's index

RE: Feature request - SVN command to clean a working copy of all unversioned and ignored files and directories

From: Bob Archer <Bob.Archer_at_amsi.com>
Date: Fri, 9 Mar 2012 09:30:25 -0500

> Hi
>
> Are there any plans to add a command to SVN that cleans a working copy or
> path of all unversioned and/or ignored files and directories?
>
> This is a very common need for automated Continuous Integration builds where
> a working copy is reused for multiple runs of the same build. Currently there is
> no simple and fast way to restore a working copy to a prestine state. Often
> users have to choose between i) completely deleting the working copy for every
> build and then doing a fresh checkout from scratch or ii) living with lots of
> unversioned and ignored files and directories building up with each successive
> build.
>
> The only option at the moment is to write a shell/batch script to provide this
> feature which is messy and there's common way to do this. A new SVN
> command or enhanced exiting command that provided this functionality would
> be incredibly useful.
>
> As an example, here is the DOS batch script that I use at the moment:
>
> @echo off
> :: revert any uncommitted changes
> svn revert . --recursive
>
> :: remove all unversioned and all ignored files and directories
> for /f "usebackq tokens=1*" %%i in (`svn status --depth infinity --no-
> ignore ^| findstr /r "^[\?I]"`) do (
> if not %%j == %~nx0 (
> if exist "%%j\*" (
> echo deleting unversioned directory "%%j"
> attrib -h "%%j" /d /s
> rmdir /s /q "%%j"
> ) else (
> echo deleting unversioned file "%%j"
> attrib -h "%%j"
> del /f "%%j"
> )
> )
> )
>
> A possible command line syntax might look something like this:
>
> svn revert . --ignored --unversioned --recursive

FYI: If you are on windows the TortoiseSVN client's "Clean up" function allows you to delete unversioned and ignored files if you want. Also, it allows you to revert all changes when you clean up as well.

BOb
Received on 2012-03-09 15:31:02 CET

This is an archived mail posted to the Subversion Users mailing list.

This site is subject to the Apache Privacy Policy and the Apache Public Forum Archive Policy.