Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Delete all files from svn repository

Tags:

svn

Probably this is a very easy question, but I did not find yet how to delete all files present at the moment in a external SVN repository.

I can delete just one file using:

svn delete -m "delete README" http://myrepo.com/svn/myrepo/README

But now I want to delete all of them. I thought about a script which gets the list of all the files of the repository and afterwards deletes them one by one, but this is tedious. Do you know a simpler solution?

I also tried:

svn rm http://myrepo.com/svn/myrepo
svn delete http://myrepo.com/svn/myrepo/*

But nothing

Thanks

like image 679
Open the way Avatar asked Sep 22 '09 17:09

Open the way


People also ask

How do I delete my TortoiseSVN repository?

Use TortoiseSVN → Delete to remove files or folders from Subversion. When you TortoiseSVN → Delete a file or folder, it is removed from your working copy immediately as well as being marked for deletion in the repository on next commit. The item's parent folder shows a “modified” icon overlay.

How do I delete a file from my repository?

Browse to the directory in your repository that you want to delete. In the top-right corner, click , then click Delete directory. Review the files you will delete.

How do I delete missing files from svn?

If you are using TortoiseSVN, just do a Check for Modifications, sort by the Status column, select all the entries marked missing , right-click to open the context menu, and select Delete. Finally, commit to publish the changes to the repository.

What does svn revert do?

Reverts any local changes to a file or directory and resolves any conflicted states. svn revert will revert not only the contents of an item in your working copy, but also any property changes.


2 Answers

You could do a shallow checkout and then delete all.

Example:

svn checkout --depth immediates http://myrepo.com/svn/myrepo myworking_copy
cd myworking_copy
svn rm *
svn ci -m "Deleting all"
like image 98
Lance Rushing Avatar answered Oct 09 '22 18:10

Lance Rushing


You can svn rm a sub-path in the repos, but not the repos itself. For the future a trunk / branches / tags structure will probably fit you better.

To delete them with some bash/zsh magic:

REPO=http://myrepo.com/svn/myrepo && svn rm `svn ls $REPO | sed "s/^/$REPO\//"`

which will expand to

svn rm http://myrepo.com/svn/myrepo/file_1 http://myrepo.com/svn/myrepo/file_2 ...
like image 36
orip Avatar answered Oct 09 '22 17:10

orip