nix-prefetch-hg: if url is local file, do not make clone, but run hg archive on it

svn path=/nixpkgs/trunk/; revision=26779
This commit is contained in:
Rob Vermaas 2011-04-11 12:24:57 +00:00
parent 3756e6021a
commit d7ac5cd014

View file

@ -36,14 +36,18 @@ fi
if test -z "$finalPath"; then
tmpPath=/tmp/hg-checkout-tmp-$$
tmpClone=$tmpPath/hg-clone
tmpArchive=$tmpPath/hg-archive
mkdir $tmpPath
trap "rm -rf $tmpPath" EXIT
# Perform the checkout.
hg clone -q -y -U "$url" $tmpClone >&2
if [[ $url != /* ]]; then
tmpClone=$tmpPath/hg-clone
hg clone -q -y -U "$url" $tmpClone >&2
else
tmpClone=$url
fi
hg archive -q -y -r "$rev" --cwd $tmpClone $tmpArchive