yL i)dZddgZddlmZmZddlmZddlmZddl m Z dd l m Z dd l mZmZmZmZdd lmZmZerdd lmZdd lmZddlmZdedefdZGdde ZGdde Zy)zcSome ref-based objects. Note the distinction between the :class:`HEAD` and :class:`Head` classes. HEADHead)GitConfigParserSectionConstraint)GitCommandError) join_path) Reference)SymbolicReference)AnySequence TYPE_CHECKINGUnion) Commit_ishPathLike)CommitRemoteReference)RepostringreturncT|jdr|jdr|ddS|S)N"r ) startswithendswith)rs S/mnt/ssd/data/python-lab/Trading/venv/lib/python3.12/site-packages/git/refs/head.py strip_quotesr s, &//#"6a| Mc eZdZUdZdZdZdZded<efddded d ffd Z d e fd Z dde e e efd edede eeed fded df dZxZS)rzqSpecial case of a :class:`~git.refs.symbolic.SymbolicReference` representing the repository's HEAD reference. ORIG_HEADrcommitreporpathrNcz||jk7rtd|jd|t| ||y)NzHEAD instance must point to z, got ) _HEAD_NAME ValueErrorsuper__init__)selfr$r% __class__s rr*z HEAD.__init__2s3 4?? "Z^_` ` t$rcBt|j|jS)z :return: :class:`~git.refs.symbolic.SymbolicReference` pointing at the ORIG_HEAD, which is maintained to contain the previous value of HEAD. )r r$_ORIG_HEAD_NAMEr+s r orig_headzHEAD.orig_head7s !D,@,@AArindex working_treepathskwargsc d}|rd}|rd}|rd}|s td |jjj||d|fi||S#t$r}|j dk7rYd}~|Sd}~wwxYw)a.Reset 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: :class:`~git.objects.commit.Commit`, :class:`~git.refs.reference.Reference`, 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 :manpage:`git-reset(1)`. :return: self z--softz--mixedNz--hardz?Cannot reset the working tree if the index is not reset as wellz--r )r(r$gitresetrstatus)r+r#r1r2r3r4modees rr7z HEAD.reset?sF D D !bcc  DIIMM  fdE DV D  xx1}  s*A A-A((A-)rTFN)__name__ __module__ __qualname____doc__r'r. __slots____annotations__rr*r r0rrstrboolr r r7 __classcell__)r,s@rrr&s$J!OI 6@%V%8%T% B,B=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 eefdZy)raA Head is a named reference to a :class:`~git.objects.commit.Commit`. Every Head instance contains a name and a :class:`~git.objects.commit.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]rGr4rNcJd}|rd}|jj|g|y)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 ``False``. z-dz-DN)r6branch)clsr$rGrHr4flags rdeletez Head.deletes( D%u%rremote_reference)rNcddlm}|t||std|z|j 5}|c|j |j |j |jt|jdk(rp|jn_|j|j |j|j|jtj|jddd|S#1swY|SxYw)aConfigure 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: self r rNzIncorrect parameter type: %rr)rEr isinstancer( config_writer remove_optionk_config_remotek_config_remote_reflenoptionsremove_section set_value remote_namer to_full_path remote_head)r+rNrwriters rset_tracking_branchzHead.set_tracking_branchs ,  ' ;K_0];>NNO O   ! V'$$T%9%9:$$T%=%=>v~~'(A-))+  !5!57G7S7ST  ,,%%&6&B&BC    s CDD c ddlm}|j}|j|jr|j|j rt |jt jt|j|j }|jt|j|j|j}||j|Sy)z :return: The remote reference we are tracking, or ``None`` if we are not a tracking branch. r rN) rEr config_reader has_optionrSrTrr$rZr get_valuername)r+rreaderrefremote_refpaths rtracking_branchzHead.tracking_branchs ,##%   T11 2v7H7HIaIa7b !!,v/?/?@X@X/Y"Z[C:_99)FDTDTUYUiUiDjloltlt:uvN"499n= =rnew_pathcd}|rd}|jjj||||jd||_|S)aRename self to a new path. :param new_path: Either a simple name or a path, e.g. ``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 used. z-mz-M/)r$r6rJ_common_path_defaultr%)r+rgrGrLs rrenamez Head.renamesB" D T42#88(C  r)rrc "||d<|ddur|jd|jjj|fi||jjj r|jjS|jj S)aCheck out 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``, :exc:`~git.exc.GitCommandError` will be raised in that situation. :param kwargs: Additional keyword arguments to be passed to git checkout, e.g. ``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+rGr4s rroz Head.checkoutsp6s #;%  JJsO t.v. 99>> % %99>> !99** *r read_onlyc|r|jj}n|jj}t|d|jzS)Nz branch "%s")r$r_rQrrb)r+rsparsers r_config_parserzHead._config_parsersA YY,,.FYY,,.F!)BCCrc&|jdS)z :return: A configuration parser instance constrained to only read this instance's values. Trsrvr/s rr_zHead.config_reader s ""T"22rc&|jdS)z :return: A configuration writer instance with read-and write access to options of this head. Frxryr/s rrQzHead.config_writer(s ""U"33r)F)r;r<r=r>rjrSrT classmethodrBr rMrr]rfrrkrorrrvr_rQr"rrrrs$(O!LQ && &*< &T &]` &ei & &E:Q4RW]>'>!?*x2#+d#+c#+eN>S#+LDD1B?1SD30A340A4rN)r>__all__ git.configrrgit.excrgit.utilr referencer symbolicr typingr r rr git.typesrr git.objectsrgit.refsrgit.reporrArrrr"rrrsm 6 9# '76*"(  W Wtn49n4r