annotate tests/test-bugzilla.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 9e1c9f016b72
children 22c53b3a390d
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
28950
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
1 mock bugzilla driver for testing template output:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
2
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
3 $ cat <<EOF > bzmock.py
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
4 > from __future__ import absolute_import
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
5 > from mercurial import extensions
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
6 >
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
7 > def extsetup(ui):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
8 > bugzilla = extensions.find('bugzilla')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
9 > class bzmock(bugzilla.bzaccess):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
10 > def __init__(self, ui):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
11 > super(bzmock, self).__init__(ui)
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
12 > self._logfile = ui.config('bugzilla', 'mocklog')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
13 > def updatebug(self, bugid, newstate, text, committer):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
14 > with open(self._logfile, 'a') as f:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
15 > f.write('update bugid=%r, newstate=%r, committer=%r\n'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
16 > % (bugid, newstate, committer))
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
17 > f.write('----\n' + text + '\n----\n')
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
18 > def notify(self, bugs, committer):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
19 > with open(self._logfile, 'a') as f:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
20 > f.write('notify bugs=%r, committer=%r\n'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
21 > % (bugs, committer))
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
22 > bugzilla.bugzilla._versions['mock'] = bzmock
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
23 > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
24
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
25 set up mock repository:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
26
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
27 $ hg init mockremote
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
28 $ cat <<EOF > mockremote/.hg/hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
29 > [extensions]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
30 > bugzilla =
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
31 > bzmock = $TESTTMP/bzmock.py
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
32 >
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
33 > [bugzilla]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
34 > version = mock
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
35 > mocklog = $TESTTMP/bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
36 >
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
37 > [hooks]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
38 > incoming.bugzilla = python:hgext.bugzilla.hook
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
39 >
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
40 > [web]
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
41 > baseurl=http://example.org/hg
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
42 >
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
43 > %include $TESTTMP/bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
44 > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
45
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
46 $ hg clone -q mockremote mocklocal
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
47
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
48 push with default template:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
49
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
50 $ echo '[bugzilla]' > bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
51 $ echo foo > mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
52 $ hg ci -R mocklocal -Aqm 'Fixes bug 123'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
53 $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
54 $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
55 update bugid=123, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
56 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
57 changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
58 details:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
59 Fixes bug 123
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
60 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
61 notify bugs={123: {}}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
62
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
63 push with style:
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
64
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
65 $ cat <<EOF > bzstyle.map
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
66 > changeset = "{node|short} refers to bug {bug}."
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
67 > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
68 $ echo "style = $TESTTMP/bzstyle.map" >> bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
69 $ echo foo >> mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
70 $ hg ci -R mocklocal -qm 'Fixes bug 456'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
71 $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
72 $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
73 update bugid=456, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
74 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
75 2808b172464b refers to bug 456.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
76 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
77 notify bugs={456: {}}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
78
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
79 push with template (overrides style):
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
80
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
81 $ cat <<EOF >> bzstyle.hgrc
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
82 > template = Changeset {node|short} in {root|basename}.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
83 > {hgweb}/rev/{node|short}\n
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
84 > {desc}
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
85 > EOF
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
86 $ echo foo >> mocklocal/foo
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
87 $ hg ci -R mocklocal -qm 'Fixes bug 789'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
88 $ hg -R mocklocal push -q
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
89 $ cat bzmock.log && rm bzmock.log
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
90 update bugid=789, newstate={}, committer='test'
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
91 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
92 Changeset a770f3e409f2 in mockremote.
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
93 http://example.org/hg/rev/a770f3e409f2
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
94
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
95 Fixes bug 789
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
96 ----
9e1c9f016b72 bugzilla: do not load style file if template is specified (BC)
Yuya Nishihara <yuya@tcha.org>
parents:
diff changeset
97 notify bugs={789: {}}, committer='test'