Mercurial > hg
annotate tests/notcapable @ 14011:b69471bdb678
tests: add script to disable a selected wire protocol capability
This can be used to test that the client and server both fall back to the
previous wire protocol when the capability is not supported.
It is currently used by test-push-http.t and I plan to use it for the HTTP
long argument support tests.
author | Steven Brown <StevenGBrown@gmail.com> |
---|---|
date | Mon, 25 Apr 2011 18:00:30 +0800 |
parents | |
children | 9ff996ba00b4 |
rev | line source |
---|---|
14011
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
1 # Disable the $CAP wire protocol capability. |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
2 |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
3 if test -z "$CAP" |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
4 then |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
5 echo "CAP environment variable not set." |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
6 fi |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
7 |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
8 cat > notcapable-$CAP.py << EOF |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
9 from mercurial import extensions, repo |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
10 def extsetup(): |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
11 extensions.wrapfunction(repo.repository, 'capable', wrapper) |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
12 def wrapper(orig, self, name, *args, **kwargs): |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
13 if name == '$CAP': |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
14 return False |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
15 return orig(self, name, *args, **kwargs) |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
16 EOF |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
17 |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
18 echo '[extensions]' >> $HGRCPATH |
b69471bdb678
tests: add script to disable a selected wire protocol capability
Steven Brown <StevenGBrown@gmail.com>
parents:
diff
changeset
|
19 echo "notcapable-$CAP = `pwd`/notcapable-$CAP.py" >> $HGRCPATH |