Skip to content

Instantly share code, notes, and snippets.

@meejah
Created June 3, 2013 20:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save meejah/5701088 to your computer and use it in GitHub Desktop.
Save meejah/5701088 to your computer and use it in GitHub Desktop.
Create a SVN repository that has @NNN branches when using "git svn clone"
#!/bin/bash
## create @nnn branches by simulating a re-organization on the server
mkdir /tmp/svnplay
pushd /tmp/svnplay
svnadmin create svnrepo
mkdir svninit
mkdir svninit/foo
mkdir svninit/foo/trunk
mkdir svninit/foo/branches
mkdir svninit/foo/tags
svn import -m "initial import" svninit file:///tmp/svnplay/svnrepo
rm -rf svninit
svn co file:///tmp/svnplay/svnrepo/foo/trunk working
cd working
cat <<EOF > foo.txt
foo
EOF
svn add foo.txt
svn ci -m c4
svn cp -m c5 file:///tmp/svnplay/svnrepo/foo/trunk file:///tmp/svnplay/svnrepo/foo/branches/branch0
svn switch file:///tmp/svnplay/svnrepo/foo/branches/branch0
cat <<EOF > foo.txt
foo
bar
EOF
svn ci -m c6
svn swich file:///tmp/svnplay/svnrepo/foo/trunk
cat <<EOF > foo.txt
foo
bazquux
EOF
svn ci -m c7
svn mv -m c8 file:///tmp/svnplay/svnrepo/foo/trunk file:///tmp/svnplay/svnrepo/trunk
svn mv -m c9 file:///tmp/svnplay/svnrepo/foo/branches file:///tmp/svnplay/svnrepo/branches
svn mv -m c10 file:///tmp/svnplay/svnrepo/foo/tags file:///tmp/svnplay/svnrepo/tags
svn rm -m c11 file:///tmp/svnplay/svnrepo/trunk
svn cp -m c12 file:///tmp/svnplay/svnrepo/branches/branch0 file:///tmp/svnplay/svnrepo/trunk
svn switch file:///tmp/svnplay/svnrepo/trunk
cat <<EOF > foo.txt
mike wuz here
EOF
svn ci -m c10
cd /tmp/svnplay
git svn clone --stdlayout --prefix=svn/ file:///tmp/svnplay/svnrepo gs
cd gs
git branch -a
popd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment