##// END OF EJS Templates
py3: add b'' prefixes in tests/test-bugzilla.t...
Pulkit Goyal -
r38081:fc3cca40 default
parent child Browse files
Show More
@@ -1,104 +1,104 b''
1 1 mock bugzilla driver for testing template output:
2 2
3 3 $ cat <<EOF > bzmock.py
4 4 > from __future__ import absolute_import
5 5 > from mercurial import extensions
6 6 > from mercurial import registrar
7 7 >
8 8 > configtable = {}
9 9 > configitem = registrar.configitem(configtable)
10 10 >
11 > configitem('bugzilla', 'mocklog',
11 > configitem(b'bugzilla', b'mocklog',
12 12 > default=None,
13 13 > )
14 14 > def extsetup(ui):
15 > bugzilla = extensions.find('bugzilla')
15 > bugzilla = extensions.find(b'bugzilla')
16 16 > class bzmock(bugzilla.bzaccess):
17 17 > def __init__(self, ui):
18 18 > super(bzmock, self).__init__(ui)
19 > self._logfile = ui.config('bugzilla', 'mocklog')
19 > self._logfile = ui.config(b'bugzilla', b'mocklog')
20 20 > def updatebug(self, bugid, newstate, text, committer):
21 21 > with open(self._logfile, 'a') as f:
22 22 > f.write('update bugid=%r, newstate=%r, committer=%r\n'
23 23 > % (bugid, newstate, committer))
24 24 > f.write('----\n' + text + '\n----\n')
25 25 > def notify(self, bugs, committer):
26 26 > with open(self._logfile, 'a') as f:
27 27 > f.write('notify bugs=%r, committer=%r\n'
28 28 > % (bugs, committer))
29 > bugzilla.bugzilla._versions['mock'] = bzmock
29 > bugzilla.bugzilla._versions[b'mock'] = bzmock
30 30 > EOF
31 31
32 32 set up mock repository:
33 33
34 34 $ hg init mockremote
35 35 $ cat <<EOF > mockremote/.hg/hgrc
36 36 > [extensions]
37 37 > bugzilla =
38 38 > bzmock = $TESTTMP/bzmock.py
39 39 >
40 40 > [bugzilla]
41 41 > version = mock
42 42 > mocklog = $TESTTMP/bzmock.log
43 43 >
44 44 > [hooks]
45 45 > incoming.bugzilla = python:hgext.bugzilla.hook
46 46 >
47 47 > [web]
48 48 > baseurl=http://example.org/hg
49 49 >
50 50 > %include $TESTTMP/bzstyle.hgrc
51 51 > EOF
52 52
53 53 $ hg clone -q mockremote mocklocal
54 54
55 55 push with default template:
56 56
57 57 $ echo '[bugzilla]' > bzstyle.hgrc
58 58 $ echo foo > mocklocal/foo
59 59 $ hg ci -R mocklocal -Aqm 'Fixes bug 123'
60 60 $ hg -R mocklocal push -q
61 61 $ cat bzmock.log && rm bzmock.log
62 62 update bugid=123, newstate={}, committer='test'
63 63 ----
64 64 changeset 7875a8342c6f in repo $TESTTMP/mockremote refers to bug 123.
65 65 details:
66 66 Fixes bug 123
67 67 ----
68 68 notify bugs={123: {}}, committer='test'
69 69
70 70 push with style:
71 71
72 72 $ cat <<EOF > bzstyle.map
73 73 > changeset = "{node|short} refers to bug {bug}."
74 74 > EOF
75 75 $ echo "style = $TESTTMP/bzstyle.map" >> bzstyle.hgrc
76 76 $ echo foo >> mocklocal/foo
77 77 $ hg ci -R mocklocal -qm 'Fixes bug 456'
78 78 $ hg -R mocklocal push -q
79 79 $ cat bzmock.log && rm bzmock.log
80 80 update bugid=456, newstate={}, committer='test'
81 81 ----
82 82 2808b172464b refers to bug 456.
83 83 ----
84 84 notify bugs={456: {}}, committer='test'
85 85
86 86 push with template (overrides style):
87 87
88 88 $ cat <<EOF >> bzstyle.hgrc
89 89 > template = Changeset {node|short} in {root|basename}.
90 90 > {hgweb}/rev/{node|short}\n
91 91 > {desc}
92 92 > EOF
93 93 $ echo foo >> mocklocal/foo
94 94 $ hg ci -R mocklocal -qm 'Fixes bug 789'
95 95 $ hg -R mocklocal push -q
96 96 $ cat bzmock.log && rm bzmock.log
97 97 update bugid=789, newstate={}, committer='test'
98 98 ----
99 99 Changeset a770f3e409f2 in mockremote.
100 100 http://example.org/hg/rev/a770f3e409f2
101 101
102 102 Fixes bug 789
103 103 ----
104 104 notify bugs={789: {}}, committer='test'
General Comments 0
You need to be logged in to leave comments. Login now