Find paths with svn:external properties with certain string?
Asked Answered
N

1

5

I've a very large subversion repository, it's about 7 GB in size and holds many many files and directories from different projects.

Now I did some major change to one project structure which is actually a library and I'm using it in quite a few other projects within the same repository. Now the documentations is sparse and I don't know which project actually really used this library as external and I'd like to somehow query the subversion server/repository to return me all directories which have a certain string in the svn:export property so I can adjust them.

Ideally without checking out the whole repository, would turn out problematic due all the branches and tags.

Is that possible somehow in a smart way?

thx

Natale answered 25/2, 2011 at 14:21 Comment(0)
D
9

The quick and dirty way, if it's just a few changes, is to use svn propget with the --recursive flag to get the properties, and make the changes manually (this might take a while to return):

svn propget --recursive svn:externals http://your.svn.server/ | grep -B 5

To do this in a more automated fashion you can script it:

  • recursively retrieve svn:externals for every path in the root

  • check out directories whose externals contain the string you're looking for (you can split the path component by filesystem separator and check out each component with depth=immediate if you want to be really selective about what you check out)

  • make and commit the change

The advantage doing it this way is that because your checkout effectively mirrors your repository (even though it's missing loads of stuff) you can make a single commit at the top level with all the changes made.

HTH.

Driscoll answered 28/2, 2011 at 18:19 Comment(3)
Is it possible to limit svn propget --recursive to directories only? I've discovered (I think) that it scans files recursively as well which is a huge problem as some repositories are taking over a day to get this information (over the network)Frolick
No, I don't think it is possible. If you're feeling brave you can have a look at the svn api (it's in C but there are extensions for a number of languages). I've used it before to recursively check out all the directories in a repository to do large scale changes (like updating externals). If you've got any coding experience it's a pretty decent API.Driscoll
I think 5 here means that we want to show 5 preceding lines. but the demanded string is missing from the snippet? it should be right after 5, right?Pipage

© 2022 - 2024 — McMap. All rights reserved.