Synchronizing SVN with an HTTPS URL

Creating a read-only mirror of a repository from a HTTPS which is in sync helps to maintain an local repo which is in sync with the global and is much faster and reliable for a group working locally.
Achieving this is pretty simple,svnsync - Subversion repository synchronization tool which makes the job easier.

The idea is pretty simple, the steps followed are :

1.Setting up a mirror repository.
2.Initialize (init) the sync.
3.Synchronizing the data.
4.Making a sync job.

Setting up a mirror repository:

#Create a mirror repository
$ svnadmin create ~/test-mirror

# add a commit hook

$ cat <<'EOF' > ~/test-mirror/hooks/pre-revprop-change
#!/bin/sh
USER="$3"
if [ "$USER" = "user-name" ]; then exit 0; fi
echo "Permission denied"
exit 1
EOF
# user-name is the desired user name

# Set permissions
$ chmod +x ~/test-mirror/hooks/pre-revprop-change

Initialize (init) the sync:

$ svnsync init --username $USER file://$HOME/test-mirror

Synchronizing the data:

svnsync --non-interactive sync file://$HOME/test-mirror

Making a sync job:

# Cron
0 2 * * * * svnsync --non-interactive sync file://$HOME/test-mirror

# immediate synchronization whenever a commit is made
Add the below lines to master-repo/hooks/post-commit

svnsync --non-interactive sync mirror-url &

# for log messages, append the following to master-repo/hooks/post-revprop-change

svnsync --non-interactive copy-revprops mirror-url ${REV} &

Share/Save

0 comments on Synchronizing SVN with an HTTPS URL

    Post new comment

    The content of this field is kept private and will not be shown publicly.
    • Web page addresses and e-mail addresses turn into links automatically.
    • Allowed HTML tags: <a> <em> <strong> <cite> <code> <ul> <ol> <li> <dl> <dt> <dd>
    • Lines and paragraphs break automatically.

    More information about formatting options


Drupal SEO