Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

List of all versioned files in subversion? (Remove files by name)

Tags:

grep

find

svn

Some smart dude at the office managed to commit a whole bunch of 'backup' files (they start with ._) to our subversion server.

Preferably I would like to delete these files using some basic bash script instead of going through the repository manually.

Is there any way I can get a list of all subversion versioned files inside a directory so I can do some basic grepping / svn deletes?

edit:

'svn list' isn't recursive and also seems to list directories, I need the kind of behavior like 'find'.

second edit:

Ok, the -R flag can make 'svn list' recursive... but how do I strip out directories?

like image 739
Daniel Sloof Avatar asked Sep 03 '10 08:09

Daniel Sloof


3 Answers

svn list -R

lists all files and directory recursively

like image 158
Nikolaus Gradwohl Avatar answered Nov 02 '22 10:11

Nikolaus Gradwohl


If it's only in one commit (or series of commits) then use svn merge to undo it.

If the user has been doing it across several commits and you're on Linux:

First check that this properly lists the files you want to delete:

find . -name '._*'

Then actually invoke svn to delete them:

find . -name '._*' -exec svn rm {} \;

Check svn status, commit if good.

Disclaimer: I have not tested the commands so beware.

I think those are Mac backup files it makes automatically.

like image 21
Rob Olmos Avatar answered Nov 02 '22 09:11

Rob Olmos


how do I strip out directories?

The key is to observe the directories will end with a slash.

You can then use grep.

svn list -R my_svn_dir | grep -v '/$'
like image 29
Gordon Fischer Avatar answered Nov 02 '22 10:11

Gordon Fischer