diff --git a/hgext/convert/convcmd.py b/hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py +++ b/hgext/convert/convcmd.py @@ -100,12 +100,12 @@ class converter(object): '''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 @@ class converter(object): '''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, []) diff --git a/hgext/convert/cvsps.py b/hgext/convert/cvsps.py --- a/hgext/convert/cvsps.py +++ b/hgext/convert/cvsps.py @@ -463,7 +463,7 @@ def createchangeset(ui, log, fuzz=60, me listsort(log, key=lambda x:(x.comment, x.author, x.branch, x.date)) changesets = [] - files = {} + files = set() c = None for i, e in enumerate(log): @@ -480,13 +480,13 @@ def createchangeset(ui, log, fuzz=60, me branch=e.branch, date=e.date, entries=[], mergepoint=getattr(e, 'mergepoint', None)) changesets.append(c) - files = {} + files = set() if len(changesets) % 100 == 0: t = '%d %s' % (len(changesets), repr(e.comment)[1:-1]) ui.status(util.ellipsis(t, 80) + '\n') c.entries.append(e) - files[e.file] = True + files.add(e.file) c.date = e.date # changeset date is date of latest commit in it # Mark synthetic changesets @@ -564,19 +564,18 @@ def createchangeset(ui, log, fuzz=60, me globaltags = {} for c in changesets: - tags = {} for e in c.entries: for tag in e.tags: # remember which is the latest changeset to have this tag globaltags[tag] = c for c in changesets: - tags = {} + tags = set() for e in c.entries: for tag in e.tags: - tags[tag] = True + tags.add(tag) # remember tags only if this is the latest changeset to have it - c.tags = sorted([tag for tag in tags if globaltags[tag] is c]) + c.tags = sorted(tag for tag in tags if globaltags[tag] is c) # Find parent changesets, handle {{mergetobranch BRANCHNAME}} # by inserting dummy changesets with two parents, and handle diff --git a/hgext/convert/git.py b/hgext/convert/git.py --- a/hgext/convert/git.py +++ b/hgext/convert/git.py @@ -63,7 +63,7 @@ class convert_git(converter_source): self.modecache = {} fh = self.gitcmd("git diff-tree -z --root -m -r %s" % version) changes = [] - seen = {} + seen = set() entry = None for l in fh.read().split('\x00'): if not entry: @@ -73,7 +73,7 @@ class convert_git(converter_source): continue f = l if f not in seen: - seen[f] = 1 + seen.add(f) entry = entry.split() h = entry[3] p = (entry[1] == "100755") diff --git a/hgext/convert/hg.py b/hgext/convert/hg.py --- a/hgext/convert/hg.py +++ b/hgext/convert/hg.py @@ -195,7 +195,7 @@ class mercurial_source(converter_source) def __init__(self, ui, path, rev=None): converter_source.__init__(self, ui, path, rev) self.ignoreerrors = ui.configbool('convert', 'hg.ignoreerrors', False) - self.ignored = {} + self.ignored = set() self.saverev = ui.configbool('convert', 'hg.saverev', False) try: self.repo = hg.repository(self.ui, path) @@ -288,7 +288,7 @@ class mercurial_source(converter_source) except error.LookupError, e: if not self.ignoreerrors: raise - self.ignored[name] = 1 + self.ignored.add(name) self.ui.warn(_('ignoring: %s\n') % e) return copies