[pacman-dev] [PATCH 3/4] makepkg: hg: update existing sources in srcdir without removing them first.

Allan McRae allan at archlinux.org
Sun Nov 9 08:19:43 UTC 2014


On 10/12/13 06:31, Lukáš Jirkovský wrote:
> The local changes are discarded when updating. This matches the behaviour
> when non-VCS sources are used. It also allows incremental builds.
> 
> Signed-off-by: Lukáš Jirkovský <l.jirkovsky at gmail.com>
> ---

I can not find any evidence of hg pull having a -C flag.


>  scripts/makepkg.sh.in | 14 ++++++++++----
>  1 file changed, 10 insertions(+), 4 deletions(-)
> 
> diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
> index 84183b0..1421bec 100644
> --- a/scripts/makepkg.sh.in
> +++ b/scripts/makepkg.sh.in
> @@ -663,13 +663,12 @@ extract_hg() {
>  
>  	msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg"
>  	pushd "$srcdir" &>/dev/null
> -	rm -rf "${dir##*/}"
>  
> -	local ref
> +	local ref=tip
>  	if [[ -n $fragment ]]; then
>  		case ${fragment%%=*} in
>  			branch|revision|tag)
> -				ref=('-u' "${fragment##*=}")
> +				ref="${fragment##*=}"
>  				;;
>  			*)
>  				error "$(gettext "Unrecognized reference: %s")" "${fragment}"
> @@ -678,7 +677,14 @@ extract_hg() {
>  		esac
>  	fi
>  
> -	if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then
> +	if [[ -d "${dir##*/}" ]]; then
> +		cd_safe "${dir##*/}"
> +		if ! (hg pull && hg update -C -r "$ref"); then
> +			error "$(gettext "Failure while updating working copy of %s %s repo")" "${repo}" "hg"
> +			plain "$(gettext "Aborting...")"
> +			exit 1
> +		fi
> +	elif ! hg clone -u "$ref" "$dir" "${dir##*/}"; then
>  		error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg"
>  		plain "$(gettext "Aborting...")"
>  		exit 1
> 


More information about the pacman-dev mailing list