add missing mercurial support

This commit is contained in:
belliash 2012-01-16 19:18:46 +01:00
parent 02be069fee
commit 76c56cbd8a
2 changed files with 29 additions and 2 deletions

View File

@ -16,7 +16,7 @@ MODULES_POSTCOMMIT=""
# These options specify the build Portage tree, which all the changes are made to, as well
# as a mainline Portage tree, which the major updates come from. Ordered parameters are:
# portage name = name of Portage tree (eg. gentoo-portage)
# sync protocol = protocol being used by repository (git, rsync, svn)
# sync protocol = protocol being used by repository (git, hg, rsync, svn)
# remote address = the remote repository address to clone from and send commits to
# optional branch = in a non-bare repository, this is the branch that will be fetched
# NOTE: Not every protocol can be used for building Portage tree!
@ -26,7 +26,7 @@ PORTAGE_MAINLINE=( "mainline-portage" "rsync" "rsync://rsync.mydomain.org/mainli
# These defines the overlays that might be used later in a synchronization process.
# Ordered parameters are:
# overlay name = the overlay name (eg. regen2-overlay)
# protocol used = protocol being used by repository (git, rsync, svn)
# protocol used = protocol being used by repository (git, hg, rsync, svn)
# remote address = the remote repository address to clone from and send commits to
# optional branch = in a non-bare repository, this is the branch that will be fetched
# files to copy = comma separated list of packages to merge, or ALL to merge every

View File

@ -39,6 +39,30 @@ function pullGit() {
return 0
}
#-------------------------------------------------------------------------------
# Downloads or updates specified HG repository
# Parameters: %dest_directory% %address% [%branch%]
#-------------------------------------------------------------------------------
function pullMercurial() {
local DIRECTORY="${1}"
local ADDRESS="${2}"
local BRANCH="${3:-default}"
if [ -d ${DIRECTORY} ]; then
cd ${DIRECTORY}
run "hg recover"
run "hg revert -aC" || return 1
run "hg purge" || return 1
run "hg pull" || return 1
else
run "hg clone ${ADDRESS} ${DIRECTORY}" || return 1
if [ ${BRANCH} != "default" ]; then
run "hg branch ${BRANCH}" || return 1
fi
echo -e "\n[extensions]\nhgext.purge=" >> ${DIRECTORY}/.hg/hgrc
fi
return 0
}
#-------------------------------------------------------------------------------
# Synchronizes specified repository regardless its protocol
# Parameters: %dest_directory% %protocol% %address% [%branch%]
@ -49,6 +73,9 @@ function pullRepository() {
[Gg][Ii][Tt])
pullGit "${1}" "${3}" "${4}" && return 0
;;
[Hh][Gg])
pullMercurial "${1}" "${3}" "${4}" && return 0
;;
[Rr][Ss][Yy][Nn][Cc])
pullRsync "${1}" "${3}" && return 0
;;