about summary refs log tree commit diff
path: root/tests/fetchMercurial.sh
diff options
context:
space:
mode:
Diffstat (limited to 'tests/fetchMercurial.sh')
-rw-r--r--tests/fetchMercurial.sh13
1 files changed, 11 insertions, 2 deletions
diff --git a/tests/fetchMercurial.sh b/tests/fetchMercurial.sh
index 0c9f4bdbbc87..4088dbd39796 100644
--- a/tests/fetchMercurial.sh
+++ b/tests/fetchMercurial.sh
@@ -2,7 +2,7 @@ source common.sh
 
 if [[ -z $(type -p hg) ]]; then
     echo "Mercurial not installed; skipping Mercurial tests"
-    exit 0
+    exit 99
 fi
 
 clearStore
@@ -16,7 +16,8 @@ echo '[ui]' >> $repo/.hg/hgrc
 echo 'username = Foobar <foobar@example.org>' >> $repo/.hg/hgrc
 
 echo utrecht > $repo/hello
-hg add --cwd $repo hello
+touch $repo/.hgignore
+hg add --cwd $repo hello .hgignore
 hg commit --cwd $repo -m 'Bla1'
 rev1=$(hg log --cwd $repo -r tip --template '{node}')
 
@@ -28,10 +29,17 @@ rev2=$(hg log --cwd $repo -r tip --template '{node}')
 path=$(nix eval --raw "(builtins.fetchMercurial file://$repo).outPath")
 [[ $(cat $path/hello) = world ]]
 
+# In pure eval mode, fetchGit without a revision should fail.
+[[ $(nix eval --raw "(builtins.readFile (fetchMercurial file://$repo + \"/hello\"))") = world ]]
+(! nix eval --pure-eval --raw "(builtins.readFile (fetchMercurial file://$repo + \"/hello\"))")
+
 # Fetch using an explicit revision hash.
 path2=$(nix eval --raw "(builtins.fetchMercurial { url = file://$repo; rev = \"$rev2\"; }).outPath")
 [[ $path = $path2 ]]
 
+# In pure eval mode, fetchGit with a revision should succeed.
+[[ $(nix eval --pure-eval --raw "(builtins.readFile (fetchMercurial { url = file://$repo; rev = \"$rev2\"; } + \"/hello\"))") = world ]]
+
 # Fetch again. This should be cached.
 mv $repo ${repo}-tmp
 path2=$(nix eval --raw "(builtins.fetchMercurial file://$repo).outPath")
@@ -69,6 +77,7 @@ path2=$(nix eval --raw "(builtins.fetchMercurial $repo).outPath")
 [ ! -e $path2/hello ]
 [ ! -e $path2/bar ]
 [ ! -e $path2/dir2/bar ]
+[ ! -e $path2/.hg ]
 [[ $(cat $path2/dir1/foo) = foo ]]
 
 [[ $(nix eval --raw "(builtins.fetchMercurial $repo).rev") = 0000000000000000000000000000000000000000 ]]