comparison hgext/bugzilla.py @ 8209:a1a5a57efe90

replace util.sort with sorted built-in This is marginally faster for small and moderately-sized lists
author Matt Mackall <mpm@selenic.com>
date Sun, 26 Apr 2009 16:50:44 -0500
parents 1750510251d0
children 46293a0c7e9f
comparison
equal deleted inserted replaced
8208:32a2a1e244f1 8209:a1a5a57efe90
167 return ids[0][0] 167 return ids[0][0]
168 168
169 def filter_real_bug_ids(self, ids): 169 def filter_real_bug_ids(self, ids):
170 '''filter not-existing bug ids from list.''' 170 '''filter not-existing bug ids from list.'''
171 self.run('select bug_id from bugs where bug_id in %s' % buglist(ids)) 171 self.run('select bug_id from bugs where bug_id in %s' % buglist(ids))
172 return util.sort([c[0] for c in self.cursor.fetchall()]) 172 return sorted([c[0] for c in self.cursor.fetchall()])
173 173
174 def filter_unknown_bug_ids(self, node, ids): 174 def filter_unknown_bug_ids(self, node, ids):
175 '''filter bug ids from list that already refer to this changeset.''' 175 '''filter bug ids from list that already refer to this changeset.'''
176 176
177 self.run('''select bug_id from longdescs where 177 self.run('''select bug_id from longdescs where
180 unknown = set(ids) 180 unknown = set(ids)
181 for (id,) in self.cursor.fetchall(): 181 for (id,) in self.cursor.fetchall():
182 self.ui.status(_('bug %d already knows about changeset %s\n') % 182 self.ui.status(_('bug %d already knows about changeset %s\n') %
183 (id, short(node))) 183 (id, short(node)))
184 unknown.discard(id) 184 unknown.discard(id)
185 return util.sort(unknown) 185 return sorted(unknown)
186 186
187 def notify(self, ids, committer): 187 def notify(self, ids, committer):
188 '''tell bugzilla to send mail.''' 188 '''tell bugzilla to send mail.'''
189 189
190 self.ui.status(_('telling bugzilla to send mail:\n')) 190 self.ui.status(_('telling bugzilla to send mail:\n'))