Mercurial > hg
annotate tests/test-newcgi.t @ 29196:bf7b8157c483 stable
strip: invalidate phase cache after stripping changeset (issue5235)
When we remove a changeset from the changelog, the phase cache must be
invalidated, otherwise it could refer to changesets that are no longer in the
repo.
To reproduce the failure, I created an extension querying the phase cache after
the strip transaction is over.
To do that, I stripped two commits with a bookmark on one of them to force
another transaction (we open a transaction for moving bookmarks)
after the strip transaction.
Without the fix in this patch, the test leads to a stacktrace showing the issue:
repair.strip(ui, repo, revs, backup)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/repair.py", line 205, in strip
tr.close()
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/transaction.py", line 44, in _active
return func(self, *args, **kwds)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/transaction.py", line 490, in close
self._postclosecallback[cat](self)
File "$TESTTMP/crashstrip2.py", line 4, in test
[repo.changelog.node(r) for r in repo.revs("not public()")]
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/changelog.py", line 337, in node
return super(changelog, self).node(rev)
File "/Users/lcharignon/facebook-hg-rpms/hg-crew/mercurial/revlog.py", line 377, in node
return self.index[rev][7]
IndexError: revlog index out of range
The situation was encountered in inhibit (evolve's repo) where we would crash
following the volatile set invalidation submitted by Augie in
e6f490e328635312ee214a12bc7fd3c7d46bf9ce. Before his patch the issue was masked
as we were not accessing the phasecache after stripping a revision.
This bug uncovered another but in histedit (see explanation in issue5235).
I changed the histedit test accordingly to avoid fixing two things at once.
author | Laurent Charignon <lcharignon@fb.com> |
---|---|
date | Thu, 12 May 2016 06:13:59 -0700 |
parents | 7a9cbb315d84 |
children | b6776b34e44e |
rev | line source |
---|---|
22046
7a9cbb315d84
tests: replace exit 80 with #require
Matt Mackall <mpm@selenic.com>
parents:
15567
diff
changeset
|
1 #require no-msys # MSYS will translate web paths as if they were file paths |
15567
8b84d040d9f9
tests: introduce 'hghave msys' to skip tests that would fail because of msys
Mads Kiilerich <mads@kiilerich.com>
parents:
13269
diff
changeset
|
2 |
12470 | 3 This tests if CGI files from after d0db3462d568 but |
4 before d74fc8dec2b4 still work. | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
5 |
12470 | 6 $ hg init test |
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 > from mercurial.hgweb.request import wsgiapplication | |
19 > | |
20 > def make_web_app(): | |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12470
diff
changeset
|
21 > return hgweb("test", "Empty test repository") |
12470 | 22 > |
23 > wsgicgi.launch(wsgiapplication(make_web_app)) | |
24 > HGWEB | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
25 |
12470 | 26 $ chmod 755 hgweb.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
27 |
12470 | 28 $ cat >hgweb.config <<HGWEBDIRCONF |
29 > [paths] | |
30 > test = test | |
31 > HGWEBDIRCONF | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
32 |
12470 | 33 $ cat >hgwebdir.cgi <<HGWEBDIR |
34 > #!/usr/bin/env python | |
35 > # | |
36 > # An example CGI script to export multiple hgweb repos, edit as necessary | |
37 > | |
38 > import cgitb | |
39 > cgitb.enable() | |
40 > | |
41 > from mercurial import demandimport; demandimport.enable() | |
42 > from mercurial.hgweb import hgwebdir | |
43 > from mercurial.hgweb import wsgicgi | |
44 > from mercurial.hgweb.request import wsgiapplication | |
45 > | |
46 > def make_web_app(): | |
12743
4c4aeaab2339
check-code: add 'no tab indent' check for unified tests
Adrian Buehlmann <adrian@cadifra.com>
parents:
12470
diff
changeset
|
47 > return hgwebdir("hgweb.config") |
12470 | 48 > |
49 > wsgicgi.launch(wsgiapplication(make_web_app)) | |
50 > HGWEBDIR | |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
51 |
12470 | 52 $ chmod 755 hgwebdir.cgi |
5577
e0173902c813
CGI compatibility fix for d74fc8dec2b4.
Dirkjan Ochtman <dirkjan@ochtman.nl>
parents:
diff
changeset
|
53 |
13269
aa3f726a2bdb
tests: remove duplication of the CGI environment variables
StevenGBrown
parents:
12743
diff
changeset
|
54 $ . "$TESTDIR/cgienv" |
12470 | 55 $ python hgweb.cgi > page1 |
56 $ python hgwebdir.cgi > page2 | |
57 | |
58 $ PATH_INFO="/test/" | |
59 $ PATH_TRANSLATED="/var/something/test.cgi" | |
60 $ REQUEST_URI="/test/test/" | |
61 $ SCRIPT_URI="http://hg.omnifarious.org/test/test/" | |
62 $ SCRIPT_URL="/test/test/" | |
63 $ python hgwebdir.cgi > page3 | |
64 | |
65 $ grep -i error page1 page2 page3 | |
66 [1] |