Strae
Strae

Reputation: 19445

How to autoremove folders/files from a SVN repo automatically?

Im using SVN for the first time, so probably this is a basic question.

The app im using under svn, the problem is that one task of the application is to add/remove folders/files automatically; When i commit, i want to update the repository with the current folder tree.

I saw how to add all created files/folder, with svn add -f myapp/*, but i get an error if i delete a folder that was already in the repository: svn: Directory '/myapp/folder' is missing.

How can I tell SVN to remove missing folder/files from repo during commit?

I know svn has the remove command, but is kindly an headcache to use everytime i remove something.

Update: Thanks to jon's link, i found this command: svn rm $( svn status [LOCAL_COPY_PATH] | sed -e '/^!/!d' -e 's/^!//' ) [LOCAL_COPY_PATH] that fullfill my needs.

Upvotes: 1

Views: 768

Answers (2)

Roland Mai
Roland Mai

Reputation: 31077

You need to structure your commit, there's no way around it. SVN treats deleted files and deleted folders somewhat differently. If you delete a file within a directory, the folder will be marked as modified. If you delete the folder after that, you will have the problem above. Now this can happen, especially if you don't commit in a while.

My suggestion is to restore the folder first with svn update, properly delete with "svn rm", then commit.

Upvotes: 0

Jon
Jon

Reputation: 2532

You should always use svn delete rather than just deleting folders/files from the repo. That being said, it looks like someone wrote a script to do this:

svn commit missing file automatically

Upvotes: 1

Related Questions