|
|
@@ -21,6 +21,25 @@ function mirrorGit() { |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
# Creates a local mirror of specified HG repository |
|
|
|
# Parameters: %dest_directory% %address% [%username%] |
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
function mirrorMercurial() { |
|
|
|
local DIRECTORY="${1}" |
|
|
|
local ADDRESS="${2}" |
|
|
|
local USER="${3:-root}" |
|
|
|
if [ -d ${DIRECTORY} ]; then |
|
|
|
cd ${DIRECTORY} |
|
|
|
run "su ${USER} -s \"/bin/sh\" -c \"hg pull --update -e \ |
|
|
|
${BINDIR}/ssh_wrapper.sh\"" || return 1 |
|
|
|
else |
|
|
|
run "su ${USER} -s \"/bin/sh\" -c \"hg clone ${ADDRESS} ${DIRECTORY} \ |
|
|
|
-e ${BINDIR}/ssh_wrapper.sh\"" || return 1 |
|
|
|
fi |
|
|
|
return 0 |
|
|
|
} |
|
|
|
|
|
|
|
#------------------------------------------------------------------------------- |
|
|
|
# Creates a local mirror of specified repository regardless its protocol |
|
|
|
# Parameters: %dest_directory% %protocol% %address% [%username%] |
|
|
@@ -30,6 +49,9 @@ function mirrorRepository() { |
|
|
|
[Gg][Ii][Tt]) |
|
|
|
mirrorGit "${1}" "${3}" "${4}" && return 0 |
|
|
|
;; |
|
|
|
[Hh][Gg]) |
|
|
|
mirrorMercurial "${1}" "${3}" "${4}" && return 0 |
|
|
|
;; |
|
|
|
[Rr][Ss][Yy][Nn][Cc]) |
|
|
|
mirrorRsync "${1}" "${3}" "${4}" && return 0 |
|
|
|
;; |