Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is there a way to use wildcard delete with command-line SVN?

Tags:

svn

wildcard

In the tags/ directory of my SVN repo, I have something like:

TAG_BUILD_001
TAG_BUILD_002
TAG_BUILD_003
TAG_BUILD_004
...
TAG_BUILD_100
TAG_BUILD_101
...

Is there a way to delete, say, everything from BUILD_001 to BUILD_099 quickly?

I tried:

svn rm https://host/module/tags/TAG_BUILD_0*

but that doesn't seem to work and I got the following error:

svn: URL 'https://host/module/tags/TAG_BUILD_0*' non-existent in that revision
like image 930
ryanprayogo Avatar asked May 04 '11 21:05

ryanprayogo


2 Answers

Actually, svn delete does take wildcards, but only if you're doing a local delete and not through a URL. The solution is to do a checkout of the tags directory, then delete the tags.

Now, normally, doing this would require gobs of time and multiple gigabytes of space since each tag would represent a revision of your entire project. If each tag is 100 megabytes in size, your checkout would be 10 Gigabytes.

However, the svn co command now takes the --depth parameter:

$ svn checkout --depth immediates https://host/module/tags svn-tags

Now, you'll checkout all of the tags, but none of their contents. That takes only a few minutes to checkout and almost no room on your computer since these are all empty directories. Now, you can use:

$ cd svn-tags
$ svn rm TAG_BUILD_00*
$ svn commit -m"Removed tags 000 through 099"

And, best of all, it's all done in a single revision.

like image 128
David W. Avatar answered Sep 27 '22 22:09

David W.


Use the shell:

for i in $(seq -w 1 13)
do
  echo "https://host/module/tags/TAG_BUILD_$i"
done

Run it and take a look at the commands you generated. If you're sure this is really what you want to do, pipe the output to bash.

like image 20
Lumi Avatar answered Sep 27 '22 22:09

Lumi