dict.iterkeys() is not present on Python 3.
Details
Details
Diff Detail
Diff Detail
- Repository
- rHG Mercurial
- Lint
Automatic diff as part of commit; lint not applicable. - Unit
Automatic diff as part of commit; unit tests not applicable.
hg-reviewers |
dict.iterkeys() is not present on Python 3.
Automatic diff as part of commit; lint not applicable. |
Automatic diff as part of commit; unit tests not applicable. |
Path | Packages | |||
---|---|---|---|---|
M | hgext/remotefilelog/basepack.py (2 lines) | |||
M | hgext/remotefilelog/fileserverclient.py (2 lines) | |||
M | hgext/remotefilelog/remotefilelog.py (2 lines) | |||
M | hgext/remotefilelog/repack.py (4 lines) |
else: | else: | ||||
params = indexparams(SMALLFANOUTPREFIX, self.VERSION) | params = indexparams(SMALLFANOUTPREFIX, self.VERSION) | ||||
fanouttable = [EMPTYFANOUT] * params.fanoutcount | fanouttable = [EMPTYFANOUT] * params.fanoutcount | ||||
# Precompute the location of each entry | # Precompute the location of each entry | ||||
locations = {} | locations = {} | ||||
count = 0 | count = 0 | ||||
for node in sorted(self.entries.iterkeys()): | for node in sorted(self.entries): | ||||
location = count * self.INDEXENTRYLENGTH | location = count * self.INDEXENTRYLENGTH | ||||
locations[node] = location | locations[node] = location | ||||
count += 1 | count += 1 | ||||
# Must use [0] on the unpack result since it's always a tuple. | # Must use [0] on the unpack result since it's always a tuple. | ||||
fanoutkey = struct.unpack(params.fanoutstruct, | fanoutkey = struct.unpack(params.fanoutstruct, | ||||
node[:params.fanoutprefix])[0] | node[:params.fanoutprefix])[0] | ||||
if fanouttable[fanoutkey] == EMPTYFANOUT: | if fanouttable[fanoutkey] == EMPTYFANOUT: |
self.ui.progress(_downloading, 0, total=count) | self.ui.progress(_downloading, 0, total=count) | ||||
missed = [] | missed = [] | ||||
count = 0 | count = 0 | ||||
while True: | while True: | ||||
missingid = cache.receiveline() | missingid = cache.receiveline() | ||||
if not missingid: | if not missingid: | ||||
missedset = set(missed) | missedset = set(missed) | ||||
for missingid in idmap.iterkeys(): | for missingid in idmap: | ||||
if not missingid in missedset: | if not missingid in missedset: | ||||
missed.append(missingid) | missed.append(missingid) | ||||
self.ui.warn(_("warning: cache connection closed early - " + | self.ui.warn(_("warning: cache connection closed early - " + | ||||
"falling back to server\n")) | "falling back to server\n")) | ||||
break | break | ||||
if missingid == "0": | if missingid == "0": | ||||
break | break | ||||
if missingid.startswith("_hits_"): | if missingid.startswith("_hits_"): |
allparents.add(p1) | allparents.add(p1) | ||||
if p2 != nullid: | if p2 != nullid: | ||||
parents.append(p2) | parents.append(p2) | ||||
allparents.add(p2) | allparents.add(p2) | ||||
# Breadth first traversal to build linkrev graph | # Breadth first traversal to build linkrev graph | ||||
parentrevs = collections.defaultdict(list) | parentrevs = collections.defaultdict(list) | ||||
revmap = {} | revmap = {} | ||||
queue = collections.deque(((None, n) for n in parentsmap.iterkeys() | queue = collections.deque(((None, n) for n in parentsmap | ||||
if n not in allparents)) | if n not in allparents)) | ||||
while queue: | while queue: | ||||
prevrev, current = queue.pop() | prevrev, current = queue.pop() | ||||
if current in revmap: | if current in revmap: | ||||
if prevrev: | if prevrev: | ||||
parentrevs[prevrev].append(revmap[current]) | parentrevs[prevrev].append(revmap[current]) | ||||
continue | continue | ||||
This can be reduced to list(entries).