6 > from mercurial import registrar |
6 > from mercurial import registrar |
7 > |
7 > |
8 > configtable = {} |
8 > configtable = {} |
9 > configitem = registrar.configitem(configtable) |
9 > configitem = registrar.configitem(configtable) |
10 > |
10 > |
11 > configitem('bugzilla', 'mocklog', |
11 > configitem(b'bugzilla', b'mocklog', |
12 > default=None, |
12 > default=None, |
13 > ) |
13 > ) |
14 > def extsetup(ui): |
14 > def extsetup(ui): |
15 > bugzilla = extensions.find('bugzilla') |
15 > bugzilla = extensions.find(b'bugzilla') |
16 > class bzmock(bugzilla.bzaccess): |
16 > class bzmock(bugzilla.bzaccess): |
17 > def __init__(self, ui): |
17 > def __init__(self, ui): |
18 > super(bzmock, self).__init__(ui) |
18 > super(bzmock, self).__init__(ui) |
19 > self._logfile = ui.config('bugzilla', 'mocklog') |
19 > self._logfile = ui.config(b'bugzilla', b'mocklog') |
20 > def updatebug(self, bugid, newstate, text, committer): |
20 > def updatebug(self, bugid, newstate, text, committer): |
21 > with open(self._logfile, 'a') as f: |
21 > with open(self._logfile, 'a') as f: |
22 > f.write('update bugid=%r, newstate=%r, committer=%r\n' |
22 > f.write('update bugid=%r, newstate=%r, committer=%r\n' |
23 > % (bugid, newstate, committer)) |
23 > % (bugid, newstate, committer)) |
24 > f.write('----\n' + text + '\n----\n') |
24 > f.write('----\n' + text + '\n----\n') |
25 > def notify(self, bugs, committer): |
25 > def notify(self, bugs, committer): |
26 > with open(self._logfile, 'a') as f: |
26 > with open(self._logfile, 'a') as f: |
27 > f.write('notify bugs=%r, committer=%r\n' |
27 > f.write('notify bugs=%r, committer=%r\n' |
28 > % (bugs, committer)) |
28 > % (bugs, committer)) |
29 > bugzilla.bugzilla._versions['mock'] = bzmock |
29 > bugzilla.bugzilla._versions[b'mock'] = bzmock |
30 > EOF |
30 > EOF |
31 |
31 |
32 set up mock repository: |
32 set up mock repository: |
33 |
33 |
34 $ hg init mockremote |
34 $ hg init mockremote |