Mercurial > hg
comparison hgext/remotefilelog/debugcommands.py @ 43104:74802979dd9d
py3: define and use pycompat.itervalues()
.itervalues() only exists on Python 2. Python 3's equivalent is
.values(). But we don't want to blindly use .values() everywhere
because on Python 2, it will create a list, which will have performance
implications.
This commit introduces pycompat.itervalues() which will call the appropriate
method on the passed object. We update all callers of obj.itervalues()
to pycompat.itervalues(obj) instead.
With this commit, the only source tranforming remaining is for
iteritems(). Victory is near...
Differential Revision: https://phab.mercurial-scm.org/D7013
author | Gregory Szorc <gregory.szorc@gmail.com> |
---|---|
date | Sun, 06 Oct 2019 17:59:15 -0400 |
parents | eef9a2d67051 |
children | 9f70512ae2cf |
comparison
equal
deleted
inserted
replaced
43103:c95b2f40db7c | 43104:74802979dd9d |
---|---|
205 for file in files: | 205 for file in files: |
206 if file == b"repos": | 206 if file == b"repos": |
207 continue | 207 continue |
208 filepath = os.path.join(root, file) | 208 filepath = os.path.join(root, file) |
209 size, firstnode, mapping = parsefileblob(filepath, decompress) | 209 size, firstnode, mapping = parsefileblob(filepath, decompress) |
210 for p1, p2, linknode, copyfrom in mapping.itervalues(): | 210 for p1, p2, linknode, copyfrom in pycompat.itervalues(mapping): |
211 if linknode == nullid: | 211 if linknode == nullid: |
212 actualpath = os.path.relpath(root, path) | 212 actualpath = os.path.relpath(root, path) |
213 key = fileserverclient.getcachekey( | 213 key = fileserverclient.getcachekey( |
214 b"reponame", actualpath, file | 214 b"reponame", actualpath, file |
215 ) | 215 ) |