1010
1111import logging
1212
13- # typing -------------------------------------------------------------------
14-
15- from typing import TYPE_CHECKING , Union
16-
17- from git .types import Commit_ish
18-
19- if TYPE_CHECKING :
20- from git .repo import Repo
21- from git .util import IterableList
22-
23- # ----------------------------------------------------------------------------
24-
2513__all__ = ["RootModule" , "RootUpdateProgress" ]
2614
2715log = logging .getLogger ('git.objects.submodule.root' )
@@ -54,7 +42,7 @@ class RootModule(Submodule):
5442
5543k_root_name = '__ROOT__'
5644
57- def __init__ (self , repo : 'Repo' ):
45+ def __init__ (self , repo ):
5846# repo, binsha, mode=None, path=None, name = None, parent_commit=None, url=None, ref=None)
5947super (RootModule , self ).__init__ (
6048repo ,
@@ -67,17 +55,15 @@ def __init__(self, repo: 'Repo'):
6755branch_path = git .Head .to_full_path (self .k_head_default )
6856 )
6957
70- def _clear_cache (self )-> None :
58+ def _clear_cache (self ):
7159"""May not do anything"""
7260pass
7361
7462#{Interface
7563
76- def update (self , previous_commit : Union [Commit_ish , None ] = None , # type: ignore[override]
77- recursive : bool = True , force_remove : bool = False , init : bool = True ,
78- to_latest_revision : bool = False , progress : Union [None , 'RootUpdateProgress' ] = None ,
79- dry_run : bool = False , force_reset : bool = False , keep_going : bool = False
80- ) -> 'RootModule' :
64+ def update (self , previous_commit = None , recursive = True , force_remove = False , init = True ,
65+ to_latest_revision = False , progress = None , dry_run = False , force_reset = False ,
66+ keep_going = False ):
8167"""Update the submodules of this repository to the current HEAD commit.
8268 This method behaves smartly by determining changes of the path of a submodules
8369 repository, next to changes to the to-be-checked-out commit or the branch to be
@@ -142,8 +128,8 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
142128previous_commit = repo .commit (previous_commit ) # obtain commit object
143129# END handle previous commit
144130
145- psms : 'IterableList[Submodule]' = self .list_items (repo , parent_commit = previous_commit )
146- sms : 'IterableList[Submodule]' = self .list_items (repo )
131+ psms = self .list_items (repo , parent_commit = previous_commit )
132+ sms = self .list_items (repo )
147133spsms = set (psms )
148134ssms = set (sms )
149135
@@ -176,8 +162,8 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
176162csms = (spsms & ssms )
177163len_csms = len (csms )
178164for i , csm in enumerate (csms ):
179- psm : 'Submodule' = psms [csm .name ]
180- sm : 'Submodule' = sms [csm .name ]
165+ psm = psms [csm .name ]
166+ sm = sms [csm .name ]
181167
182168# PATH CHANGES
183169##############
@@ -357,7 +343,7 @@ def update(self, previous_commit: Union[Commit_ish, None] = None,
357343
358344return self
359345
360- def module (self )-> 'Repo' :
346+ def module (self ):
361347""":return: the actual repository containing the submodules"""
362348return self .repo
363349#} END interface
0 commit comments