allow pushing changes back to mercurial repositories through ssh
This commit is contained in:
parent
3ceca3f3f7
commit
c94a0d9036
|
@ -52,9 +52,10 @@ function pullMercurial() {
|
||||||
run "hg recover"
|
run "hg recover"
|
||||||
run "hg revert -aC" || return 1
|
run "hg revert -aC" || return 1
|
||||||
run "hg purge" || 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
|
else
|
||||||
run "hg clone ${ADDRESS} ${DIRECTORY}" || return 1
|
run "hg clone ${ADDRESS} ${DIRECTORY} -e ${BINDIR}/ssh_wrapper.sh" \
|
||||||
|
|| return 1
|
||||||
if [ ${BRANCH} != "default" ]; then
|
if [ ${BRANCH} != "default" ]; then
|
||||||
run "hg branch ${BRANCH}" || return 1
|
run "hg branch ${BRANCH}" || return 1
|
||||||
fi
|
fi
|
||||||
|
@ -144,6 +145,21 @@ function pushGit() {
|
||||||
return 0
|
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
|
# Sends an update to specified remote repository regardless its protocol
|
||||||
# Parameters: %directory% %protocol% %message%
|
# Parameters: %directory% %protocol% %message%
|
||||||
|
@ -153,6 +169,9 @@ function pushRepository() {
|
||||||
[Gg][Ii][Tt])
|
[Gg][Ii][Tt])
|
||||||
pushGit "${1}" "${3}" && return 0
|
pushGit "${1}" "${3}" && return 0
|
||||||
;;
|
;;
|
||||||
|
[Hh][Gg])
|
||||||
|
pushMercurial "${1}" "${3}" && return 0
|
||||||
|
;;
|
||||||
*)
|
*)
|
||||||
printWarn "Tried to push data using unsupported protocol (${2})!"
|
printWarn "Tried to push data using unsupported protocol (${2})!"
|
||||||
;;
|
;;
|
||||||
|
|
Loading…
Reference in New Issue