svnmirroringsvnsync

Cannot checkout code from mirror repository created using svnsync


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

Solution

  • 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 :)