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