Debian Codegraph @

tests/test-url-download.t

raw
1 #require serve
2
3 $ hg init server
4 $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E ../error.log
5 $ cat hg1.pid >> $DAEMON_PIDS
6
7 Check basic fetching
8
9 $ hg debugdownload "http://localhost:$HGPORT/?cmd=lookup&key=tip"
10 1 0000000000000000000000000000000000000000
11 $ hg debugdownload -o null.txt "http://localhost:$HGPORT/?cmd=lookup&key=null"
12 $ cat null.txt
13 1 0000000000000000000000000000000000000000
14
15 Check the request is made from the usual Mercurial logic
16 (rev details, give different content if the request has a Mercurial user agent)
17
18 $ get-with-headers.py --headeronly "localhost:$HGPORT" "rev/tip" content-type
19 200 Script output follows
20 content-type: text/html; charset=ascii
21 $ hg debugdownload "http://localhost:$HGPORT/rev/tip"
22
23 # HG changeset patch
24 # User
25 # Date 0 0
26 # Node ID 0000000000000000000000000000000000000000
27
28
29
30
31
32 Check other kind of compatible url
33
34 $ hg debugdownload ./null.txt
35 1 0000000000000000000000000000000000000000
36
37 $ cat ../error.log
38
39 Test largefile URL
40 ------------------
41
42 $ cat << EOF >> $HGRCPATH
43 > [extensions]
44 > largefiles=
45 > EOF
46
47 $ killdaemons.py
48 $ rm -f error.log hg1.pid
49 $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E error.log
50 $ cat hg1.pid >> $DAEMON_PIDS
51
52 $ hg -R server debuglfput null.txt
53 a57b57b39ee4dc3da1e03526596007f480ecdbe8
54
55 $ hg debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8" --config paths.default=http://localhost:$HGPORT/
56 1 0000000000000000000000000000000000000000
57
58 from within a repository
59
60 $ hg clone http://localhost:$HGPORT/ client
61 no changes found
62 updating to branch default
63 0 files updated, 0 files merged, 0 files removed, 0 files unresolved
64
65 $ cd client
66 $ hg path
67 default = http://localhost:$HGPORT/
68 $ hg debugdownload "largefile://a57b57b39ee4dc3da1e03526596007f480ecdbe8"
69 1 0000000000000000000000000000000000000000
70 $ cd ..
71
72 $ cat error.log