
    chi                     r   % / S Qr SSKrSSKrSSKrSSKJr  SSKJr  SSKJ	r	  SSK
Jr  SSK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  SS	KJrJr  \(       a$  SS
KJr  SSKJr  SSK J!r!  SSK"J#r#  SSK$J%r%  SSK&J'r'  \S   r(\RR                   " S S\RT                  5      5       r+\+RX                  r,\\+RX                     \-S'    \+R\                  r.\\+R\                     \-S'    \R^                  " S5      r0S\S\14S jr2S$S\1S\3S\\1   4S jjr4 " S S5      r5\" SSS 9r6 " S! S"\\6   5      r7 " S# S5      r8g)%)DiffConstants	NULL_TREEINDEXDiffable	DiffIndexDiff    N)handle_process_output)defenc)Blob)mode_str_to_int)finalize_process
hex_to_bin)
AnyIteratorListMatchOptionalTupleTYPE_CHECKINGTypeVarUnioncast)LiteralPathLike)Popen)Git)IndexObject)Commit)Tree)Repo)ADCMRTUc                   ^    \ rS rSrSr\R                  " 5       r \R                  " 5       rSr	g)r   0   a]  Special objects for :meth:`Diffable.diff`.

See the :meth:`Diffable.diff` method's ``other`` parameter, which accepts various
values including these.

:note:
    These constants are also available as attributes of the :mod:`git.diff` module,
    the :class:`Diffable` class and its subclasses and instances, and the top-level
    :mod:`git` module.
 N)
__name__
__module____qualname____firstlineno____doc__enumautor   r   __static_attributes__r*       [C:\Users\julio\OneDrive\Documentos\Trabajo\Ideas Frescas\venv\Lib\site-packages\git/diff.pyr   r   0   s+    	 		I IIKEr3   r   r   r   s   \\([0-9]{3})matchobjreturnc                 j    U R                  S5      n[        US5      n[        [        U45      5      nU$ )N      )groupintbytes	bytearray)r5   values     r4   _octal_replr?   b   s1    NN1EqME)UH%&ELr3   pathhas_ab_prefixc                    U S:X  a  g U R                  S5      (       a[  U R                  S5      (       aE  U SS R                  SS5      R                  SS5      R                  S	S5      R                  S
S5      n [        R	                  [
        U 5      n U(       a3  U R                  S5      (       d  U R                  S5      (       d   eU SS  n U $ )Ns	   /dev/null   "r8   s   \n   
s   \t   	s   \"s   \\   \s   a/s   b/   )
startswithendswithreplace_octal_byte_resubr?   )r@   rA   s     r4   decode_pathrN   i   s    |tt!4!4Abz!!&%088GOOPVX\]eefmotuk40Du%%)?)???ABxKr3   c                       \ rS rSr% SrSrS\S'    \r \r \r	 S\
\\S 4      S\
\\S 4      4S jr\S	S
4S\\SS\S	4   S\\\
\   \\S4   S	4   S\S\SS4
S jjrSrg	)r   y   a/  Common interface for all objects that can be diffed against another object of
compatible type.

:note:
    Subclasses require a :attr:`repo` member, as it is the case for
    :class:`~git.objects.base.Object` instances. For practical reasons we do not
    derive from :class:`~git.objects.base.Object`.
r*   r    repoargsr6   c                     U$ )z
:return:
    Possibly altered version of the given args list.
    This method is called right before git command execution.
    Subclasses can use it to alter the behaviour of the superclass.
r*   )selfrR   s     r4   _process_diff_argsDiffable._process_diff_args   s	     r3   NFotherr   r   paths.create_patchkwargsDiffIndex[Diff]c                   ^ / nUR                  S5        UR                  S5        [        U4S jS 5       5      (       d  UR                  S5        U(       a#  UR                  S5        UR                  S5        O"UR                  S5        UR                  S	5        UR                  S
5        Ub  [        U[        [        45      (       d  U/nU R
                  R                  R                  nU[        L a  UR                  SS5        OU[        L aE  UR                  SS5        UR                  SS5        U R
                  R                  R                  nOGUbD  UR                  SS5        UR                  SU5        U R
                  R                  R                  nUR                  SU 5        U(       a"  UR                  S5        UR                  U5        STS'   U" U R                  U5      0 TD6nU(       a  [        R                  O[        R                   nU" U R
                  U5      n	UR#                  5         U	$ )ak  Create diffs between two items being trees, trees and index or an index and
the working tree. Detects renames automatically.

:param other:
    This the item to compare us with.

    * If ``None``, we will be compared to the working tree.

    * If a :class:`~git.types.Tree_ish` or string, it will be compared against
      the respective tree.

    * If :const:`INDEX`, it will be compared against the index.

    * If :const:`NULL_TREE`, it will compare against the empty tree.

    This parameter defaults to :const:`INDEX` (rather than ``None``) so that the
    method will not by default fail on bare repositories.

:param paths:
    This a list of paths or a single path to limit the diff to. It will only
    include at least one of the given path or paths.

:param create_patch:
    If ``True``, the returned :class:`Diff` contains a detailed patch that if
    applied makes the self to other. Patches are somewhat costly as blobs have
    to be read and diffed.

:param kwargs:
    Additional arguments passed to :manpage:`git-diff(1)`, such as ``R=True`` to
    swap both sides of the diff.

:return:
    A :class:`DiffIndex` representing the computed diff.

:note:
    On a bare repository, `other` needs to be provided as :const:`INDEX`, or as
    an instance of :class:`~git.objects.tree.Tree` or
    :class:`~git.objects.commit.Commit`, or a git command error will occur.
z--abbrev=40z--full-indexc              3   ,   >#    U  H	  oT;   v   M     g 7fNr*   ).0xrZ   s     r4   	<genexpr> Diffable.diff.<locals>.<genexpr>   s     L(K1;(Ks   )find_renames
no_renamesr$   z-Mz-pz--no-ext-diffz--rawz-zz
--no-colorr   z--cachedz-rz--rootz--T
as_process)appendany
isinstancetuplelistrQ   gitdiffr   insertr   	diff_treeextendrU   r   _index_from_patch_format_index_from_raw_formatwait)
rT   rW   rX   rY   rZ   rR   diff_cmdprocdiff_methodindexs
       `     r4   rl   Diffable.diff   s   \ 13M"N# L(KLLLKKKKKK(KK KK 	L!Zt}%E%EGE99==%%E>KK:&iKK4 KK8$yy}}..HKK4 KK5!yy}}..HAt KKKK  $|006A&A7Cd33IdIdDIIt,		r3   )r+   r,   r-   r.   r/   	__slots____annotations__r   r   Indexr   r   r   rU   r   strr   boolr   rl   r2   r*   r3   r4   r   r   y   s     I
LRI E E
5:-./
 
eHj()	*
 DIMQ"	_]FHc4?@_ XtH~uXs]/CTIJ_ 	_
 _ 
_ _r3   r   T_Diffr   )boundc                   6    \ rS rSrSrSr S\S\\   4S jr	Sr
g)	r   i  zAn index for diffs, allowing a list of :class:`Diff`\s to be queried by the diff
properties.

The class improves the diff handling convenience.
)r!   r#   r"   r%   r$   r&   change_typer6   c              #     #    XR                   ;  a  [        SU-  5      eU  H  nUR                   U:X  a  Uv   M  US:X  a  UR                  (       a  Uv   M6  US:X  a  UR                  (       a  Uv   MS  US:X  a  UR                  (       a  Uv   Mp  US:X  a  UR
                  (       a  Uv   M  US:X  d  M  UR                  (       d  M  UR                  (       d  M  UR                  UR                  :w  d  M  Uv   M     g7f)aG  
:return:
    Iterator yielding :class:`Diff` instances that match the given `change_type`

:param change_type:
    Member of :attr:`DiffIndex.change_type`, namely:

    * 'A' for added paths
    * 'D' for deleted paths
    * 'R' for renamed paths
    * 'M' for paths with modified data
    * 'T' for changed in the type paths
zInvalid change type: %sr!   r"   r#   r%   r$   N)r   
ValueErrornew_filedeleted_filecopied_filerenamed_filea_blobb_blob)rT   r   diffidxs      r4   iter_change_typeDiffIndex.iter_change_type.  s      ...6DEEG""k1#(8(8#(<(<#(;(;#(<(<#7>>>gnn`g`n`nNn s   B1D7D
DD9	Dr*   N)r+   r,   r-   r.   r/   r   Lit_change_typer   r}   r   r2   r*   r3   r4   r   r     s+     1KO @P r3   r   c                       \ rS rSrSr\R                  " S\R                  \R                  -  5      r	Sr
SrSrSSS	\\   S
\\   S\\\S4   S\\\S4   S\\\S4   S\\\S4   S\S\S\S\\   S\\   S\\\S4   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5       r\S\\   4S  j5       r\S\\   4S! j5       r\S\\   4S" j5       r\S\4S# j5       r\S\4S$ j5       r \!S%\S&\S'\S\\   4S( j5       r"\!SSS)\S*   S\#S    4S+ j5       r$\%S,\SSS-\#S    SS4S. j5       r&\!S1S/ j5       r'S0r(g)2r   iO  al  A Diff contains diff information between two Trees.

It contains two sides a and b of the diff. Members are prefixed with "a" and "b"
respectively to indicate that.

Diffs keep information about the changed blob objects, the file mode, renames,
deletions and new files.

There are a few cases where ``None`` has to be expected as member variable value:

New File::

    a_mode is None
    a_blob is None
    a_path is None

Deleted File::

    b_mode is None
    b_blob is None
    b_path is None

Working Tree Blobs:

    When comparing to working trees, the working tree blob will have a null hexsha
    as a corresponding object does not yet exist. The mode will be null as well. The
    path will be available, though.

    If it is listed in a diff, the working tree version of the file must differ from
    the version in the index or tree, and hence has been modified.
s  
                                ^diff[ ]--git
                                    [ ](?P<a_path_fallback>"?[ab]/.+?"?)[ ](?P<b_path_fallback>"?[ab]/.+?"?)\n
                                (?:^old[ ]mode[ ](?P<old_mode>\d+)\n
                                   ^new[ ]mode[ ](?P<new_mode>\d+)(?:\n|$))?
                                (?:^similarity[ ]index[ ]\d+%\n
                                   ^rename[ ]from[ ](?P<rename_from>.*)\n
                                   ^rename[ ]to[ ](?P<rename_to>.*)(?:\n|$))?
                                (?:^new[ ]file[ ]mode[ ](?P<new_file_mode>.+)(?:\n|$))?
                                (?:^deleted[ ]file[ ]mode[ ](?P<deleted_file_mode>.+)(?:\n|$))?
                                (?:^similarity[ ]index[ ]\d+%\n
                                   ^copy[ ]from[ ].*\n
                                   ^copy[ ]to[ ](?P<copied_file_name>.*)(?:\n|$))?
                                (?:^index[ ](?P<a_blob_id>[0-9A-Fa-f]+)
                                    \.\.(?P<b_blob_id>[0-9A-Fa-f]+)[ ]?(?P<b_mode>.+)?(?:\n|$))?
                                (?:^---[ ](?P<a_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
                                (?:^\+\+\+[ ](?P<b_path>[^\t\n\r\f\v]*)[\t\r\f\v]*(?:\n|$))?
                            (0000000000000000000000000000000000000000s                       )r   r   a_modeb_mode	a_rawpath	b_rawpathr   r   r   raw_rename_fromraw_rename_torl   r   scorerQ   r    r   r   	a_blob_idN	b_blob_idr   r   r   r   r   r   r   rl   r   r   r6   c                    Ub  [        U[        5      (       d   eUb  [        U[        5      (       d   eX l        X0l        U(       a  [	        U5      OS U l        U(       a  [	        U5      OS U l        U(       ae  U(       a^  UR                   HN  nUR                  UR                  [        S5      :X  d  M)  UR                  5       (       a  UR                  5       n  O   U   Ub  X@R                  :X  a  S U l        O.[        U[!        U5      U R
                  U R"                  S9U l        U   Ub  XPR                  :X  a  S U l        O.[        U[!        U5      U R                  U R&                  S9U l        Xl        Xl        Xl        Ub  [        U[        5      (       d   eUb  [        U[        5      (       d   eU=(       d    S U l        U=(       d    S U l        Xl        Xl        Xl        g )NrK   )moder@   )rh   r<   r   r   r   r   r   
submodulesr@   decoder
   module_existsmoduleNULL_HEX_SHAr   r   r   a_pathr   b_pathr   r   r   r   r   rl   r   r   )rT   rQ   r   r   r   r   r   r   r   r   r   r   r   rl   r   r   	submodules                    r4   __init__Diff.__init__  s   $  Jy%$@$@@@ Jy%$@$@@@""17of-T17of-T I!__	>>Y%5%5fi%HH ..00(//1	 - 		->-> >DKtZ	%:SWS^S^_DK	->-> >DKtZ	%:SWS^S^_DK&".!, &*_e*L*LLL$
=%(H(HHH.6$*2d	9D
r3   rW   c                 ^    U R                    H  n[        X5      [        X5      :w  d  M    g   g)NFT)rx   getattr)rT   rW   names      r4   __eq__Diff.__eq__  s*    NNDt"ge&:: # r3   c                     X:X  + $ r^   r*   )rT   rW   s     r4   __ne__Diff.__ne__  s    ""r3   c                 T   ^  [        [        U 4S jT R                   5       5      5      $ )Nc              3   <   >#    U  H  n[        TU5      v   M     g 7fr^   )r   )r_   nrT   s     r4   ra    Diff.__hash__.<locals>.<genexpr>  s     CNq'$**Ns   )hashri   rx   rT   s   `r4   __hash__Diff.__hash__  s    ECDNNCCDDr3   c                    SnU R                   (       a  XR                   R                  -  nO)U R                  (       a  XR                  R                  -  nSnS nSn[        U R                   U R                  4S5       HF  u  pVU(       a  SXeR                  UR
                  4-  nOSU-  n[        [        U5      U5      nX#-  nMH     USSU-  -   -  nU R                  (       a  US	-  nU R                  (       a  US
-  nU R                  (       a!  USU R                  < SU R                  < 3-  nU R                  (       a  USU R                  -  -  nU R                  (       a  USU R                  -  -  nU R                  (       aX  US-  n U[!        U R                  ["        5      (       a  U R                  R%                  [&        5      OU R                  -  nUS-  nX-   $ ! [(         a    US-  n Nf = f)Nz%s r   )lhsrhsz
%s: %o | %sz	
%s: None
=z
file deleted in rhsz
file added in rhsz
file z copied from z
file renamed from %rz
file renamed to %rz
---zOMITTED BINARY DATA)r   r@   r   zipr   hexshamaxlenr   r   r   r   r   rename_from	rename_torl   rh   r<   r   r
   UnicodeDecodeError)rT   hmsglineline_lengthbr   s          r4   __str__Diff.__str__  s   ;;!!!A[[!!!Adkk2NCDA&!VVQXX)>>#a'c$i5KKC D 	
TC+%%%**C==((CdkkJJC+d.>.>>>C>>)DNN::C997NC-:dii3O3Otyy''/UYU^U^^ 7NC w & -,,-s   AG$ $G65G6c                 h    U R                   (       a   U R                   R                  [        S5      $ S $ NrK   )r   r   r
   r   s    r4   r   Diff.a_path  $    ;?>>t~~$$VY7StSr3   c                 h    U R                   (       a   U R                   R                  [        S5      $ S $ r   )r   r   r
   r   s    r4   r   Diff.b_path  r   r3   c                 h    U R                   (       a   U R                   R                  [        S5      $ S $ r   )r   r   r
   r   s    r4   r   Diff.rename_from  s)    AEAUAUt##**69=_[__r3   c                 h    U R                   (       a   U R                   R                  [        S5      $ S $ r   )r   r   r
   r   s    r4   r   Diff.rename_to  s)    ?C?Q?Qt!!((;[W[[r3   c                 N    [         R                  " S[        SS9  U R                  $ )zDeprecated, use :attr:`renamed_file` instead.

:return:
    ``True`` if the blob of our diff has been renamed

:note:
    This property is deprecated.
    Please use the :attr:`renamed_file` property instead.
z9Diff.renamed is deprecated, use Diff.renamed_file insteadrH   )
stacklevel)warningswarnDeprecationWarningr   r   s    r4   renamedDiff.renamed#  s'     	G	

    r3   c                 4    U R                   U R                  :g  $ )z::return: ``True`` if the blob of our diff has been renamed)r   r   r   s    r4   r   Diff.renamed_file5  s     4>>11r3   
path_matchrename_matchpath_fallback_matchc                 n    U(       a  [        U5      $ U(       a
  [        USS9$ U(       a  [        U5      $ g )NF)rA   )rN   )clsr   r   r   s       r4   _pick_best_pathDiff._pick_best_path:  s2    z**|5AA233r3   rt   )r   zGit.AutoInterruptc                 (   / n[        X#R                  S[        SS9  SR                  U5      n[	        5       nSnSnSu  pSu  pU R
                  R                  U5       GH  nUR                  5       u  nnnnnnnnnnnnnn	[        U5      [        U5      [        U5      nnnU R                  UUU5      nU R                  U	UU5      n	Ub(  XFR                  5       UR                  5        US   l        U=(       d&    U=(       d    U=(       a    U=(       d    U=(       d    Un
U=(       d    U=(       d    U=(       d    U	=(       a    U
nUR                  [        UUU	U=(       a    UR                  [        5      U=(       a    UR                  [        5      U
=(       a    U
R                  [        5      U=(       a    UR                  [        5      UUUUUSSS5      5        UnUnGM     U(       a!  U(       a  XGR                  5       S US   l        U$ )aA  Create a new :class:`DiffIndex` from the given process output which must be
in patch format.

:param repo:
    The repository we are operating on.

:param proc:
    :manpage:`git-diff(1)` process to read from
    (supports :class:`Git.AutoInterrupt <git.cmd.Git.AutoInterrupt>` wrapper).

:return:
    :class:`DiffIndex`
NFdecode_streamsr3   )NNrD   )r	   rf   r   joinr   	re_headerfinditergroupsr|   r   endstartrl   r   r   r
   )r   rQ   rt   	text_listtextrv   previous_headerheaderr   r   r   r   _headera_path_fallbackb_path_fallbackold_modenew_moder   r   new_file_modedeleted_file_modecopied_file_namer   r   r   r   r   s                              r4   rp   Diff._index_from_patch_formatG  s   " "$	d$4$4d<L]bc xx	"&[59,0##}}--d3G   !  ]#&'%& %0lH ((oNF((OLF *!%&9&9&;gmmo!Nb	
 h!2hv7g6CfXCfYfFOxO=OV=NFLL:)"2"26"::)"2"26":4v}}V44v}}V4 ( &OFu 4x V!**,.1E"IN r3   lines_bytesrv   c                    U R                  [        5      nUR                  S5      u    pCUR                  S5       GH  nU(       d  M  UR                  S5      u  pdnUR	                  S5      nUR                  S S5      u  ppn[        [        US   5      nSR                  USS  5      nUR                  5       (       a  [        U5      OS nUR                  S5      nUR                  [        5      nUR                  [        5      nS	nS	nS	nS nS nUS
:X  a  S nSnOUS:X  a  S n
SnOUS:X  aB  SnUR                  SS5      u  nnUR                  [        5      nUR                  [        5      nOQUS:X  aD  UR                  SS5      u  nnUR                  [        5      nUR                  [        5      nUUnnOUS:X  a   [        UUUU
UUU	UUUUUSUU5      nUR                  U5        GM     g )N:z :    r   r   r8   r   Fr"   Tr!   r#   r%   r&   )r   r
   	partitionsplitrstripr   r   r   isdigitr;   stripencoder   rf   )r   rQ   rv   lines_r   metar@   r   r   r   r   _change_typer   	score_strr   r   r   r   r   r   r   r   
a_path_str
b_path_strrl   s                             r4   _handle_diff_lineDiff._handle_diff_line  s   ""6* ooc*1KK(D NN62MDT;;v&D FJZZPTVWEXBH	l ,0a+QKQR 01I&/&7&7&9&9C	NtE::d#D[[(F[[(F LHKKI c! 	## 	#")-FA)>&
J#**62#**62#)-FA)>&
J#**62#**62)/YY# D" LLA )r3   c                 N   ^ ^^ [        5       m[        UU UU4S jS[        SS9  T$ )zCreate a new :class:`DiffIndex` from the given process output which must be
in raw format.

:param repo:
    The repository we are operating on.

:param proc:
    Process to read output from.

:return:
    :class:`DiffIndex`
c                 *   > TR                  U TT5      $ r^   )r
  )bytr   rv   rQ   s    r4   <lambda>-Diff._index_from_raw_format.<locals>.<lambda>  s    --c4?r3   NFr   )r   r	   r   )r   rQ   rt   rv   s   `` @r4   rq   Diff._index_from_raw_format  s*    " '[? 	
 r3   )r   r   r   r   r   r   r   r   r   rl   r   r   r   r   )rQ   r    rt   r   r6   r[   ))r+   r,   r-   r.   r/   recompileVERBOSE	MULTILINEr   r   NULL_BIN_SHArx   r   r<   r   r{   r|   r   r;   r   objectr   r   r   r   propertyr   r   r   r   r   r   classmethodr   r   rp   staticmethodr
  rq   r2   r*   r3   r4   r   r   O  s   B 

	 $ 	

R\\!'I. LLI";; E?; E?	;
 eT)*; eT)*; eS$&'; eS$&'; ; ; ; "%;  ; C$%; o.;  }!;" 
#;zF t #F #t #E# E+ +Z T T T T T T `Xc] ` ` \8C= \ \ ! ! !" 2d 2 2 
 
e 
Z_ 
dlmrds 
 
 ZF Z%@\:] Zbklrbs Z Zx Fu FF F9VCT FY] F FP  r3   )T)9__all__r0   r  r   git.cmdr	   
git.compatr
   git.objects.blobr   git.objects.utilr   git.utilr   r   typingr   r   r   r   r   r   r   r   r   r   	git.typesr   r   
subprocessr   r   git.objects.baser   git.objects.commitr   git.objects.treer   git.repo.baser    r   uniqueEnumr   r   ry   r   r  rL   r<   r?   r|   rN   r   r}   r   r   r*   r3   r4   <module>r*     s=   S
R  	  )  ! , 1   ( ,)%";<
 DII  8 /<.E.E	7=**+ E '4&9&9w}""# 9 ,-% E e D HUO  ^ ^B 
	(.V .dx xr3   