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

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

From: Simon Dean <Simon.Dean_at_moneysupermarket.com>
Date: Fri, 9 Mar 2012 13:56:34 +0000

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

Many thanks
Simon Dean

-----------------------------------------------------------------------------------------------------------------------------------------
The information contained in this message may be CONFIDENTIAL and is intended for the addressee only. Any unauthorised use, dissemination of the information, or copying of this message is prohibited. If you are not the addressee, please notify the sender immediately by return e-mail and delete this message. Although this e-mail and any attachments are believed to be free of any virus, or other defect which might affect any computer or system into which they are received and opened, it is the responsibility of the recipient to ensure that they are virus free and no responsibility is accepted by Moneysupermarket.com Financial Group Limited for any loss or damage from receipt or use thereof.
The views expressed are of the individual, and do not necessarily reflect the views of Moneysupermarket.com Financial Group Limited.
Moneysupermarket.com Limited is an appointed representative of Moneysupermarket.com Financial Group Limited, which is authorised and regulated by the Financial Services Authority (FSA FRN 303190).
Moneysupermarket.com Financial Group Limited, registered in England No. 3157344.
Registered Office: Moneysupermarket House, St. David’s Park, Ewloe, CH5 3UZ. Telephone 01244 665700.
Received on 2012-03-09 15:07:56 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.