# HG changeset patch # User Gregory Szorc # Date 1645472568 25200 # Node ID fd5b8e696b75d0f9db748c48b6e2e8d81ea1d880 # Parent 2974cdda819b13bb789251e3394ea1d9b6ccbfed py3: stop using util.iterfile() The Python 3 implementation is a no-op. So this is equivalent. We still keep util.iterfile() around for backwards API compatibility to help the Python 3 migration. It can be deleted in a future release. Differential Revision: https://phab.mercurial-scm.org/D12347 diff -r 2974cdda819b -r fd5b8e696b75 hgext/convert/common.py --- a/hgext/convert/common.py Thu Mar 03 07:56:47 2022 -0800 +++ b/hgext/convert/common.py Mon Feb 21 12:42:48 2022 -0700 @@ -552,7 +552,7 @@ if err.errno != errno.ENOENT: raise return - for i, line in enumerate(util.iterfile(fp)): + for i, line in enumerate(fp): line = line.splitlines()[0].rstrip() if not line: # Ignore blank lines diff -r 2974cdda819b -r fd5b8e696b75 hgext/convert/convcmd.py --- a/hgext/convert/convcmd.py Thu Mar 03 07:56:47 2022 -0800 +++ b/hgext/convert/convcmd.py Mon Feb 21 12:42:48 2022 -0700 @@ -242,7 +242,7 @@ m = {} try: fp = open(path, b'rb') - for i, line in enumerate(util.iterfile(fp)): + for i, line in enumerate(fp): line = line.splitlines()[0].rstrip() if not line: # Ignore blank lines diff -r 2974cdda819b -r fd5b8e696b75 mercurial/match.py --- a/mercurial/match.py Thu Mar 03 07:56:47 2022 -0800 +++ b/mercurial/match.py Mon Feb 21 12:42:48 2022 -0700 @@ -1611,7 +1611,7 @@ patterns = [] fp = open(filepath, b'rb') - for lineno, line in enumerate(util.iterfile(fp), start=1): + for lineno, line in enumerate(fp, start=1): if b"#" in line: global _commentre if not _commentre: diff -r 2974cdda819b -r fd5b8e696b75 mercurial/patch.py --- a/mercurial/patch.py Thu Mar 03 07:56:47 2022 -0800 +++ b/mercurial/patch.py Mon Feb 21 12:42:48 2022 -0700 @@ -1259,7 +1259,7 @@ # Remove comment lines patchfp = open(patchfn, 'rb') ncpatchfp = stringio() - for line in util.iterfile(patchfp): + for line in patchfp: line = util.fromnativeeol(line) if not line.startswith(b'#'): ncpatchfp.write(line) @@ -2343,7 +2343,7 @@ ui.debug(b'Using external patch tool: %s\n' % cmd) fp = procutil.popen(cmd, b'rb') try: - for line in util.iterfile(fp): + for line in fp: line = line.rstrip() ui.note(line + b'\n') if line.startswith(b'patching file '): diff -r 2974cdda819b -r fd5b8e696b75 mercurial/store.py --- a/mercurial/store.py Thu Mar 03 07:56:47 2022 -0800 +++ b/mercurial/store.py Mon Feb 21 12:42:48 2022 -0700 @@ -661,7 +661,7 @@ """make sure there is no empty string in entries""" if b'' in self.entries: fp.seek(0) - for n, line in enumerate(util.iterfile(fp)): + for n, line in enumerate(fp): if not line.rstrip(b'\n'): t = _(b'invalid entry in fncache, line %d') % (n + 1) if warn: