# HG changeset patch # User Jim Hague # Date 1301474985 -3600 # Node ID d04fc5582772d4b3a472a68f15fc733e1bfeae96 # Parent 9c9fa78f4e2d28ff7f6b7b79a6fdd0604c5312c4 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. diff -r 9c9fa78f4e2d -r d04fc5582772 hgext/bugzilla.py --- 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),