+G[ddlmZmZddlmZddlmZddlmZddl m Z ddl m Z m Z mZmZddlmZmZerdd lmZdd lmZdd lmZd d gZdedefdZGdd eZGdd e ZdS))GitConfigParserSectionConstraint) join_path)GitCommandError)SymbolicReference) Reference)AnySequenceUnion TYPE_CHECKING)PathLike Commit_ish)Repo)CommitRemoteReferenceHEADHeadstringreturncn|dr|dr |ddS|S)N"r) startswithendswith)rs /srv/buildsys-work-dir/castor/build_node/builder-2/WGSG1/unpkd_srcs/cloudlinux-venv-1.0.6/venv/lib/python3.11/site-packages/git/refs/head.py strip_quotesrs> &//#"6"6ad| Mc eZdZdZdZdZdZefdddeffd Zde fd Z dd e e e e fdedede eeed fdeddf dZxZS)rzZSpecial case of a Symbolic Reference as it represents the repository's HEAD reference. ORIG_HEADreporpathc||jkrtd|jd|tt||||dS)NzHEAD instance must point to z, got ) _HEAD_NAME ValueErrorsuperr__init__)selfr#r$ __class__s rr)z HEAD.__init__'s[ 4? " "*Z^Z^_`` ` dD""4... rrc6t|j|jS)z :return: SymbolicReference pointing at the ORIG_HEAD, which is maintained to contain the previous value of HEAD)rr#_ORIG_HEAD_NAMEr*s r orig_headzHEAD.orig_head-s!D,@AAArTFNcommitindex working_treepathskwargsc d}|rd}|rd}|rd}|std |jjj||d|fi|n##t$r}|jdkrYd}~nd}~wwxYw|S)aReset our HEAD to the given commit optionally synchronizing the index and working tree. The reference we refer to will be set to commit as well. :param commit: Commit object, Reference Object or string identifying a revision we should reset HEAD to. :param index: If True, the index will be set to match the given commit. Otherwise it will not be touched. :param working_tree: If True, the working tree will be forcefully adjusted to match the given commit, possibly overwriting uncommitted changes without warning. If working_tree is True, index must be true as well :param paths: Single path or list of paths relative to the git root directory that are to be reset. This allows to partially reset individual files. :param kwargs: Additional arguments passed to git-reset. :return: selfz--softz--mixedNz--hardz?Cannot reset the working tree if the index is not reset as wellz--r)r'r#gitresetrstatus)r*r0r1r2r3r4modees rr7z HEAD.reset3sD  D   dD d !bccc  DIM fdE D DV D D D D   x1}}}}}}  s= A AA)rTFN)__name__ __module__ __qualname____doc__r&r- __slots__rr)rr/r rstrboolr r r7 __classcell__)r+s@rrrsJ!OI6@V8 B,BBBB=C";? ==j"3S89== = Xx1478 =  = ========rc eZdZdZdZdZdZeddddd d d ed e d df dZ de dd dfdZ d e dfdZ dded ed dfdZdd ed e d e dfdZded eefdZd eefdZd eefdZdS)raA Head is a named reference to a Commit. Every Head instance contains a name and a Commit object. Examples:: >>> repo = Repo("/path/to/repo") >>> head = repo.heads[0] >>> head.name 'master' >>> head.commit >>> head.commit.hexsha '1c09f116cbc2cb4100fb6935bb162daa4723f455'z refs/headsremotemergeF)forcer#rheadszUnion[Head, str]rFr4rNc8d}|rd}|jj|g|RdS)zDelete the given heads :param force: If True, the heads will be deleted even if they are not yet merged into the main development stream. Default Falsez-dz-DN)r6branch)clsr#rFrGr4flags rdeletez Head.deletes8  D%u%%%%%%rremote_reference)rNcBddlm}|"t||std|z|5}|n||j||jt| dkr| nX| |j|j | |jt|jdddn #1swxYwY|S)a  Configure this branch to track the given remote reference. This will alter this branch's configuration accordingly. :param remote_reference: The remote reference to track or None to untrack any references :return: selfrrNzIncorrect parameter type: %rr)rDr isinstancer' config_writer remove_optionk_config_remotek_config_remote_reflenoptionsremove_section set_value remote_namer to_full_path remote_head)r*rMrwriters rset_tracking_branchzHead.set_tracking_branchsb ,+++++  ' ;K_0]0] ';>NNOO O   ! ! V'$$T%9:::$$T%=>>>v~~''((A--))+++  !57G7STTT  ,%%&6&BCC                sC DDDc ddlm}|}||jr||jrt |jt t| |j}|jt| |j|j }||j|SdS)zk :return: The remote_reference we are tracking, or None if we are not a tracking branchrrN) rDr config_reader has_optionrRrSrr#rYr get_valuername)r*rreaderrefremote_refpaths rtracking_branchzHead.tracking_branchs ,+++++##%%   T1 2 2 >v7H7HIa7b7b > !!,v/?/?@X/Y/Y"Z"Z[[C:_9)FDTDTUYUiDjDjlolt:u:uvvN"?49n== =trnew_pathcvd}|rd}|jj||||jd||_|S)aRename self to a new path :param new_path: Either a simple name or a path, i.e. new_name or features/new_name. The prefix refs/heads is implied :param force: If True, the rename will succeed even if a head with the target name already exists. :return: self :note: respects the ref log as git commands are usedz-mz-M/)r#r6rI_common_path_defaultr$)r*rfrFrKs rrenamez Head.renamesN  D T4222#888((C  r)rrc ||d<|ddur|d|jjj|fi||jjjr |jjS|jjS)arCheckout this head by setting the HEAD to this reference, by updating the index to reflect the tree we point to and by updating the working tree to reflect the latest index. The command will fail if changed working tree files would be overwritten. :param force: If True, changes to the index and the working tree will be discarded. If False, GitCommandError will be raised in that situation. :param kwargs: Additional keyword arguments to be passed to git checkout, i.e. b='new_branch' to create a new branch at the given spot. :return: The active branch after the checkout operation, usually self unless a new branch has been created. If there is no active branch, as the HEAD is now detached, the HEAD reference will be returned instead. :note: By default it is only allowed to checkout heads - everything else will leave the HEAD detached which is allowed and possible, but remains a special state that some tools might not be able to handle.fF)popr#r6checkouthead is_detached active_branch)r*rFr4s rrnz Head.checkoutsn2s #;%   JJsOOO t..v... 9> % +9> !9* *r read_onlyc|r|j}n|j}t|d|jzS)Nz branch "%s")r#r^rPrra)r*rrparsers r_config_parserzHead._config_parsersK  /Y,,..FFY,,..F!)BCCCrc.|dS)zm :return: A configuration parser instance constrained to only read this instance's valuesTrrrur.s rr^zHead.config_reader s""T"222rc.|dS)zp :return: A configuration writer instance with read-and write access to options of this headFrwrxr.s rrPzHead.config_writers""U"333r)F)r;r<r=r>rirRrS classmethodrAr rLr r\rerrjrnrrrur^rPr"rrrrss66"(O!LQ & & && &*< &T &]` &ei & & &[ &E:Q4RW]:'>!?&x*!+!+d!+c!+eN>S!+!+!+!+HDD1B?1SDDDD30A3333 40A444444rN) git.configrrgit.utilrgit.excrsymbolicr referencer typingr r r r git.typesrrgit.repor git.objectsrgit.refsr__all__r@rrrr"rrrs99999999######'''''' 766666666666********)""""""(((((( 6  RRRRR RRRj`4`4`4`4`49`4`4`4`4`4r