typing: add `from __future__ import annotations` to remaining source files
Most of these look newer than when the original imports referenced in the
previous commit were dropped, so these weren't covered by the backout. These
were found with:
hg files mercurial hgext hgext3rd -I '**.py' -X '**/thirdparty' \
| xargs grep -L 'from __future__ import annotations'
All of the `__init__.py` files that finds are empty, so those were ignored and
the rest manually edited.
--- a/hgext/purge.py Mon Sep 16 15:36:44 2024 +0200
+++ b/hgext/purge.py Thu Sep 12 16:27:58 2024 -0400
@@ -36,4 +36,7 @@
# extensions which SHIP WITH MERCURIAL. Non-mainline extensions should
# be specifying the version(s) of Mercurial they are tested with, or
# leave the attribute unspecified.
+
+from __future__ import annotations
+
testedwith = b'ships-with-hg-core'
--- a/mercurial/__main__.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/__main__.py Thu Sep 12 16:27:58 2024 -0400
@@ -1,3 +1,6 @@
+from __future__ import annotations
+
+
def run():
from . import demandimport
--- a/mercurial/admin/chainsaw.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/admin/chainsaw.py Thu Sep 12 16:27:58 2024 -0400
@@ -19,6 +19,8 @@
variable (see :hg:`help scripting`).
"""
+from __future__ import annotations
+
import shutil
from ..i18n import _
--- a/mercurial/admin/verify.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/admin/verify.py Thu Sep 12 16:27:58 2024 -0400
@@ -5,6 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import collections
import copy
import functools
--- a/mercurial/admin_commands.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/admin_commands.py Thu Sep 12 16:27:58 2024 -0400
@@ -5,6 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
from .i18n import _
from .admin import chainsaw, verify
from . import error, registrar, transaction
--- a/mercurial/bundlecaches.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/bundlecaches.py Thu Sep 12 16:27:58 2024 -0400
@@ -3,6 +3,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import collections
import typing
--- a/mercurial/revlogutils/concurrency_checker.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/revlogutils/concurrency_checker.py Thu Sep 12 16:27:58 2024 -0400
@@ -1,3 +1,5 @@
+from __future__ import annotations
+
from ..i18n import _
from .. import error
--- a/mercurial/revlogutils/debug.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/revlogutils/debug.py Thu Sep 12 16:27:58 2024 -0400
@@ -6,6 +6,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import collections
import string
--- a/mercurial/revlogutils/randomaccessfile.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/revlogutils/randomaccessfile.py Thu Sep 12 16:27:58 2024 -0400
@@ -3,6 +3,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import contextlib
from ..i18n import _
--- a/mercurial/revlogutils/rewrite.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/revlogutils/rewrite.py Thu Sep 12 16:27:58 2024 -0400
@@ -7,6 +7,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import binascii
import contextlib
import os
--- a/mercurial/stabletailgraph/stabletailsort.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/stabletailgraph/stabletailsort.py Thu Sep 12 16:27:58 2024 -0400
@@ -19,6 +19,8 @@
optimised to operate on large production graphs.
"""
+from __future__ import annotations
+
import itertools
from ..node import nullrev
from .. import ancestor
--- a/mercurial/typelib.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/typelib.py Thu Sep 12 16:27:58 2024 -0400
@@ -5,6 +5,8 @@
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+from __future__ import annotations
+
import typing
from typing import (
--- a/mercurial/upgrade_utils/auto_upgrade.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/upgrade_utils/auto_upgrade.py Thu Sep 12 16:27:58 2024 -0400
@@ -4,6 +4,9 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+
+from __future__ import annotations
+
from ..i18n import _
from .. import (
--- a/mercurial/utils/memorytop.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/utils/memorytop.py Thu Sep 12 16:27:58 2024 -0400
@@ -5,6 +5,8 @@
# memorytop in strategic places to show the current memory use by allocation
# site.
+from __future__ import annotations
+
import gc
import tracemalloc
--- a/mercurial/utils/urlutil.py Mon Sep 16 15:36:44 2024 +0200
+++ b/mercurial/utils/urlutil.py Thu Sep 12 16:27:58 2024 -0400
@@ -4,6 +4,9 @@
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
+
+from __future__ import annotations
+
import os
import re as remod
import socket