Mercurial > hg
diff hgext/convert/convcmd.py @ 8456:e9e2a2c9b294
convert: use set instead of dict
author | Benoit Boissinot <benoit.boissinot@ens-lyon.org> |
---|---|
date | Sun, 17 May 2009 03:04:17 +0200 |
parents | 057e96fe2955 |
children | 31e613a89750 |
line wrap: on
line diff
--- a/hgext/convert/convcmd.py Sun May 17 03:02:12 2009 +0200 +++ b/hgext/convert/convcmd.py Sun May 17 03:04:17 2009 +0200 @@ -100,12 +100,12 @@ '''Return a mapping that identifies the uncommitted parents of every uncommitted changeset.''' visit = heads - known = {} + known = set() parents = {} while visit: n = visit.pop(0) if n in known or n in self.map: continue - known[n] = 1 + known.add(n) commit = self.cachecommit(n) parents[n] = [] for p in commit.parents: @@ -118,14 +118,14 @@ '''Return an ordering such that every uncommitted changeset is preceeded by all its uncommitted ancestors.''' visit = parents.keys() - seen = {} + seen = set() children = {} actives = [] while visit: n = visit.pop(0) if n in seen: continue - seen[n] = 1 + seen.add(n) # Ensure that nodes without parents are present in the 'children' # mapping. children.setdefault(n, [])