allow pushing changes back to mercurial repositories through ssh

This commit is contained in:
belliash 2012-01-16 20:26:57 +01:00
부모 3ceca3f3f7
커밋 c94a0d9036
1개의 변경된 파일21개의 추가작업 그리고 2개의 파일을 삭제

파일 보기

@ -52,9 +52,10 @@ function pullMercurial() {
run "hg recover"
run "hg revert -aC" || return 1
run "hg purge" || return 1
run "hg pull --update" || return 1
run "hg pull --update -e ${BINDIR}/ssh_wrapper.sh" || return 1
else
run "hg clone ${ADDRESS} ${DIRECTORY}" || return 1
run "hg clone ${ADDRESS} ${DIRECTORY} -e ${BINDIR}/ssh_wrapper.sh" \
|| return 1
if [ ${BRANCH} != "default" ]; then
run "hg branch ${BRANCH}" || return 1
fi
@ -144,6 +145,21 @@ function pushGit() {
return 0
}
function pushMercurial() {
local DIRECTORY="${1}"
local MESSAGE="${2}"
local STATUS
[ ! -d ${DIRECTORY} ] && return 1
cd ${DIRECTORY}
run "hg add ." || return 1
STATUS=$(hg status)
if [ "${STATUS}" != "" ]; then
run "hg commit -A -m ${MESSAGE}" || return 1
run "hg push -e ${BINDIR}/ssh_wrapper.sh" || return 1
fi
return 0
}
#-------------------------------------------------------------------------------
# Sends an update to specified remote repository regardless its protocol
# Parameters: %directory% %protocol% %message%
@ -153,6 +169,9 @@ function pushRepository() {
[Gg][Ii][Tt])
pushGit "${1}" "${3}" && return 0
;;
[Hh][Gg])
pushMercurial "${1}" "${3}" && return 0
;;
*)
printWarn "Tried to push data using unsupported protocol (${2})!"
;;