aboutsummaryrefslogtreecommitdiff
path: root/paludis/syncers/dosvn.in
diff options
context:
space:
mode:
Diffstat (limited to 'paludis/syncers/dosvn.in')
-rw-r--r--paludis/syncers/dosvn.in67
1 files changed, 67 insertions, 0 deletions
diff --git a/paludis/syncers/dosvn.in b/paludis/syncers/dosvn.in
new file mode 100644
index 000000000..a7c0ff5df
--- /dev/null
+++ b/paludis/syncers/dosvn.in
@@ -0,0 +1,67 @@
+#!/bin/bash
+
+source "${PALUDIS_EBUILD_DIR}/echo_functions.bash"
+
+for f in ${PALUDIS_BASHRC_FILES}; do
+ [[ -f "${f}" ]] && source "${f}"
+done
+
+LOCAL=
+REMOTE=
+
+SVN_CHECKOUT_OPTIONS=( )
+
+while [[ $# -gt 0 ]]; do
+ case "${1}" in
+
+ --svn-checkout-option=*)
+ SVN_CHECKOUT_OPTIONS[${#SVN_CHECKOUT_OPTIONS[@]}]="${1#*=}"
+ ;;
+
+ --help)
+ PROTO="${0##*/do}"
+ if [[ "${PROTO}" == svn ]]; then
+ echo " URL syntax: svn://[USERNAME@]SERVER/PATH"
+ elif [[ "${PROTO}" == svn+ssh ]]; then
+ echo " URL syntax: svn+ssh://[USERNAME[:PASSWORD]@]SERVER:/PATH"
+ elif [[ "${PROTO}" == svn+http || "${PROTO}" == svn+https ]]; then
+ echo " URL syntax: ${PROTO}://[USERNAME[:PASSWORD]@]SERVER[:PORT]/PATH"
+ else
+ ewarn "URL syntax for ${PROTO} is unknown. This script will likely not work with the ${PROTO} protocol"
+ fi
+ echo " Options:"
+ echo " --svn-checkout-option=OPTION Pass OPTION to svn checkout"
+ exit 0
+ ;;
+
+ --*)
+ ewarn "${0}: unknown option '${1%%=*}'"
+ ;;
+
+ *)
+ if [[ -z "${LOCAL}" ]]; then
+ LOCAL="${1}"
+ elif [[ -z "${REMOTE}" ]]; then
+ REMOTE="${1}"
+ else
+ eerror "${0}: extra argument '${1}'"
+ exit 1
+ fi
+ ;;
+
+ esac
+ shift
+done
+
+if [[ -z "${LOCAL}" ]]; then
+ eerror "${0}: unspecified local repository directory"
+ exit 1
+elif [[ -z "${REMOTE}" ]]; then
+ eerror "${0}: unspecified remote repository URL"
+ exit 1
+fi
+
+[[ "${REMOTE}" == svn+http* ]] && REMOTE="${REMOTE#svn+}"
+
+${SVN_WRAPPER} svn checkout "${SVN_CHECKOUT_OPTIONS[@]}" "${REMOTE}" "${LOCAL}/"
+