Mercurial > public > mercurial-scm > hg-stable
diff mercurial/localrepo.py @ 7622:4dd7b28003d2
use dict.iteritems() rather than dict.items()
This should be faster and more future-proof. Calls where the result is to be
sorted using util.sort() have been left unchanged. Calls to .items() on
configparser objects have been left as-is, too.
author | Dirkjan Ochtman <dirkjan@ochtman.nl> |
---|---|
date | Mon, 12 Jan 2009 09:16:03 +0100 |
parents | 7bf7c073375e |
children | 08cabecfa8a8 |
line wrap: on
line diff
--- a/mercurial/localrepo.py Mon Jan 12 09:07:02 2009 +0100 +++ b/mercurial/localrepo.py Mon Jan 12 09:16:03 2009 +0100 @@ -265,7 +265,7 @@ h.append(n) filetags[key] = (bin_n, h) - for k, nh in filetags.items(): + for k, nh in filetags.iteritems(): if k not in globaltags: globaltags[k] = nh tagtypes[k] = tagtype @@ -301,7 +301,7 @@ self.tagscache = {} self._tagstypecache = {} - for k,nh in globaltags.items(): + for k, nh in globaltags.iteritems(): n = nh[0] if n != nullid: self.tagscache[k] = n @@ -343,7 +343,7 @@ def tagslist(self): '''return a list of tags ordered by revision''' l = [] - for t, n in self.tags().items(): + for t, n in self.tags().iteritems(): try: r = self.changelog.rev(n) except: @@ -355,7 +355,7 @@ '''return the tags associated with a node''' if not self.nodetagscache: self.nodetagscache = {} - for t, n in self.tags().items(): + for t, n in self.tags().iteritems(): self.nodetagscache.setdefault(n, []).append(t) return self.nodetagscache.get(node, []) @@ -388,7 +388,7 @@ # the branch cache is stored on disk as UTF-8, but in the local # charset internally - for k, v in partial.items(): + for k, v in partial.iteritems(): self.branchcache[util.tolocal(k)] = v self._ubranchcache = partial return self.branchcache @@ -1756,7 +1756,7 @@ # we only need to see a diff. deltamf = mnfst.readdelta(mnfstnode) # For each line in the delta - for f, fnode in deltamf.items(): + for f, fnode in deltamf.iteritems(): f = changedfiles.get(f, None) # And if the file is in the list of files we care # about.