0

I'm trying to create a mirror repository of an online svn repository, so i can have the source code with the ability to synchronize the changes on the online repo. and start to checkout the code from the mirror repo. to make changes on it.

After doing the steps using svnsync and after i did actually my first svnsync sync command, no source code have been copied to the mirror repo.

Am i misunderstanding the use of svnsync or i'm misunderstanding all the svn mirroring mechanism? How can i checkout the code from the mirror repo. and start to working on it?

Note I did the following to create a mirror svn repo.

$ svnadmin create dest
$ cat <<'EOF' > dest/hooks/pre-revprop-change
#!/bin/sh
USER="$3"

if [ "$USER" = "svnsync" ]; then exit 0; fi

echo "Only the svnsync user can change revprops" >&2
exit 1
EOF

$ chmod +x dest/hooks/pre-revprop-change
$ svnsync init --username svnsync file://`pwd`/dest http://thesource/source/repos
$ svnsync sync file://`pwd`/dest
Ahmed Adel
  • 66
  • 8

2 Answers2

0

Ahmed,

I suggest not to treat svn repositories like git where you can push/pull commits back and forth.

If dealing with a local offline mirror is a must then git-svn is a solution here but learn it carefully first.

Maher Gamal
  • 96
  • 2
  • 3
  • I'm now trying to clone the repo. using `git-svn` but the problem is in my company's internal infrastructure and they need this on SVN not GIT Thank you Maher for your help – Ahmed Adel Nov 09 '14 at 15:42
  • Do you need to maintain the public repository's history in your local mirror? Or could you do a full reimport to everything as a sort og a snapshot? – Maher Gamal Nov 09 '14 at 16:59
  • I need to keep up with the public repository's commits, but i don't care about old history – Ahmed Adel Nov 10 '14 at 09:08
  • A decent cron job should do the job of exporting the public repository and importing it as a snapshot internally. – Maher Gamal Nov 10 '14 at 10:24
  • JAK Maher for your interest :) – Ahmed Adel Nov 10 '14 at 11:14
0

I found out the missing step in the steps to create a mirror using svnsync. As described in the following blog post and the second comment in the post the problem solved by dumping the public repository using the following command:

$ svnrdump dump http://sourceRepo/svn/repo > /tmp/sourceDump

we can optionally use -rX or -rX:Y to dump a specific revision or a revision range. After that we start to create the mirror repository using the following command:

$ svnadmin create destRepo
$ cat <<'EOF' > /pathToCreatedRepo/destRepo/hooks/pre-revprop-change
#!/bin/sh
USER="$3"

if [ "$USER" = "svnsync" ]; then exit 0; fi

echo "Only the svnsync user can change revprops" >&2
exit 1
EOF

$ chmod +x /pathToCreatedRepo/destRepo/hooks/pre-revprop-change

after that we need to import the dump file into the new destRepo using the following command

$ svnadmin load /pathToCreatedRepo/destRepo < /tmp/sourceDump

we now will do the synchronization initialization using the following command:

$ svnsync initialize --allow-non-empty file:///pathToCreatedRepo/destRepo http://sourceRepo/svn/repo

Note we must here add the argument --allow-non-empty to make SVN able to sync over the existing dump loaded previously. We can now do an ordinary sync call on the new destRepo

$ svnsync sync file:///pathToCreatedRepo/destRepo

I'm now able to checkout code from the mirror repository :)

Ahmed Adel
  • 66
  • 8