Directories are printed with a trailing slash, so if you just want directories, you could grep for that:
On May 3, 2014, at 20:13, Dan Ellis wrote:
> The svn command line list command currently accepts --depth arguments of files, infinity, and immediates (and empty, but that is really a no-op). I'm in need of being able to list directory entries only in a repository, but I'm not sure there is any good way to accomplish that as-is. I've search the lists and can only find articles about how folks have grep'ed the output or hacked list.c to only return directory entries (which is really just an inelegant grep anyways since the server still will be sending the data).
>
> Is there a way, or consideration from the developers to add a feature, to fetch only directory entries from a repo? Perhaps a --depth dirs (opposite of --depth files) option. If there is no off the shelf way and/or the developers are against (or don't see enough need) to implement this, would there be any advise on how to accomplish this with a patch? Is there in inherent limitation to the server protocol that makes a request like this simply unworkable?
You already mentioned the grep solution in your message, so I’m guessing that’s not satisfactory for some reason. If that’s true, then maybe you could explain in more detail what you need exactly, if it’s not the above.
brane@zulu:~/subversion/trunk$ grep -ir depth subversion | fgrep -v subversion/tests | wc -l
6217
Good luck with that ... :)The ‘list’ command is really only implemented at a high level, by retrieving the entries of each directory at a time and then filtering the results.
There is nothing you can do to really optimize this for directories without changing the ra layer and wire protocol for svn:// and http://.
I think it would make at least some users happy to add a ‘streamy’ list operation on the ra layer as it would optimize all the ‘svn ls’ cases, but nobody spend the time to fully implement this yet.
(I actually started an implementation of this some time ago, but never finished this as the compatibility work to support older servers was harder than I anticipated. But a lot of the missing ground work that made it that difficult back then is now implemented)
I’m not sure which Subversion client you use for your ‘svn ls’, but recently I compared an 1.6 an 1.8 client over http:// and the difference was *huge*, and 1.9 should be slightly better yet than 1.8. Perhaps just using a newer client might solve your performance problem.
Note that ‘svn ls’ was never an operation that Subversion was tuned for. Subversion works best on and between entire trees, while ‘ls’ is mostly a diagnostic tool. Some api users actually use the ‘svn status’ backend to quickly obtain a full tree of a repository in a single request in a faster way than ‘ls’
Bert