Mercurial > public > mercurial-scm > hg
diff hgext/mq.py @ 8152:08e1baf924ca
replace set-like dictionaries with real sets
Many of the dictionaries created by dict.fromkeys were emulating sets.
These can now be replaced with real sets.
author | Martin Geisler <mg@lazybytes.net> |
---|---|
date | Wed, 22 Apr 2009 00:57:28 +0200 |
parents | 127281884959 |
children | f3abe032fc89 |
line wrap: on
line diff
--- a/hgext/mq.py Wed Apr 22 00:56:06 2009 +0200 +++ b/hgext/mq.py Wed Apr 22 00:57:28 2009 +0200 @@ -1338,7 +1338,7 @@ msg = '' return '%s%s' % (patchname, msg) - applied = dict.fromkeys([p.name for p in self.applied]) + applied = set([p.name for p in self.applied]) if length is None: length = len(self.series) - start if not missing: @@ -1762,10 +1762,8 @@ if sr.mq.applied: qbase = bin(sr.mq.applied[0].rev) if not hg.islocal(dest): - heads = dict.fromkeys(sr.heads()) - for h in sr.heads(qbase): - del heads[h] - destrev = heads.keys() + heads = set(sr.heads()) + destrev = list(heads.difference(sr.heads(qbase))) destrev.append(sr.changelog.parents(qbase)[0]) elif sr.capable('lookup'): try: