200804201629svnsync 做 svn repository 的單向備份

使用 svnsync 來做 repository mirror, 但是不能對 mirror repository 做 commit 的動作.

參考: https://www.opends.org/wiki/page/MirroringASubversionRepository


  • Create a new filesystem directory that will be used to hold the mirror, like:
$ mkdir /mirror/subversion
  • Use the svnadmin utility to create a new repository within that directory, like:
$ svnadmin create /mirror/subversion/OpenDS
  • The mirror repository must be configured to allow revision properties, and it should only allow those changes by the "svnsync" user, which can be done by creating a "hooks/pre-revprop-change" file in that repository with the execute permission set and with the following contents:

if [ "$3" = "guest" ]; then exit 0; fi

echo "Only the guest user may edit revision properties through svnsync" >&2
exit 1
  • Initialize the mirror repository using the "svnsync init" command, like:
svnsync init --username guest file:///mirror/subversion/OpenDS https://opends.dev.java.net/svn/opends
  • Use the "svnsync sync" command to populate the mirror repository, like:
svnsync sync file:///mirror/subversion/OpenDS
  • To keep the mirror up to date, periodically re-issue the above "svnsync sync" command (e.g., using a cron job).

See http://svn.collab.net/repos/svn/trunk/notes/svnsync.txt for more information on the svnsync utility.


Powered by Xuite