T&1^hn7 d dl Z d dlmZ d dlmZ d dlmZ d dlZd dlm Z m Z mZmZ d dl mZ er$ddlmZ d d lmZ d d lmZ d dlmZ d dl mZ d d lmZ dZdedefdZdedefdZdddeddfdZde d deddfdZ G d de ZdS ) N)InvalidGitRepositoryError)GitConfigParser)BytesIO)AnySequence TYPE_CHECKINGUnion)PathLike ) Submodule) ReferenceType)Repo)Head)Remote)RemoteReference) sm_sectionsm_namemkheadfind_first_remote_branchSubmoduleConfigParsernamereturnc d| dS )z=:return: section title used in .gitmodules configuration filezsubmodule "" )r s l/builddir/build/BUILD/cloudlinux-venv-1.0.10/venv/lib/python3.11/site-packages/git/objects/submodule/util.pyr r " s sectionc > | } | dd S )z>:return: name of the submodule as parsed from the section name )strip)r s r r r ' s mmooG2b5>r repor pathr c f t j | t j | S )z!:return: New branch/head instance)gitr to_full_path)r# r$ s r r r - s$ 8D#(//55666r remotesr branch_namer c n | D ]!} |j | c S # t $ r Y w xY wt d|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 r r r 2 s` ;{++++ H $$`cn$n o oos ""c L e Zd ZdZdededdf fdZdd Zd d Zd fdZ xZ S )r aX 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 argskwargsr Nc r d | _ d | _ d| _ t t | j |i | d S )NT)_smref_index_auto_writesuperr __init__)selfr/ r0 __class__s r r6 zSubmoduleConfigParser.__init__O sB ?C3#T**3TDVDDDDDr submoduler c 8 t j | | _ dS )z`Set this instance's submodule. It must be called before the first write operation beginsN)weakrefrefr2 )r7 r9 s r set_submodulez#SubmoduleConfigParser.set_submoduleV s k),,r c | j J t | j t rJ | }|M| j }||j j }| |j g| j | dS dS )z4Flush changes in our configuration file to the indexN)write)r2 isinstance_file_or_filesr r3 r# indexaddk_modules_filer4 _clear_cache)r7 smrB s r flush_to_indexz$SubmoduleConfigParser.flush_to_index[ s {&&&d17;;;;; [[]] >KE} IIr()1AIBBBOO >r c ~ t t | }| |S )N)r5 r r? rG )r7 rvalr8 s r r? zSubmoduleConfigParser.writen s6 0$77==??r )r9 r r N)r N) __name__ __module____qualname____doc__r r6 r= rG r? __classcell__)r8 s @r r r D s Ec ES ET E E E E E E- - - - & r r )r&