
    64%e&                         d dl mZmZ ddlmZmZ d dlmZmZm	Z	m
Z
mZmZ d dlmZmZmZ erd dlmZ dgZded	ef         d
ed	ef         fdZ G d deee          ZdS )    )	LazyMixinIterableObj   )SymbolicReferenceT_References)AnyCallableIteratorTypeUnionTYPE_CHECKING)
Commit_ishPathLike_T)Repo	Referencefunc.returnc                 V     dt           dt          dt          f fd} j        |_        |S )zOA decorator raising a TypeError if we are not a valid remote, based on the pathselfargsr   c                 l    |                                  st          d| j        z             | g|R  S )Nz1ref path does not point to a remote reference: %s)	is_remote
ValueErrorpath)r   r   r   s     2lib/python3.11/site-packages/git/refs/reference.pywrapperz(require_remote_ref_path.<locals>.wrapper   sF    ~~ 	^PSWS\\]]]tD 4        )r   r   r   __name__)r   r   s   ` r   require_remote_ref_pathr       sG    !l !3 !2 ! ! ! ! ! ! }GNr   c                   `    e Zd ZdZdZdZdZdZdddded	e	d
df fdZ
d
efdZ	 ddeedef         deedf         d
d f fdZed
efd            Ze	 ddee         dddeedf         deded
ee         fd            Zeed
efd                        Zeed
efd                        Z xZS )r   zRepresents a named reference to any object. Subclasses may apply restrictions though,
    i.e. Heads can only point to commits. FTrefsrepor   r   
check_pathr   Nc                     |rIt          |                              | j        dz             st          d| j        j        d|           |  t          t          |                               ||           dS )ab  Initialize this instance

        :param repo: Our parent repository
        :param path:
            Path relative to the .git/ directory pointing to the ref in question, i.e.
            refs/heads/master
        :param check_path: if False, you can provide any path. Otherwise the path must start with the
            default path prefix of this type./zCannot instantiate z from path N)	str
startswith_common_path_defaultr   	__class__r   superr   __init__)r   r$   r   r%   r+   s       r   r-   zReference.__init__2   s      	ac$ii2243Ls3RSS 	a_4>3J__Y]__```i''d33333r   c                     | j         S N)name)r   s    r   __str__zReference.__str__@   s
    yr   objectr   logmsgc                     d}|*| j         j        }|j        s|j        | k    r| j        j        }t          t          |                               ||           | | j         j        	                    ||           | S )z[Special version which checks if the head-log needs an update as well

        :return: selfN)
r$   headis_detachedrefcommitbinshar,   r   
set_object
log_append)r   r2   r3   	oldbinshar5   r+   s        r   r:   zReference.set_objectF   s     	9>D# /D(8(8 K.	 	i))&&999  IN%%i888 r   c                     | j                             d          }t          |          dk     r| j         S d                    |dd                   S )zK:return: (shortest) Name of this reference - it may contain path componentsr'         N)r   splitlenjoinr   tokenss     r   r0   zReference.namel   sH    
 %%v;;??9xxqrr
###r   clscommon_pathr   kwargsc                 .    |                      ||          S )zdEquivalent to SymbolicReference.iter_items, but will return non-detached
        references as well.)_iter_items)rE   r$   rF   r   rG   s        r   
iter_itemszReference.iter_itemsv   s     t[111r   c                 F    | j                             d          }|d         S )z
        :return:
            Name of the remote we are a reference of, such as 'origin' for a reference
            named 'origin/master'r'   r?   )r   r@   rC   s     r   remote_namezReference.remote_name   s!     %%ayr   c                 p    | j                             d          }d                    |dd                   S )z:return: Name of the remote head itself, i.e. master.
        :note: The returned name is usually not qualified enough to uniquely identify
            a branchr'   r>   N)r   r@   rB   rC   s     r   remote_headzReference.remote_head   s1     %%xxqrr
###r   )Tr/   )r   
__module____qualname____doc__	__slots___points_to_commits_only_resolve_ref_on_creater*   r   boolr-   r(   r1   r   r   r:   propertyr0   classmethodr   r   r   r
   rJ   r    rL   rN   __classcell__)r+   s   @r   r   r   (   s       - - I#!!4 4V 48 4 4QU 4 4 4 4 4 4     $(" "j"5s:;" c4i " 
	" " " " " "L $c $ $ $ X$  .2	2 	2,	2	2 8T>*	2 		2
 	2 
,		2 	2 	2 [	2 S     X $S $ $ $  X$ $ $ $ $r   N)git.utilr   r   symbolicr   r   typingr   r	   r
   r   r   r   	git.typesr   r   r   git.repor   __all__r    r   r"   r   r   <module>r_      s2          6 5 5 5 5 5 5 5
 G F F F F F F F F F F F F F F F . . . . . . . . . . 
 -

(37"3 
b8I 
 
 
 
 p$ p$ p$ p$ p$!9k p$ p$ p$ p$ p$r   