Mercurial > hg
annotate tests/test-bugzilla.t @ 31454:a5bad127128d
branchmap: handle nullrev in setcachedata
906be86990 recently changed to switch from:
self._rbcrevs[rbcrevidx:rbcrevidx + _rbcrecsize] = rec
to
pack_into(_rbcrecfmt, self._rbcrevs, rbcrevidx, node, branchidx)
This causes an exception if rbcrevidx is -1 (i.e. the nullrev). The old code
handled this because python handles out of bound sets to arrays gracefully. The
new code throws because the self._rbcrevs buffer isn't long enough to write 8
bytes to. Normally it would've been resized by the immediately preceding line,
but because the 0 length buffer is greater than the idx (-1) times the size, no
resize happens.
Setting the branch for the nullrev doesn't make sense anyway, so let's skip it.
This was caught by external tests in the Facebook extensions repo, but I've
added a test here that catches the issue.
author | Durham Goode <durham@fb.com> |
---|---|
date | Wed, 15 Mar 2017 15:48:57 -0700 |
parents | 22c53b3a390d |
children | fbfecd1dbfb5 |
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 ---- |
29102
22c53b3a390d
tests: add globs for Windows
Matt Harbison <matt_harbison@yahoo.com>
parents:
28950
diff
changeset
|
57 changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123. (glob) |
28950
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' |