#!/bin/sh #################################################################### # # # sync-svn-repos-now: quickly mirror an SVN repository locally. # # # # Usage: sync-svn-repos-now SOURCE_SVN_URL [LOCAL_MIRROR] # # # # If the LOCAL_MIRROR parameter is omitted, a random name # # starting with "svn-repos-local-mirror-" will be chosen. # # # # (Written by Karl Fogel in 2021, but this is so simple that # # I'm not even bothering to put a free software license on it. # # If it's useful to you, please use, improve, etc. You know # # the drill.) # # # #################################################################### SOURCE_REPOS="${1}" LOCAL_REPOS="${2}" if [ -z "${SOURCE_REPOS}" ]; then echo "ERROR: first argument must be source repository URL" >&2 exit 1 fi if [ -z "${LOCAL_REPOS}" ]; then LOCAL_REPOS=svn-repos-local-mirror-$$ echo "Using ${LOCAL_REPOS} as local mirror repository" >&2 fi svnadmin create ${LOCAL_REPOS} HOOK_FILE=${LOCAL_REPOS}/hooks/pre-revprop-change echo '#!/bin/sh' > ${HOOK_FILE} echo '' >> ${HOOK_FILE} echo 'exit 0' >> ${HOOK_FILE} chmod a+x ${HOOK_FILE} svnsync init file://`pwd`/${LOCAL_REPOS} ${SOURCE_REPOS} svnsync sync file://`pwd`/${LOCAL_REPOS}