Show More
@@ -44,6 +44,7 test-branch-change.t | |||
|
44 | 44 | test-branch-option.t |
|
45 | 45 | test-branch-tag-confict.t |
|
46 | 46 | test-branches.t |
|
47 | test-bugzilla.t | |
|
47 | 48 | test-bundle-phases.t |
|
48 | 49 | test-bundle-r.t |
|
49 | 50 | test-bundle-type.t |
@@ -303,6 +303,7 from mercurial import ( | |||
|
303 | 303 | error, |
|
304 | 304 | logcmdutil, |
|
305 | 305 | mail, |
|
306 | pycompat, | |
|
306 | 307 | registrar, |
|
307 | 308 | url, |
|
308 | 309 | util, |
@@ -342,10 +343,10 configitem('bugzilla', 'db', | |||
|
342 | 343 | default='bugs', |
|
343 | 344 | ) |
|
344 | 345 | configitem('bugzilla', 'fixregexp', |
|
345 | default=(r'fix(?:es)?\s*(?:bugs?\s*)?,?\s*' | |
|
346 | r'(?:nos?\.?|num(?:ber)?s?)?\s*' | |
|
347 | r'(?P<ids>(?:#?\d+\s*(?:,?\s*(?:and)?)?\s*)+)' | |
|
348 | r'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?') | |
|
346 | default=(br'fix(?:es)?\s*(?:bugs?\s*)?,?\s*' | |
|
347 | br'(?:nos?\.?|num(?:ber)?s?)?\s*' | |
|
348 | br'(?P<ids>(?:#?\d+\s*(?:,?\s*(?:and)?)?\s*)+)' | |
|
349 | br'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?') | |
|
349 | 350 | ) |
|
350 | 351 | configitem('bugzilla', 'fixresolution', |
|
351 | 352 | default='FIXED', |
@@ -363,9 +364,9 configitem('bugzilla', 'password', | |||
|
363 | 364 | default=None, |
|
364 | 365 | ) |
|
365 | 366 | configitem('bugzilla', 'regexp', |
|
366 | default=(r'bugs?\s*,?\s*(?:#|nos?\.?|num(?:ber)?s?)?\s*' | |
|
367 | r'(?P<ids>(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)' | |
|
368 | r'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?') | |
|
367 | default=(br'bugs?\s*,?\s*(?:#|nos?\.?|num(?:ber)?s?)?\s*' | |
|
368 | br'(?P<ids>(?:\d+\s*(?:,?\s*(?:and)?)?\s*)+)' | |
|
369 | br'\.?\s*(?:h(?:ours?)?\s*(?P<hours>\d*(?:\.\d+)?))?') | |
|
369 | 370 | ) |
|
370 | 371 | configitem('bugzilla', 'strip', |
|
371 | 372 | default=0, |
@@ -733,7 +734,7 class bzxmlrpc(bzaccess): | |||
|
733 | 734 | c = self.bzproxy.Bug.comments({'ids': [id], |
|
734 | 735 | 'include_fields': ['text'], |
|
735 | 736 | 'token': self.bztoken}) |
|
736 |
return ''.join([t['text'] for t in c['bugs'][ |
|
|
737 | return ''.join([t['text'] for t in c['bugs']['%d' % id]['comments']]) | |
|
737 | 738 | |
|
738 | 739 | def filter_real_bug_ids(self, bugs): |
|
739 | 740 | probe = self.bzproxy.Bug.get({'ids': sorted(bugs.keys()), |
@@ -804,11 +805,11 class bzxmlrpcemail(bzxmlrpc): | |||
|
804 | 805 | |
|
805 | 806 | def makecommandline(self, fieldname, value): |
|
806 | 807 | if self.bzvermajor >= 4: |
|
807 | return "@%s %s" % (fieldname, str(value)) | |
|
808 | return "@%s %s" % (fieldname, pycompat.bytestr(value)) | |
|
808 | 809 | else: |
|
809 | 810 | if fieldname == "id": |
|
810 | 811 | fieldname = "bug_id" |
|
811 | return "@%s = %s" % (fieldname, str(value)) | |
|
812 | return "@%s = %s" % (fieldname, pycompat.bytestr(value)) | |
|
812 | 813 | |
|
813 | 814 | def send_bug_modify_email(self, bugid, commands, comment, committer): |
|
814 | 815 | '''send modification message to Bugzilla bug via email. |
@@ -873,7 +874,7 class bzrestapi(bzaccess): | |||
|
873 | 874 | self.fixresolution = self.ui.config('bugzilla', 'fixresolution') |
|
874 | 875 | |
|
875 | 876 | def apiurl(self, targets, include_fields=None): |
|
876 | url = '/'.join([self.bzroot] + [str(t) for t in targets]) | |
|
877 | url = '/'.join([self.bzroot] + [pycompat.bytestr(t) for t in targets]) | |
|
877 | 878 | qv = {} |
|
878 | 879 | if self.apikey: |
|
879 | 880 | qv['api_key'] = self.apikey |
@@ -938,7 +939,7 class bzrestapi(bzaccess): | |||
|
938 | 939 | for bugid in bugs.keys(): |
|
939 | 940 | burl = self.apiurl(('bug', bugid, 'comment'), include_fields='text') |
|
940 | 941 | result = self._fetch(burl) |
|
941 | comments = result['bugs'][str(bugid)]['comments'] | |
|
942 | comments = result['bugs'][pycompat.bytestr(bugid)]['comments'] | |
|
942 | 943 | if any(sn in c['text'] for c in comments): |
|
943 | 944 | self.ui.status(_('bug %d already knows about changeset %s\n') % |
|
944 | 945 | (bugid, sn)) |
@@ -1011,7 +1012,7 class bugzilla(object): | |||
|
1011 | 1012 | self.ui.config('bugzilla', 'regexp'), re.IGNORECASE) |
|
1012 | 1013 | self.fix_re = re.compile( |
|
1013 | 1014 | self.ui.config('bugzilla', 'fixregexp'), re.IGNORECASE) |
|
1014 | self.split_re = re.compile(r'\D+') | |
|
1015 | self.split_re = re.compile(br'\D+') | |
|
1015 | 1016 | |
|
1016 | 1017 | def find_bugs(self, ctx): |
|
1017 | 1018 | '''return bugs dictionary created from commit comment. |
@@ -1098,7 +1099,7 class bugzilla(object): | |||
|
1098 | 1099 | t = logcmdutil.changesettemplater(self.ui, self.repo, spec) |
|
1099 | 1100 | self.ui.pushbuffer() |
|
1100 | 1101 | t.show(ctx, changes=ctx.changeset(), |
|
1101 | bug=str(bugid), | |
|
1102 | bug=pycompat.bytestr(bugid), | |
|
1102 | 1103 | hgweb=self.ui.config('web', 'baseurl'), |
|
1103 | 1104 | root=self.repo.root, |
|
1104 | 1105 | webroot=webroot(self.repo.root)) |
@@ -3,7 +3,9 mock bugzilla driver for testing templat | |||
|
3 | 3 | $ cat <<EOF > bzmock.py |
|
4 | 4 | > from __future__ import absolute_import |
|
5 | 5 | > from mercurial import extensions |
|
6 | > from mercurial import pycompat | |
|
6 | 7 | > from mercurial import registrar |
|
8 | > from mercurial.utils import stringutil | |
|
7 | 9 | > |
|
8 | 10 | > configtable = {} |
|
9 | 11 | > configitem = registrar.configitem(configtable) |
@@ -18,14 +20,17 mock bugzilla driver for testing templat | |||
|
18 | 20 | > super(bzmock, self).__init__(ui) |
|
19 | 21 | > self._logfile = ui.config(b'bugzilla', b'mocklog') |
|
20 | 22 | > def updatebug(self, bugid, newstate, text, committer): |
|
21 | > with open(self._logfile, 'a') as f: | |
|
22 |
> f.write('update bugid=% |
|
|
23 |
> % (bugid, |
|
|
24 | > f.write('----\n' + text + '\n----\n') | |
|
23 | > with open(pycompat.fsdecode(self._logfile), 'ab') as f: | |
|
24 | > f.write(b'update bugid=%s, newstate=%s, committer=%s\n' | |
|
25 | > % (stringutil.pprint(bugid), | |
|
26 | > stringutil.pprint(newstate), | |
|
27 | > stringutil.pprint(committer))) | |
|
28 | > f.write(b'----\n' + text + b'\n----\n') | |
|
25 | 29 | > def notify(self, bugs, committer): |
|
26 | > with open(self._logfile, 'a') as f: | |
|
27 |
> f.write('notify bugs=% |
|
|
28 |
> % (bugs, |
|
|
30 | > with open(pycompat.fsdecode(self._logfile), 'ab') as f: | |
|
31 | > f.write(b'notify bugs=%s, committer=%s\n' | |
|
32 | > % (stringutil.pprint(bugs), | |
|
33 | > stringutil.pprint(committer))) | |
|
29 | 34 | > bugzilla.bugzilla._versions[b'mock'] = bzmock |
|
30 | 35 | > EOF |
|
31 | 36 |
General Comments 0
You need to be logged in to leave comments.
Login now