Ver código fonte

allow pushing changes back to mercurial repositories through ssh

master
belliash 8 anos atrás
pai
commit
c94a0d9036
1 arquivos alterados com 21 adições e 2 exclusões
  1. +21
    -2
      libraries/repositories

+ 21
- 2
libraries/repositories Ver arquivo

@@ -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})!"
;;


Carregando…
Cancelar
Salvar