
    chͫ              	          % S SK r / SQr\ R                  S:X  a  \R                  S5        S SKJr  S SKrS SKJr  S SK	r	S SK
r
S SKrS SKJr  S SKrS SKrS SKrS SKrS SKrS SKrS SKrS SKJrJr  S SKrS SKJrJrJrJrJrJrJ r J!r!J"r"  S S	K#J$r$J%r%J&r&J'r'J(r(J)r)J*r*J+r+J,r,J-r-J.r.J/r/J0r0J1r1J2r2J3r3J4r4J5r5  \1(       a  S S
K6J7r7  S SK8J9r9J:r:  S SK;J<r<  S SK=J>r>  S SK?J@r@JArAJBrBJCrCJDrDJErEJFrFJGrGJHrH  \2" S\3S   SS9rI\
R                  " \K5      rLS\MS\NS\N4S jrOS\MS\NS\N4S jrP\P" SS5      rQ\P" SS5      rR\2" S5      rSS\'S\S4   S\'S\S4   4S jrT\R                  S\DS\)\DSS4   4S j5       rV\R                  S\MS \MS\)S!   4S" j5       rWS#\DSS4S$ jrXS#\DSS4S% jrYSmS&\&S'\&S(\ZS\Z4S) jjr[S*\DS+\DS\D4S, jr\\ R                  S:X  a  S#\DS\D4S- jr]S#\DS\M4S. jr^\]r_OS#\DS\M4S/ jr^\^r_S*\DS+\DS\D4S0 jr`SnS#\DS2\NS\N4S3 jjraS\/\M   4S4 jrbSoS5\MS#\-\D   S\,\M   4S6 jjrcS7\-\M   S#\MS\M4S8 jrd\R                  " S95      S: S14\R                  " S;5      \dS14\R                  " S<5      \dS14\R                  " S=\R                  5      S> S4\R                  " S?5      S@ S144rg\0\0\.\M   \'\N4   S4   \hSA'   S#\MS\M4SB jri\R                  " SC5      rjS#\DS\M4SD jrk0 rl\(\M\-\N   4   \hSE'   SF\MS\N4SG jrm\5SFSS\CS1   4SH j5       rn\5SF\DS\N4SI j5       rnSF\3S\D4   S\N4SJ jrnS\M4SK jroSL\3\R                  SM4   SN\$SS4SO jrq\5SpS+SSP\NSS4SQ jj5       rr\5SpS+\DSP\NS\M4SR jj5       rrSqS+\3S\D4   SP\NS\-\D   4SS jjrrST\/\M   S\,\M   4SU jrs " SV SW5      rt " SX SY\t5      ru " SZ S[5      rv " S\ S]5      rw " S^ S_5      rx " S` Sa5      ry " Sb Sc\y5      rz " Sd Se\,\I   5      r{\H " Sf Sg\E5      5       r| " Sh Si\}5      r~ " Sj Sk\~Sl9rg)r    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                     [         R                  U    n[        R	                  SU 5        UR                  5       R                  5       nUS;   a  gUS;   a  g[        R	                  SXU5        U$ ! [         a    Us $ f = f)zyRead 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       [C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\git/util.py_read_env_flagr\   s   s    

4  OOv
 [[]((*N11--OOCTRYZN  s   A0 0A?>A?c                 L    [         R                  S:H  =(       a    [        X5      $ )zRead 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~d'DD    r   HIDE_WINDOWS_FREEZE_ERRORSTfunc.c           	      l   ^ ^ SSK Jm  [        T 5      SSS[        S[        S[        4UU 4S jj5       nU$ )	zpMethods with this decorator raise :exc:`~git.exc.InvalidGitRepositoryError` if
they encounter a bare repository.   )InvalidGitRepositoryErrorselfr9   argskwargsrI   c                 |   > U R                   R                  (       a  T" STR                  -  5      eT" U /UQ70 UD6$ )Nz/Method '%s' cannot operate on bare repositories)repobare__name__)rh   ri   rj   rg   rd   s      r[   wrapperunbare_repo.<locals>.wrapper   s;    99>>+,]`d`m`m,mnnD*4*6**ra   )excrg   r   r$   rc   )rd   ro   rg   s   ` @r[   r   r      sA     /
4[+h +s +c +a + + Nra   new_dirc              #      #    [         R                  " 5       n[         R                  " U 5         U v   [         R                  " U5        g! [         R                  " U5        f = f7f)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)rr   old_dirs     r[   cwdrw      s@      iikGHHW
s   ,A%A
 A%
A""A%rY   )NNNc              #     #    [         R                  " U 5      nU[         R                  U '    Sv   Uc  [         R                  U 	 gU[         R                  U '   g! Uc  [         R                  U 	 f U[         R                  U '   f = f7f)z=Context manager to temporarily patch an environment variable.N)rR   getenvrS   )rG   rY   	old_values      r[   	patch_envr{      sm      		$IBJJt)

4 (BJJt 

4 (BJJts   *BA )B*BBpathc                    S[         S[        S[        SS4S jn[        R                  S:w  a  [
        R                  " U 5        g[        R                  S:  a  [
        R                  " XS	9  g[
        R                  " XS
9  g)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                     [         R                  " U[        R                  5         U " U5        g! [         a#  n[
        (       a  SSKJn  U" SU 35      Uee SnAff = f)zeCallback 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[   handlerrmtree.<locals>.handler   sT     	t||$	TN 	((-!GtLMSUU	s   0 
AAAr   )      )onexc)onerror)r'   r?   r$   r^   r_   shutilr   version_info)r|   r   s     r[   r   r      sc    ( ( c d " ||wd			W	$d*d,ra   c                     [         R                  " U 5      (       aB  [        R                  S:X  a  [        R
                  " U S5        [        R                  " U 5        gg)zSEnsure 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      s=     zz$<<7"HHT5!
		$ ra   sourcedestination
chunk_sizec                     Sn U R                  U5      nUR                  U5        U[        U5      -  n[        U5      U:  a   U$ MD  )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      sO     
B
J'% 
c%ju:
"I ra   apc                     [        U 5      nU H`  n[        U5      nU(       d  M  UR                  S5      (       a	  X#SS -  nM6  US:X  d  UR                  S5      (       a  X#-  nMX  USU-   -  nMb     U$ )ziJoin 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     sr     q6DF<<abEMDRZ4==--IDC!GOD  Kra   c                 <    [        U 5      n U R                  SS5      $ )Nr   \r   replacer   s    r[   r   r   $  s    4y||C&&ra   c                 <    [        U 5      n U R                  SS5      $ )Nr   r   r   r   s    r[   r   r   (  s    4y||D#&&ra   c                     [        U 5      $ N)r   r   s    r[   r   r   /  s    4yra   c                 ,    [        [        U /UQ76 5      $ )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                     U(       a  [         R                  " U 5      n [         R                  " U 5      (       d  [        R                  " U SS9  gg)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   >  s6     {{4 99T??
D4(ra   c                      [         R                  R                  SS 5      n U (       a/  [        S U R	                  [         R
                  5       5       5      $ [        R                  S:X  a  gg)NPATHEXTc              3   @   #    U  H  oR                  5       v   M     g 7fr   )upper).0r   s     r[   	<genexpr>&_get_exe_extensions.<locals>.<genexpr>T  s     B(A1WWYY(As   r   )z.BATz.COMz.EXE )rR   rS   gettuplesplitpathsepr^   r_   )r   s    r[   _get_exe_extensionsr   Q  sI    jjnnY-GBbjj(ABBB		 'ra   programc                   ^ [        5       mS[        S[        4U4S jjn/ nU(       d  [        R                  S   n[        U5      R                  [        R                  5       Hv  nUR                  S5      nU(       d  M  [        R                  " X@5      nU/T Vs/ s H
  oe< U< 3PM     sn-    H#  nU" U5      (       d  M  UR                  U5        M%     Mx     U$ s  snf )a  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                   >^  [         R                  " T 5      =(       ai    [        R                  " T [        R                  5      =(       a=    [
        R                  S:g  =(       d#    T(       + =(       d    [        U 4S jT 5       5      $ )Nr   c              3   b   >#    U  H$  nTR                  5       R                  U5      v   M&     g 7fr   )r   r   )r   extr   s     r[   r   ,py_where.<locals>.is_exec.<locals>.<genexpr>p  s)     Bwjvcf5;;=CYCYZ]C^C^jvs   ,/)r   r   rR   accessX_OKr^   r_   any)r   winprog_extss   `r[   is_execpy_where.<locals>.is_execk  sW    JJu 		%) 'w|+;wsBwjvBw?w		
ra   PATH")r   r   boolrR   rS   r   r   rW   r   joinappend)	r   r|   r   progsfolderexe_pathefr   s	           @r[   py_wherer   [  s     '(L
s 
t 
 Ezz&!d)//"**-c"6xx0HZ<"P<aXq#9<"PP1::LLO Q	 . L #Qs   C drivec                    [         R                  " U5      (       a
  U (       d  UnOU=(       a>    [         R                  " [         R                  " [         R                  " U5      5      5      n[         R                  " U5      (       a  U (       a  UnO+[        U5      nOU (       a  SU R                  5       < SU< 3n[        U5      nUR                  SS5      $ )Nz/proc/cygdrive/r   r   )	r   isabsnormpath
expandvars
expandusercygpathrX   r   r   )r   r|   r   p_strs       r[   
_cygexpathr     s    
yyu GS\\#..1E"FG99Q<<AJ*/++-;AFE==s##ra   z*\\\\\?\\UNC\\([^\\]+)\\([^\\]+)(?:\\(.*))?c           	      >    SU < SU< SUR                  SS5      < 3$ )N//r   r   )r   )servershare	rest_paths      r[   <lambda>r     s    &%IZIZ[_adIe*fra   z\\\\\?\\(\w):[/\\](.*)z(\w):[/\\](.*)z	file:(.*)c                     U $ r   r   )r   s    r[   r   r     s    	ra   z(\w{2,}:.*)c                     U $ r   r   )urls    r[   r   r     s    cra   _cygpath_parsersc                     [        U 5      n U R                  S5      (       d\  [         HF  u  pnUR                  U 5      nU(       d  M   U" UR	                  5       6 n U(       a  [        U 5      n   U $    [        SU 5      n U $ )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     sv    t9D??@AA&6"E7KK%Euu||~."4=D K '7 dD)DKra   z(?:/proc)?/cygdrive/(\w)(/.*)?c                     [        U 5      n [        R                  U 5      nU(       a2  UR                  5       u  p#UR	                  5       < SU=(       d    S< 3n U R                  SS5      $ )N:rK   r   r   )r   _decygpath_regexr   r   r   r   )r|   mr   r   s       r[   	decygpathr     sS    t9Dt$A88:++-b9<<T""ra   _is_cygwin_cachegit_executablec                    [         R                  U 5      nUGc   Sn [        R                  " U 5      nU(       d-  [	        U 5      nU(       a  [        R                  " US   5      OSn[        R
                  " US5      n[        R                  " U5      R                  5       (       a*  [        R                  " U[        R                  5      (       d$  [        R                  SU S35        U[         U '   U$ [        R                  " U/[        R                   SS9nUR#                  5       u  pgS	U;   nU[         U '   U$ ! [$         a   n[        R                  S
U5         S nAN0S nAff = f)NFr   rK   unamez&Failed checking if running in CYGWIN: z is not an executableT)stdoutuniversal_newlinesCYGWINz/Failed checking if running in CYGWIN due to: %r)r   r   r   r   r   r   pathlibPathr   rR   r   r   rU   debug
subprocessPopenPIPEcommunicate	Exception)	r   	is_cygwingit_dirres	uname_cmdprocess	uname_out_r   s	            r[   _is_cygwin_gitr    s(    $$^4I		Qkk.1G~.14#++c!f-" '2ILL+3355"))Irww:W:W FykQfgh3< 0   &&	{:??_cdG"..0LI I-I ,5(	  	QMMKRPP	Qs   CD< 5<D< <
E&E!!E&c                     g r   r   r   s    r[   is_cygwin_gitr        ;>ra   c                     g r   r   r  s    r[   r  r    s    58ra   c                     [         R                  S[        R                  < SU < 35        [        R                  S:w  a  gU c  g[	        [        U 5      5      $ )Nzsys.platform=z, git_executable=cygwinF)rU   r  r^   r_   r  r   r  s    r[   r  r    sJ    MMM#,,!11B>BTUV
||x		c.122ra   c                  `    [         R                  " 5       < S[        R                  " 5       < 3$ )zM:return: String identifying the currently active system user as ``name@node``@)getpassgetuserr_   noder   ra   r[   r   r     s    oo'99ra   proczGit.AutoInterruptrj   c                 (    U R                   " S0 UD6  g)zTWait for the process (clone, fetch, pull or push) and handle its errors
accordingly.Nr   )wait)r  rj   s     r[   finalize_processr    s     	IIra   expand_varsc                     g r   r   r   r   s     r[   expand_pathr#    r  ra   c                     g r   r   r"  s     r[   r#  r#    s     ra   c                 <   [        U [        R                  5      (       a  U R                  5       $  [        R
                  " U 5      n U(       a  [        R                  " U 5      n [        R                  " [        R                  " U 5      5      $ ! [         a     g f = fr   )

isinstancer   r  resolver   r   r   r   abspathr  r"  s     r[   r#  r#    sl    !W\\""yy{NN1q!A||CKKN++ s   AB 
BBcmdlinec                    / n[        U 5       H  u  p#UR                  U5         [        U5      nUR                  c  UR                  c  M>  UR                  b3  UR                  UR                  R                  UR                  S5      S9nUR                  b3  UR                  UR                  R                  UR                  S5      S9n[        U5      X'   M     U$ ! [         a     M  f = f)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.
z*****)netloc)
	enumerater   r   passwordusername_replacer+  r   r   
ValueError)r)  new_cmdlineindexto_parser   s        r[   remove_password_if_presentr4    s     K$W-8$	8$C||#(<||'ll#***<*<S\\7*SlT||'ll#***<*<S\\7*SlT!+CK .    		s   %CBC
C-,C-c                   l   \ rS rSr% SrSr\\S'   \" \5       V Vs/ s H  nSU-  PM
     snn u	  r	r
rrrrrrr\	\
-  r\) rSrSrSr\R0                  " S	5      r\R0                  " S
5      rSS jrS\SS4S jrS\\/S4   4S jr S\SS4S jr!  SS\S\"\\#4   S\"\\#S4   S\SS4
S jjr$Sr%gs  snn f )r   i;  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_codesrf   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                 <    / U l         S U l        / U l        / U l        g r   )r9  r8  r:  r;  rh   s    r[   __init__RemoteProgress.__init__[  s     $&(,&(&(ra   linec                    [        U[        5      (       a  UR                  S5      nOUnX l        U R                  R	                  S5      (       a&  U R
                  R                  U R                  5        gSu  p4U R                  R                  U5      nUc  U R                  R                  U5      nU(       d-  U R                  U5        U R                  R                  U5        gSnUR                  5       u  pxppJUS:X  a  X`R                  -  nOUS:X  a  X`R                  -  nO{US:X  a  X`R                  -  nOfUS	:X  a  X`R                   -  nOQUS
:X  a  X`R"                  -  nO<US:X  a  X`R$                  -  nO'US:X  a  X`R&                  -  nOU R                  U5        gX`R(                  ;  a)  U R(                  R                  U5        X`R*                  -  nU
c  Sn
U
R-                  5       n
U
R/                  U R0                  5      (       a'  X`R2                  -  nU
S[5        U R0                  5      *  n
U
R-                  U R6                  5      n
U R9                  UU=(       a    [;        U5      U=(       a    [;        U5      U
5        g)a6  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decoder8  r   r:  r   re_op_relativer   re_op_absoluteline_droppedr;  r   COUNTINGCOMPRESSINGWRITING	RECEIVING	RESOLVINGFINDING_SOURCESCHECKING_OUTr9  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_line#RemoteProgress._parse_progress_linea  sA    dE""{{7+HH!>>$$%9::##DNN3)	##))(3=''--h7Eh'##H- DILLNA(y ((}}$G--'''G))||#G++~~%G**~~%G))+++G,,(((G h'  ..(NN!!'*zz!G ?G --/DOO,,xxG5T__!5 56G-- 4 45*%	**%	*		
ra   c                 (   ^  S[         SS4U 4S jjnU$ )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                 B   > TR                  U R                  5       5      $ r   )r\  rstrip)r@  rh   s    r[   r   3RemoteProgress.new_message_handler.<locals>.handler  s    ,,T[[];;ra   )r%   )rh   r   s   ` r[   new_message_handler"RemoteProgress.new_message_handler  s    	<& 	<T 	<
 ra   c                     g)zICalled whenever a line could not be understood and was therefore dropped.Nr   )rh   r@  s     r[   rF  RemoteProgress.line_dropped  s    ra   rW  rU  rV  r[  c                     g)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   rW  rU  rV  r[  s        r[   rR  RemoteProgress.update  s    H 	ra   rI   NNrK   )&rn   
__module____qualname____firstlineno____doc__r7  int__annotations__rangerN  rP  rG  rH  rI  rJ  rK  rL  rM  
STAGE_MASKOP_MASKrO  rQ  	__slots__recompilerE  rD  r>  r%   r\  r'   r   rb  rF  r3   rS  rR  __static_attributes__)r   xs   00r[   r   r   ;  s6   5 M3 }-.-Aa-.
JkGJOI ZZ HINZZ UVN)W
 W
D W
rXseTk%:    .2$$ e$$ eT)*	$
 $ 
$ $C 	/s   B0r   c                   R   ^  \ rS rSrSrSrS\SS4U 4S jjrS\S	\SS4S
 jr	Sr
U =r$ )r   i  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                 .   > Xl         [        TU ]	  5         g r   )rz  superr>  )rh   r{  	__class__s     r[   r>  CallableRemoteProgress.__init__  s    ra   ri   rj   c                 (    U R                   " U0 UD6  g r   ry  )rh   ri   rj   s      r[   rR  CallableRemoteProgress.update  s    ''ra   )rn   rj  rk  rl  rm  rs  r'   r>  r$   rR  rv  __classcell__r~  s   @r[   r   r     sA     I8  (C (3 (4 ( (ra   r   c            
          \ rS rSrSr\R                  " S5      r\R                  " S5      rSr	Sr
SrSrS	rS
rSrS	\\   S
\\   SS4S jrS\S\4S jrS\S\4S jrS\4S jrS\4S jrS\4S jr\S\SS 4S j5       r\ SS\S\S\S   SS 4S jj5       r\SS\S   SS 4S jj5       r\SS\S   SS 4S jj5       r Sr!g) r   i  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                     Xl         X l        g r   r  )rh   rG   r  s      r[   r>  Actor.__init__  s    	
ra   otherc                 t    U R                   UR                   :H  =(       a    U R                  UR                  :H  $ r   r  rh   r  s     r[   __eq__Actor.__eq__!  s'    yyEJJ&D4::+DDra   c                     X:X  + $ r   r   r  s     r[   __ne__Actor.__ne__$  s    ""ra   c                 D    [        U R                  U R                  45      $ r   )hashrG   r  r=  s    r[   __hash__Actor.__hash__'  s    TYY

+,,ra   c                 @    U R                   (       a  U R                   $ S$ ri  )rG   r=  s    r[   __str__Actor.__str__*  s     IItyy-2-ra   c                 @    SU R                   < SU R                  < S3$ )Nz<git.Actor "z <z>">r  r=  s    r[   __repr__Actor.__repr__-  s    *.))TZZ@@ra   stringc                    U R                   R                  U5      nU(       a  UR                  5       u  p4[        X45      $ U R                  R                  U5      nU(       a  [        UR                  S5      S5      $ [        US5      $ )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_stringActor._from_string0  sp       ''/((*KD%%##**62AQWWQZ..&&ra   env_name	env_emailconfig_reader)Nr7   r8   c                   ^^ [        SS5      nS mS[        4U4S jjmS[        4U4S jjnSXR                  U4SX R                  T44 H&  u  pgp [        R
                  U   n
[        XFU
5        M(     U$ ! [         ab    Ub7   UR                  SU5      n
O! [         a
    U	" 5       n
 Of = f[        XFU
5        [        XF5      (       d  [        XFU	" 5       5         M   M  f = f)NrK   rI   c                  *   > T (       d
  [        5       m T $ r   )r   )user_ids   r[   default_email(Actor._main_actor.<locals>.default_emailS  s    %-Nra   c                  6   > T " 5       R                  S5      S   $ )Nr  r   )r   )r  s   r[   default_name'Actor._main_actor.<locals>.default_nameY  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_actorActor._main_actorI  s     b"	s 		1c 	1 X}}l;i?*
%D4jj&S)*
&   	4 ,(+//=$ (%i(E-u++E3 ,	4s6   A77C#BC#B,)C#+B,,0C#"C#c                 P    U R                  U R                  U R                  U5      $ )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[   	committerActor.committerq  s$     s55s7N7NP]^^ra   c                 P    U R                  U R                  U R                  U5      $ )z~Same 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[   authorActor.author  s#     s22C4H4H-XXra   )r  rG   r   )"rn   rj  rk  rl  rm  rt  ru  r  r  r  r  r  r  r  r  rs  r-   r   r>  r$   r   r  r  rn  r  r  r  classmethodr  r3   r  r  r  rv  r   ra   r[   r   r     s   
 jj+Ozz/2 (O)-/ IJ!IXc] 8C= T EC ED E#C #D #-# -. .A# A '# '' ' '0 
 NR	%% % IJ	%
 
% %N _e,X&Y _el _ _ Y5)U#V Ybi Y Yra   r   c                   \    \ rS rSrSrSrS\S\\\	4   SS4S jr
\S	S
S\SS 4S j5       rSrg)r   i  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                     Xl         X l        g r   r  )rh   r  r  s      r[   r>  Stats.__init__  s    

ra   rl   r:   textc                    SSSSS.0 S.nUR                  5        H  nUR                  S5      u  pVpxUS:g  =(       a    [        U5      =(       d    Sn	US:g  =(       a    [        U5      =(       d    Sn
US   S==   U	-  ss'   US   S==   U
-  ss'   US   S	==   X-   -  ss'   US   S
==   S-  ss'   U	U
X-   US.nXS
   UR                  5       '   M     [	        US   US
   5      $ )zqCreate 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   rn  rW   r   )r  rl   r  hshr@  r  raw_insertionsraw_deletionsfilenamer  r  
files_dicts               r[   _list_from_stringStats._list_from_string  s    %&AAN
 OO%DEIZZPTEUB[-'3.F3~3FK!J%,C]1CHqIL&*4&L%2%L!Z%;;!L!Q&!(&#/*	$J .8L)* & S\3w<00ra   )r  r  )rn   rj  rk  rl  rm  rs  rB   r(   r?   r;   r>  r  r   r  rv  r   ra   r[   r   r     s[    4 #Ih tHh4F/G D  1V 13 17 1 1ra   r   c                   j    \ rS rSrSrSrS\SS4S jrS\S\	4S	 jr
S\4S
 jrS\4S jrS\	4S jrSrg)r   i  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                 0    Xl         [        S5      U l        g )Nra   )r   r!   r  )rh   r   s     r[   r>  IndexFileSHA1Writer.__init__  s    SM	ra   datac                 n    U R                   R                  U5        U R                  R                  U5      $ r   )r  rR  r   r   )rh   r  s     r[   r   IndexFileSHA1Writer.write  s'    		vv||D!!ra   c                 p    U R                   R                  5       nU R                  R                  U5        U$ r   )r  digestr   r   rh   shas     r[   	write_shaIndexFileSHA1Writer.write_sha  s)    ii S
ra   c                 Z    U R                  5       nU R                  R                  5         U$ r   )r  r   closer  s     r[   r  IndexFileSHA1Writer.close  s     nn
ra   c                 6    U R                   R                  5       $ r   )r   tellr=  s    r[   r  IndexFileSHA1Writer.tell  s    vv{{}ra   )rn   rj  rk  rl  rm  rs  r*   r>  r%   rn  r   rB  r  r  r  rv  r   ra   r[   r   r     sX     I"" " ""& "S "5 
u 
c ra   r   c                   r    \ rS rSrSrSrS\SS4S jrSS jrS\	4S	 jr
S\4S
 jrSS jrSS jrSS jrSrg)r   i  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                     Xl         SU l        g )NFr  )rh   r  s     r[   r>  LockFile.__init__  s    #ra   c                 $    U R                  5         g r   )_release_lockr=  s    r[   __del__LockFile.__del__  s    ra   c                      SU R                   -  $ )z:return: Path to lockfilez%s.lock)r  r=  s    r[   _lock_file_pathLockFile._lock_file_path  s    DOO,,ra   c                     U R                   $ )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_lockLockFile._has_lock   s     ra   c                 j   U R                  5       (       a  gU R                  5       n[        R                  " U5      (       a  [	        SU R
                  < SU< S35      e [        USS9    SSS5        SU l	        g! , (       d  f       N= f! [         a  n[	        [        U5      5      UeSnAff = f)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_raiseLockFile._obtain_lock_or_raise
  s     >>((*	::i  ??I/ 
	)ic* +
  +* 	)#a&/q(	)s6   !
B +A=-B =
BB B 
B2B--B2c                 "    U R                  5       $ )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_lockLockFile._obtain_lock"  s    
 ))++ra   c                     U R                  5       (       d  gU R                  5       n [        U5        SU l        g! [         a     Nf = f)z Release our lock if we have one.NF)r  r   r   r
  r  )rh   lfps     r[   r  LockFile._release_lock)  sK    ~~ ""$	3K    		s   ; 
AArh  )rn   rj  rk  rl  rm  rs  r?   r>  r  r   r   r   r  r  r  r  rv  r   ra   r[   r   r     sM     -I (  t  - -4 0, ra   r   c            	       p   ^  \ rS rSrSrSrS\R                  4S\S\	S\
SS	4U 4S
 jjjrSU 4S jjrSrU =r$ )r   i8  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                 <   > [         TU ]  U5        X l        X0l        g)zConfigure 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)r}  r>  r  r  )rh   r  r  r  r~  s       r[   r>  BlockingLockFile.__init__C  s     	#//ra   c                 ,  > [         R                   " 5       nU[        U R                  5      -   n  [        TU ]  5         g! [
         a  n[         R                   " 5       n[        R                  " [        R                  " U R                  5       5      5      (       d#  SU R                  5       XA-
  4-  n[        U5      UeXB:  a#  SX!-
  U R                  5       4-  n[        U5      Ue[         R                  " U R                  5         SnAOSnAff = fM  )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.
zVDirectory containing the lockfile %r was not readable anymore after waiting %g secondsz Waited %g seconds for lock at %rN)timerS  r  r}  r  r  r   r   r   r   sleepr  )rh   	starttimemaxtimer   curtimemsgr~  s         r[   r  BlockingLockFile._obtain_lockV  s     IIK	eD$8$899$&, +  1 ))+yyT-A-A-C!DEEr,,.+v C "#,A- %<+,,.@ C "#,A-

4//00'1 s   A   
D
B=DDrh  )rn   rj  rk  rl  rm  rs  r^   maxsizer?   rS  rn  r>  r  rv  r  r  s   @r[   r   r   8  sU     7I
 #& #	00  0 	0
 
0 0&   ra   r   c                      ^  \ rS rSrSrSrSS\S\SS4U 4S jjjrSS\S\SS	4S
 jjrS\	S\
4S jrS\S\4S jrS\\\\\4   S\4S jrS\\\\\4   SS	4S jrSrU =r$ )r
   iz  an  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_prefixid_attrprefixrI   zIterableList[T_IterableObj]c                 "   > [         TU ]  U 5      $ r   )r}  __new__)r  r(  r)  r~  s      r[   r+  IterableList.__new__  s    ws##ra   Nc                     Xl         X l        g r   r%  )rh   r(  r)  s      r[   r>  IterableList.__init__  s    ra   r  c                      [         R                  X5      nU(       a  U$   [	        U [        [        U5      5        g! [        [        4 a     N.f = f! [        [        4 a     gf = f)NTF)list__contains__AttributeError	TypeErrorr  r4   r   )rh   r  rvals      r[   r1  IterableList.__contains__  sm    	$$T0D 	D$sD/* 	* 		 	* 		s    = A AAA&%A&c                     U R                   U-   nU  H   n[        X R                  5      U:X  d  M  Us  $    [        R	                  X5      $ r   )r'  r  r&  r0  __getattribute__)rh   r  items      r[   __getattr__IterableList.__getattr__  sC    ||d"Dt]]+t3  $$T00ra   r2  c                 
   [        U[        5      (       a  [        R                  X5      $ [        U[        5      (       a  [        S5      e [        X5      $ ! [         a!  n[        SU R                  U-   -  5      UeS nAff = f)NzIndex should be an int or strzNo item found with id %r)
r&  rn  r0  __getitem__slicer0  r  r2  
IndexErrorr'  )rh   r2  r   s      r[   r<  IterableList.__getitem__  sy    eS!!##D00u%%<==]t++! ] !;t||e?S!TU[\\]s   
A 
B!A==Bc                 $   [        [        U5      n[        U[        5      (       dV  SnU R                  U-   n[	        U 5       H"  u  pE[        XPR                  5      U:X  d  M   Un  O   US:X  a  [        SU-  5      e[        R                  X5        g )NzItem with name %s not found)
r4   rn  r&  r'  r,  r  r&  r>  r0  __delitem__)rh   r2  delindexrG   ir8  s         r[   rB  IterableList.__delitem__  s    U#%%%H<<%'D$T?4/47 H + 2~ !>!EFF 	(ra   )rK   )rn   rj  rk  rl  rm  rs  r   r+  r>  objectr   r1  rD   r9  r3   rA   rn  r=  r<  rB  rv  r  r  s   @r[   r
   r
   z  s    8 (I$c $3 $8U $ $ S $  D $1 1 1	]}c5#'E!F 	]= 	])}c5#'E!F )4 ) )ra   r
   c                       \ rS rSr% SrSr\\S'   \\	SSS\
S\
S	\\   4S
 j5       5       r\SSS\
S\
S	\\   4S j5       rSrg)r	   i  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                     [        S5      e)a#  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_itemsIterableObj.iter_items  s     ""ABBra   c                 z    [        U R                  5      nUR                  U R                  " U/UQ70 UD65        U$ )aj  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
   rH  extendrN  r  rl   ri   rj   out_lists        r[   
list_itemsIterableObj.list_items  s8     ".c.@.@!At=d=f=>ra   N)rn   rj  rk  rl  rm  rs  r   ro  r  r   r$   r+   rD   rN  r
   rU  rv  r   ra   r[   r	   r	     s     ICf CS CC CH]D[ C  C f S C LQ^D_  ra   r	   c                   2    \ rS rSrSrS\S\S\SS4S jrS	r	g)
IterableClassWatcheri  z^Metaclass that issues :exc:`DeprecationWarning` when :class:`git.util.Iterable`
is subclassed.rG   basesclsdictrI   Nc                 z    U H5  n[        U5      [        L d  M  [        R                  " SU S3[        SS9  M7     g )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)typerX  warningswarnDeprecationWarning)r  rG   rY  rZ  bases        r[   r>  IterableClassWatcher.__init__  s>    DDz117v >0 0 '  ra   r   )
rn   rj  rk  rl  rm  r   r0   r(   r>  rv  r   ra   r[   rX  rX    s(    
C 
 
 
 
ra   rX  c            	       h    \ rS rSrSrSrSr\SSS\S\S	\4S
 j5       r	\SSS\S\S	\4S j5       r
Srg)Iterablei  zDeprecated, 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                     [        S5      e)zDeprecated, use :class:`IterableObj` instead.

Find (all) items of this type.

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

:return:
    Iterator yielding Items
rJ  rK  rM  s       r[   rN  Iterable.iter_items)  s     ""ABBra   c                 z    [        U R                  5      nUR                  U R                  " U/UQ70 UD65        U$ )zDeprecated, 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
rQ  rS  s        r[   rU  Iterable.list_items6  s8     %S%7%78t=d=f=>ra   N)rn   rj  rk  rl  rm  rs  rH  r  r$   rN  rU  rv  r   ra   r[   re  re    sw     ILN
Cf 
CS 
CC 
CC 
C 
C f S C C  ra   re  )	metaclass)i   )Fr   ).)T)r^   __all__r_   r   abcr   
contextlib	functoolsr   r  loggingrR   os.pathr|   r   r   rt  r   r   r  r  urllib.parser   r   r_  
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   contextmanagerrw   r{   r   r   rn  r   r   r   r   r   r   r   r   r   r   ru  Ir   ro  r   r   r   r   r  r  r   r  r  r#  r4  r   r   r   r   r   r   r   r
   r	   r^  rX  re  r   ra   r[   <module>r|     s   * <<7NN+,      	    	     - 
 
 
    * =!"
 
 
 u5V/Wcgh 

H
% t  4
ES 
E4 
ED 
E  //JDQ /0LdS  CLhsAv& 8CF+; $  i$(<=   
)C 
) 
)	2B(C 
) 
)- -d -B d  x S Z] $ x H $ <<7'X '( ''8 ' ' ,N8   *N, ,h ,8 ,( T d &Xc] #c #(!3 #tCy #L$hsm $3 $3 $. 	

@A	f
 ZZ)*Z%@ZZ!"Z%8ZZbdd#&ADIZZ/E:E %gclHd:;S@A # # $ ::?@ #H # # /1 $sHTN*+ 03 4 : 
 >$ >75> > 
 > 
 8( 8t 8 
 83%h"7 3D 3:S :
5!1!13F!FG SV [_  
 >4 >d >T > 
 > 
8 $   

	5x( 	t 	xPXGY 	 $s) Du up(^ ((}Y }Y@=1 =1@   FK  K \>x >D[)4& [)| 1( 1 1h4 "%- %ra   