diff mercurial/subrepo.py @ 52755:5c48fd4c0e68

typing: introduce a `types` module and a MatcherT alias This is a proposal to formalise the way we do typing and do more of it. The initial motivation to make progress is to help break the 100+ module cycle that is slowing pytype a lot.
author Pierre-Yves David <pierre-yves.david@octobus.net>
date Thu, 30 Jan 2025 18:22:01 +0100
parents 5cc8deb96b48
children
line wrap: on
line diff
--- a/mercurial/subrepo.py	Tue Feb 04 14:02:20 2025 -0500
+++ b/mercurial/subrepo.py	Thu Jan 30 18:22:01 2025 +0100
@@ -18,6 +18,9 @@
 import xml.dom.minidom
 
 from .i18n import _
+from .interfaces.types import (
+    MatcherT,
+)
 from .node import (
     bin,
     hex,
@@ -367,7 +370,7 @@
         """handle the files command for this subrepo"""
         return 1
 
-    def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
+    def archive(self, opener, prefix, match: MatcherT, decode=True):
         files = [f for f in self.files() if match(f)]
         total = len(files)
         relpath = subrelpath(self)
@@ -656,7 +659,7 @@
             )
 
     @annotatesubrepoerror
-    def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
+    def archive(self, opener, prefix, match: MatcherT, decode=True):
         self._get(self._state + (b'hg',))
         files = [f for f in self.files() if match(f)]
         rev = self._state[1]
@@ -1913,7 +1916,7 @@
             else:
                 self.wvfs.unlink(f)
 
-    def archive(self, opener, prefix, match: matchmod.basematcher, decode=True):
+    def archive(self, opener, prefix, match: MatcherT, decode=True):
         total = 0
         source, revision = self._state
         if not revision: