views:

1456

answers:

7

Hi everyone, is there a way to perform a SVN checkout (or export), which would fetch only the directory structure, i.e. no files?

Thanks in a advance.

A: 

I can't see that there is a way to do it from a brief look at svn help co. Something I've done before for updating a repository from a new version of a downloaded library (i.e. a vendor branch) is to delete everything which isn't an .svn folder:

#!/bin/sh
find ./ -type f | grep -v .svn | xargs rm -f

It's not particularly efficient if you were trying to avoid having to check those files out in the first place, but it should have the same result.

Mike Houston
I hope no one run by mistake this command as root on / ;-)
FerranB
If you just want the tree without the .svn directories use svn export instead of svn co.
jblocksom
@FerranB definitely!
Mike Houston
+3  A: 

SVN can't do that per se, but if you just want to export directory structure, try svn ls -R --xml to get XML listing of the directory structure and then recreate it by hand.

Anton Gogolev
A: 

There's no way to do this, and in fact it's a slightly odd thing to want to do, so now I'm curious!

This may not be relevant, but you can prevent the files being comitted in the first place by adding an svn:ignore property on the relevant directories. This is particularly useful to prevent generated artifacts such as documentation or cache files being comitted.

12345
I want to replicate the repository directory structure on my local drive and then do further processing using other tools (NAnt/MSBuild). svn:ignore is not relevant.
petr k.
+3  A: 

There is a python script in the contrib tools of subversion (http://svn.collab.net/repos/svn/trunk/contrib/client-side/svn_export_empty_files.py), which creates the directory structure with empty files. With a little bit of python knowledge, it should not be to hard to skip creating the files at all.

jor
+4  A: 

svn ls -R {svnrepo} | grep "/$" | xargs -n 1 mkdir -p

Export, not a checkout.

[Updated]

With Export:

env REPO={repo} sh -c 'svn ls -R $REPO | grep "/\$" | xargs -n 1 svn co --depth=empty $REPO'

This will be pretty slow for anything too large.

Dave Stenglein
A: 

You can specify --non-recursive to the checkout command, might help you to get what you want.

A: 

Hi,

I ve got the same problem I want to replicate the repository directory structure too. requisites: i don't want to execute a svn export because i don't want the whole of the repository structure. (I have the paths of the files that i want to extract.)

Did you get an easy way to do it ?

I am going to make a tcl script.

Any suggestions ? Thanks in advance.

Julia

julia2020
Is there a solution with ant ?
julia2020