diff mercurial/subrepoutil.py @ 52645:4cb75772818d

pyupgrade: drop the quoting around type annotations This is the `typing_pep563` fixer in `pyupgrade`. Quoting to delay evaluation hasn't been necessary since adding `from __future__ import annotations` in 1c5810ce737e.
author Matt Harbison <matt_harbison@yahoo.com>
date Mon, 06 Jan 2025 00:30:55 -0500
parents 9d79ffeed7c0
children 5c48fd4c0e68
line wrap: on
line diff
--- a/mercurial/subrepoutil.py	Sun Jan 05 22:26:16 2025 -0500
+++ b/mercurial/subrepoutil.py	Mon Jan 06 00:30:55 2025 -0500
@@ -70,7 +70,7 @@
 Substate = Dict[bytes, Tuple[bytes, bytes, bytes]]
 
 
-def state(ctx: "context.changectx", ui: "uimod.ui") -> Substate:
+def state(ctx: context.changectx, ui: uimod.ui) -> Substate:
     """return a state dict, mapping subrepo paths configured in .hgsub
     to tuple: (source from .hgsub, revision from .hgsubstate, kind
     (key in types dict))
@@ -174,7 +174,7 @@
     return state
 
 
-def writestate(repo: "localrepo.localrepository", state: Substate) -> None:
+def writestate(repo: localrepo.localrepository, state: Substate) -> None:
     """rewrite .hgsubstate in (outer) repo with these subrepo states"""
     lines = [
         b'%s %s\n' % (state[s][1], s)
@@ -185,10 +185,10 @@
 
 
 def submerge(
-    repo: "localrepo.localrepository",
-    wctx: "context.workingctx",
-    mctx: "context.changectx",
-    actx: "context.changectx",
+    repo: localrepo.localrepository,
+    wctx: context.workingctx,
+    mctx: context.changectx,
+    actx: context.changectx,
     overwrite: bool,
     labels: Optional[Any] = None,
 ) -> Substate:
@@ -332,10 +332,10 @@
 
 
 def precommit(
-    ui: "uimod.ui",
-    wctx: "context.workingcommitctx",
-    status: "istatus.Status",
-    match: "matchmod.basematcher",
+    ui: uimod.ui,
+    wctx: context.workingcommitctx,
+    status: istatus.Status,
+    match: matchmod.basematcher,
     force: bool = False,
 ) -> Tuple[List[bytes], Set[bytes], Substate]:
     """Calculate .hgsubstate changes that should be applied before committing
@@ -436,7 +436,7 @@
     return normalized_path
 
 
-def reporelpath(repo: "localrepo.localrepository") -> bytes:
+def reporelpath(repo: localrepo.localrepository) -> bytes:
     """return path to this (sub)repo as seen from outermost repo"""
     parent = repo
     while hasattr(parent, '_subparent'):
@@ -444,13 +444,13 @@
     return repo.root[len(pathutil.normasprefix(parent.root)) :]
 
 
-def subrelpath(sub: "subrepo.abstractsubrepo") -> bytes:
+def subrelpath(sub: subrepo.abstractsubrepo) -> bytes:
     """return path to this subrepo as seen from outermost repo"""
     return sub._relpath
 
 
 def _abssource(
-    repo: "localrepo.localrepository",
+    repo: localrepo.localrepository,
     push: bool = False,
     abort: bool = True,
 ) -> Optional[bytes]:
@@ -501,7 +501,7 @@
         raise error.Abort(_(b"default path for subrepository not found"))
 
 
-def newcommitphase(ui: "uimod.ui", ctx: "context.changectx") -> int:
+def newcommitphase(ui: uimod.ui, ctx: context.changectx) -> int:
     commitphase = phases.newcommitphase(ui)
     substate = getattr(ctx, "substate", None)
     if not substate: