Mercurial > hg
annotate tests/test-newercgi.t @ 18969:257afe5489d4
largefiles: improve repo wrapping detection
Before this patch, repo wrapping detection in "reposetup()" of
largefiles can detect only limited repo wrapping: replacing target
functions by another one named as "wrap".
So, it can't detect repo wrapping even in recommended style: replacing
"__class__" of repo by derived class.
This patch can detect repo wrapping in both styles below:
- replacing "__class__" of repo by derived class (recommended style):
class derived(repo.__class__):
def push(self, *args, **kwargs):
return super(derived, self).push(*args, **kwargs)
repo.__class__ = derived
- replacing function of repo by another one (not recommended style):
orgpush = repo.push
def push(*args, **kwargs):
return orgpush(*args, **kwargs)
repo.push = push
author | FUJIWARA Katsunori <foozy@lares.dti.ne.jp> |
---|---|
date | Wed, 10 Apr 2013 02:27:35 +0900 |
parents | 8b84d040d9f9 |
children | 7a9cbb315d84 |
rev | line source |
---|---|
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
13269
diff
changeset
|
1 $ "$TESTDIR/hghave" no-msys || exit 80 # MSYS will translate web paths as if they were file paths |
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
13269
diff
changeset
|
2 |
12471 | 3 This is a rudimentary test of the CGI files as of d74fc8dec2b4. |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
4 |
12471 | 5 $ hg init test |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
6 |
12471 | 7 $ cat >hgweb.cgi <<HGWEB |
8 > #!/usr/bin/env python | |
9 > # | |
10 > # An example CGI script to use hgweb, edit as necessary | |
11 > | |
12 > import cgitb | |
13 > cgitb.enable() | |
14 > | |
15 > from mercurial import demandimport; demandimport.enable() | |
16 > from mercurial.hgweb import hgweb | |
17 > from mercurial.hgweb import wsgicgi | |
18 > | |
19 > application = hgweb("test", "Empty test repository") | |
20 > wsgicgi.launch(application) | |
21 > HGWEB | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
22 |
12471 | 23 $ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
24 |
12471 | 25 $ cat >hgweb.config <<HGWEBDIRCONF |
26 > [paths] | |
27 > test = test | |
28 > HGWEBDIRCONF | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
29 |
12471 | 30 $ cat >hgwebdir.cgi <<HGWEBDIR |
31 > #!/usr/bin/env python | |
32 > # | |
33 > # An example CGI script to export multiple hgweb repos, edit as necessary | |
34 > | |
35 > import cgitb | |
36 > cgitb.enable() | |
37 > | |
38 > from mercurial import demandimport; demandimport.enable() | |
39 > from mercurial.hgweb import hgwebdir | |
40 > from mercurial.hgweb import wsgicgi | |
41 > | |
42 > application = hgwebdir("hgweb.config") | |
43 > wsgicgi.launch(application) | |
44 > HGWEBDIR | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
45 |
12471 | 46 $ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
47 |
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12471
diff
changeset
|
48 $ . "$TESTDIR/cgienv" |
12471 | 49 $ python hgweb.cgi > page1 |
50 $ python hgwebdir.cgi > page2 | |
51 | |
52 $ PATH_INFO="/test/" | |
53 $ PATH_TRANSLATED="/var/something/test.cgi" | |
54 $ REQUEST_URI="/test/test/" | |
55 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
56 $ SCRIPT_URL="/test/test/" | |
57 $ python hgwebdir.cgi > page3 | |
58 | |
59 $ grep -i error page1 page2 page3 | |
60 [1] |