tags:

views:

32

answers:

4

Is there a svn command to tell the repository to automatically “rm” files in repo that exist in the repo but not in my dir?

a bit explanation:

i have my own project hosted on google code. In my local dir, i've deleted many files. Now, i want to commit. However, i don't remember which files i've removed. It seems quite cumbersome to find out (by e.g. backup my dir, update the dir, and diff the dirs, then generate a file list to “svn rm f1 f2 ...”)

i know that in svn that proper way to remove a file is to first call “svn rm fname”, which will delete the file for you. But long story short... i have the above situation.

+1  A: 

Not that I know of.

svn status gives you an overview of the current status of your working directory. Files prefixed with a ! are missing (removed, but not svn rm'd).

jackrabbit
+1  A: 

If you commit your working copy's root folder, Subversion should notice that the files are missing in the working copy. At least TortoiseSVN offers to delete those files from the repo as well - I don't know how the command line client handles this.

Pekka
+2  A: 

Hi Xah. I just tried the following on my Mac OS X system and it seemed to work:

$ svn status -q | grep '! ' | awk '{ print $2 }' | xargs svn rm

This doesn't commit anything, just issues the svn rm command(s) for you. Hope this helps!

EDIT: This does not correctly handle files with spaces in the name (e.g. "My text file.txt"), but it should work for whitespace-free file names.

Matt Solnit
+1 for posting first :)
zr
thanks all. svn status -q did it.
Xah Lee
@zr Cheers! :-)
Matt Solnit
+2  A: 

This SHOULD work. Use at your own risk - better create a backup before you run it:

svn st | grep "^!" | gawk '{print $2}' | xargs svn rm
zr