views:

56

answers:

2

Hi,

I've deleted many files from my local copy which were present in different sub directories of main directory. I want to remove all the locally deleted files from my SVN repository also.

If I'm checking the SVN status of my main directory using svn st main_dir then all the deleted files are showing with '!' symbol which means the corresponding files are missing. But those files are not getting removed from my SVN repository even if I commit my changes using svn ci main_dir.

Is there any way or command or script to remove all the locally deleted files of my main directory and sub directories also from my SVN repository. I think we can loop through all the files of each folder and remove the locally deleted files from SVN by checking the corresponding file SVN STATUS('!'), but I don't know how to convert my idea to a script.

Can anybody please help me to finish this task? Thanks in advance ...

Siva

+1  A: 

You should've used svn delete PATH to delete those files. This way they're being deleted from both, your filesystem and the working copy.

See svn delete for further details.

I suggest you svn update to get the files back from the remote repository and delete them using svn delete.

halfdan
I've not deleted those files manually, actually while upgrading one of my third party libraries some of the old files got deleted from the old version of that library. So I just need to remove those files from my SVN repository also.
Siva
+2  A: 

for i in $(svn st | grep \! | awk '{print $2}'); do svn delete $i; done

Gadolin
Thanks a lot Gadolin, this is working perfectly. I'm very new to this scripting, can you please explain this statement a bit so that I can understand properly.
Siva
1. svn st <- svn status
Gadolin
1. grep takes only lines from svn status that begins with !, so those are you are interested, then as svn status output has two columns, awk takes second column (where file name is), then each file is taken as an input in for loop as 'i' . Inside loop I call svn delete $i, where $i is substituted by file.
Gadolin
Thanks for your explanation Gadolin.
Siva