id4 ddlZddlmZddlmZddlmZddlZddlm Z m Z m Z m Z ddl mZe r$ddlmZdd lmZdd lmZdd lmZdd lmZdd lmZdZdedefdZdedefdZdddeddfdZde ddeddfdZGddeZdS) N)InvalidGitRepositoryError)GitConfigParser)BytesIO)AnySequence TYPE_CHECKINGUnion)PathLike) Submodule) ReferenceType)Repo)Head)Remote)RemoteReference) sm_sectionsm_namemkheadfind_first_remote_branchSubmoduleConfigParsernamereturncd|dS)z=:return: section title used in .gitmodules configuration filez submodule "")rs O/opt/cloudlinux/venv/lib/python3.11/site-packages/git/objects/submodule/util.pyrr"s   sectionc>|}|ddS)z>:return: name of the submodule as parsed from the section name )strip)rs rrr'smmooG 2b5>rreporpathrcftj|tj|S)z!:return: New branch/head instance)gitr to_full_path)r#r$s rrr-s$ 8D#(//55 6 66rremotesr branch_namercn|D]!} |j|cS#t$rYwxYwtd|z)z_Find the remote branch matching the name of the given branch or raise InvalidGitRepositoryErrorz:Didn't find remote branch '%r' in any of the given remotes)refs IndexErrorr)r(r)remotes rrr2s` ;{+ + + +    H  $$`cn$n o oos  ""cLeZdZdZdededdffd Zd d Zd d Zd fd ZxZ S)raX Catches calls to _write, and updates the .gitmodules blob in the index with the new data, if we have written into a stream. Otherwise it will add the local file to the index to make it correspond with the working tree. Additionally, the cache must be cleared Please note that no mutating method will work in bare mode argskwargsrNcrd|_d|_d|_tt|j|i|dS)NT)_smref_index _auto_writesuperr__init__)selfr/r0 __class__s rr6zSubmoduleConfigParser.__init__OsB?C  3#T**3TDVDDDDDr submoduler c8tj||_dS)z`Set this instance's submodule. It must be called before the first write operation beginsN)weakrefrefr2)r7r9s r set_submodulez#SubmoduleConfigParser.set_submoduleVsk),, rc|jJt|jtrJ|}|M|j}| |jj}||jg|j | dSdS)z4Flush changes in our configuration file to the indexN)write) r2 isinstance_file_or_filesrr3r#indexaddk_modules_filer4 _clear_cache)r7smrBs rflush_to_indexz$SubmoduleConfigParser.flush_to_index[s{&&&d17;;;;; [[]] >KE}  IIr()1AI B B B OO      >rc~tt|}||S)N)r5rr?rG)r7rvalr8s rr?zSubmoduleConfigParser.writens60$77==??  r)r9r rN)rN) __name__ __module__ __qualname____doc__rr6r=rGr? __classcell__)r8s@rrrDsEcESETEEEEEE----    &rr)r&git.excr git.configriorr;typingrrrr git.typesr baser r git.reporgit.refsrrr__all__strrrrrrrrrrYs ------&&&&&& 766666666666)%%%%%%(((((( !S!S!!!! SS 77x7F7777 phx&8 ps pO` p p p p$-----O-----r