§
    cÌc‡Q  ã                   óZ  — d dl mZ ddlZddlZddlmZmZmZ dZ G d„ de¦  «        Z	 G d„ d	e¦  «        Z
 G d
„ de	¦  «        Z G d„ de	¦  «        Z G d„ de¦  «        Z G d„ de	¦  «        Zd„ Zd„ Zd„ Z G d„ d¦  «        Z G d„ de¦  «        Z G d„ de¦  «        Z G d„ de¦  «        ZdZdZd„ Zd Z G d!„ d"¦  «        Zd7d$„Z G d%„ d&¦  «        Z G d'„ d(e¦  «        Zd7d)„Zd8d*ee         d+ed,efd-„Z d*ee         d.ee         fd/„Z!d8d0„Z"d1„ Z#d2„ Z$d3„ Z%d9d4„Z& G d5„ d6¦  «        Z'dS ):é   )ÚBzrErroré    N)ÚListÚOptionalÚIterators"   Binary files (.*) and (.*) differ
c                   ó   — e Zd ZdZdS )ÚPatchSyntaxz#Base class for patch syntax errors.N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__© ó    ú0/usr/lib/python3/dist-packages/breezy/patches.pyr	   r	      s   € € € € € Ø-Ð-Ð-Ð-r   r	   c                   ó   — e Zd ZdZd„ ZdS )ÚBinaryFilesz!Binary files section encountered.c                 ó"   — || _         || _        d S ©N)Ú	orig_nameÚmod_name)Úselfr   r   s      r   Ú__init__zBinaryFiles.__init__&   s   € Ø"ˆŒØ ˆŒˆˆr   N©r
   r   r   Ú_fmtr   r   r   r   r   r   "   s(   € € € € € à.€Dð!ð !ð !ð !ð !r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚMalformedPatchHeaderz*Malformed patch header.  %(desc)s
%(line)rc                 ó"   — || _         || _        d S r   ©ÚdescÚline©r   r   r    s      r   r   zMalformedPatchHeader.__init__/   ó   € ØˆŒ	ØˆŒ	ˆ	ˆ	r   Nr   r   r   r   r   r   +   s(   € € € € € à8€Dðð ð ð ð r   r   c                   ó   — e Zd ZdZd„ ZdS )ÚMalformedLinez"Malformed line.  %(desc)s
%(line)rc                 ó"   — || _         || _        d S r   r   r!   s      r   r   zMalformedLine.__init__8   r"   r   Nr   r   r   r   r$   r$   4   s(   € € € € € à0€Dðð ð ð ð r   r$   c                   ó   — e Zd ZdZd„ ZdS )ÚPatchConflictzwText contents mismatch at line %(line_no)d.  Original has "%(orig_line)s", but patch says it should be "%(patch_line)s"c                 ó|   — || _         |                     d¦  «        | _        |                     d¦  «        | _        d S )Nú
)Úline_noÚrstripÚ	orig_lineÚ
patch_line)r   r*   r,   r-   s       r   r   zPatchConflict.__init__B   s7   € ØˆŒØ"×)Ò)¨$Ñ/Ô/ˆŒØ$×+Ò+¨DÑ1Ô1ˆŒˆˆr   Nr   r   r   r   r'   r'   =   s+   € € € € € ðL€Dð2ð 2ð 2ð 2ð 2r   r'   c                   ó   — e Zd ZdZd„ ZdS )ÚMalformedHunkHeaderz)Malformed hunk header.  %(desc)s
%(line)rc                 ó"   — || _         || _        d S r   r   r!   s      r   r   zMalformedHunkHeader.__init__L   r"   r   Nr   r   r   r   r/   r/   H   s(   € € € € € à7€Dðð ð ð ð r   r/   c                 ó(  — t          | ¦  «        }	 t          j        t          |¦  «        }|�6t	          |                     d¦  «        |                     d¦  «        ¦  «        ‚|                     d¦  «        st          d|¦  «        ‚|dd …                              d¦  «        }	 | 	                    d¦  «        \  }}n# t          $ r d }Y nw xY wn# t          $ r t          dd	¦  «        ‚w xY w	 t          | ¦  «        }|                     d
¦  «        st          d¦  «        ‚|dd …                              d¦  «        }	 | 	                    d¦  «        \  }}n# t          $ r d }Y nw xY wn# t          $ r t          dd	¦  «        ‚w xY w||f||ffS )Nr   é   ó   --- zNo orig nameé   ó   
ó   	zNo orig lineÚ s   +++ zNo mod namezNo mod line)ÚnextÚreÚmatchÚbinary_files_rer   ÚgroupÚ
startswithr   r+   ÚsplitÚ
ValueErrorÚStopIterationr	   )Ú
iter_linesr    r:   r   Úorig_tsr   Úmod_tss          r   Úget_patch_namesrD   Q   sÈ  € Ý�
ÑÔ€Dð7Ý”�¨$Ñ/Ô/ˆØÐÝ˜eŸkšk¨!™nœn¨e¯kªk¸!©n¬nÑ=Ô=Ð=Ø�Š˜wÑ'Ô'ð 	Ý& ~°tÑ<Ô<Ð<à˜Q˜R˜RœŸš¨Ñ.Ô.ˆIðØ'0§¢°uÑ'=Ô'=Ñ$�˜G˜GøÝð ð ð Ø���ðøøøøøåð 7ð 7ð 7Ý" >°2Ñ6Ô6Ð6ð7øøøð6Ý�JÑÔˆØ�Š˜wÑ'Ô'ð 	Ý˜mÑ,Ô,Ð,à˜A˜B˜B”x—’ uÑ-Ô-ˆHðØ%-§^¢^°EÑ%:Ô%:Ñ"�˜6˜6øÝð ð ð Ø���ðøøøøøåð 6ð 6ð 6Ý" =°"Ñ5Ô5Ð5ð6øøøà˜Ð  8¨VÐ"4Ð5Ð5sa   ‘BC Â&B? Â>C Â?CÃC ÃCÃC ÃC-Ã1AE. ÅE ÅE. ÅE*Å'E. Å)E*Å*E. Å.F	c                 ó¶   — |                       d¦  «        }t          |¦  «        dk    r|d         }d}n|\  }}t          |¦  «        }t          |¦  «        }||fS )zÀParse a patch range, handling the "1" special-case

    :param textrange: The text to parse
    :type textrange: str
    :return: the position and range, as a tuple
    :rtype: (int, int)
    ó   ,r   r   ó   1)r>   ÚlenÚint)Ú	textrangeÚtmpÚposÚbrangeÚranges        r   Úparse_rangerO   p   s]   € ð �/Š/˜$Ñ
Ô
€CÝ
ˆ3�x„x�1‚}€}Ø�!ŒfˆØˆˆà‰ˆˆfÝ
ˆc‰(Œ(€CÝ�‰KŒK€EØ�ˆ<Ðr   c                 óê  — dd l } |j        d| ¦  «        }|€t          d| ¦  «        ‚	 |                     d¦  «                             d¦  «        \  }}n6# t
          t          f$ r"}t          t          |¦  «        | ¦  «        ‚d }~ww xY w|                     d¦  «        r|                     d¦  «        st          d| ¦  «        ‚	 t          |dd …         ¦  «        \  }}t          |dd …         ¦  «        \  }}	n6# t
          t          f$ r"}t          t          |¦  «        | ¦  «        ‚d }~ww xY w|	dk     s|dk     rt          d	| ¦  «        ‚|                     d
¦  «        }
t          ||||	|
¦  «        S )Nr   s   \@\@ ([^@]*) \@\@( (.*))?\nzDoes not match format.r   ó    ó   -ó   +z"Positions don't start with + or -.zHunk range is negativeé   )r9   r:   r/   r<   r>   r?   Ú
IndexErrorÚstrr=   rO   ÚHunk)r    r9   ÚmatchesÚorigÚmodÚeÚorig_posÚ
orig_rangeÚmod_posÚ	mod_rangeÚtails              r   Úhunk_from_headerra   ƒ   s‘  € Ø€I€I€IØˆbŒhÐ6¸Ñ=Ô=€GØ€Ý!Ð":¸DÑAÔAÐAð0Ø—m’m AÑ&Ô&×,Ò,¨TÑ2Ô2‰ˆˆsˆsøÝ�
Ð#ð 0ð 0ð 0Ý!¥# a¡&¤&¨$Ñ/Ô/Ð/øøøøð0øøøà�?Š?˜4Ñ Ô ð N¨¯ª°tÑ(<Ô(<ð NÝ!Ð"FÈÑMÔMÐMð0Ý!,¨T°!°"°"¬XÑ!6Ô!6Ñˆ�:Ý*¨3¨q¨r¨r¬7Ñ3Ô3Ñˆ�)�)øÝ�
Ð#ð 0ð 0ð 0Ý!¥# a¡&¤&¨$Ñ/Ô/Ð/øøøøð0øøøà�1‚}€}˜
 Qš˜Ý!Ð":¸DÑAÔAÐAØ�=Š=˜ÑÔ€DÝ�˜* g¨y¸$Ñ?Ô?Ð?s/   ©+A ÁBÁ&BÂBÃ4C; Ã;D.ÄD)Ä)D.c                   ó    — e Zd Zd„ Zd„ Zd„ ZdS )ÚHunkLinec                 ó   — || _         d S r   )Úcontents©r   re   s     r   r   zHunkLine.__init__›   s   € Ø ˆŒˆˆr   c                 óŽ   — | j         dk    r|dk    r	 | j                              d¦  «        sdt          z   }nd}|| j         z   |z   S )Nr5   rQ   Fr   )re   ÚendswithÚNO_NL)r   ÚleadcharÚ
terminators      r   Úget_strzHunkLine.get_strž   sV   € ØŒ=˜EÒ!Ð! h°$Ò&6Ð&6Ð&6àŒ}×%Ò% eÑ,Ô,ð 	Ø¥™ˆJˆJàˆJØ˜$œ-Ñ'¨*Ñ4Ð4r   c                 ó   — t           ‚r   )ÚNotImplementedError©r   s    r   Úas_byteszHunkLine.as_bytes§   s   € Ý!Ð!r   N)r
   r   r   r   rl   rp   r   r   r   rc   rc   ™   sA   € € € € € ð!ð !ð !ð5ð 5ð 5ð"ð "ð "ð "ð "r   rc   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚContextLinec                 ó<   — t                                | |¦  «         d S r   ©rc   r   rf   s     r   r   zContextLine.__init__­   ó   € Ý×Ò˜$ Ñ)Ô)Ð)Ð)Ð)r   c                 ó,   — |                       d¦  «        S )NrQ   ©rl   ro   s    r   rp   zContextLine.as_bytes°   ó   € Ø�|Š|˜DÑ!Ô!Ð!r   N©r
   r   r   r   rp   r   r   r   rr   rr   «   s2   € € € € € ð*ð *ð *ð"ð "ð "ð "ð "r   rr   c                   ó   — e Zd Zd„ Zd„ ZdS )Ú
InsertLinec                 ó<   — t                                | |¦  «         d S r   rt   rf   s     r   r   zInsertLine.__init__µ   ru   r   c                 ó,   — |                       d¦  «        S )NrS   rw   ro   s    r   rp   zInsertLine.as_bytes¸   rx   r   Nry   r   r   r   r{   r{   ´   ó2   € € € € € ð*ð *ð *ð"ð "ð "ð "ð "r   r{   c                   ó   — e Zd Zd„ Zd„ ZdS )Ú
RemoveLinec                 ó<   — t                                | |¦  «         d S r   rt   rf   s     r   r   zRemoveLine.__init__½   ru   r   c                 ó,   — |                       d¦  «        S )NrR   rw   ro   s    r   rp   zRemoveLine.as_bytesÀ   rx   r   Nry   r   r   r   r€   r€   ¼   r~   r   r€   s   \ No newline at end of file
zno-returnvaluesc                 ór  — |                       d¦  «        rt          | ¦  «        S |                       d¦  «        rt          | dd …         ¦  «        S |                       d¦  «        rt          | dd …         ¦  «        S |                       d¦  «        rt          | dd …         ¦  «        S t	          d| ¦  «        ‚)Nr5   rQ   r   rS   rR   zUnknown line type)r=   rr   r{   r€   r$   )r    s    r   Ú
parse_liner„   È   s³   € Ø‡‚�uÑÔð 	7Ý˜4Ñ Ô Ð Ø	�Š˜Ñ	Ô	ð 7Ý˜4   œ8Ñ$Ô$Ð$Ø	�Š˜Ñ	Ô	ð 7Ý˜$˜q˜r˜rœ(Ñ#Ô#Ð#Ø	�Š˜Ñ	Ô	ð 7Ý˜$˜q˜r˜rœ(Ñ#Ô#Ð#åÐ/°Ñ6Ô6Ð6r   r7   c                   ó8   — e Zd Zdd„Zd„ Zd„ Zd„ ZeZd„ Zd„ Z	dS )	rW   Nc                 óZ   — || _         || _        || _        || _        || _        g | _        d S r   )r\   r]   r^   r_   r`   Úlines)r   r\   r]   r^   r_   r`   s         r   r   zHunk.__init__Ú   s0   € Ø ˆŒØ$ˆŒØˆŒØ"ˆŒØˆŒ	ØˆŒ
ˆ
ˆ
r   c                 ó²   — | j         €d}n
d| j         z   }d|                      | j        | j        ¦  «        |                      | j        | j        ¦  «        |fz  S )Nr   rQ   s   @@ -%s +%s @@%s
)r`   Ú	range_strr\   r]   r^   r_   )r   Útail_strs     r   Ú
get_headerzHunk.get_headerâ   si   € ØŒ9ÐØˆHˆHà˜dœiÑ'ˆHØ# t§~¢~°d´mØ6:´oñ(Gô (Gà'+§~¢~°d´lØ6:´nñ(Fô (Fà'/ð	'1ñ 1ð 	1r   c                 ó&   — |dk    rd|z  S d||fz  S )a  Return a file range, special-casing for 1-line files.

        :param pos: The position in the file
        :type pos: int
        :range: The range in the file
        :type range: int
        :return: a string in the format 1,4 except when range == pos == 1
        r   s   %is   %i,%ir   )r   rL   rN   s      r   r‰   zHunk.range_strí   s&   € ð �AŠ:ˆ:Ø˜3‘;Ðà˜s E˜lÑ*Ð*r   c                 ó¸   — |                       ¦   «         g}| j        D ])}|                     |                     ¦   «         ¦  «         Œ*d                     |¦  «        S )Nr   )r‹   r‡   Úappendrp   Újoin)r   r‡   r    s      r   rp   zHunk.as_bytesû   sR   € Ø—’Ñ"Ô"Ð#ˆØ”Jð 	*ð 	*ˆDØ�LŠL˜Ÿš™œÑ)Ô)Ð)Ð)Ø�xŠx˜‰ŒÐr   c                 ó�   — || j         dz
  k     rdS || j         | j        z   k    r| j        | j        z
  S |                      |¦  «        S ©Nr   r   )r\   r]   r_   Úshift_to_mod_lines)r   rL   s     r   Úshift_to_modzHunk.shift_to_mod  sP   € Ø�” Ñ"Ò"Ð"Ø�1Ø�4”= 4¤?Ñ2Ò2Ð2Ø”> D¤OÑ3Ð3à×*Ò*¨3Ñ/Ô/Ð/r   c                 óþ   — | j         dz
  }d}| j        D ]h}t          |t          ¦  «        r|dz  }nCt          |t          ¦  «        r||k    r d S |dz  }|dz  }nt          |t
          ¦  «        r|dz  }||k    r nŒi|S r‘   )r\   r‡   Ú
isinstancer{   r€   rr   )r   rL   ÚpositionÚshiftr    s        r   r’   zHunk.shift_to_mod_lines  sª   € Ø”= 1Ñ$ˆØˆØ”Jð 	ð 	ˆDÝ˜$¥
Ñ+Ô+ð Ø˜‘
��Ý˜D¥*Ñ-Ô-ð Ø˜s’?�?Ø˜4˜4Ø˜‘
�Ø˜A‘��Ý˜D¥+Ñ.Ô.ð Ø˜A‘�Ø˜#Š~ˆ~Ø�ð àˆr   r   )
r
   r   r   r   r‹   r‰   rp   Ú	__bytes__r“   r’   r   r   r   rW   rW   Ø   sz   € € € € € ðð ð ð ð	1ð 	1ð 	1ð+ð +ð +ðð ð ð €Ið0ð 0ð 0ðð ð ð ð r   rW   Fc              #   óî  K  — d}| D ]å}|dk    r	|�|V — d}Œ|�|V — 	 t          |¦  «        }n# t          $ r |rY  dS ‚ w xY wd}d}||j        k     s||j        k     rŽt	          t          | ¦  «        ¦  «        }|j                             |¦  «         t          |t          t          f¦  «        r|dz  }t          |t          t          f¦  «        r|dz  }||j        k     °ƒ||j        k     °ŽŒæ|�|V — dS dS )a"  
    :arg iter_lines: iterable of lines to parse for hunks
    :kwarg allow_dirty: If True, when we encounter something that is not
        a hunk header when we're looking for one, assume the rest of the lines
        are not part of the patch (comments or other junk).  Default False
    Nr5   r   r   )ra   r/   r]   r_   r„   r8   r‡   rŽ   r•   r€   rr   r{   )rA   Úallow_dirtyÚhunkr    Ú	orig_sizeÚmod_sizeÚ	hunk_lines          r   Ú
iter_hunksrŸ     sY  è è € ð €DØð ð ˆØ�5Š=ˆ=ØÐØ�
�
�
Ø�ØØÐØˆJˆJˆJð	Ý# DÑ)Ô)ˆDˆDøÝ"ð 	ð 	ð 	Øð ð ���Øð	øøøð ˆ	ØˆØ˜$œ/Ò)Ð)¨X¸¼Ò-FÐ-FÝ"¥4¨
Ñ#3Ô#3Ñ4Ô4ˆIØŒJ×Ò˜iÑ(Ô(Ð(Ý˜)¥jµ+Ð%>Ñ?Ô?ð Ø˜Q‘�	Ý˜)¥jµ+Ð%>Ñ?Ô?ð Ø˜A‘�ð ˜$œ/Ò)Ð)¨X¸¼Ò-FÐ-Føð ÐØˆ
ˆ
ˆ
ˆ
ˆ
ð Ðs   Ÿ/¯A¿Ac                   ó   — e Zd Zd„ Zd„ ZdS )ÚBinaryPatchc                 ó"   — || _         || _        d S r   ©ÚoldnameÚnewname)r   r¤   r¥   s      r   r   zBinaryPatch.__init__E  s   € ØˆŒØˆŒˆˆr   c                 ó$   — d| j         | j        fz  S )Ns   Binary files %s and %s differ
r£   ro   s    r   rp   zBinaryPatch.as_bytesI  s   € Ø1ØŒL˜$œ,ð5(ñ (ð 	(r   Nry   r   r   r   r¡   r¡   C  s2   € € € € € ðð ð ð(ð (ð (ð (ð (r   r¡   c                   óP   — e Zd Zd
d„Zd„ Zed„ ¦   «         Zd„ Zd„ Zd„ Z	d„ Z
d	„ ZdS )ÚPatchNc                 óh   — t                                | ||¦  «         || _        || _        g | _        d S r   )r¡   r   ÚoldtsÚnewtsÚhunks)r   r¤   r¥   rª   r«   s        r   r   zPatch.__init__P  s3   € Ý×Ò˜T 7¨GÑ4Ô4Ð4ØˆŒ
ØˆŒ
ØˆŒ
ˆ
ˆ
r   c                 ó|   — |                       ¦   «         }|d                     d„ | j        D ¦   «         ¦  «        z  }|S )Nr   c                 ó6   — g | ]}|                      ¦   «         ‘ŒS r   )rp   )Ú.0Úhs     r   ú
<listcomp>z"Patch.as_bytes.<locals>.<listcomp>X  s    € Ð:Ð:Ð:¨!˜Ÿš™œÐ:Ð:Ð:r   )r‹   r�   r¬   )r   Úrets     r   rp   zPatch.as_bytesV  s=   € Ø�oŠoÑÔˆØˆs�xŠxÐ:Ð:¨t¬zÐ:Ñ:Ô:Ñ;Ô;Ñ;ˆØˆ
r   c                 ó4   — |dz   |z   }|�|d|z  z  }|dz  }|S )NrQ   s   	%sr5   r   )ÚclsÚstartÚnameÚtsÚls        r   Ú_headerlinezPatch._headerline[  s1   € à�D‰L˜4ÑˆØˆ>Ø�˜2‘ÑˆAØ	ˆU‰
ˆØˆr   c                 óˆ   — |                       d| j        | j        ¦  «        |                       d| j        | j        ¦  «        z   S )Ns   ---s   +++)r¹   r¤   rª   r¥   r«   ro   s    r   r‹   zPatch.get_headerc  s?   € à×Ò˜V T¤\°4´:Ñ>Ô>Ø×Ò˜V T¤\°4´:Ñ>Ô>ñ?ð	@r   c                 óÊ   — d}d}| j         D ]A}|j        D ]7}t          |t          ¦  «        r|dz  }Œt          |t          ¦  «        r|dz  }Œ8ŒB||t          | j         ¦  «        fS )z,Calculate the number of inserts and removes.r   r   )r¬   r‡   r•   r{   r€   rH   )r   ÚremovesÚinsertsr›   r    s        r   Ústats_valueszPatch.stats_valuesh  sƒ   € àˆØˆØ”Jð 	!ð 	!ˆDØœ
ð !ð !�Ý˜d¥JÑ/Ô/ð !Ø˜q‘L�G�GÝ ¥jÑ1Ô1ð !Ø˜q‘L�Gøð	!ð
 ˜¥# d¤j¡/¤/Ð2Ð2r   c                 ó0   — d|                       ¦   «         z  S )z#Return a string of patch statisticsz"%i inserts, %i removes in %i hunks)r¾   ro   s    r   Ú	stats_strzPatch.stats_strt  s   € à3Ø×ÒÑÔñ ð 	 r   c                 ó\   — |}| j         D ]!}|                     |¦  «        }|€ d S ||z  }Œ"|S r   )r¬   r“   )r   r–   Únewposr›   r—   s        r   Ú
pos_in_modzPatch.pos_in_mody  sG   € ØˆØ”Jð 	ð 	ˆDØ×%Ò% hÑ/Ô/ˆEØˆ}Ø�t�tØ�e‰OˆFˆFØˆr   c              #   óº   K  — | j         D ]P}|j        dz
  }|j        D ]<}t          |t          ¦  «        r||fV — |dz  }t          |t
          ¦  «        r|dz  }Œ=ŒQdS )zƒIteraties through inserted lines

        :return: Pair of line number, line
        :rtype: iterator of (int, InsertLine)
        r   N)r¬   r^   r‡   r•   r{   rr   )r   r›   rL   r    s       r   Úiter_insertedzPatch.iter_inserted‚  sŒ   è è € ð ”Jð 	ð 	ˆDØ”, Ñ"ˆCØœ
ð ð �Ý˜d¥JÑ/Ô/ð Ø ˜+Ð%Ð%Ð%Ø˜1‘H�CÝ˜d¥KÑ0Ô0ð Ø˜1‘H�Cøðð	ð 	r   )NN)r
   r   r   r   rp   Úclassmethodr¹   r‹   r¾   rÀ   rÃ   rÅ   r   r   r   r¨   r¨   N  s    € € € € € ðð ð ð ðð ð ð
 ðð ñ „[ðð@ð @ð @ð

3ð 
3ð 
3ð ð  ð  ð
ð ð ðð ð ð ð r   r¨   c                 ó6  — t          | ¦  «        } 	 t          | ¦  «        \  \  }}\  }}t          ||||¦  «        }t          | |¦  «        D ]}|j                             |¦  «         Œ|S # t          $ r$}t          |j        |j	        ¦  «        cY d}~S d}~ww xY w)z“
    :arg iter_lines: iterable of lines to parse
    :kwarg allow_dirty: If True, allow the patch to have trailing junk.
        Default False
    N)
Úiter_lines_handle_nlrD   r¨   rŸ   r¬   rŽ   r   r¡   r   r   )	rA   rš   r   rB   r   rC   Úpatchr›   r[   s	            r   Úparse_patchrÊ   ’  sÇ   € õ & jÑ1Ô1€Jð	Ý5DØñ6ô 6Ñ2Ñ	ˆ)�WÑ1 ¨&õ
 �i ¨7°FÑ;Ô;ˆÝ˜z¨;Ñ7Ô7ð 	%ð 	%ˆDØŒK×Ò˜tÑ$Ô$Ð$Ð$Øˆøõ ð 4ð 4ð 4Ý˜1œ;¨¬
Ñ3Ô3Ð3Ð3Ð3Ð3Ð3Ð3øøøøð4øøøs   ‘A* Á*
BÁ4BÂBÂBrA   rš   Ú
keep_dirtyc              #   ó°  K  — t          j        t          ¦  «        }g }g }d}d}| D �]w}|                     d¦  «        rS|r|rn8t	          |¦  «        dk    r%|rt	          |¦  «        dk    r
||dœV — g }n|V — g }|                     |¦  «         Œk|                     d¦  «        rŒ�|                     d¦  «        rŒ—|dk    r0|                     d¦  «        s|                     d¦  «        r|d	z  }n•|                     d
¦  «        s|                     |¦  «        r@|r|rd}n6t	          |¦  «        dk    r#|rt	          |¦  «        dk    r
||dœV — g }n|V — g }n+|                     d¦  «        rt          |¦  «        }	|	j        }|                     |¦  «         �Œyt	          |¦  «        dk    r$|rt	          |¦  «        dk    r	||dœV — dS |V — dS dS )a•  
    :arg iter_lines: iterable of lines to parse for patches
    :kwarg allow_dirty: If True, allow comments and other non-patch text
        before the first patch.  Note that the algorithm here can only find
        such text before any patches have been found.  Comments after the
        first patch are stripped away in iter_hunks() if it is also passed
        allow_dirty=True.  Default False.
    r   Ts   === )Úsaved_linesÚ
dirty_heads   *** ó   #rR   rQ   r   r3   Fs   @@N)	r9   Úcompiler;   r=   rH   rŽ   r:   ra   r]   )
rA   rš   rË   ÚregexrÍ   rÎ   r]   Ú	beginningr    r›   s
             r   Úiter_file_patchrÓ   ¥  s•  è è € õ ŒJ•Ñ'Ô'€EØ!€KØ €JØ€JØ€Iàð )!ñ )!ˆØ�?Š?˜7Ñ#Ô#ð 	Øð !˜yð !ð Ý�[Ñ!Ô! AÒ%Ð%Øð &¥# j¡/¤/°AÒ"5Ð"5Ø*5Ø)3ð5ð 5ð 5ð 5ð 5à!#�J�Jà%Ð%Ð%Ð%Ø �Ø×Ò˜dÑ#Ô#Ð#ØØ�?Š?˜7Ñ#Ô#ð 	ØØ�?Š?˜4Ñ Ô ð 	)ØØ˜!Š^ˆ^Ø�Š˜tÑ$Ô$ð  ¨¯ª¸Ñ(=Ô(=ð  Ø˜a‘�
øØ�_Š_˜WÑ%Ô%ð 	)¨¯ª°TÑ):Ô):ð 	)Øð &˜yð &ð "�	�	Ý�[Ñ!Ô! AÒ%Ð%Øð &¥# j¡/¤/°AÒ"5Ð"5Ø*5Ø)3ð5ð 5ð 5ð 5ð 5à!#�J�Jà%Ð%Ð%Ð%ØˆKˆKØ�_Š_˜UÑ#Ô#ð 	)Ý# DÑ)Ô)ˆDØœˆJØ×Ò˜4Ñ Ô Ð Ñ Ý
ˆ;ÑÔ˜!ÒÐØð 	�#˜j™/œ/¨AÒ-Ð-Ø"-Ø!+ð-ð -ð -ð -ð -ð -ð -ð ÐÐÐÐÐð Ðr   Úreturnc              #   ó°   K  — d}| D ]F}|t           k    r1|�|                     d¦  «        st          ¦   «         ‚|dd…         }d}|�|V — |}ŒG|�|V — dS dS )zî
    Iterates through lines, ensuring that lines that originally had no
    terminating 
 are produced without one.  This transformation may be
    applied at any point up until hunk line parsing, and is safe to apply
    repeatedly.
    Nr5   éÿÿÿÿ)ri   rh   ÚAssertionError)rA   Ú	last_liner    s      r   rÈ   rÈ   ë  s�   è è € ð "&€Iàð ð ˆØ•5Š=ˆ=ØÐ ¨	×(:Ò(:¸5Ñ(AÔ(AÐ Ý$Ñ&Ô&Ð&Ø! # 2 #œˆIØˆDØÐ ØˆOˆOˆOØˆ	ˆ	ØÐØˆˆˆˆˆð Ðr   c              #   ó¢   K  — t          | ||¦  «        D ]:}d|v r"t          |d         |¦  «        |d         dœV — Œ(t          ||¦  «        V — Œ;dS )ab  
    :arg iter_lines: iterable of lines to parse for patches
    :kwarg allow_dirty: If True, allow text that's not part of the patch at
        selected places.  This includes comments before and after a patch
        for instance.  Default False.
    :kwarg keep_dirty: If True, returns a dict of patches with dirty headers.
        Default False.
    rÎ   rÍ   )rÉ   rÎ   N)rÓ   rÊ   )rA   rš   rË   Úpatch_liness       r   Úparse_patchesrÛ     s‹   è è € õ ' z°;À
ÑKÔKð 8ð 8ˆØ˜;Ð&Ð&Ý(¨°]Ô)CÀ[ÑQÔQØ"-¨lÔ";ð=ð =ð >ð >ð >ð >õ ˜k¨;Ñ7Ô7Ð7Ð7Ð7Ð7ð8ð 8r   c                 ó¸   — t          | ¦  «        }t          |¦  «        |k     rt          |¦  «        }t          |¦  «        D ]}| |         ||         k    r|c S ŒdS )a  Find the indext of the first character that differs between two texts

    :param atext: The first text
    :type atext: str
    :param btext: The second text
    :type str: str
    :return: The index, or None if there are no differences within the range
    :rtype: int or NoneType
    N)rH   rN   )ÚatextÚbtextÚlengthÚis       r   Údifference_indexrá     sf   € õ �‰ZŒZ€FÝ
ˆ5�z„z�FÒÐÝ�U‘”ˆÝ�6‰]Œ]ð ð ˆØ�Œ8�u˜Q”xÒÐØˆHˆHˆHð  àˆ4r   c                 ó’   — t          t          |¦  «        ¦  «        }t          |¦  «         t          | t	          |¦  «        ¦  «        S )z€Iterate through a series of lines with a patch applied.
    This handles a single file, and does exact, not fuzzy patching.
    )rÈ   ÚiterrD   Úiter_patched_from_hunksrŸ   )Ú
orig_linesrÚ   s     r   Úiter_patchedræ   %  s?   € õ '¥t¨KÑ'8Ô'8Ñ9Ô9€KÝ�KÑ Ô Ð Ý" :­z¸+Ñ/FÔ/FÑGÔGÐGr   c           	   #   óv  K  — g }d}| �t          | ¦  «        } |D �]}||j        k     r#t          | ¦  «        }|V — |dz  }||j        k     °#|j        D ]Ø}|                     |j        ¦  «         t          |t          ¦  «        r
|j        V — Œ;t          |t          t          f¦  «        r�t          | ¦  «        }||j        k    r$t          ||d                     |¦  «        ¦  «        ‚t          |t          ¦  «        r|V — n$t          |t          ¦  «        st          |¦  «        ‚|dz  }ŒÙ�Œ| �
| E d{V —† dS dS )zÞIterate through a series of lines with a patch applied.
    This handles a single file, and does exact, not fuzzy patching.

    :param orig_lines: The unpatched lines.
    :param hunks: An iterable of Hunk instances.
    r   Nr   )rã   r\   r8   r‡   rŽ   re   r•   r{   rr   r€   r'   r�   r×   )rå   r¬   Ú
seen_patchr*   r›   r,   rž   s          r   rä   rä   .  sŽ  è è € ð €JØ€GØÐÝ˜*Ñ%Ô%ˆ
Øð ñ ˆØ˜œÒ%Ð%Ý˜ZÑ(Ô(ˆIØˆOˆOˆOØ�q‰LˆGð ˜œÒ%Ð%ð œð 	ð 	ˆIØ×Ò˜iÔ0Ñ1Ô1Ð1Ý˜)¥ZÑ0Ô0ð ØÔ(Ð(Ð(Ð(Ð(Ý˜I­µZÐ'@ÑAÔAð 
Ý  Ñ,Ô,�	Ø 	Ô 2Ò2Ð2Ý'¨°Ø(+¯ª°Ñ(<Ô(<ñ>ô >ð >å˜i­Ñ5Ô5ð 8Ø#�O�O�O�Oå% iµÑ<Ô<ð 8Ý,¨YÑ7Ô7Ð7Ø˜1‘�øñ	ð ÐØÐÐÐÐÐÐÐÐÐð Ðr   c           	      óÒ  — d„ }ddl m} |D �]Y}|j        dk    rd}d}nf ||j                             ¦   «         ¦  «        }|                      |¦  «        }| j                             |¦  «        }|                      |¦  «         |j        dk    rÕ ||j                             ¦   «         ¦  «        }	t          | 
                    d¦  «        |j        ¦  «        }
|€st          j                             |	¦  «        }| j        }|dd	…         D ]}|                      ||¦  «        }Œ|                      |d	         ||
 ||	¦  «        ¬
¦  «         �ŒC|                      |
|¦  «         �Œ[dS )zªApply patches to a TreeTransform.

    :param tt: TreeTransform instance
    :param patches: List of patches
    :param prefix: Number leading path segments to strip
    c                 ób   — d                      |                      d¦  «        dd …         ¦  «        S )Nú/r   )r�   r>   )Úps    r   Ústrip_prefixz#apply_patches.<locals>.strip_prefixX  s'   € Ø�xŠx˜Ÿš ™œ Q R RÔ(Ñ)Ô)Ð)r   r   )Úgen_file_ids	   /dev/nullNr   Tr   rÖ   )Úfile_id)Úbreezy.bzr.generate_idsrî   r¤   ÚdecodeÚtrans_id_tree_pathÚ_treeÚget_file_textÚdelete_contentsr¥   rä   Ú
splitlinesr¬   ÚosÚpathr>   ÚrootÚnew_directoryÚnew_fileÚcreate_file)ÚttÚpatchesÚprefixrí   rî   rÉ   Útrans_idÚorig_contentsr¤   r¥   Únew_contentsÚpartsÚparts                r   Úapply_patchesr  Q  s�  € ð*ð *ð *ð 4Ð3Ð3Ð3Ð3Ð3àð 7ñ 7ˆØŒ=˜LÒ(Ð(ØˆHØˆMˆMà"�l 5¤=×#7Ò#7Ñ#9Ô#9Ñ:Ô:ˆGØ×,Ò,¨WÑ5Ô5ˆHØœH×2Ò2°7Ñ;Ô;ˆMØ×Ò˜xÑ(Ô(Ð(àŒ=˜LÒ(Ð(Ø"�l 5¤=×#7Ò#7Ñ#9Ô#9Ñ:Ô:ˆGÝ2Ø×(Ò(¨Ñ.Ô.°´ñ=ô =ˆLàÐÝœŸš gÑ.Ô.�Øœ7�Ø! ! B $œKð @ð @�DØ!×/Ò/°°hÑ?Ô?�H�HØ—’Ø˜"”I˜x¨Ø'˜K¨Ñ0Ô0ð ñ 2ô 2ð 2ñ 2ð —’˜|¨XÑ6Ô6Ð6ùð/7ð 7r   c                   ó&   — e Zd ZdZdd„Zd„ Zd„ ZdS )ÚAppliedPatcheszAContext that provides access to a tree with patches applied.
    r   c                 ó0   — || _         || _        || _        d S r   )Útreerþ   rÿ   )r   r	  rþ   rÿ   s       r   r   zAppliedPatches.__init__{  s   € ØˆŒ	ØˆŒØˆŒˆˆr   c                 ó²   — | j                              ¦   «         | _        t          | j        | j        | j        ¬¦  «         | j                             ¦   «         S )N)rÿ   )r	  Úpreview_transformÚ_ttr  rþ   rÿ   Úget_preview_treero   s    r   Ú	__enter__zAppliedPatches.__enter__€  sF   € Ø”9×.Ò.Ñ0Ô0ˆŒÝ�d”h ¤°T´[ÐAÑAÔAÐAØŒx×(Ò(Ñ*Ô*Ð*r   c                 ó8   — | j                              ¦   «          dS )NF)r  Úfinalize)r   Úexc_typeÚ	exc_valueÚexc_tbs       r   Ú__exit__zAppliedPatches.__exit__…  s   € ØŒ×ÒÑÔÐØˆur   N©r   )r
   r   r   r   r   r  r  r   r   r   r  r  w  sP   € € € € € ðð ðð ð ð ð
+ð +ð +ð
ð ð ð ð r   r  )F)FFr  )(Úerrorsr   r÷   r9   Útypingr   r   r   r;   r	   r   r   r$   r'   r/   rD   rO   ra   rc   rr   r{   r€   ri   Ú__pychecker__r„   rW   rŸ   r¡   r¨   rÊ   ÚbytesÚboolrÓ   rÈ   rÛ   rá   ræ   rä   r  r  r   r   r   ú<module>r     s÷  ðð$ð ð ð ð ð ð 
€	€	€	Ø 	€	€	€	Ø +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +Ð +ð 9€ð.ð .ð .ð .ð .�(ñ .ô .ð .ð!ð !ð !ð !ð !�(ñ !ô !ð !ðð ð ð ð ˜;ñ ô ð ðð ð ð ð �Kñ ô ð ð2ð 2ð 2ð 2ð 2�Hñ 2ô 2ð 2ðð ð ð ð ˜+ñ ô ð ð6ð 6ð 6ð>ð ð ð&@ð @ð @ð,"ð "ð "ð "ð "ñ "ô "ð "ð$"ð "ð "ð "ð "�(ñ "ô "ð "ð"ð "ð "ð "ð "�ñ "ô "ð "ð"ð "ð "ð "ð "�ñ "ô "ð "ð 	*€Ø!€ð
7ð 
7ð 
7ð €ðBð Bð Bð Bð Bñ Bô Bð BðJ#ð #ð #ð #ðL(ð (ð (ð (ð (ñ (ô (ð (ðAð Að Að Að AˆKñ Aô Að AðHð ð ð ð&Cð C ¨¤ð C¸dð CÐX\ð Cð Cð Cð CðL X¨e¤_ð ¸À%¼ð ð ð ð ð,8ð 8ð 8ð 8ð"ð ð ð&Hð Hð Hð ð  ð  ðF#7ð #7ð #7ð #7ðLð ð ð ð ñ ô ð ð ð r   