bookmarks: add the items method to lazyremotenamedict

Summary:
The iteritems method doesn't exist in Python3, add the items one and remove the
pycompat.itermitems wherever we iterate over the lazyremotenamedict.

Reviewed By: quark-zju

Differential Revision: D20926027

fbshipit-source-id: de9d297126e8190f008cb5d09cc5a128d68c2213
This commit is contained in:
Xavier Deguillard 2020-04-10 09:51:25 -07:00 committed by Facebook GitHub Bot
parent 28830035dd
commit c552dd8af8
4 changed files with 5 additions and 8 deletions

View File

@ -1021,7 +1021,7 @@ class remotenames(dict):
if not self._node2marks:
mark2nodes = self.mark2nodes()
self._node2marks = {}
for name, node in pycompat.iteritems(mark2nodes):
for name, node in mark2nodes.items():
self._node2marks.setdefault(node[0], []).append(name)
return self._node2marks
@ -1030,7 +1030,7 @@ class remotenames(dict):
mark2nodes = self.mark2nodes()
self._hoist2nodes = {}
hoist += "/"
for name, node in pycompat.iteritems(mark2nodes):
for name, node in mark2nodes.items():
if name.startswith(hoist):
name = name[len(hoist) :]
self._hoist2nodes[name] = node
@ -1041,7 +1041,7 @@ class remotenames(dict):
mark2nodes = self.mark2nodes()
self._node2hoists = {}
hoist += "/"
for name, node in pycompat.iteritems(mark2nodes):
for name, node in mark2nodes.items():
if name.startswith(hoist):
name = name[len(hoist) :]
self._node2hoists.setdefault(node[0], []).append(name)
@ -1195,7 +1195,7 @@ class lazyremotenamedict(pycompat.Mapping):
self._load()
return self.potentialentries.keys()
def iteritems(self):
def items(self):
"""Iterate over (name, node) tuples"""
if not self.loaded:
self._load()
@ -1203,7 +1203,7 @@ class lazyremotenamedict(pycompat.Mapping):
yield (k, [bin(vtup[0])])
def __iter__(self):
for k, v in self.iteritems():
for k, v in self.items():
yield k
def __len__(self):

View File

@ -1,4 +1,3 @@
#require py2
$ enable remotenames
> mkcommit()
> {

View File

@ -1,4 +1,3 @@
#require py2
#chg-compatible
$ disable treemanifest

View File

@ -1,4 +1,3 @@
#require py2
#chg-compatible
$ disable treemanifest