Mercurial > hg-stable
changeset 14048:58e58406ed19
wireproto: add test for new optional arg missing on server
New argument is silently ignored by both HTTP and SSH servers.
This means we can, for instance, add new flags to getbundle()
to request advanced features (like lightweight-copy-aware bundles),
and older servers will silently ignore this request and send back
a plain bundle.
author | Peter Arrenbrecht <peter.arrenbrecht@gmail.com> |
---|---|
date | Fri, 29 Apr 2011 14:54:01 +0200 |
parents | 30ccb7d03864 |
children | 92db9667d15a |
files | mercurial/commands.py mercurial/localrepo.py mercurial/wireproto.py tests/test-wireproto.t |
diffstat | 4 files changed, 22 insertions(+), 12 deletions(-) [+] |
line wrap: on
line diff
--- a/mercurial/commands.py Sat Apr 30 02:42:05 2011 -0500 +++ b/mercurial/commands.py Fri Apr 29 14:54:01 2011 +0200 @@ -4558,6 +4558,7 @@ (debugwireargs, [('', 'three', '', 'three'), ('', 'four', '', 'four'), + ('', 'five', '', 'five'), ] + remoteopts, _('REPO [OPTIONS]... [ONE [TWO]]')), "^diff":
--- a/mercurial/localrepo.py Sat Apr 30 02:42:05 2011 -0500 +++ b/mercurial/localrepo.py Fri Apr 29 14:54:01 2011 +0200 @@ -1921,9 +1921,9 @@ def listkeys(self, namespace): return pushkey.list(self, namespace) - def debugwireargs(self, one, two, three=None, four=None): + def debugwireargs(self, one, two, three=None, four=None, five=None): '''used to test argument passing over the wire''' - return "%s %s %s %s" % (one, two, three, four) + return "%s %s %s %s %s" % (one, two, three, four, five) # used to avoid circular references so destructors work def aftertrans(files):
--- a/mercurial/wireproto.py Sat Apr 30 02:42:05 2011 -0500 +++ b/mercurial/wireproto.py Fri Apr 29 14:54:01 2011 +0200 @@ -159,7 +159,7 @@ self.ui.status(_('remote: '), l) return ret - def debugwireargs(self, one, two, three=None, four=None): + def debugwireargs(self, one, two, three=None, four=None, five=None): # don't pass optional arguments left at their default value opts = {} if three is not None:
--- a/tests/test-wireproto.t Sat Apr 30 02:42:05 2011 -0500 +++ b/tests/test-wireproto.t Fri Apr 29 14:54:01 2011 +0200 @@ -8,11 +8,13 @@ Local: $ hg debugwireargs repo eins zwei --three drei --four vier - eins zwei drei vier + eins zwei drei vier None $ hg debugwireargs repo eins zwei --four vier - eins zwei None vier + eins zwei None vier None $ hg debugwireargs repo eins zwei - eins zwei None None + eins zwei None None None + $ hg debugwireargs repo eins zwei --five fuenf + eins zwei None None fuenf HTTP: @@ -20,11 +22,13 @@ $ cat hg1.pid >> $DAEMON_PIDS $ hg debugwireargs http://localhost:$HGPORT/ un deux trois quatre - un deux trois quatre + un deux trois quatre None $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --four vier - eins zwei None vier + eins zwei None vier None $ hg debugwireargs http://localhost:$HGPORT/ eins zwei - eins zwei None None + eins zwei None None None + $ hg debugwireargs http://localhost:$HGPORT/ eins zwei --five fuenf + eins zwei None None None $ cat access.log * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) * - - [*] "GET /?cmd=debugwireargs&four=quatre&one=un&three=trois&two=deux HTTP/1.1" 200 - (glob) @@ -35,6 +39,9 @@ * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob) * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob) + * - - [*] "GET /?cmd=capabilities HTTP/1.1" 200 - (glob) + * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob) + * - - [*] "GET /?cmd=debugwireargs&one=eins&two=zwei HTTP/1.1" 200 - (glob) SSH (try to exercise the ssh functionality with a dummy script): @@ -52,9 +59,11 @@ > EOF $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo uno due tre quattro - uno due tre quattro + uno due tre quattro None $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei --four vier - eins zwei None vier + eins zwei None vier None $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei - eins zwei None None + eins zwei None None None + $ hg debugwireargs --ssh "python ./dummyssh" ssh://user@dummy/repo eins zwei --five fuenf + eins zwei None None None