
    ch¶                     v   S r / SQrSSKrSSKrSSKrSSKJrJr  SSKJ	r	J
r
  SSKJrJrJr  SSKJr  SSK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  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*J+r+  SSK,J-r-J.r.J/r/  \'(       a  SSK0J1r1  SSK2J3r3  SSK4J5r5  \.S   r6\Rn                  " \85      r9S\S\S\)\S\ S\4   S4   S\4S jr:\+SSS\4S j5       r;\+S\ S\4   S\4S j5       r;\+S\S\4S j5       r;S\)\ S\4   \S4   S\)\\4   4S jr; " S S\5      r< " S S\\<   5      r= " S S \5      r> " S! S"\\5      r?g)#zHModule implementing a remote object allowing easy access to git remotes.)RemoteProgressPushInfo	FetchInfoRemote    N)Githandle_process_output)defenc
force_text)GitConfigParserSectionConstraintcp)GitCommandError)Head	ReferenceRemoteReferenceSymbolicReferenceTagReference)CallableRemoteProgressIterableListIterableObj	LazyMixinr   	join_path)AnyCallableDictIteratorListNoReturnOptionalSequenceTYPE_CHECKINGTypeUnioncastoverload)AnyGitObjectLiteralPathLike)Commit)UpdateProgress)Repo) !+-*=t?kwargsgitprogressr*   .returnc                 @    Ub  UR                   SS nUS:  a  SU S'   U $ )zAdd the ``--progress`` flag to the given `kwargs` dict if supported by the git
command.

:note:
    If the actual progress in the given progress instance is not given, we do not
    request any progress.

:return:
    Possibly altered `kwargs`
N   )      Tr6   )version_info)r4   r5   r6   vs       ]C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\git/remote.pyadd_progressr?   >   s4     Ra ;!%F: M    c                     g N r6   s    r>   to_progress_instancerE   Y   s    <?r@   c                     g rB   rC   rD   s    r>   rE   rE   ]   s    RUr@   c                     g rB   rC   rD   s    r>   rE   rE   a   s    FIr@   c                 V    [        U 5      (       a  [        U 5      $ U c
  [        5       $ U $ )z]Given the `progress` return a suitable object derived from
:class:`~git.util.RemoteProgress`.)callabler   r   rD   s    r>   rE   rE   e   s2     %h// 
	 Or@   c                   V   \ rS 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\\\\S.r  SS
\S\\S	4   S\SSS\\   S\SS	4S jjr\S\S   4S j5       r\S\\\4   4S j5       r\SSS\SS 4S j5       r \SSS\!S\!S\"4S j5       r#Sr$g	s  snn f )r   v   a8  
Carries information about the result of a push operation of a single head::

    info = remote.push()[0]
    info.flags          # bitflags providing more information about the result
    info.local_ref      # Reference pointing to the local reference that was pushed
                        # It is None if the ref was deleted.
    info.remote_ref_string # path to the remote reference located on the remote side
    info.remote_ref # Remote Reference on the local side corresponding to
                    # the remote_ref_string. It can be a TagReference as well.
    info.old_commit # commit at which the remote_ref was standing before we pushed
                    # it to local_ref.commit. Will be None if an error was indicated
    info.summary    # summary line providing human readable english text about the push
)	local_refremote_ref_stringflags_old_commit_sha_remotesummarypushinfo   r:   r   )Xr/   r0   r.   r,   r1   r-   NrN   rL   rM   remoter   
old_commitrQ   r7   c                 L    Xl         X l        X0l        X@l        XPl        X`l        g)z{Initialize a new instance.

local_ref: HEAD | Head | RemoteReference | TagReference | Reference | SymbolicReference | None
N)rN   rL   rM   rP   rO   rQ   )selfrN   rL   rM   rU   rV   rQ   s          r>   __init__PushInfo.__init__   s$     
"!2)r@   )r)   Nc                     U R                   =(       a/    U R                  R                  R                  U R                   5      =(       d    S $ rB   )rO   rP   repocommitrX   s    r>   rV   PushInfo.old_commit   s4    ##V(9(9(@(@AUAU(V^Z^^r@   c                    U R                   R                  S5      (       a*  [        U R                  R                  U R                   5      $ U R                   R                  S5      (       ao  [        U R                  R                  U R                   5      n[        U R                  R                  S[        U R                  5      < SUR                  < 35      $ [        SU R                   -  5      e)z
:return:
    Remote :class:`~git.refs.reference.Reference` or
    :class:`~git.refs.tag.TagReference` in the local repository corresponding to
    the :attr:`remote_ref_string` kept in this instance.
z	refs/tagsz
refs/headszrefs/remotes//zCould not handle remote ref: %r)
rM   
startswithr   rP   r\   r   r   strname
ValueError)rX   
remote_refs     r>   rf   PushInfo.remote_ref   s     !!,,[99 1 143I3IJJ##..|<<"4<<#4#4d6L6LMJ"!!(+DLL(9:??K 
 >AWAWWXXr@   linec                    UR                  SS5      u  p4nSn X`R                  U   -  nUR                  S5      u  pX`R                  -  (       a  Sn
O*US:X  a  Sn
O![
        R                  " UR                  U5      n
SnUR                  S	5      (       a~  S
U;   a  X`R                  -  nOSU;   a  X`R                  -  nOSU;   a  X`R                  -  nOpSU;   a  X`R                  -  nO[SU;   a  X`R                  -  nOFSU;   a  X`R                  -  nO1SnUS:X  a  SnUR                  S5      S   R                  U5      u  pUn[        XjXX5      $ ! [         a  n[        SU< SU< 35      UeSnAff = f)zCreate a new :class:`PushInfo` instance as parsed from line which is expected
to be like refs/heads/master:refs/heads/master 05d2687..1d0568e as bytes.	   r   Control character  unknown as parsed from line N:z(delete)[z
[rejected]z[remote rejected]z[remote failure]z
[no match]z	[new tag]z[new branch]...r,   ..)split	_flag_mapKeyErrorre   DELETEDr   	from_pathr\   rb   REJECTEDREMOTE_REJECTEDREMOTE_FAILUREERRORNEW_TAGNEW_HEADr   )clsrU   rh   control_characterfrom_torQ   rN   efrom_ref_stringto_ref_stringfrom_refrV   split_tokenold_sha_new_shas                  r>   
_from_linePushInfo._from_line   s    /3jjq.A+G	w]]#455E *1s);&;;7;H*,$..v{{OL %)
c""w&%$/,,,#w.+++("'$7*%
  K C'" 'c 21 5 ; ;K HG J 
TTS  	wVgimnouvv	ws   E 
E4E//E4r\   r+   argsr4   c                     [         erB   NotImplementedErrorr}   r\   r   r4   s       r>   
iter_itemsPushInfo.iter_items      !!r@   )rO   rP   rN   rL   rM   rQ   )N )%__name__
__module____qualname____firstlineno____doc__	__slots___id_attribute_ranger{   r|   NO_MATCHrw   rx   ry   ru   FORCED_UPDATEFAST_FORWARD
UP_TO_DATErz   rs   intr#   r   rc   r   rY   propertyrV   r   r   rf   classmethodr   r   r   r   __static_attributes__.0xs   00r>   r   r   v   s   I  N r#Aa# I  %) *D01 	
  SM  
( _E.1 _ _ YE/<"?@ Y Y( 2U 2U 2U
 2U 2Uh "f "S "C "H " "_ 	$s   B%r   c                   D   ^  \ rS rSrSrSS jrSU 4S jjrSS jrSrU =r	$ )	PushInfoListi  z=:class:`~git.util.IterableList` of :class:`PushInfo` objects.c                 L    [        [        [        R                  " U S5      5      $ N
push_infos)r$   r   r   __new__r}   s    r>   r   PushInfoList.__new__  s    L,"6"6sL"IJJr@   c                 2   > [         TU ]  S5        S U l        g r   )superrY   error)rX   	__class__s    r>   rY   PushInfoList.__init__  s    &*.
r@   c                 >    U R                   (       a  U R                   eg)z-Raise an exception if any ref failed to push.Nr   r^   s    r>   raise_if_errorPushInfoList.raise_if_error  s    ::** r@   r   )r7   r   r7   N)
r   r   r   r   r   r   rY   r   r   __classcell__r   s   @r>   r   r     s    GK/ r@   r   c                      \ rS 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"                  " S5      r\\S\
\\S	.r\\\4   \S
'   \S\S   4S j5       r   S!S\S\S\S\\S4   S\\    SS4S jjr!S\4S jr"\#S\4S j5       r$\#S"S j5       r%\SSS\S\SS 4S j5       r&\SSS\'S\'S\(4S j5       r)S r*gs  snn f )#r   i   a  
Carries information about the results of a fetch operation of a single head::

 info = remote.fetch()[0]
 info.ref           # Symbolic Reference or RemoteReference to the changed
                    # remote head or FETCH_HEAD
 info.flags         # additional flags to be & with enumeration members,
                    # i.e. info.flags & info.REJECTED
                    # is 0 if ref is SymbolicReference
 info.note          # additional notes given by git-fetch intended for the user
 info.old_commit    # if info.flags & info.FORCED_UPDATE|info.FAST_FORWARD,
                    # field is set to the previous location of ref, otherwise None
 info.remote_ref_path # The path from which we fetched on the remote. It's the remote's version of our info.ref
)refrV   rN   noteremote_ref_path	fetchinfo   r:   zK^ *(?:.{0,3})(.) (\[[\w \.$@]+\]|[\w\.$@]+) +(.+) -> ([^ ]+)(    \(.*\)?$)?r   )r-   r.   r0   r1   r,   r/   rs   r7   Tc                    [         R                  " [        5         U R                  S	 SSS5        [         R                  " [        5         U R                  S	 SSS5        [	        5       R
                  SS S:  a  U R                  U R                  S'   gU R                  U R                  S'   g! , (       d  f       N= f! , (       d  f       Nn= f)zUpdate information about which :manpage:`git-fetch(1)` flags are supported
by the git executable being used.

Called by the :func:`git.refresh` function in the top level ``__init__``.
r2   Nr/   r9   )r9   
   T)
contextlibsuppressrt   rs   r   r<   
TAG_UPDATEr   s    r>   refreshFetchInfo.refreshJ  s       *c" +  *c" + 5bq!W,!$CMM#  "%CMM# +***s   B0C0
B>
CNr   rN   r   rV   r   c                 @    Xl         X l        X0l        X@l        XPl        g)zInitialize a new instance.N)r   rN   r   rV   r   )rX   r   rN   r   rV   r   s         r>   rY   FetchInfo.__init___  s     
	$.r@   c                     U R                   $ rB   rd   r^   s    r>   __str__FetchInfo.__str__n      yyr@   c                 .    U R                   R                  $ )z:return: Name of our remote ref)r   rd   r^   s    r>   rd   FetchInfo.nameq  s     xx}}r@   c                 .    U R                   R                  $ )z!:return: Commit of our remote ref)r   r]   r^   s    r>   r]   FetchInfo.commitv  s     xxr@   r\   r+   rh   
fetch_linec                 `   U R                   R                  U5      nUc  [        SU-  5      eUR                  5       u  nnnnn	[	        [
        U5      n UR                  S5      u  pnUR                  SS5      u  pSn XR                  U   -  nSnS
nSU;   a  XR                  -  nSU;   a  XR                  -  nSnSU;   a  XR                  -  nSnSU;   a  XR                  -  nSU;   d  SU;   a0  SnUS:X  a  USS nUR                  UR                  U5      S   5      nSnUS:X  a  [        nO<US:X  d  U(       a  [        nO(US;   a  [         nOSU;   a  ["        nO[%        SU-  5      eU[        L a
  U" US5      nOSnUR'                  5       nUR)                  [*        R,                  S-   5      (       a9  UnU[        La-  UR)                  [         R,                  S-   5      (       d  [*        nO@U[        L a!  SU;   a  [/        [         R,                  U5      nO[/        UR,                  U5      nU" UUS
S9nU	=(       a    U	R'                  5       =(       d    Sn	U " UXUU5      $ ! [         a  n[        SU-  5      UeSnAff = f! [         a  n[        SU< S	U< 35      UeSnAff = f)a  Parse information from the given line as returned by ``git-fetch -v`` and
return a new :class:`FetchInfo` object representing this information.

We can handle a line as follows::

    %c %-*s %-*s -> %s%s

Where ``c`` is either a space, ``!``, ``+``, ``-``, ``*``, or ``=``:

- '!' means error
- '+' means success forcing update
- '-' means a tag was updated
- '*' means birth of new branch or tag
- '=' means the head was up to date (and not moved)
- ' ' means a fast-forward

`fetch_line` is the corresponding line from FETCH_HEAD, like::

    acb0fa8b94ef421ad60c8507b634759a472cd56c    not-for-merge   branch '0.1.7RC' of /tmp/tmpya0vairemote_repo
NzFailed to parse line: %rrj   r,   r:   z#Failed to parse FETCH_HEAD line: %rr   rl   rm   Frejectedznew tagTz
tag updatez
new branchrp   rq   
FETCH_HEADtag)zremote-trackingbranchra   z Cannot handle reference type: %rztags/)
check_pathr   )_re_fetch_resultmatchre   groupsr$   flagKeyLiteralrr   rs   rt   rw   r{   r   r|   	rev_parser   r   r   r   	TypeErrorstriprb   r   _common_path_defaultr   )r}   r\   rh   r   r   r~   	operationlocal_remote_refremote_local_ref_strr   _new_hex_sha_fetch_operation
fetch_noteref_type_namer   rN   rV   is_tag_operationr   ref_typeremote_local_refref_paths                         r>   r   FetchInfo._from_line{  s   , $$**40=7$>?? LLN	
  1BC	X9C9I9I$9O6LJ(2(8(8a(@%M
 	w]]#455E 15
 "\\!E	![[ E#9$^^#E#9$\\!EI!2K C')#2.	(DQ(GHJ 7;</(He#'7 $H;; 'HM! H>NOO (('l; ,0H#7#=#=#? #..y/M/MPS/STT 0</8L8W8W#883>9 9  )H\)g9M.M$_%I%IK_`$X%B%BDXY
  (h5I %,"#U*>NOO  	XBZOPVWW	X  	wVgimnouvv	ws0   (I) ?J
 )
J3JJ

J-J((J-r   r4   c                     [         erB   r   r   s       r>   r   FetchInfo.iter_items  r   r@   )rN   r   rV   r   r   )r   NN)r7   r)   )+r   r   r   r   r   r   r   r   r{   r|   HEAD_UPTODATEr   rw   r   r   rz   recompiler   rs   r   r   r   __annotations__r   r'   r   r   rc   r#   r&   r   r(   rY   r   r   rd   r]   r   r   r   r   r   r   s   00r>   r   r      s    JI N q"Aa"	 zz"pq ,ItNC'(    0 04.2// / 	/
 ,,-/ "(+/ 
/  c     EPf EPC EPS EP[ EP EPN "f "S "C "H " "O 	#s   Cr   c                     ^  \ rS rSr% SrSrSrS/rS/rSS/r	\
\S'    S	S
S\
SS4S jrS\
S\4U 4S jjrS\
4S jrS\
SS4U 4S jjrS\
4S jr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	S
S\S\S\S    4S j5       r S@S\
S\\
   S\S\SS 4
S jjrSAS\
S\S\SS 4S  jjrS\
S\SS 4S! jr \!S\\
   4S" j5       r"\!S\#\$   4S# j5       r%\!S\#\&   4S$ j5       r'\SAS	S
S\
S\
S\S\SS 4S% jj5       r(\S	S
S\
S\
S\SS 4
S& j5       r)\S	S
S\
S\
4S' j5       r*\S	S
S\
S\
4S( j5       r+S)\
SS 4S* jr,S\SS 4S+ jr- SBS,S-S.\.\/S/\4   \0S4   S0\.S\14   S\#S1   4S2 jjr2 SBS,S-S.\.\/S/\4   \0S4   S0\.S\14   S\34S3 jjr4SCS4 jr5      SDS5\.\
\6\
   S4   S.\.\0SS64   S7\S0\.S\14   S\S8\S\S\#\7   4S9 jjr8     SES5\.\
\6\
   S4   S.\.\0S6S4   S0\.S\14   S\S8\S\S\#\7   4S: jjr9     SES5\.\
\6\
   S4   S.\.\0S6\/S/\04   S4   S0\.S\14   S\S8\S\S\34S; jjr:\!S\;\<   4S< j5       r=SCS= jr>\!S\;4S> j5       r?S?r@U =rA$ )Fr   i  aF  Provides easy read and write access to a git remote.

Everything not part of this interface is considered an option for the current
remote, allowing constructs like ``remote.pushurl`` to query the pushurl.

:note:
    When querying configuration, the configuration accessor will be cached to speed
    up subsequent accesses.
)r\   rd   _config_readerrd   z--upload-packz--receive-packz--execurlr\   r+   r7   Nc                     Xl         X l        g)zInitialize a remote instance.

:param repo:
    The repository we are a remote of.

:param name:
    The name of the remote, e.g. ``origin``.
N)r\   rd   )rX   r\   rd   s      r>   rY   Remote.__init__+  s     		r@   attrc                    > US:X  a  [         TU ]  U5      $  U R                  R                  U5      $ ! [        R
                   a    [         TU ]  U5      s $ f = f)zoAllows to call this instance like ``remote.special(*args, **kwargs)`` to
call ``git remote special self.name``.r   )r   __getattr__r   getr   NoOptionErrorrX   r   r   s     r>   r   Remote.__getattr__7  s_     ##7&t,,	-&&**400 	-7&t,,	-s   3 #AAc                      SU R                   -  $ )Nzremote "%s"r   r^   s    r>   _config_section_nameRemote._config_section_nameE  s    tyy((r@   c                    > US:X  a9  [        U R                  R                  S5      U R                  5       5      U l        g [
        TU ]  U5        g )Nr   
repository)r   r\   config_readerr   r   r   _set_cache_r   s     r>   r  Remote._set_cache_H  sH    ## #4		''5))+#D
 G%r@   c                     U R                   $ rB   r   r^   s    r>   r   Remote.__str__S  r   r@   c                 T    SU R                   R                  < SU R                  < S3$ )Nz<git.z "z">)r   r   rd   r^   s    r>   __repr__Remote.__repr__V  s    "&.."9"9499EEr@   otherc                 l    [        U[        U 5      5      =(       a    U R                  UR                  :H  $ rB   )
isinstancetyperd   rX   r  s     r>   __eq__Remote.__eq__Y  s%    %d,Hejj1HHr@   c                     X:X  + $ rB   rC   r  s     r>   __ne__Remote.__ne__\  s    ""r@   c                 ,    [        U R                  5      $ rB   )hashrd   r^   s    r>   __hash__Remote.__hash___  s    DIIr@   c                      U R                   R                  S5        g! [        R                   a     g[        R                   a     gf = f)z
:return:
    ``True`` if this is a valid, existing remote.
    Valid remotes have an entry in the repository's configuration.
r   TF)r  r   r   r   NoSectionErrorr^   s    r>   existsRemote.existsb  sG    	""5) 	   		s    A
A
	A
r   r4   c              /   &  #    UR                  S5      R                  5        Hj  nUR                  S5      (       d  M  UR                  S5      nUR	                  S5      nUS:X  d  US:X  a  [        SU-  5      e[        XUS-   U 5      v   Ml     g7f)zJ:return: Iterator yielding :class:`Remote` objects of the given repositoryr  zremote "r   z%Remote-Section has invalid format: %rr:   N)r  sectionsrb   findrfindre   r   )r}   r\   r   r4   sectionlboundrbounds          r>   r   Remote.iter_itemsq  s      )),7@@BG%%i00\\#&F]]3'F|v| !H7!RSSvzF;<< Cs   BBnew_urlold_urlallow_unsafe_protocolsc                 .   U(       d  [         R                  " U5        SnXTS'   U(       a6  U R                  R                  R                  " USU R
                  X40 UD6  U $ U R                  R                  R                  " USU R
                  U40 UD6  U $ )ar  Configure URLs on current remote (cf. command ``git remote set-url``).

This command manages URLs on the remote.

:param new_url:
    String being the URL to add as an extra remote URL.

:param old_url:
    When set, replaces this URL with `new_url` for the remote.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:return:
    self
zset-urlinsert_kwargs_after--)r   check_unsafe_protocolsr\   r5   rU   rd   )rX   r'  r(  r)  r4   scmds         r>   set_urlRemote.set_url~  s~    & &&&w/(,$%IIMM  tTYYSFS  IIMM  tTYYJ6Jr@   c                 $    U R                  USUS9$ )ae  Adds a new url on current remote (special case of ``git remote set-url``).

This command adds new URLs to a given remote, making it possible to have
multiple URLs for a single remote.

:param url:
    String being the URL to add as an extra remote URL.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:return:
    self
T)addr)  r/  )rX   r   r)  r4   s       r>   add_urlRemote.add_url  s     ||CTBX|YYr@   c                 "    U R                  USS9$ )a  Deletes a new url on current remote (special case of ``git remote set-url``).

This command deletes new URLs to a given remote, making it possible to have
multiple URLs for a single remote.

:param url:
    String being the URL to delete from the remote.

:return:
    self
T)deleter3  )rX   r   r4   s      r>   
delete_urlRemote.delete_url  s     ||C|--r@   c              #   b  ^#     U R                   R                  R                  SSU R                  5      n[	        U[
        5      (       d   eUR                  S5       H  nUv   M	     g! [         Ga7  nS[        U5      ;   Ga    U R                   R                  R                  SU R                  5      n[	        U[
        5      (       d   eUR                  S5       H!  nSU;   d  M  UR                  S5      S   v   M#      SnAg! [         a  m[        U4S	 jS
 5       5      (       ao  U R                   R                  R                  SSU R                  -  5      n[	        U[
        5      (       d   eUR                  S5       H  nUv   M	      Sm@ SnAgTeSm@ff = fUeSnAff = f7f)zL:return: Iterator yielding all configured URL targets on a remote as stringszget-urlz--all
zUnknown subcommand: get-urlshowz  Push  URL:z: r   c              3   >   >#    U  H  o[        T5      ;   v   M     g 7frB   )rc   )r   msg_exs     r>   	<genexpr>Remote.urls.<locals>.<genexpr>  s     b6as#c(?6as   )zcorrect access rightszcannot run sshz	--get-allzremote.%s.urlN)
r\   r5   rU   rd   r  rc   rr   r   anyconfig)rX   remote_detailsrh   exr?  s       @r>   urlsRemote.urls  sd    	!YY]]11)WdiiPNnc2222&,,T2
 3 	 -B7"%)YY]]%9%9&$))%LN%nc:::: . 4 4T :)T1"&**T"22"66 !; ' "b6abbb)-)=)=k?]a]f]fKf)g).#>>>>$2$8$8$>D"&J %?$> "	" /	sg   F/A$A* )F/*F,5F'AD)DF/
F"B FF'F/FF""F''F,,F/c                     [        [        R                  SU R                  -  5      nUR	                  [        R
                  " U R                  U R                  S95        U$ )a  
:return:
    :class:`~git.util.IterableList` of :class:`~git.refs.remote.RemoteReference`
    objects.

    It is prefixed, allowing you to omit the remote path portion, e.g.::

        remote.refs.master  # yields RemoteReference('/refs/remotes/origin/master')
%s/)rU   )r   r   r   rd   extend
list_itemsr\   )rX   out_refss     r>   refsRemote.refs  sI     3??]?]_dgkgpgp_p2q22499TYYOPr@   c                 T   [        [        R                  SU R                  -  5      nU R                  R
                  R                  SSU 5      R                  5       SS  H  nSnUR                  U5      (       d  M  UR                  US5      nUR                  [        R                  S-   5      (       a2  UR                  [        R                  " U R                  U5      5        M  [        R                  < SU< 3nUR                  [        U R                  U5      5        M     U$ )	a  
:return:
    :class:`~git.util.IterableList` of :class:`~git.refs.remote.RemoteReference`
    objects that do not have a corresponding head in the remote reference
    anymore as they have been deleted on the remote side, but are still
    available locally.

    The :class:`~git.util.IterableList` is prefixed, hence the 'origin' must be
    omitted. See :attr:`refs` property for an example.

    To make things more complicated, it can be possible for the list to include
    other kinds of references, for example, tag references, if these are stale
    as well. This is a fix for the issue described here:
    https://github.com/gitpython-developers/GitPython/issues/260
rI  prunez	--dry-runr9   Nz * [would prune] r   ra   )r   r   r   rd   r\   r5   rU   
splitlinesrb   replacer   r   appendrv   )rX   rL  rh   tokenref_namefqhns         r>   
stale_refsRemote.stale_refs  s    " -99W9WY^aeajajYj,kIIMM((+tDOOQRSRTUD (E??5))||E2.H""9#A#AC#GHH	 3 3DIIx HI"1"F"FQ		4 @A V r@   c                     SnXeS'   [         R                  " U5      nU(       d  [         R                  " U5        UR                  R                  " USX#40 UD6  U " X5      $ )a  Create a new remote to the given repository.

:param repo:
    Repository instance that is to receive the new remote.

:param name:
    Desired name of the remote.

:param url:
    URL which corresponds to the remote's name.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:param kwargs:
    Additional arguments to be passed to the ``git remote add`` command.

:return:
    New :class:`Remote` instance

:raise git.exc.GitCommandError:
    In case an origin with that name already exists.
r2  r+  r,  )r   
polish_urlr-  r5   rU   )r}   r\   rd   r   r)  r4   r.  s          r>   createRemote.create  sT    2 (,$%nnS!%&&s+dD884r@   c                 *    U R                   " XU40 UD6$ rB   )r[  )r}   r\   rd   r   r4   s        r>   r2  
Remote.add/  s    zz$c4V44r@   c                 ~    UR                   R                  SU5        [        X 5      (       a  UR                  5         U$ )zVRemove the remote with the given name.

:return:
    The passed remote name to remove
rm)r5   rU   r  _clear_cacher}   r\   rd   s      r>   removeRemote.remove3  s2     	d#d  r@   c                 $    U R                  X5      $ )zgAlias of remove.
Remove the remote with the given name.

:return:
    The passed remote name to remove
)rc  rb  s      r>   r`  	Remote.rm?  s     zz$%%r@   new_namec                     U R                   U:X  a  U $ U R                  R                  R                  SU R                   U5        Xl         U R	                  5         U $ )z8Rename self to the given `new_name`.

:return:
    self
rename)rd   r\   r5   rU   ra  )rX   rg  s     r>   ri  Remote.renameI  sI     99 K		Xtyy(;	r@   c                 t    SnX!S'   U R                   R                  R                  " X R                  40 UD6  U $ )a  Fetch all changes for this remote, including new branches which will be
forced in (in case your local remote branch is not part the new remote branch's
ancestry anymore).

:param kwargs:
    Additional arguments passed to ``git remote update``.

:return:
    self
updater+  )r\   r5   rU   rd   )rX   r4   r.  s      r>   rl  Remote.updateX  s6     (,$%		T9977r@   proczGit.AutoInterruptr6   .kill_after_timeoutr   c           	         [        U5      n[        S5      n/ n[        [        R                  R                  5       5      nUR                  5       n[        US US SUS9  UR                  =(       a    SR                  UR                  5      =(       d    SnUR                  US9  U(       a  [        R                  SU5        UR                   HO  n	[        U	5      n	U H;  n
[        U	5      S:  d  M  U	S	   S
:X  d  M  U	S   U
:X  d  M*  UR!                  U	5        M=     MQ     [#        U R$                  S5      n['        UR(                  S5       nUR+                  5        V	s/ s H  oR-                  [.        5      PM     nn	S S S 5        [        U5      n[        W5      nX:w  a  SnUS-  nUS-  nUX4-  n[        R1                  U5        [        R1                  S[3        U5      R5                  S5      -   5        [        R1                  S[3        U5      R5                  S5      -   5        X:  a  US U nOUS U n[7        X]5       H7  u  nn UR!                  [        R9                  U R$                  UU5      5        M9     U$ s  sn	f ! , (       d  f       GN= f! [:         aE  n[        R1                  SU5        [        R                  SUR=                  5       5         S nAM  S nAff = f)Nrd   F	finalizerdecode_streamsro  r;  r   stderr'Error lines received while fetching: %sr:   r   r,   r   rbzFFetch head lines do not match lines provided via progress information
zKlength of progress lines %i should be equal to lines in FETCH_HEAD file %i
z5Will ignore extra progress lines or fetch head lines.s   info lines: zUTF-8s   head info: z#Caught error while parsing line: %szGit informed while fetching: %s)rE   r   setr   rs   keysnew_message_handlerr   error_linesjoinwait_loggerwarningother_linesr
   lenrS  r   r\   openabspath	readlinesdecoder	   debugrc   encodezipr   re   r   )rX   rn  r6   ro  outputfetch_info_linescmdsprogress_handlerstderr_textrh   cmd
fetch_headfpfetch_head_infol_fill_fhir>  err_liner   excs                       r>   _get_fetch_info_from_stderr"Remote._get_fetch_info_from_stderrh  s    (1 -9,@
  9&&++-.#779 1	
 **Ntyy9M9M/NTRT			%OOE{S((Dd#Dt9q=T!W^Q3$++D1  ) 'tyy,?
*$$d+r?A||~N~t{{62~ON , $%O$>[CaaCJJCE>!CMM#MM/C0@,A,H,H,QQRMM.3+?+F+Fw+OOP}"1&5"9#3FU#;  %((8$J HjUi22499h
ST %K 3 O ,+.  UCSI A8>>CSTTUs6   JJ=J0JJ
J
K'":K""K'c           	        ^ ^ [        U5      nUR                  5       n[        5       mS[        SS 4UU 4S jjn[	        UUUS SUS9  UR
                  =(       a    SR                  UR
                  5      =(       d    Sn UR                  US9  T$ ! [         a7  nT(       d  e U(       a  [        R                  S	U5        UTl         S nAT$ S nAff = f)
Nrh   r7   c                 r   >  TR                  [        R                  TU 5      5        g ! [         a     g f = frB   )rS  r   r   re   )rh   r  rX   s    r>   stdout_handler-Remote._get_push_info.<locals>.stdout_handler  s3    h11$=> s   %) 
66Frq  r;  r   rt  rv  )rE   rz  r   rc   r   r{  r|  r}  	Exceptionr~  r  r   )	rX   rn  r6   ro  r  r  r  r   r  s	   `       @r>   _get_push_infoRemote._get_push_info  s     (1 $779+~	 	 	 	 	 1	
 **Ntyy9M9M/NTRT		!II[I)   	!  I;W 	!s   ?B 
C,CCc                     U R                   nSn UR                  SUS9UL a/  SnUS-  nUS-  n[        X0R                  U R                  4-  5      e UR	                  5         g! UR	                  5         f = f)z?Turns out we can't deal with remotes if the refspec is missing.placeholderfetch)defaultz Remote '%s' has no refspec set.
zYou can set it as follows:zA 'git config --add "remote.%s.fetch +refs/heads/*:refs/heads/*"'.N)r  	get_valueAssertionErrorrd   release)rX   rC  unsetr>  s       r>   _assert_refspecRemote._assert_refspec  s    ##	75@933\\$SIItyy+A%ABB	 A NNFNNs   AA$ $A6refspecr*   verboseallow_unsafe_optionsc                    Uc  U R                  5         [        XpR                  R                  U5      n[	        U[
        5      (       a  UnOU/nU(       d(  U H"  n	U	(       d  M  [        R                  " U	5        M$     U(       d6  [        R                  " [        UR                  5       5      U R                  S9  U R                  R                  R                  " SU /UQ7SSSUS.UD6n
U R                  XUS9n[        U R                  R                  S5      (       a$  U R                  R                  R                  5         U$ )a  Fetch the latest changes for this remote.

:param refspec:
    A "refspec" is used by fetch and push to describe the mapping
    between remote ref and local ref. They are combined with a colon in
    the format ``<src>:<dst>``, preceded by an optional plus sign, ``+``.
    For example: ``git fetch $URL refs/heads/master:refs/heads/origin`` means
    "grab the master branch head from the $URL and store it as my origin
    branch head". And ``git push $URL refs/heads/master:refs/heads/to-upstream``
    means "publish my master branch head as to-upstream branch at $URL".
    See also :manpage:`git-push(1)`.

    Taken from the git manual, :manpage:`gitglossary(7)`.

    Fetch supports multiple refspecs (as the underlying :manpage:`git-fetch(1)`
    does) - supplying a list rather than a string for 'refspec' will make use of
    this facility.

:param progress:
    See the :meth:`push` method.

:param verbose:
    Boolean for verbose output.

:param kill_after_timeout:
    To specify a timeout in seconds for the git command, after which the process
    should be killed. It is set to ``None`` by default.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:param allow_unsafe_options:
    Allow unsafe options to be used, like ``--upload-pack``.

:param kwargs:
    Additional arguments to be passed to :manpage:`git-fetch(1)`.

:return:
    IterableList(FetchInfo, ...) list of :class:`FetchInfo` instances providing
    detailed information about the fetch results

:note:
    As fetch does not provide progress information to non-ttys, we cannot make
    it available here unfortunately as in the :meth:`push` method.
optionsunsafe_optionsr,  TF)
as_processwith_stdoutuniversal_newlinesr=   ro  update_cache)r  r?   r\   r5   r  listr   r-  check_unsafe_optionsry  unsafe_git_fetch_optionsr  r  hasattrodbr  )rX   r  r6   r  ro  r)  r  r4   r   r   rn  ress               r>   r  Remote.fetch  s   n ?  "fiimmX>gt$$,3D9D%3..s3  $$$T&++--@QUQnQnoyy}}""$

*.EVZ^e
io
 ..tRd.e499==.11IIMM&&(
r@   c                 |   Uc  U R                  5         [        X`R                  R                  U5      n[        R
                  " U=(       d    / 5      nU(       d  U H  n[        R                  " U5        M     U(       d6  [        R                  " [        UR                  5       5      U R                  S9  U R                  R                  R                  " SX4SSSSS.UD6nU R                  XUS9n	[        U R                  R                  S5      (       a$  U R                  R                  R                  5         U	$ )a<  Pull changes from the given branch, being the same as a fetch followed by a
merge of branch with your local branch.

:param refspec:
    See :meth:`fetch` method.

:param progress:
    See :meth:`push` method.

:param kill_after_timeout:
    See :meth:`fetch` method.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:param allow_unsafe_options:
    Allow unsafe options to be used, like ``--upload-pack``.

:param kwargs:
    Additional arguments to be passed to :manpage:`git-pull(1)`.

:return:
    Please see :meth:`fetch` method.
r  r,  FT)r  r  r  r=   r  r  )r  r?   r\   r5   r   _unpack_argsr-  r  r  ry  unsafe_git_pull_optionspullr  r  r  r  )
rX   r  r6   ro  r)  r  r4   r   rn  r  s
             r>   r  Remote.pull9  s    B ?  "fiimmX>""7=b1%**3/  $$$T&++--@QUQmQmnyy}}!!$
-2tX\`d
hn
 ..tRd.e499==.11IIMM&&(
r@   c                    [        X`R                  R                  U5      n[        R                  " U=(       d    / 5      nU(       d  U H  n[        R
                  " U5        M     U(       d6  [        R                  " [        UR                  5       5      U R                  S9  U R                  R                  R                  " SU U4SSSUS.UD6nU R                  XUS9$ )aw  Push changes from source branch in refspec to target branch in refspec.

:param refspec:
    See :meth:`fetch` method.

:param progress:
    Can take one of many value types:

    * ``None``, to discard progress information.
    * A function (callable) that is called with the progress information.
      Signature: ``progress(op_code, cur_count, max_count=None, message='')``.
      See :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` for a
      description of all arguments given to the function.
    * An instance of a class derived from :class:`~git.util.RemoteProgress` that
      overrides the
      :meth:`RemoteProgress.update <git.util.RemoteProgress.update>` method.

:note:
    No further progress information is returned after push returns.

:param kill_after_timeout:
    To specify a timeout in seconds for the git command, after which the process
    should be killed. It is set to ``None`` by default.

:param allow_unsafe_protocols:
    Allow unsafe protocols to be used, like ``ext``.

:param allow_unsafe_options:
    Allow unsafe options to be used, like ``--receive-pack``.

:param kwargs:
    Additional arguments to be passed to :manpage:`git-push(1)`.

:return:
    A :class:`PushInfoList` object, where each list member represents an
    individual head which had been updated on the remote side.

    If the push contains rejected heads, these will have the
    :const:`PushInfo.ERROR` bit set in their flags.

    If the operation fails completely, the length of the returned
    :class:`PushInfoList` will be 0.

    Call :meth:`~PushInfoList.raise_if_error` on the returned object to raise on
    any failure.
r  r,  T)	porcelainr  r  ro  r  )r?   r\   r5   r   r  r-  r  r  ry  unsafe_git_push_optionspushr  )	rX   r  r6   ro  r)  r  r4   r   rn  s	            r>   r  Remote.pusho  s    n fiimmX>""7=b1%**3/  $$$T&++--@QUQmQmnyy}}!!	
 #1	
 	
 ""4FX"YYr@   c                     U R                   $ )z
:return:
    :class:`~git.config.GitConfigParser` compatible object able to read options
    for only our remote. Hence you may simply type ``config.get("pushurl")`` to
    obtain the information.
)r   r^   s    r>   r  Remote.config_reader  s     """r@   c                 *     U ? g ! [         a     g f = frB   )r   AttributeErrorr^   s    r>   ra  Remote._clear_cache  s    	# 		s    
c                     U R                   R                  5       nU R                  5         [        XR	                  5       5      $ )a  
:return:
    :class:`~git.config.GitConfigParser`-compatible object able to write options
    for this remote.

:note:
    You can only own one writer at a time - delete it to release the
    configuration file and make it usable by others.

    To assure consistent results, you should only query options through the
    writer. Once you are done writing, you are free to use the config reader
    once again.
)r\   config_writerra  r   r   )rX   writers     r>   r  Remote.config_writer  s8     ((* 	 )B)B)DEEr@   )r   rd   r\   )NF)FrB   r   )NNTNFF)NNNFF)Br   r   r   r   r   r   r   r  r  r  rc   r   rY   r   r   r   r  r   r
  objectboolr  r  r   r  r  r   r   r   r   r/  r4  r8  r   rF  r   r   rM  r   rW  r[  r2  rc  r`  ri  rl  r#   r   r   floatr  r   r  r  r   r   r  r  r  r   r   r  ra  r  r   r   r   s   @r>   r   r     s    3IN
 	  	 		 
H,
V 
3 
4 
- - -)c )	& 	& 	& F# FIF It I#F #t ##   	=f 	=S 	=C 	=HXDV 	= 	= [`%-c]SWkn	:Z3 Z ZPS ZX` Z".c .S .X . hsm  @ l?3    L3    D &  # t gj ow  B 5v 5S 5s 5c 5h 5 5 	& 	 	 	 	 &f &C &C & &s x s x ( 26	E!E c*ND@AE "$+.	E
 
k	"EV 26	*!* c*ND@A* "$+.	*
 
*X 04BF15',%*OsDIt+,O .>>?O 	O
 "$+.O !%O #O O 
i	 Of 04BF15',%*4sDIt+,4 (8$>?4 "$+.	4
 !%4 #4 4 
i	 4p 04ae15',%*KZsDIt+,KZ (8(3CV:WY]]^KZ "$+.	KZ
 !%KZ #KZ KZ 
KZZ #0A # # F0 F Fr@   r   )@r   __all__r   loggingr   git.cmdr   r   
git.compatr	   r
   
git.configr   r   r   git.excr   git.refsr   r   r   r   r   git.utilr   r   r   r   r   r   typingr   r   r   r   r   r   r   r    r!   r"   r#   r$   r%   	git.typesr&   r'   r(   git.objects.commitr)   git.objects.submodule.baser*   git.repo.baser+   r   	getLoggerr   r~  r?   rE   r   r   r   r   rC   r@   r>   <module>r     s   O
?   	 . ) = = # V V      6 5)9"?@ 

H
%
	 N$4hsN?R6SUYYZ 		6 
 ?4 ?N ? 
 ? 
 U8CH#5 U:P U 
 U 
 I> In I 
 IHS#X&<=
>112"W"{ W"t<)  e" e"PXFY XFr@   