
    .Ph              	       f   U d dl Z g dZe j        dk    re                    d           d dlmZ d dlZd dlmZ d dl	Z	d dl
Z
d dlZd dlmZ d dlZd dlZd dlZd dlZd dlZd dlZd dlZd dlmZmZ d dlZd dlmZmZmZmZmZmZm Z m!Z!m"Z" d d	l#m$Z$m%Z%m&Z&m'Z'm(Z(m)Z)m*Z*m+Z+m,Z,m-Z-m.Z.m/Z/m0Z0m1Z1m2Z2m3Z3m4Z4m5Z5 e1rd d
l6m7Z7 d dl8m9Z9m:Z: d dl;m<Z< d dl=m>Z> d dl?m@Z@mAZAmBZBmCZCmDZDmEZEmFZFmGZGmHZH  e2de3d         d          ZI e
jJ        eK          ZLdeMdeNdeNfdZOdeMdeNdeNfdZP ePdd          ZQ ePdd          ZR e2d          ZSde'deSf         de'deSf         fdZTejU        deDde)eDddf         fd            ZVejU        deMd eMde)d!         fd"            ZWd#eDddfd$ZXd#eDddfd%ZYdnd'e&d(e&d)eZdeZfd*Z[d+eDd,eDdeDfd-Z\e j        dk    rd#eDdeDfd.Z]d#eDdeMfd/Z^e]Z_n
d#eDdeMfd0Z^e^Z_d+eDd,eDdeDfd1Z`dod#eDd3eNdeNfd4Zade/eM         fd5Zbdpd6eMd#e-eD         de,eM         fd7Zcd8e-eM         d#eMdeMfd9Zd eje        d:          d; d2f eje        d<          edd2f eje        d=          edd2f eje        d>ejf                  d? df eje        d@          dA d2ffZge0e0e.eM         e'eNf         df         ehdB<   d#eMdeMfdCZi eje        dD          Zjd#eDdeMfdEZki Zle(eMe-eN         f         ehdF<   dGeMdeNfdHZme5dGddeCd2         fdI            Zne5dGeDdeNfdJ            ZndGe3deDf         deNfdKZndeMfdLZodMe3ejp        dNf         dOe$ddfdPZqe5dqd,ddQeNddfdR            Zre5dqd,eDdQeNdeMfdS            Zrdrd,e3deDf         dQeNde-eD         fdTZrdUe/eM         de,eM         fdVZs G dW dX          Zt G dY dZet          Zu G d[ d\          Zv G d] d^          Zw G d_ d`          Zx G da db          Zy G dc ddey          Zz G de dfe,eI                   Z{eH G dg dheE                      Z| G di dje}          Z~ G dk dle~m          ZdS )s    N)stream_copy	join_pathto_native_path_linuxjoin_path_nativeStatsIndexFileSHA1WriterIterableObjIterableListBlockingLockFileLockFileActorget_user_idassure_directory_existsRemoteProgressCallableRemoteProgressrmtreeunbare_repoHIDE_WINDOWS_KNOWN_ERRORSwin32to_native_path_windows)abstractmethod)wraps)urlsplit
urlunsplit)		LazyMixinLockedFD
bin_to_hexfile_contents_rofile_contents_ro_filepath
hex_to_binmake_sha
to_bin_sha
to_hex_sha)AnyAnyStrBinaryIOCallableDict	GeneratorIOIteratorListOptionalPatternSequenceTupleTYPE_CHECKINGTypeVarUnioncastoverload)Git)GitConfigParserSectionConstraint)Remote)Repo)	Files_TDHas_id_attributeHSH_TDLiteralPathLikeProtocolSupportsIndexTotal_TDruntime_checkableT_IterableObj)r	   r<   T)bound	covariantnamedefaultreturnc                 &   	 t           j        |          }n# t          $ r |cY S w xY wt                              d|            |                                                                }|dv rdS |dv rdS t                              d| ||           |S )zRead a boolean flag from an environment variable.

    :return:
        The flag, or the `default` value if absent or ambiguous.
    zlThe %s environment variable is deprecated. Its effect has never been documented and changes without warning.>    0nofalseF>   1yestrueTz-%s has unrecognized value %r, treating as %r.)osenvironKeyError_loggerwarningstriplower)rG   rH   valueadjusted_values       H/var/www/html/test/jupyter/venv/lib/python3.11/site-packages/git/util.py_read_env_flagr\   s   s    
4     OOv  
 [[]]((**N111u---tOOCT5RYZZZNs    $$c                 B    t           j        dk    ot          | |          S )a  Read a boolean flag from an environment variable on Windows.

    :return:
        On Windows, the flag, or the `default` value if absent or ambiguous.
        On all other operating systems, ``False``.

    :note:
        This only accesses the environment on Windows.
    r   )sysplatformr\   )rG   rH   s     r[   _read_win_env_flagr`      s      <7"D~dG'D'DD    r   HIDE_WINDOWS_FREEZE_ERRORSTfunc.c           	      |     ddl m t                     dddt          dt          dt          f fd            }|S )	ztMethods with this decorator raise :exc:`~git.exc.InvalidGitRepositoryError` if
    they encounter a bare repository.   )InvalidGitRepositoryErrorselfr9   argskwargsrI   c                 Z    | j         j        r dj        z             | g|R i |S )Nz/Method '%s' cannot operate on bare repositories)repobare__name__)rh   ri   rj   rg   rd   s      r[   wrapperzunbare_repo.<locals>.wrapper   sK    9> 	o++,]`d`m,mnnntD*4***6***ra   )excrg   r   r$   rc   )rd   ro   rg   s   ` @r[   r   r      sn     /.....
4[[+h +s +c +a + + + + + + [+ Nra   new_dirc              #      K   t          j                    }t          j        |            	 | V  t          j        |           dS # t          j        |           w xY w)zContext manager to temporarily change directory.

    This is similar to :func:`contextlib.chdir` introduced in Python 3.11, but the
    context manager object returned by a single call to this function is not reentrant.
    N)rR   getcwdchdir)rq   old_dirs     r[   cwdrv      s]       ikkGHW
s   A ArY   )NNNc              #      K   t          j        |           }|t           j        | <   	 dV  |t           j        | = dS |t           j        | <   dS # |t           j        | = n|t           j        | <   w xY w)z=Context manager to temporarily patch an environment variable.N)rR   getenvrS   )rG   rY   	old_values      r[   	patch_envrz      s       	$IBJt)
4   (BJt 
4  (BJt((((s   A !A.pathc                    dt           dt          dt          ddfd}t          j        dk    rt          j        |            dS t          j        dk    rt          j        | |	           dS t          j        | |
           dS )zRemove the given directory tree recursively.

    :note:
        We use :func:`shutil.rmtree` but adjust its behaviour to see whether files that
        couldn't be deleted are read-only. Windows will not remove them in that case.
    functionr{   _excinforI   Nc                     t          j        |t          j                   	  | |           dS # t          $ r"}t
          rddlm}  |d|           | d}~ww xY w)zuCallback for :func:`shutil.rmtree`.

        This works as either a ``onexc`` or ``onerror`` style callback.
        r   )SkipTestz%FIXME: fails with: PermissionError
  N)rR   chmodstatS_IWUSRPermissionErrorr   unittestr   )r}   r{   r~   exr   s        r[   handlerzrmtree.<locals>.handler   s     	t|$$$	HTNNNNN 	 	 	( V------hLLLMMSUU	s   . 
AAAr   )      )onexc)onerror)r'   r?   r$   r^   r_   shutilr   version_info)r{   r   s     r[   r   r      s    ( ( c d    " |wd		W	$	$d'******dG,,,,,,ra   c                     t          j        |           r;t          j        dk    rt	          j        | d           t	          j        |            dS dS )zWEnsure file deleted also on *Windows* where read-only files need special
    treatment.r   i  N)ospisfiler^   r_   rR   r   remover{   s    r[   rmfiler      sP     z$ <7""HT5!!!
	$ ra      sourcedestination
chunk_sizec                     d}	 |                      |          }|                    |           |t          |          z  }t          |          |k     rnQ|S )zCopy all data from the `source` stream into the `destination` stream in chunks
    of size `chunk_size`.

    :return:
        Number of bytes written
    r   )readwritelen)r   r   r   brchunks        r[   r   r      sc     
BJ''%   
c%jju::
"" Ira   apc                     t          |           }|D ]`}t          |          }|s|                    d          r||dd         z  }7|dk    s|                    d          r||z  }X|d|z   z  }a|S )zmJoin path tokens together similar to osp.join, but always use ``/`` instead of
    possibly ``\`` on Windows./rf   NrK   )str
startswithendswith)r   r   r{   bs       r[   r   r     s     q66D 	 	FF 	<< 	AabbEMDDRZZ4==--ZAIDDC!GODDKra   c                 L    t          |           } |                     dd          S )Nr   \r   replacer   s    r[   r   r   $  s!    4yy||C&&&ra   c                 L    t          |           } |                     dd          S )Nr   r   r   r   s    r[   r   r   (  s!    4yy||D#&&&ra   c                      t          |           S N)r   r   s    r[   r   r   /  s    4yyra   c                 6    t          t          | g|R            S )zLike :func:`join_path`, but makes sure an OS native path is returned.

    This is only needed to play it safe on Windows and to ensure nice paths that only
    use ``\``.
    )to_native_pathr   )r   r   s     r[   r   r   5  s"     )A****+++ra   Fis_filec                     |rt          j        |           } t          j        |           st          j        | d           dS dS )a$  Make sure that the directory pointed to by path exists.

    :param is_file:
        If ``True``, `path` is assumed to be a file and handled correctly.
        Otherwise it must be a directory.

    :return:
        ``True`` if the directory was created, ``False`` if it already existed.
    T)exist_okF)r   dirnameisdirrR   makedirs)r{   r   s     r[   r   r   >  sJ      !{4  9T?? 
D4((((t5ra   c                      t           j                            dd           } | r6t          d |                     t           j                  D                       S t          j        dk    rdS dS )NPATHEXTc              3   >   K   | ]}|                                 V  d S r   )upper).0r   s     r[   	<genexpr>z&_get_exe_extensions.<locals>.<genexpr>T  s*      BB1QWWYYBBBBBBra   r   )z.BATz.COMz.EXE )rR   rS   gettuplesplitpathsepr^   r_   )r   s    r[   _get_exe_extensionsr   Q  sb    jnnY--G BBbj(A(ABBBBBB		 	 ''rra   programc                    t                      dt          dt          ffd}g }|st          j        d         }t          |                              t          j                  D ]c}|                    d          }|rJt          j	        ||           gfdD             z   D ]"} ||          r|
                    |           #d|S )a6  Perform a path search to assist :func:`is_cygwin_git`.

    This is not robust for general use. It is an implementation detail of
    :func:`is_cygwin_git`. When a search following all shell rules is needed,
    :func:`shutil.which` can be used instead.

    :note:
        Neither this function nor :func:`shutil.which` will predict the effect of an
        executable search on a native Windows system due to a :class:`subprocess.Popen`
        call without ``shell=True``, because shell and non-shell executable search on
        Windows differ considerably.
    fpathrI   c                      t          j                   oLt          j         t          j                  o-t
          j        dk    p pt           fdD                       S )Nr   c              3   f   K   | ]+}                                                     |          V  ,d S r   )r   r   )r   extr   s     r[   r   z,py_where.<locals>.is_exec.<locals>.<genexpr>p  s;      BwBwcf5;;==CYCYZ]C^C^BwBwBwBwBwBwra   )r   r   rR   accessX_OKr^   r_   any)r   winprog_extss   `r[   is_execzpy_where.<locals>.is_execk  sh    Ju 	%)) 'w|+;wsBwBwBwBwjvBwBwBw?w?w		
ra   PATH"c                     g | ]}|	S r   r   )r   eexe_paths     r[   
<listcomp>zpy_where.<locals>.<listcomp>{  s"    "P"P"PaXXqq#9"P"P"Pra   )r   r   boolrR   rS   r   r   rW   r   joinappend)r   r{   r   progsfolderfr   r   s         @@r[   py_wherer   [  s     '((L
s 
t 
 
 
 
 
 
 E "z&!d))//"*-- $ $c"" 	$x00HZ"P"P"P"P<"P"P"PP $ $71:: $LLOOOLra   drivec                 |   t          j        |          r| s|}n|o7t          j        t          j        t          j        |                              }t          j        |          r| r|}n,t          |          }n| rd|                                 d|}t          |          }|                    dd          S )Nz/proc/cygdrive/r   r   )	r   isabsnormpath
expandvars
expandusercygpathrX   r   r   )r   r{   r   p_strs       r[   
_cygexpathr     s    
y <u < GS\#.1E1E"F"FGG9Q<< 	< AJJ 	< 	<*/++----;AFFE==s###ra   z*\\\\\?\\UNC\\([^\\]+)\\([^\\]+)(?:\\(.*))?c           	      @    d| d|d|                     dd          S )N//r   r   )r   )servershare	rest_paths      r[   <lambda>r     s,     &&&%%%IZIZ[_adIeIeIe*f ra   z\\\\\?\\(\w):[/\\](.*)z(\w):[/\\](.*)z	file:(.*)c                     | S r   r   )r   s    r[   r   r     s    	 ra   z(\w{2,}:.*)c                     | S r   r   )urls    r[   r   r     s    c ra   _cygpath_parsersc                    t          |           } |                     d          s_t          D ]G\  }}}|                    |           }|r* ||                                 } |rt          |           }  nHt          d|           } | S )zJUse :meth:`git.cmd.Git.polish_url` instead, that works on any environment.)z	/cygdriver   z/proc/cygdriveN)r   r   r   matchgroupsr   r   )r{   regexparserrecurser   s        r[   r   r     s    t99D??@AA 	*&6 	* 	*"E67KK%%E vu||~~. )"4==D	 dD))DKra   z(?:/proc)?/cygdrive/(\w)(/.*)?c                     t          |           } t                              |           }|r2|                                \  }}|                                d|pd} |                     dd          S )N:rK   r   r   )r   _decygpath_regexr   r   r   r   )r{   mr   r   s       r[   	decygpathr     sj    t99Dt$$A :88::y++----b9<<T"""ra   _is_cygwin_cachegit_executablec                    t                               |           }|d}	 t          j        |           }|s-t	          |           }|rt          j        |d                   nd}t          j        |d          }t          j        |gt          j        d          }|	                                \  }}d|v }n2# t          $ r%}t                              d|           Y d }~nd }~ww xY w|t           | <   |S )	NFr   rK   unameT)stdoutuniversal_newlinesCYGWINz/Failed checking if running in CYGWIN due to: %r)r   r   r   r   r   r   
subprocessPopenPIPEcommunicate	ExceptionrU   debug)	r   	is_cygwingit_dirres	uname_cmdprocess	uname_out_r   s	            r[   _is_cygwin_gitr    s    $$^44I		Qk.11G =~..14<#+c!f---" '22I &	{:?_cdddG"..00LIq I-II 	Q 	Q 	QMMKRPPPPPPPP	Q+4(s   BB6 6
C% C  C%c                     d S r   r   r   s    r[   is_cygwin_gitr        ;>3ra   c                     d S r   r   r  s    r[   r  r    s    58Sra   c                 f    t           j        dk    rdS | dS t          t          |                     S )Nr   F)r^   r_   r  r   r  s    r[   r  r    s5    
|wu		uc.11222ra   c                  T    t          j                    dt          j                    S )zM:return: String identifying the currently active system user as ``name@node``@)getpassgetuserr_   noder   ra   r[   r   r     s#    o''''99ra   proczGit.AutoInterruptrj   c                       | j         di | dS )zXWait for the process (clone, fetch, pull or push) and handle its errors
    accordingly.Nr   )wait)r  rj   s     r[   finalize_processr    s"     DIra   expand_varsc                     d S r   r   r   r  s     r[   expand_pathr    r  ra   c                     d S r   r   r  s     r[   r  r    s	     Cra   c                 "   t          | t          j                  r|                                 S 	 t	          j        |           } |rt	          j        |           } t	          j        t	          j        |                     S # t          $ r Y d S w xY wr   )

isinstancepathlibPathresolver   r   r   r   abspathr  r  s     r[   r  r    s    !W\"" yy{{N1 	"q!!A|CKNN+++   tts   AB   
BBcmdlinec                    g }t          |           D ]\  }}|                    |           	 t          |          }|j        |j        9|j        4|                    |j                            |j        d                    }|j        4|                    |j                            |j        d                    }t          |          ||<   # t          $ r Y w xY w|S )a>  Parse any command line argument and if one of the elements is an URL with a
    username and/or password, replace them by stars (in-place).

    If nothing is found, this just returns the command line as-is.

    This should be used for every log line that print a command line, as well as
    exception messages.
    Nz*****)netloc)
	enumerater   r   passwordusername_replacer(  r   r   
ValueError)r&  new_cmdlineindexto_parser   s        r[   remove_password_if_presentr1    s     K$W--  x8$$$	8$$C|#(<|'ll#**<*<S\7*S*SlTT|'ll#**<*<S\7*S*SlTT!+CK 	 	 	H	 s   CBC
C! C!c                   F   e Zd ZU dZdZeed<   d  ee          D             \	  ZZ	Z
ZZZZZZee	z  Ze ZdZdZdZ ej        d          Z ej        d	          ZddZded
dfdZd
eegdf         fdZded
dfdZ 	 	 ddede!ee"f         de!ee"df         ded
df
dZ#dS )r   zHandler providing an interface to parse progress information emitted by
    :manpage:`git-push(1)` and :manpage:`git-fetch(1)` and to dispatch callbacks
    allowing subclasses to react to the progress.	   _num_op_codesc                     g | ]}d |z  S )rf   r   )r   xs     r[   r   zRemoteProgress.<listcomp>C  s    ...Aa...ra   zdone.z, )	_cur_line	_seen_opserror_linesother_linesz%(remote: )?([\w\s]+):\s+()(\d+)()(.*)z2(remote: )?([\w\s]+):\s+(\d+)% \((\d+)/(\d+)\)(.*)rI   Nc                 >    g | _         d | _        g | _        g | _        d S r   )r8  r7  r9  r:  rh   s    r[   __init__zRemoteProgress.__init__S  s&    $&(,&(&(ra   linec                    t          |t                    r|                    d          }n|}|| _        | j                            d          r!| j                            | j                   dS d\  }}| j                            |          }|| j	                            |          }|s1| 
                    |           | j                            |           dS d}|                                \  }}}	}}}
|dk    r|| j        z  }n}|dk    r|| j        z  }nl|dk    r|| j        z  }n[|d	k    r|| j        z  }nJ|d
k    r|| j        z  }n9|dk    r|| j        z  }n(|dk    r|| j        z  }n| 
                    |           dS || j        vr$| j                            |           || j        z  }|
d}
|
                                }
|
                    | j                  r'|| j        z  }|
dt5          | j                            }
|
                    | j                  }
|                     ||ot;          |          |ot;          |          |
           dS )a^  Parse progress information from the given line as retrieved by
        :manpage:`git-push(1)` or :manpage:`git-fetch(1)`.

        - Lines that do not contain progress info are stored in :attr:`other_lines`.
        - Lines that seem to contain an error (i.e. start with ``error:`` or ``fatal:``)
          are stored in :attr:`error_lines`.
        zutf-8)zerror:zfatal:N)NNr   zCounting objectszCompressing objectszWriting objectszReceiving objectszResolving deltaszFinding sourceszChecking out filesrK   )r!  bytesdecoder7  r   r9  r   re_op_relativer   re_op_absoluteline_droppedr:  r   COUNTINGCOMPRESSINGWRITING	RECEIVING	RESOLVINGFINDING_SOURCESCHECKING_OUTr8  BEGINrW   r   
DONE_TOKENENDr   TOKEN_SEPARATORupdatefloat)rh   r>  line_str	cur_count	max_countr   op_code_remoteop_name_percentmessages              r[   _parse_progress_linez#RemoteProgress._parse_progress_lineY  s    dE"" 	{{7++HHH!>$$%9:: 	##DN333F)	9#))(33='--h77E 	h'''##H---F DILLNNA(Iy' (((t}$GG---t''GG)))t|#GG+++t~%GG***t~%GG)))t++GG,,,t((GG h''' F $.((N!!'***tz!G ?G --//DO,, 	7txG5T_!5!5 556G-- 455*%	***%	**		
 	
 	
 	
 	
ra   c                 &     dt           ddf fd}|S )z
        :return:
            A progress handler suitable for :func:`~git.cmd.handle_process_output`,
            passing lines on to this progress handler in a suitable format.
        r>  rI   Nc                 R                         |                                           S r   )rZ  rstrip)r>  rh   s    r[   r   z3RemoteProgress.new_message_handler.<locals>.handler  s    ,,T[[]];;;ra   )r%   )rh   r   s   ` r[   new_message_handlerz"RemoteProgress.new_message_handler  s6    	<& 	<T 	< 	< 	< 	< 	< 	<
 ra   c                     dS )zICalled whenever a line could not be understood and was therefore dropped.Nr   )rh   r>  s     r[   rD  zRemoteProgress.line_dropped  s    ra   rK   rU  rS  rT  rY  c                     dS )a  Called whenever the progress changes.

        :param op_code:
            Integer allowing to be compared against Operation IDs and stage IDs.

            Stage IDs are :const:`BEGIN` and :const:`END`. :const:`BEGIN` will only be
            set once for each Operation ID as well as :const:`END`. It may be that
            :const:`BEGIN` and :const:`END` are set at once in case only one progress
            message was emitted due to the speed of the operation. Between
            :const:`BEGIN` and :const:`END`, none of these flags will be set.

            Operation IDs are all held within the :const:`OP_MASK`. Only one Operation
            ID will be active per call.

        :param cur_count:
            Current absolute count of items.

        :param max_count:
            The maximum count of items we expect. It may be ``None`` in case there is no
            maximum number of items or if it is (yet) unknown.

        :param message:
            In case of the :const:`WRITING` operation, it contains the amount of bytes
            transferred. It may possibly be used for other purposes as well.

        :note:
            You may read the contents of the current line in
            :attr:`self._cur_line <_cur_line>`.
        Nr   )rh   rU  rS  rT  rY  s        r[   rP  zRemoteProgress.update  s
    H 	ra   rI   NNrK   )$rn   
__module____qualname____doc__r4  int__annotations__rangerL  rN  rE  rF  rG  rH  rI  rJ  rK  
STAGE_MASKOP_MASKrM  rO  	__slots__recompilerC  rB  r=  r%   rZ  r'   r   r^  rD  r3   rQ  rP  r   ra   r[   r   r   3  s        5 5 M3 	/.}--...
JkGJOI  RZ HIINRZ UVVN) ) ) )W
 W
D W
 W
 W
 W
rXseTk%:          .2$ $$ e$$ eT)*	$
 $ 
$ $ $ $ $ $ra   r   c                   D     e Zd ZdZdZdeddf fdZdededdfd	Z xZ	S )
r   a  A :class:`RemoteProgress` implementation forwarding updates to any callable.

    :note:
        Like direct instances of :class:`RemoteProgress`, instances of this
        :class:`CallableRemoteProgress` class are not themselves directly callable.
        Rather, instances of this class wrap a callable and forward to it. This should
        therefore not be confused with :class:`git.types.CallableProgress`.
    	_callablefnrI   Nc                 V    || _         t                                                       d S r   )rp  superr=  )rh   rq  	__class__s     r[   r=  zCallableRemoteProgress.__init__  s&    ra   ri   rj   c                       | j         |i | d S r   ro  )rh   ri   rj   s      r[   rP  zCallableRemoteProgress.update  s    ''''''ra   )
rn   rc  rd  re  rk  r'   r=  r$   rP  __classcell__rt  s   @r[   r   r     s          I8       (C (3 (4 ( ( ( ( ( ( ( (ra   r   c            
          e Zd ZdZ ej        d          Z ej        d          ZdZdZ	dZ
dZdZd	Zd
Zdee         d	ee         ddfdZdedefdZdedefdZdefdZdefdZdefdZededd fd            Ze	 ddededed         dd fd            Zedded         dd fd            Zedded         dd fd            ZdS )r   zActors hold information about a person acting on the repository. They can be
    committers and authors or anything with a name and an email as mentioned in the git
    log entries.z<(.*)>z(.*) <(.*?)>GIT_AUTHOR_NAMEGIT_AUTHOR_EMAILGIT_COMMITTER_NAMEGIT_COMMITTER_EMAILrG   emailrG   r}  rI   Nc                 "    || _         || _        d S r   r~  )rh   rG   r}  s      r[   r=  zActor.__init__  s    	


ra   otherc                 B    | j         |j         k    o| j        |j        k    S r   r~  rh   r  s     r[   __eq__zActor.__eq__  s    yEJ&D4:+DDra   c                     | |k     S r   r   r  s     r[   __ne__zActor.__ne__  s    EM""ra   c                 8    t          | j        | j        f          S r   )hashrG   r}  r<  s    r[   __hash__zActor.__hash__  s    TY
+,,,ra   c                 "    | j         r| j         ndS rb  )rG   r<  s    r[   __str__zActor.__str__"  s     I-tyy2-ra   c                 (    d| j         d| j        dS )Nz<git.Actor "z <z>">r~  r<  s    r[   __repr__zActor.__repr__%  s     *.)))TZZZ@@ra   stringc                 &   | j                             |          }|r'|                                \  }}t          ||          S | j                            |          }|r#t          |                    d          d          S t          |d          S )zCreate an :class:`Actor` from a string.

        :param string:
            The string, which is expected to be in regular git format::

                John Doe <jdoe@example.com>

        :return:
            :class:`Actor`
        rf   N)name_email_regexsearchr   r   name_only_regexgroup)clsr  r   rG   r}  s        r[   _from_stringzActor._from_string(  s      ''// 	'((**KD%u%%%#**622A /QWWQZZ...&&&ra   env_name	env_emailconfig_reader)Nr7   r8   c                    t          dd          }d dt          ffddt          ffd}d|| j        |fd|| j        ffD ]\  }}}}		 t          j        |         }
t          |||
           ,# t          $ rq |C	 |                    d|          }
n# t          $ r  |	            }
Y nw xY wt          |||
           t          ||          st          || |	                       Y w xY w|S )NrK   rI   c                  (     st                        S r   )r   )user_ids   r[   default_emailz(Actor._main_actor.<locals>.default_emailK  s     (%--Nra   c                  J                                       d          d         S )Nr  r   )r   )r  s   r[   default_namez'Actor._main_actor.<locals>.default_nameQ  s"     =??((--a00ra   rG   r}  user)r   r   	conf_name
conf_emailrR   rS   setattrrT   r   r  getattr)r  r  r  r  actorr  attrevarcvarrH   valr  r  s              @@r[   _main_actorzActor._main_actorA  sl    b"	s 	 	 	 	 	 		1c 	1 	1 	1 	1 	1 	1 Xs}l;i?*
 	4 	4%D$g4j&tS)))) 	4 	4 	4 ,(+//==$ ( ( (%gii(E4---ud++ 4E4333	4 s6   #A11C,>BC,B,)C,+B,,=C,+C,c                 D    |                      | j        | j        |          S )a  
        :return:
            :class:`Actor` instance corresponding to the configured committer. It
            behaves similar to the git implementation, such that the environment will
            override configuration values of `config_reader`. If no value is set at all,
            it will be generated.

        :param config_reader:
            ConfigReader to use to retrieve the values from in case they are not set in
            the environment.
        )r  env_committer_nameenv_committer_emailr  r  s     r[   	committerzActor.committeri  s!     s5s7NP]^^^ra   c                 D    |                      | j        | j        |          S )zSame as :meth:`committer`, but defines the main author. It may be specified
        in the environment, but defaults to the committer.)r  env_author_nameenv_author_emailr  s     r[   authorzActor.authorx  s      s2C4H-XXXra   r   ) rn   rc  rd  re  rl  rm  r  r  r  r  r  r  r  r  rk  r-   r   r=  r$   r   r  r  rf  r  r  r  classmethodr  r3   r  r  r  r   ra   r[   r   r     sI        
 !bj++O!rz/22 (O)-/ IJ!IXc] 8C= T    EC ED E E E E#C #D # # # #-# - - - -. . . . .A# A A A A '# '' ' ' ' ['0 
 NR	% %% % IJ	%
 
% % % [%N _ _e,X&Y _el _ _ _ [_ Y Y5)U#V Ybi Y Y Y [Y Y Yra   r   c                   ^    e Zd ZdZdZdedeeef         ddfdZ	e
dd	d
edd fd            ZdS )r   a  Represents stat information as presented by git at the end of a merge. It is
    created from the output of a diff operation.

    Example::

     c = Commit( sha1 )
     s = c.stats
     s.total         # full-stat-dict
     s.files         # dict( filepath : stat-dict )

    ``stat-dict``

    A dictionary with the following keys and values::

      deletions = number of deleted lines as int
      insertions = number of inserted lines as int
      lines = total number of lines changed as int, or deletions + insertions
      change_type = type of change as str, A|C|D|M|R|T|U|X|B

    ``full-stat-dict``

    In addition to the items in the stat-dict, it features additional information::

     files = number of changed files as int
    totalfilesr  r  rI   Nc                 "    || _         || _        d S r   r  )rh   r  r  s      r[   r=  zStats.__init__  s    



ra   rl   r:   textc                    dddddi d}|                                 D ]}|                    d          \  }}}}|dk    rt          |          pd}	|dk    rt          |          pd}
|d         dxx         |	z  cc<   |d         dxx         |
z  cc<   |d         d	xx         |	|
z   z  cc<   |d         d
xx         dz  cc<   |	|
|	|
z   |d}||d
         |                                <   t	          |d         |d
                   S )zCreate a :class:`Stats` object from output retrieved by
        :manpage:`git-diff(1)`.

        :return:
            :class:`git.Stats`
        r   )
insertions	deletionslinesr  r  	-r  r  r  r  r  rf   )r  r  r  change_type)
splitlinesr   rf  rW   r   )r  rl   r  hshr>  r  raw_insertionsraw_deletionsfilenamer  r  
files_dicts               r[   _list_from_stringzStats._list_from_string  sg    %&AANN
 
 OO%% 	8 	8DEIZZPTEUEUB[.-'3.F3~3F3FK!J%,C]1C1CHqIL&&&*4&&&L%%%2%%%L!!!Z)%;;!!!L!!!Q&!!!(&#i/*	$ $J .8CL))**S\3w<000ra   )rn   rc  rd  re  rk  rB   r(   r?   r;   r=  r  r   r  r   ra   r[   r   r     s         4 #Ih tHh4F/G D     1V 13 17 1 1 1 [1 1 1ra   r   c                   Z    e Zd ZdZdZdeddfdZdedefdZ	de
fd	Zde
fd
ZdefdZdS )r   a  Wrapper around a file-like object that remembers the SHA1 of the data written to
    it. It will write a sha when the stream is closed or if asked for explicitly using
    :meth:`write_sha`.

    Only useful to the index file.

    :note:
        Based on the dulwich project.
    )r   sha1r   rI   Nc                 <    || _         t          d          | _        d S )Nra   )r   r!   r  )rh   r   s     r[   r=  zIndexFileSHA1Writer.__init__  s    SMM			ra   datac                 j    | j                             |           | j                            |          S r   )r  rP  r   r   )rh   r  s     r[   r   zIndexFileSHA1Writer.write  s,    	v||D!!!ra   c                 l    | j                                         }| j                            |           |S r   )r  digestr   r   rh   shas     r[   	write_shazIndexFileSHA1Writer.write_sha  s.    i  S
ra   c                 `    |                                  }| j                                         |S r   )r  r   closer  s     r[   r  zIndexFileSHA1Writer.close  s%    nn
ra   c                 4    | j                                         S r   )r   tellr<  s    r[   r  zIndexFileSHA1Writer.tell  s    v{{}}ra   )rn   rc  rd  re  rk  r*   r=  r%   rf  r   r@  r  r  r  r   ra   r[   r   r     s          I"" " " " " ""& "S " " " "5    
u    
c      ra   r   c                   ^    e Zd ZdZdZdeddfdZddZdefdZ	de
fd	Zdd
ZddZddZdS )r   a  Provides methods to obtain, check for, and release a file based lock which
    should be used to handle concurrent access to the same file.

    As we are a utility class to be derived from, we only use protected methods.

    Locks will automatically be released on destruction.
    
_file_path
_owns_lock	file_pathrI   Nc                 "    || _         d| _        d S )NFr  )rh   r  s     r[   r=  zLockFile.__init__  s    #ra   c                 .    |                                   d S r   )_release_lockr<  s    r[   __del__zLockFile.__del__  s    ra   c                     d| j         z  S )z:return: Path to lockfilez%s.lock)r  r<  s    r[   _lock_file_pathzLockFile._lock_file_path  s    DO,,ra   c                     | j         S )z
        :return:
            True if we have a lock and if the lockfile still exists

        :raise AssertionError:
            If our lock-file does not exist.
        )r  r<  s    r[   	_has_lockzLockFile._has_lock  s     ra   c                 |   |                                  rdS |                                 }t          j        |          rt	          d| j        d|d          	 t          |d          5  	 ddd           n# 1 swxY w Y   n/# t          $ r"}t	          t          |                    |d}~ww xY wd| _	        dS )zCreate a lock file as flag for other instances, mark our instance as
        lock-holder.

        :raise IOError:
            If a lock was already present or a lock file could not be written.
        NzLock for file z did already exist, delete z in case the lock is illegalw)modeT)
r  r  r   r   IOErrorr  openOSErrorr   r  )rh   	lock_filer   s      r[   _obtain_lock_or_raisezLockFile._obtain_lock_or_raise  s    >> 	F((**	:i   	'???III/  
	)ic***                 	) 	) 	)#a&&//q(	) s<   B ,A:.B :A>>B A>B 
B2B--B2c                 *    |                                  S )zThe default implementation will raise if a lock cannot be obtained.

        Subclasses may override this method to provide a different implementation.
        )r  r<  s    r[   _obtain_lockzLockFile._obtain_lock  s    
 ))+++ra   c                     |                                  sdS |                                 }	 t          |           n# t          $ r Y nw xY wd| _        dS )z Release our lock if we have one.NF)r  r  r   r  r  )rh   lfps     r[   r  zLockFile._release_lock!  si    ~~ 	F ""$$	3KKKK 	 	 	D	s   < 
A	A	ra  )rn   rc  rd  re  rk  r?   r=  r  r   r  r   r  r  r  r  r   ra   r[   r   r     s          -I (  t           - - - - -4       0, , , ,           ra   r   c            	       T     e Zd ZdZdZdej        fdedede	ddf fd	Z
d fd
Z xZS )r   a  The lock file will block until a lock could be obtained, or fail after a
    specified timeout.

    :note:
        If the directory containing the lock was removed, an exception will be raised
        during the blocking period, preventing hangs as the lock can never be obtained.
    )_check_interval_max_block_timeg333333?r  check_interval_smax_block_time_srI   Nc                 f    t                                          |           || _        || _        dS )a  Configure the instance.

        :param check_interval_s:
            Period of time to sleep until the lock is checked the next time.
            By default, it waits a nearly unlimited time.

        :param max_block_time_s:
            Maximum amount of seconds we may lock.
        N)rs  r=  r  r  )rh   r  r  r  rt  s       r[   r=  zBlockingLockFile.__init__;  s3     	###//ra   c                 T   t          j                     }|t          | j                  z   }	 	 t                                                       dS # t
          $ r}t          j                     }t          j        t          j        | 	                                                    s,d| 	                                ||z
  fz  }t          |          |||k    r,d||z
  | 	                                fz  }t          |          |t          j
        | j                   Y d}~nd}~ww xY w)zThis method blocks until it obtained the lock, or raises :exc:`IOError` if it
        ran out of time or if the parent directory was not available anymore.

        If this method returns, you are guaranteed to own the lock.
        TzVDirectory containing the lockfile %r was not readable anymore after waiting %g secondsz Waited %g seconds for lock at %rN)timerQ  r  rs  r  r  r   r   r   r  sleepr  )rh   	starttimemaxtimer   curtimemsgrt  s         r[   r  zBlockingLockFile._obtain_lockN  sD    IKK	eD$8999	$$&&&, +  1 1 1 )++yT-A-A-C-C!D!DEE .r,,..)+v C "#,,A- g%%<)+,,..@ C "#,,A-
4/00000000'1	s    A 
D&CD!!D&ra  )rn   rc  rd  re  rk  r^   maxsizer?   rQ  rf  r=  r  rv  rw  s   @r[   r   r   0  s          7I
 #& #	0 00  0 	0
 
0 0 0 0 0 0&                   ra   r   c                        e Zd ZdZdZddededdf fdZddededd	fd
Zdede	fdZ
dedefdZdeeeeef         defdZdeeeeef         dd	fdZ xZS )r
   a  List of iterable objects allowing to query an object by id or by named index::

     heads = repo.heads
     heads.master
     heads['master']
     heads[0]

    Iterable parent objects:

    * :class:`Commit <git.objects.Commit>`
    * :class:`Submodule <git.objects.submodule.base.Submodule>`
    * :class:`Reference <git.refs.reference.Reference>`
    * :class:`FetchInfo <git.remote.FetchInfo>`
    * :class:`PushInfo <git.remote.PushInfo>`

    Iterable via inheritance:

    * :class:`Head <git.refs.head.Head>`
    * :class:`TagReference <git.refs.tag.TagReference>`
    * :class:`RemoteReference <git.refs.remote.RemoteReference>`

    This requires an ``id_attribute`` name to be set which will be queried from its
    contained items to have a means for comparison.

    A prefix can be specified which is to be used in case the id returned by the items
    always contains a prefix that does not matter to the user, so it can be left out.
    _id_attr_prefixrK   id_attrprefixrI   zIterableList[T_IterableObj]c                 F    t                                          |           S r   )rs  __new__)r  r   r  rt  s      r[   r  zIterableList.__new__  s    wws###ra   Nc                 "    || _         || _        d S r   r  )rh   r   r  s      r[   r=  zIterableList.__init__  s    ra   r  c                     	 t                               | |          }|r|S n# t          t          f$ r Y nw xY w	 t	          | t          t          |                     dS # t          t          f$ r Y dS w xY w)NTF)list__contains__AttributeError	TypeErrorr  r4   r   )rh   r  rvals      r[   r  zIterableList.__contains__  s    	$$T400D 	* 	 	 	D	
	D$sD//***4	* 	 	 	55	s   " 66#A A43A4c                     | j         |z   }| D ]}t          || j                  |k    r|c S  t                              | |          S r   )r  r  r  r  __getattribute__)rh   r  items      r[   __getattr__zIterableList.__getattr__  sZ    |d" 	 	DtT]++t33 4 $$T4000ra   r/  c                 ~   t          |t          t          t          f          s
J d            t          |t                    rt                              | |          S t          |t                    rt          d          	 t          | |          S # t          $ r }t          d| j
        |z   z            |d }~ww xY w)N-Index of IterableList should be an int or strzIndex should be an int or strzNo item found with id %r)r!  rf  r   slicer  __getitem__r-  r  r  
IndexErrorr  )rh   r/  r   s      r[   r  zIterableList.__getitem__  s    %#sE!233dd5ddddeS!! 	]##D%000u%% 	]<===]tU+++! ] ] ] !;t|e?S!TUU[\\]s   B 
B<B77B<c                    t          |t          t          f          s
J d            t          t          |          }t          |t                    sVd}| j        |z   }t          |           D ]"\  }}t          || j                  |k    r|} n#|dk    rt          d|z            t          
                    | |           d S )Nr  zItem with name %s not found)r!  rf  r   r4   r  r)  r  r  r  r  __delitem__)rh   r/  delindexrG   ir  s         r[   r  zIterableList.__delitem__  s    %#s,,]].]]]]U##%%% 
	GH<%'D$T??  44//477 HE 8
 2~~ !>!EFFF 	x(((((ra   )rK   )rn   rc  rd  re  rk  r   r  r=  objectr   r  rD   r  r3   rA   rf  r  r  r  rv  rw  s   @r[   r
   r
   r  sA        8 (I$ $c $3 $8U $ $ $ $ $ $  S $     D    $1 1 1 1 1 1]}c5#'E!F ]= ] ] ] ])}c5#'E!F )4 ) ) ) ) ) ) ) )ra   r
   c                       e Zd ZU dZdZeed<   eeddde	de	de
e         fd	                        Zeddde	de	dee         fd
            ZdS )r	   a  Defines an interface for iterable items, so there is a uniform way to retrieve
    and iterate items within the git repository.

    Subclasses:

    * :class:`Submodule <git.objects.submodule.base.Submodule>`
    * :class:`Commit <git.objects.Commit>`
    * :class:`Reference <git.refs.reference.Reference>`
    * :class:`PushInfo <git.remote.PushInfo>`
    * :class:`FetchInfo <git.remote.FetchInfo>`
    * :class:`Remote <git.remote.Remote>`
    r   _id_attribute_rl   r:   ri   rj   rI   c                      t          d          )aS  Find (all) items of this type.

        Subclasses can specify `args` and `kwargs` differently, and may use them for
        filtering. However, when the method is called with no additional positional or
        keyword arguments, subclasses are obliged to to yield all items.

        :return:
            Iterator yielding Items
        To be implemented by SubclassNotImplementedErrorr  rl   ri   rj   s       r[   
iter_itemszIterableObj.iter_items  s     ""ABBBra   c                 v    t          | j                  }|                     | j        |g|R i |           |S )a  Find (all) items of this type and collect them into a list.

        For more information about the arguments, see :meth:`iter_items`.

        :note:
            Favor the :meth:`iter_items` method as it will avoid eagerly collecting all
            items. When there are many items, that can slow performance and increase
            memory usage.

        :return:
            list(Item,...) list of item instances
        r
   r  extendr!  r  rl   ri   rj   out_lists        r[   
list_itemszIterableObj.list_items  sG     ".c.@!A!At=d===f==>>>ra   N)rn   rc  rd  re  rk  r   rg  r  r   r$   r+   rD   r!  r
   r'  r   ra   r[   r	   r	     s           ICf CS CC CH]D[ C C C ^ [C f S C LQ^D_    [  ra   r	   c                   *    e Zd ZdZdedededdfdZdS )IterableClassWatcherzbMetaclass that issues :exc:`DeprecationWarning` when :class:`git.util.Iterable`
    is subclassed.rG   basesclsdictrI   Nc                 |    |D ]8}t          |          t          u r t          j        d| dt          d           9d S )Nz!GitPython Iterable subclassed by zq. Iterable is deprecated due to naming clash since v3.1.18 and will be removed in 4.0.0. Use IterableObj instead.   )
stacklevel)typer)  warningswarnDeprecationWarning)r  rG   r*  r+  bases        r[   r=  zIterableClassWatcher.__init__  se     		 		DDzz1110 0 0 0 '    		 		ra   )rn   rc  rd  re  r   r0   r(   r=  r   ra   r[   r)  r)  	  sN         
C 
 
 
 
 
 
 
 
 
ra   r)  c            	       j    e Zd ZdZdZdZedddededefd	            Zedddededefd
            Z	dS )IterablezDeprecated, use :class:`IterableObj` instead.

    Defines an interface for iterable items, so there is a uniform way to retrieve
    and iterate items within the git repository.
    r   z5attribute that most suitably identifies your instancerl   r:   ri   rj   rI   c                      t          d          )zDeprecated, use :class:`IterableObj` instead.

        Find (all) items of this type.

        See :meth:`IterableObj.iter_items` for details on usage.

        :return:
            Iterator yielding Items
        r  r  r   s       r[   r!  zIterable.iter_items%  s     ""ABBBra   c                 v    t          | j                  }|                     | j        |g|R i |           |S )a  Deprecated, use :class:`IterableObj` instead.

        Find (all) items of this type and collect them into a list.

        See :meth:`IterableObj.list_items` for details on usage.

        :return:
            list(Item,...) list of item instances
        r#  r%  s        r[   r'  zIterable.list_items2  sG     %S%788t=d===f==>>>ra   N)
rn   rc  rd  re  rk  r  r  r$   r!  r'  r   ra   r[   r5  r5    s          ILN
Cf 
CS 
CC 
CC 
C 
C 
C [
C f S C C    [  ra   r5  )	metaclass)r   )Fr   ).)T)r^   __all__r_   r   abcr   
contextlib	functoolsr   r  loggingrR   os.pathr{   r   r"  rl  r   r   r   r  urllib.parser   r   r0  
gitdb.utilr   r   r   r   r   r    r!   r"   r#   typingr$   r%   r&   r'   r(   r)   r*   r+   r,   r-   r.   r/   r0   r1   r2   r3   r4   r5   git.cmdr6   
git.configr7   r8   
git.remoter9   git.repo.baser:   	git.typesr;   r<   r=   r>   r?   r@   rA   rB   rC   rD   	getLoggerrn   rU   r   r   r\   r`   r   rb   rc   r   contextmanagerrv   rz   r   r   rf  r   r   r   r   r   r   r   r   r   r   rm  Ir   rg  r   r   r   r   r  r  r   r   r  r  r1  r   r   r   r   r   r   r   r
   r	   r/  r)  r5  r   ra   r[   <module>rJ     sz   



  * <7NN+,,,                   				         				        - - - - - - - - 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
                                       *  #========!!!!!!""""""
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 u5V/Wcghhh '
H
%
% t     4
ES 
E4 
ED 
E 
E 
E 
E  /./JDQQ //0LdSS  GCLLhsAv& 8CF+;    $  i$(<=     
)C 
) 
)	2B(C 
) 
) 
) 
)- -d - - - -B d      x S Z]    $ x H    $ <7'X '( ' ' ' ''8 ' ' ' ' ' ,NN8      *N, ,h ,8 , , , , ( T d    &Xc]    # #c #(!3 #tCy # # # #L$hsm $3 $3 $ $ $ $. 	
@AA	f	f
 RZ)**Z%@RZ!""Z%8RZbd##&A&ADIRZ//E:E %gclHd:;S@A   # #    $ 2:?@@ #H # # # # # /1 $sHTN*+ 0 0 03 4    . 
 >$ >75> > > > 
 > 
 8( 8t 8 8 8 
 83%h"7 3D 3 3 3 3:S : : : :
5!13F!FG SV [_     
 > >4 >d >T > > > 
 > 
 8 $     

	 	5x( 	t 	xPXGY 	 	 	 	 $s)    Du u u u u u u up( ( ( ( (^ ( ( ((}Y }Y }Y }Y }Y }Y }Y }Y@=1 =1 =1 =1 =1 =1 =1 =1@               FK  K  K  K  K  K  K  K \> > > > >x > > >D_) _) _) _) _)4& _) _) _)D 1 1 1 1 1( 1 1 1h    4   "% % % % %- % % % % % %ra   