Mercurial > hg
changeset 13799:d04fc5582772
bugzilla: keep bug IDs in set.
Bug IDs are collected into a set, and then silently converted in
filter_real_bug_ids() into a list. For consistency, keep them in
a set throughout and update the docstrings to say that.
author | Jim Hague <jim.hague@acm.org> |
---|---|
date | Wed, 30 Mar 2011 09:49:45 +0100 |
parents | 9c9fa78f4e2d |
children | c2ef8159dabe |
files | hgext/bugzilla.py |
diffstat | 1 files changed, 10 insertions(+), 9 deletions(-) [+] |
line wrap: on
line diff
--- a/hgext/bugzilla.py Wed Mar 30 09:49:45 2011 +0100 +++ b/hgext/bugzilla.py Wed Mar 30 09:49:45 2011 +0100 @@ -190,22 +190,21 @@ return ids[0][0] def filter_real_bug_ids(self, ids): - '''filter not-existing bug ids from list.''' + '''filter not-existing bug ids from set.''' self.run('select bug_id from bugs where bug_id in %s' % buglist(ids)) - return sorted([c[0] for c in self.cursor.fetchall()]) + return set([c[0] for c in self.cursor.fetchall()]) def filter_cset_known_bug_ids(self, node, ids): - '''filter bug ids from list that already refer to this changeset.''' + '''filter bug ids that already refer to this changeset from set.''' self.run('''select bug_id from longdescs where bug_id in %s and thetext like "%%%s%%"''' % (buglist(ids), short(node))) - unknown = set(ids) for (id,) in self.cursor.fetchall(): self.ui.status(_('bug %d already knows about changeset %s\n') % (id, short(node))) - unknown.discard(id) - return sorted(unknown) + ids.discard(id) + return ids def notify(self, ids, committer): '''tell bugzilla to send mail.''' @@ -353,10 +352,12 @@ _split_re = None def find_bug_ids(self, ctx): - '''find valid bug ids that are referred to in changeset - comments and that do not already have references to this - changeset.''' + '''return set of integer bug IDs from commit comment. + Extract bug IDs from changeset comments. Filter out any that are + not known to Bugzilla, and any that already have a reference to + the given changeset in their comments. + ''' if bugzilla._bug_re is None: bugzilla._bug_re = re.compile( self.ui.config('bugzilla', 'regexp', bugzilla._default_bug_re),