annotate tests/test-url-download.t @ 35562:6580cf751418

debug: add a 'debugdownload' command This command resolve and fetch and URL through the Mercurial logic. Mercurial logic add various headers (including authentication) while resolving an URL so the commands helps with building the same request Mercurial would be doing. A new test file is created because we'll add more logic regarding Mercurial download logic and it will grow to a reasonable size.
author Boris Feld <boris.feld@octobus.net>
date Fri, 15 Dec 2017 09:30:16 +0100
parents
children cf841f2b5a72
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35562
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
1 #require serve
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
2
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
3 $ hg init server
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
4 $ hg serve -R server -p $HGPORT -d --pid-file=hg1.pid -E ../error.log
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
5 $ cat hg1.pid >> $DAEMON_PIDS
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
6
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
7 Check basic fetching
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
8
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
9 $ hg debugdownload "http://localhost:$HGPORT/?cmd=lookup&key=tip"
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
10 1 0000000000000000000000000000000000000000
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
11 $ hg debugdownload -o null.txt "http://localhost:$HGPORT/?cmd=lookup&key=null"
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
12 $ cat null.txt
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
13 1 0000000000000000000000000000000000000000
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
14
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
15 Check the request is made from the usual Mercurial logic
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
16 (rev details, give different content if the request has a Mercurial user agent)
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
17
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
18 $ get-with-headers.py --headeronly "localhost:$HGPORT" "rev/tip" content-type
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
19 200 Script output follows
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
20 content-type: text/html; charset=ascii
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
21 $ hg debugdownload "http://localhost:$HGPORT/rev/tip"
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
22
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
23 # HG changeset patch
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
24 # User
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
25 # Date 0 0
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
26 # Node ID 0000000000000000000000000000000000000000
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
27
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
28
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
29
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
30
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
31
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
32 Check other kind of compatible url
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
33
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
34 $ hg debugdownload ./null.txt
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
35 1 0000000000000000000000000000000000000000
6580cf751418 debug: add a 'debugdownload' command
Boris Feld <boris.feld@octobus.net>
parents:
diff changeset
36