[PATCH 03 of 12 py3] manifest: add __next__ methods for Python 3

Augie Fackler raf at durin42.com
Sun Mar 12 15:49:52 EDT 2017


# HG changeset patch
# User Augie Fackler <augie at google.com>
# Date 1489297400 18000
#      Sun Mar 12 00:43:20 2017 -0500
# Node ID 90450bdc25b4adba9e4941b62f3b77c264636842
# Parent  82cbf9cd26c318c4f3efa2e01d32f226c492cd11
manifest: add __next__ methods for Python 3

Python 3 renamed .next() in the iterator protocol to __next__().

diff --git a/mercurial/manifest.py b/mercurial/manifest.py
--- a/mercurial/manifest.py
+++ b/mercurial/manifest.py
@@ -123,6 +123,8 @@ class lazymanifestiter(object):
         zeropos = data.find('\x00', pos)
         return data[pos:zeropos]
 
+    __next__ = next
+
 class lazymanifestiterentries(object):
     def __init__(self, lm):
         self.lm = lm
@@ -146,6 +148,8 @@ class lazymanifestiterentries(object):
         self.pos += 1
         return (data[pos:zeropos], hashval, flags)
 
+    __next__ = next
+
 def unhexlify(data, extra, pos, length):
     s = data[pos:pos + length].decode('hex')
     if extra:


More information about the Mercurial-devel mailing list