From e1ea0e745fbd2b2aaf9ff373c75f61be740d76db Mon Sep 17 00:00:00 2001 From: Naoya Inada Date: Sat, 17 Jan 2015 12:13:50 +0900 Subject: [PATCH] Change Go source repository to git --- scripts/completion | 2 +- scripts/env/use | 2 +- scripts/gvm-check | 6 +++--- scripts/install | 14 +++++++------- scripts/listall | 2 +- scripts/update | 2 +- 6 files changed, 14 insertions(+), 14 deletions(-) diff --git a/scripts/completion b/scripts/completion index 396be4b..ae5e572 100644 --- a/scripts/completion +++ b/scripts/completion @@ -58,7 +58,7 @@ _gvm() install) [ ! -d $GVM_ROOT/archive/go ] && return 1 [[ $COMP_CWORD > 2 ]] && return 1 - local version="$(for x in `hg tags -R $GVM_ROOT/archive/go | awk '{print $1}' | $GREP_PATH -E "release|tip|go"`; do echo ${x} ; done )" + local version="$(cd $GVM_ROOT/archive/go && for x in `git tag | $GREP_PATH -E "release|tip|go"`; do echo ${x} ; done )" COMPREPLY=( $(compgen -W "${version}" -- ${cur}) ) return 0 ;; diff --git a/scripts/env/use b/scripts/env/use index 417f732..c58ed66 100644 --- a/scripts/env/use +++ b/scripts/env/use @@ -6,7 +6,7 @@ function gvm_use() { fuzzy_match=$($LS_PATH "$GVM_ROOT/gos" | $SORT_PATH | $GREP_PATH "$1" | $HEAD_PATH -n 1 | $GREP_PATH "$1") if [[ "$?" != "0" ]]; then GO_CACHE_PATH=$GVM_ROOT/archive/go - version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH "$VERSION") + version=$(cd "$GO_CACHE_PATH" && git tag -l "$VERSION") if [[ "x$version" == "x" ]]; then display_error "Version not found locally. Try 'gvm install $1'" || return 1 else diff --git a/scripts/gvm-check b/scripts/gvm-check index ad9fc9d..c6d0673 100755 --- a/scripts/gvm-check +++ b/scripts/gvm-check @@ -3,10 +3,10 @@ error_message="" -# Check for hg -which hg &> /dev/null || +# Check for git +which git &> /dev/null || error_message="${error_message} -Could not find mercurial +Could not find git linux: apt-get install mercurial mac: brew install mercurial diff --git a/scripts/install b/scripts/install index 206b970..5206265 100755 --- a/scripts/install +++ b/scripts/install @@ -21,7 +21,7 @@ read_command_line() { show_usage exit 1 fi - GO_SOURCE_URL=https://go.googlecode.com/hg/ + GO_SOURCE_URL=https://go.googlesource.com/go for i in "$@"; do case $i in -s=*|--source=*) @@ -59,22 +59,22 @@ download_source() { GO_CACHE_PATH=$GVM_ROOT/archive/go [[ -d $GO_CACHE_PATH ]] && return display_message "Downloading Go source..." - hg clone "$GO_SOURCE_URL" "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 || + git clone "$GO_SOURCE_URL" "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 || display_fatal "Couldn't download Go source. Check the logs $GVM_ROOT/logs/go-download.log" } check_tag() { - version=$(hg tags -R "$GO_CACHE_PATH" | awk '{print $1}' | $SORT_PATH | $GREP_PATH "$VERSION" | $HEAD_PATH -n 1 | $GREP_PATH -w "$VERSION") + version=$(cd "$GO_CACHE_PATH" && git tag -l "$VERSION") } update_source() { display_message "Updating Go source..." - hg pull -R "$GO_CACHE_PATH" >> "$GVM_ROOT/logs/go-download.log" 2>&1 || - display_fatal "Couldn't get latest Go version info. Check the logs $GVM_ROOT/logs/go-download.log" + (cd "$GO_CACHE_PATH" && git pull >> "$GVM_ROOT/logs/go-download.log" 2>&1 || + display_fatal "Couldn't get latest Go version info. Check the logs $GVM_ROOT/logs/go-download.log") } copy_source() { - hg clone -u "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 || + git clone -b "$version" "$GO_CACHE_PATH" "$GO_INSTALL_ROOT" >> "$GVM_ROOT/logs/go-$GO_NAME-install.log" 2>&1 || display_fatal "Couldn't copy source to target folder. Check the logs $GVM_ROOT/logs/go-$GO_NAME-install.log" } @@ -285,7 +285,7 @@ install_from_source() { which goinstall &> /dev/null || GVM_GOINSTALL="go get" - x="$(hg tags -R "$GO_CACHE_PATH")"; echo "${x#*b0819469a6df}" | $GREP_PATH "$version " &> /dev/null + x="$(cd "$GO_CACHE_PATH" && git tag)"; echo "${x#*b0819469a6df}" | $GREP_PATH "$version " &> /dev/null if [[ "$?" == "1" ]]; then if [[ "$INSTALL_BUILD_TOOLS" == "true" ]]; then install_gb || display_warning "Failed to install gb" diff --git a/scripts/listall b/scripts/listall index 5a8c94d..6e7c634 100755 --- a/scripts/listall +++ b/scripts/listall @@ -32,7 +32,7 @@ read_command_line "$@" echo display_message "gvm gos (available)" echo -versions=$(curl -s https://go.googlecode.com/hg/.hgtags | awk '{ print $2 }' | $SORT_PATH) +versions=$(git ls-remote -t https://go.googlesource.com/go | awk -F/ '{ print $NF }' | $SORT_PATH) if [[ $? -ne 0 ]]; then display_fatal "Failed to get version list from Google" fi diff --git a/scripts/update b/scripts/update index f32d2d3..cd7cb0d 100755 --- a/scripts/update +++ b/scripts/update @@ -4,5 +4,5 @@ cd "$GVM_ROOT/archive/go" &> /dev/null || display_fatal "Failed to find local Go source" -hg pull || display_fatal "Failed to update" +git pull || display_fatal "Failed to update"