618 |
618 |
619 self.bzproxy = xmlrpclib.ServerProxy(bzweb, self.transport(bzweb)) |
619 self.bzproxy = xmlrpclib.ServerProxy(bzweb, self.transport(bzweb)) |
620 ver = self.bzproxy.Bugzilla.version()['version'].split('.') |
620 ver = self.bzproxy.Bugzilla.version()['version'].split('.') |
621 self.bzvermajor = int(ver[0]) |
621 self.bzvermajor = int(ver[0]) |
622 self.bzverminor = int(ver[1]) |
622 self.bzverminor = int(ver[1]) |
623 self.bzproxy.User.login(dict(login=user, password=passwd)) |
623 self.bzproxy.User.login({'login': user, 'password': passwd}) |
624 |
624 |
625 def transport(self, uri): |
625 def transport(self, uri): |
626 if urlparse.urlparse(uri, "http")[0] == "https": |
626 if urlparse.urlparse(uri, "http")[0] == "https": |
627 return cookiesafetransport() |
627 return cookiesafetransport() |
628 else: |
628 else: |
629 return cookietransport() |
629 return cookietransport() |
630 |
630 |
631 def get_bug_comments(self, id): |
631 def get_bug_comments(self, id): |
632 """Return a string with all comment text for a bug.""" |
632 """Return a string with all comment text for a bug.""" |
633 c = self.bzproxy.Bug.comments(dict(ids=[id], include_fields=['text'])) |
633 c = self.bzproxy.Bug.comments({'ids': [id], |
|
634 'include_fields': ['text']}) |
634 return ''.join([t['text'] for t in c['bugs'][str(id)]['comments']]) |
635 return ''.join([t['text'] for t in c['bugs'][str(id)]['comments']]) |
635 |
636 |
636 def filter_real_bug_ids(self, bugs): |
637 def filter_real_bug_ids(self, bugs): |
637 probe = self.bzproxy.Bug.get(dict(ids=sorted(bugs.keys()), |
638 probe = self.bzproxy.Bug.get({'ids': sorted(bugs.keys()), |
638 include_fields=[], |
639 'include_fields': [], |
639 permissive=True)) |
640 'permissive': True, |
|
641 }) |
640 for badbug in probe['faults']: |
642 for badbug in probe['faults']: |
641 id = badbug['id'] |
643 id = badbug['id'] |
642 self.ui.status(_('bug %d does not exist\n') % id) |
644 self.ui.status(_('bug %d does not exist\n') % id) |
643 del bugs[id] |
645 del bugs[id] |
644 |
646 |
715 To stop users from crafting commit comments with |
717 To stop users from crafting commit comments with |
716 Bugzilla commands, specify the bug ID via the message body, rather |
718 Bugzilla commands, specify the bug ID via the message body, rather |
717 than the subject line, and leave a blank line after it. |
719 than the subject line, and leave a blank line after it. |
718 ''' |
720 ''' |
719 user = self.map_committer(committer) |
721 user = self.map_committer(committer) |
720 matches = self.bzproxy.User.get(dict(match=[user])) |
722 matches = self.bzproxy.User.get({'match': [user]}) |
721 if not matches['users']: |
723 if not matches['users']: |
722 user = self.ui.config('bugzilla', 'user', 'bugs') |
724 user = self.ui.config('bugzilla', 'user', 'bugs') |
723 matches = self.bzproxy.User.get(dict(match=[user])) |
725 matches = self.bzproxy.User.get({'match': [user]}) |
724 if not matches['users']: |
726 if not matches['users']: |
725 raise util.Abort(_("default bugzilla user %s email not found") % |
727 raise util.Abort(_("default bugzilla user %s email not found") % |
726 user) |
728 user) |
727 user = matches['users'][0]['email'] |
729 user = matches['users'][0]['email'] |
728 commands.append(self.makecommandline("id", bugid)) |
730 commands.append(self.makecommandline("id", bugid)) |