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} &
About Hemanth HM
Hemanth HM is a Sr. Machine Learning Manager at PayPal, Google Developer Expert, TC39 delegate, FOSS advocate, and community leader with a passion for programming, AI, and open-source contributions.