Unverified Commit c352064f authored by Sandro Jäckel's avatar Sandro Jäckel Committed by GitHub
Browse files

fetchdarcs: add {pre,post}Fetch hooks (#469215)

parents f1fa2cd9 dfa916a6
Loading
Loading
Loading
Loading
+11 −3
Original line number Diff line number Diff line
runHook preFetch

tagtext=""
tagflags=""
# Darcs hashes are sha1 (120 bits, 40-character hex)
@@ -15,16 +17,22 @@ fi
# Repository list may contain ?. No glob expansion for that.
set -o noglob

success=
for repository in $repositories; do
    echo "Trying to clone $repository $tagtext into $out …"
    if darcs clone --lazy $tagflags "$repository" "$out"; then
        # remove metadata, because it can change
        rm -rf "$out/_darcs"
        exit 0
        success=1
        break
    fi
done

set +o noglob

if [ -z "$success" ]; then
    echo "Error: couldn’t clone repository from any mirror" 1>&2
    exit 1
fi

runHook postFetch