# HG changeset patch
# User Manuel Jacob <me@manueljacob.de>
# Date 1583499345 -3600
#      Fri Mar 06 13:55:45 2020 +0100
# Node ID c77e882038360e3fffa9024e5063f3a746e86362
# Parent  bbfad219e5abcf15e9cd72e96170fdadd3275b09
compat: add iteritems and itervalues

Newer versions of Mercurial that properly support Python 3 have them in
pycompat. For older versions of Mercurial we define them, but only for Python 2.

diff --git a/hggit/compat.py b/hggit/compat.py
--- a/hggit/compat.py
+++ b/hggit/compat.py
@@ -2,6 +2,7 @@
 
 from mercurial import (
     context,
+    pycompat,
     templatekw,
     ui,
     url,
@@ -29,6 +30,13 @@
     quotecommand = hgutil.quotecommand
     binary = hgutil.binary
 
+try:
+    from mercurial.pycompat import iteritems, itervalues
+except ImportError:
+    assert not pycompat.ispy3
+    iteritems = lambda x: x.iteritems()
+    itervalues = lambda x: x.itervalues()
+
 
 def gitvfs(repo):
     """return a vfs suitable to read git related data"""