On Apr 19, 2010, at 17:39, Ryan Schmidt wrote:
> On Apr 19, 2010, at 17:04, Omar Ousmane Kadry wrote:
>
>> Not sure if it is the right place for this but I’m looking for a way to imitate the cvs behavior when checking out folders.
>> In cvs:
>> cvs co mod1/dir1/dir2/file2
>> will result in having:
>> mod1/dir1/dir2/file2
>>
>> How can I obtain this hierarchical checkout with SVN?
>
> There isn't anything built into Subversion to do that. You'll have to make the directories yourself, for example using "mkdir -p".
Here's a quick unix script "svnco" I wrote which you could use instead of "svn co" to do this. There's no error checking, no handling of special characters (i.e. those that would be percent-encoded in URLs), and maybe other issues, but it shows how it can be done.
$ cat /path/to/svnco
#!/bin/bash
URL="$1"
MKDIR=mkdir
SED=sed
SVN=svn
REPO_ROOT=$($SVN info "$URL" | $SED -n "s|^Repository Root: ||p")
PATH_IN_REPO=$(echo "$URL" | $SED "s|^$REPO_ROOT/||")
$MKDIR -p "$PATH_IN_REPO"
$SVN co "$URL" "$PATH_IN_REPO"
$ mkdir test
$ cd test
$ /path/to/svnco http://svn.macosforge.org/repository/macports/trunk/dports/devel/subversion
A trunk/dports/devel/subversion/files
A trunk/dports/devel/subversion/files/patch-path.c.diff
A trunk/dports/devel/subversion/files/patch-Makefile.in.diff
A trunk/dports/devel/subversion/Portfile
Checked out revision 66676.
$ find .
.
./trunk
./trunk/dports
./trunk/dports/devel
./trunk/dports/devel/subversion
./trunk/dports/devel/subversion/.svn
./trunk/dports/devel/subversion/.svn/all-wcprops
./trunk/dports/devel/subversion/.svn/entries
./trunk/dports/devel/subversion/.svn/prop-base
./trunk/dports/devel/subversion/.svn/prop-base/Portfile.svn-base
./trunk/dports/devel/subversion/.svn/props
./trunk/dports/devel/subversion/.svn/text-base
./trunk/dports/devel/subversion/.svn/text-base/Portfile.svn-base
./trunk/dports/devel/subversion/.svn/tmp
./trunk/dports/devel/subversion/.svn/tmp/prop-base
./trunk/dports/devel/subversion/.svn/tmp/props
./trunk/dports/devel/subversion/.svn/tmp/text-base
./trunk/dports/devel/subversion/files
./trunk/dports/devel/subversion/files/.svn
./trunk/dports/devel/subversion/files/.svn/all-wcprops
./trunk/dports/devel/subversion/files/.svn/entries
./trunk/dports/devel/subversion/files/.svn/prop-base
./trunk/dports/devel/subversion/files/.svn/props
./trunk/dports/devel/subversion/files/.svn/text-base
./trunk/dports/devel/subversion/files/.svn/text-base/patch-Makefile.in.diff.svn-base
./trunk/dports/devel/subversion/files/.svn/text-base/patch-path.c.diff.svn-base
./trunk/dports/devel/subversion/files/.svn/tmp
./trunk/dports/devel/subversion/files/.svn/tmp/prop-base
./trunk/dports/devel/subversion/files/.svn/tmp/props
./trunk/dports/devel/subversion/files/.svn/tmp/text-base
./trunk/dports/devel/subversion/files/patch-Makefile.in.diff
./trunk/dports/devel/subversion/files/patch-path.c.diff
./trunk/dports/devel/subversion/Portfile
$
Received on 2010-04-20 00:50:56 CEST