You are viewing a plain text version of this content. The canonical link for it is here.
Posted to users@subversion.apache.org by "Parrish, Ken" <KP...@gomez.com> on 2008/12/10 19:07:22 UTC

Script to clean out files not in Subversion ...

I would like to create a script that will scan a Subversion working
directory and detect all files and directories which are NOT presently
under Subversion control.  The files and directories will then be
deleted so as to return the state of the working directory to that of a
recently 'checkout'.
 
I would like to avoid having to delete the entire directory tree and
then execute a Subversion 'checkout' or 'update' on the directory due to
performance and network issues.
 
I have various scripting tools available to handle the job, but need a
way to easily detect which files to remove.
 
Thanks for your help.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=982408

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

RE: Script to clean out files not in Subversion ...

Posted by "Parrish, Ken" <KP...@gomez.com>.
Thanks.  This will work just fine from a Nant script.

Ken

-----Original Message-----
From: Andy Levy [mailto:andy.levy@gmail.com] 
Sent: Wednesday, December 10, 2008 2:20 PM
To: Parrish, Ken
Cc: users@subversion.tigris.org
Subject: Re: Script to clean out files not in Subversion ...

On Wed, Dec 10, 2008 at 14:07, Parrish, Ken <KP...@gomez.com> wrote:
> I would like to create a script that will scan a Subversion working
> directory and detect all files and directories which are NOT presently
under
> Subversion control.  The files and directories will then be deleted so
as to
> return the state of the working directory to that of a recently
'checkout'.
>
>
>
> I would like to avoid having to delete the entire directory tree and
then
> execute a Subversion 'checkout' or 'update' on the directory due to
> performance and network issues.
>
>
>
> I have various scripting tools available to handle the job, but need a
way
> to easily detect which files to remove.

Any file listed in the output of svn st with a question mark in the
first column is "unknown" to Subversion.  Grep that output for a ? at
the beginning of the line and you'll have a list of all unversioned
files/directories.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=982483

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].


Re: Script to clean out files not in Subversion ...

Posted by Andy Levy <an...@gmail.com>.
On Wed, Dec 10, 2008 at 14:07, Parrish, Ken <KP...@gomez.com> wrote:
> I would like to create a script that will scan a Subversion working
> directory and detect all files and directories which are NOT presently under
> Subversion control.  The files and directories will then be deleted so as to
> return the state of the working directory to that of a recently 'checkout'.
>
>
>
> I would like to avoid having to delete the entire directory tree and then
> execute a Subversion 'checkout' or 'update' on the directory due to
> performance and network issues.
>
>
>
> I have various scripting tools available to handle the job, but need a way
> to easily detect which files to remove.

Any file listed in the output of svn st with a question mark in the
first column is "unknown" to Subversion.  Grep that output for a ? at
the beginning of the line and you'll have a list of all unversioned
files/directories.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=982443

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Script to clean out files not in Subversion ...

Posted by Christian Unger <ch...@mac.com>.
svn st | grep ^?



cu
christian unger




On 10.12.2008, at 20:07, Parrish, Ken wrote:

> I would like to create a script that will scan a Subversion working  
> directory and detect all files and directories which are NOT  
> presently under Subversion control.  The files and directories will  
> then be deleted so as to return the state of the working directory  
> to that of a recently ‘checkout’.
>
> I would like to avoid having to delete the entire directory tree and  
> then execute a Subversion ‘checkout’ or ‘update’ on the directory  
> due to performance and network issues.
>
> I have various scripting tools available to handle the job, but need  
> a way to easily detect which files to remove.
>
> Thanks for your help.
>
>

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=982448

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].

Re: Script to clean out files not in Subversion ...

Posted by Eric Johnson <er...@tibco.com>.
Hi Ken,

Parrish, Ken wrote:
>
> I would like to create a script that will scan a Subversion working 
> directory and detect all files and directories which are NOT presently 
> under Subversion control.  The files and directories will then be 
> deleted so as to return the state of the working directory to that of 
> a recently ‘checkout’.
>
>  
>
> I would like to avoid having to delete the entire directory tree and 
> then execute a Subversion ‘checkout’ or ‘update’ on the directory due 
> to performance and network issues.
>
>  
>
> I have various scripting tools available to handle the job, but need a 
> way to easily detect which files to remove.
>
It sort of depends on the "environment" that you're in.  Assuming a 
capable command line like from Linux:

In the past, I've used "svn st" to get this list, then done a 
search/replace for the ? at the beginning of each line, replacing with 
"rm -r ".

This isn't quite enough, as the "svn:ignore" entries won't show up 
unless you also pass the --no-ignore option, but you may or may not want 
to do that depending on your scenarios.

If you like XML processing more, you could do "svn st --xml 
--no-ignore", and pipe that into a file, process with XSLT to turn into 
a script that runs "rm ".

-Eric.

------------------------------------------------------
http://subversion.tigris.org/ds/viewMessage.do?dsForumId=1065&dsMessageId=982588

To unsubscribe from this discussion, e-mail: [users-unsubscribe@subversion.tigris.org].