§
    cÌcª  ã            
       ó¬  — d dl Z d dlZd dlZd dlZd dlZd dlmZmZmZm	Z	 ddl
m
Z
  e
 e¦   «         d¦  «         ddlmZmZmZ ddlmZ ddlmZmZmZ dd	lmZmZ d
Z G d„ dej        ¦  «        Zdddefd„Z	 	 d4d„Zd5d„Zg d¢Z d„ Z!d„ Z"	 d5d„Z#d6d„Z$ddddddddef	de%de%de%dee%         fd „Z&d!„ Z'd"„ Z( G d#„ d$¦  «        Z) G d%„ d&¦  «        Z* G d'„ d(e)¦  «        Z+ G d)„ d*e)¦  «        Z, G d+„ d,e)¦  «        Z- G d-„ d.e)¦  «        Z. G d/„ d0e)¦  «        Z/ G d1„ d2¦  «        Z0 ee%e	e0         f         ¦   «         Z1e1 2                    d3e0¦  «         dS )7é    N)ÚOptionalÚListÚUnionÚTypeé   )Úlazy_importzÔ
import errno
import patiencediff
import subprocess

from breezy import (
    controldir,
    textfile,
    timestamp,
    views,
    )

from breezy.workingtree import WorkingTree
from breezy.i18n import gettext
)ÚerrorsÚosutilsÚ	transport)ÚRegistry)ÚmutterÚnoteÚwarning)ÚTreeÚFileTimestampUnavailableé   c                   ó   — e Zd ZdZd„ ZdS )Ú_PrematchedMatcherz<Allow SequenceMatcher operations to use predetermined blocksc                 óN   — t          j        | d d ¦  «         || _        d | _        d S ©N)ÚdifflibÚSequenceMatcherÚmatching_blocksÚopcodes)Úselfr   s     ú-/usr/lib/python3/dist-packages/breezy/diff.pyÚ__init__z_PrematchedMatcher.__init__@   s*   € ÝÔ  d¨DÑ1Ô1Ð1Ø.ˆÔØˆŒˆˆó    N)Ú__name__Ú
__module__Ú__qualname__Ú__doc__r   © r   r   r   r   =   s)   € € € € € ØFÐFðð ð ð ð r   r   FÚutf8c	           	      óŒ  — |du r4t                                |¦  «         t                                |¦  «         |€t          j        }t	          |||                      |d¦  «        |                     |d¦  «        ||¬¦  «        }	t          |	¦  «        }	t          |	¦  «        dk    rd S |s |	d                              dd¦  «        |	d<   n!|s|	d                              dd	¦  «        |	d<   |	D ]A}
| 	                    |
¦  «         |
 
                    d
¦  «        s| 	                    d¦  «         ŒB| 	                    d
¦  «         d S )NFÚreplace)ÚfromfileÚtofileÚnÚsequencematcherr   é   s   -1,0s   -0,0s   +1,0s   +0,0ó   
s   
\ No newline at end of file
)ÚtextfileÚcheck_text_linesÚpatiencediffÚPatienceSequenceMatcherÚunified_diff_bytesÚencodeÚlistÚlenr&   ÚwriteÚendswith)Ú	old_labelÚoldlinesÚ	new_labelÚnewlinesÚto_fileÚallow_binaryÚsequence_matcherÚpath_encodingÚcontext_linesÚudÚlines              r   Úinternal_diffrB   F   sW  € ð �uÐÐÝ×!Ò! (Ñ+Ô+Ð+Ý×!Ò! (Ñ+Ô+Ð+àÐÝ'Ô?ÐÝ	Ø�(Ø×!Ò! -°Ñ;Ô;Ø×Ò ¨yÑ9Ô9Ø
Ð)9ð	
;ñ 
;ô 
;€Bõ 
ˆb‰Œ€BÝ
ˆ2�w„w�!‚|€|Øˆð ð 0Ø�1”—’˜g wÑ/Ô/ˆˆ1‰ˆØð 0Ø�1”—’˜g wÑ/Ô/ˆˆ1‰àð ?ð ?ˆØ�Š�dÑÔÐØ�}Š}˜UÑ#Ô#ð 	?Ø�MŠMÐ=Ñ>Ô>Ð>øØ‡M‚M�%ÑÔÐÐÐr   r   r,   c	              #   ób  K  — |€t           j        }|rdt          |¦  «        z   }|rdt          |¦  «        z   }d}	 |d| |¦  «                             |¦  «        D ]Ó}
|	sd|||fz  V — d|||fz  V — d}	|
d         d         |
d	         d
         |
d         d         |
d	         d         f\  }}}}d|dz   ||z
  |dz   ||z
  |fz  V — |
D ]c\  }}}}}|dk    r| ||…         D ]	}d|z   V — Œ
Œ#|dk    s|dk    r| ||…         D ]	}d|z   V — Œ
|dk    s|dk    r|||…         D ]	}d|z   V — Œ
ŒdŒÔdS )a›  
    Compare two sequences of lines; generate the delta as a unified diff.

    Unified diffs are a compact way of showing line changes and a few
    lines of context.  The number of context lines is set by 'n' which
    defaults to three.

    By default, the diff control lines (those with ---, +++, or @@) are
    created with a trailing newline.  This is helpful so that inputs
    created from file.readlines() result in diffs that are suitable for
    file.writelines() since both the inputs and outputs have trailing
    newlines.

    For inputs that do not have trailing newlines, set the lineterm
    argument to "" so that the output will be uniformly newline free.

    The unidiff format normally has a header for filenames and modification
    times.  Any or all of these may be specified using strings for
    'fromfile', 'tofile', 'fromfiledate', and 'tofiledate'.  The modification
    times are normally expressed in the format returned by time.ctime().

    Example:

    >>> for line in bytes_unified_diff(b'one two three four'.split(),
    ...             b'zero one tree four'.split(), b'Original', b'Current',
    ...             b'Sat Jan 26 23:30:50 1991', b'Fri Jun 06 10:20:52 2003',
    ...             lineterm=b''):
    ...     print line
    --- Original Sat Jan 26 23:30:50 1991
    +++ Current Fri Jun 06 10:20:52 2003
    @@ -1,4 +1,4 @@
    +zero
     one
    -two
    -three
    +tree
     four
    Nó   	Fs
   --- %s%s%ss
   +++ %s%s%sTr   r   éÿÿÿÿr+   r   é   s   @@ -%d,%d +%d,%d @@%sÚequaló    r&   Údeleteó   -Úinsertó   +)r   r   ÚbytesÚget_grouped_opcodes)ÚaÚbr'   r(   ÚfromfiledateÚ
tofiledater)   Úlinetermr*   ÚstartedÚgroupÚi1Úi2Új1Új2ÚtagrA   s                    r   r1   r1   p   sô  è è € ðP ÐÝ!Ô1ˆàð 3Ø�u \Ñ2Ô2Ñ2ˆØð /Ø�U :Ñ.Ô.Ñ.ˆ
à€GØ �  q¨!Ñ,Ô,×@Ò@ÀÑCÔCð &ð &ˆØð 	Ø 8¨\¸8Ð"DÑDÐDÐDÐDØ 6¨:°xÐ"@Ñ@Ð@Ð@Ð@ØˆGØ˜qœ !œ e¨B¤i°¤l°E¸!´H¸Q´KÀÀrÄÈ1ÄÐM‰ˆˆB��BØ&¨"¨q©&°"°r±'¸2À¹6À2ÈÁ7ÈHÐ)UÑUÐUÐUÐUØ#(ð 
	&ð 
	&ÑˆC��R˜˜RØ�gŠ~ˆ~Ø˜b ˜eœHð &ð &�DØ ™+Ð%Ð%Ð%Ð%ØØ�iÒÐ 3¨(¢? ?Ø˜b ˜eœHð &ð &�DØ ™+Ð%Ð%Ð%Ð%Ø�iÒÐ 3¨(¢? ?Ø˜b ˜eœHð &ð &�DØ ™+Ð%Ð%Ð%Ð%øð
	&ð&ð &r   Tc                 ó–  — |rDi }t           j                             d¦  «        }|�||d<   d|d<   d|d<   d|d<   t          j        }nd}d}	 t                               | t          j        t          j        ||¬¦  «        }nI# t          $ r<}|j        t          j        k    r!t          j
        t          |¦  «        ¦  «        ‚‚ d}~ww xY w|S )a@  Spawn the external diff process, and return the child handle.

    :param diffcmd: The command list to spawn
    :param capture_errors: Capture stderr as well as setting LANG=C
        and LC_ALL=C. This lets us read and understand the output of diff,
        and respond to any errors.
    :return: A Popen object.
    ÚPATHNÚCÚLANGUAGEÚLANGÚLC_ALL)ÚstdinÚstdoutÚstderrÚenv)ÚosÚenvironÚgetÚ
subprocessÚPIPEÚPopenÚOSErrorÚerrnoÚENOENTr	   ÚNoDiffÚstr)ÚdiffcmdÚcapture_errorsrd   Úpathrc   ÚpipeÚes          r   Ú_spawn_external_diffru   µ   sä   € ð ð àˆÝŒz�~Š~˜fÑ%Ô%ˆØÐØˆC�‰KØˆˆJ‰ØˆˆF‰ØˆˆH‰Ý”ˆˆàˆØˆð	Ý×Ò Ý&0¤oÝ'1¤Ø'-Ø$'ð	  ñ )ô )ˆˆøõ
 ð ð ð ØŒ7•e”lÒ"Ð"Ý”-¥ A¡¤Ñ'Ô'Ð'Øøøøøðøøøð
 €Ks   Á3B  Â 
CÂ
7CÃC)z-cz-Cz	--contextz-ez--edz-fz--forward-edz-qz--briefz--normalz-nz--rcsú-uz-Uz	--unifiedz-yz--side-by-sidez-Dz--ifdefc                 ó€   — t           D ] }| D ]}|                     |¦  «        r nŒŒ n|                      d¦  «         | S )aâ  Default to unified diff style if alternative not specified in diff_opts.

        diff only allows one style to be specified; they don't override.
        Note that some of these take optargs, and the optargs can be
        directly appended to the options.
        This is only an approximate parser; it doesn't properly understand
        the grammar.

    :param diff_opts: List of options for external (GNU) diff.
    :return: List of options with default style=='unified'.
    rv   )Ústyle_option_listÚ
startswithÚappend)Ú	diff_optsÚsÚjs      r   Údefault_style_unifiedr~   æ   sb   € õ ð ð ˆØð 	ð 	ˆAØ�|Š|˜A‰Œð Ø�ðð Øˆà×Ò˜ÑÔÐØÐr   c                 óx  — ddl }|                     ¦   «          |                     d¬¦  «        \  }}|                     d¬¦  «        \  }	}
t          j        |d¦  «        }t          j        |	d¦  «        }	 |                     |¦  «         |                     |¦  «         |                     ¦   «          |                     ¦   «          |sg }t          j        dk    r*|  	                    d¦  «        } | 	                    d¦  «        }d	d
| |d
||
dg}t          |¦  «        }|r|                     |¦  «         t          |d¬¦  «        }|                     ¦   «         \  }}|j        }|dz  }|dk    rý|}t          |d¬¦  «        }|                     ¦   «         \  }}|                     |dz   ¦  «         |j        dk    rt!          j        d|›�¦  «        ‚|                     dd¦  «        d         }t'          j        d|t&          j        ¦  «        }|€t!          j        d|›�¦  «        ‚	 |                     ¦   «          |                     ¦   «          d„ } ||¦  «          ||
¦  «         dS |                     |¦  «         |dvr,|dk     rd| z  }nd|z  }t!          j        d|›d|›�¦  «        ‚	 |                     ¦   «          |                     ¦   «          d„ } ||¦  «          ||
¦  «         dS # |                     ¦   «          |                     ¦   «          d„ } ||¦  «          ||
¦  «         w xY w)z;Display a diff by calling out to the external diff program.r   Nzbrz-diff-old-©Úprefixzbrz-diff-new-ÚwbÚwin32ÚmbcsÚdiffz--labelz--binaryT)rq   r,   r+   Fzdexternal diff failed with exit code 2 when run with LANG=C and LC_ALL=C, but not when run natively: r   s   ^(binary )?files.*differ$z0external diff failed with exit code 2; command: c                 ó¶   — 	 t          j        | ¦  «         d S # t          $ r6}|j        t          j        fvrt          d| |¦  «         Y d }~d S Y d }~d S d }~ww xY w)Nz&Failed to delete temporary file: %s %s)re   Úremoverk   rl   rm   r   )rr   rt   s     r   Úcleanupzexternal_diff.<locals>.cleanup`  s†   € ðOÝ”	˜$‘”���øÝð Oð Oð OØ”7¥5¤< /Ð1Ð1ÝÐDÀdÈAÑNÔNÐNÐNÐNÐNÐNÐNÐNð 2Ð1Ð1Ð1Ð1Ð1øøøøðOøøøs   ‚ ˜
A¢%AÁA)r   r   z	signal %dzexit code %dzexternal diff failed with z; command: )ÚtempfileÚflushÚmkstempre   ÚfdopenÚ
writelinesÚcloseÚsysÚplatformr2   r~   Úextendru   ÚcommunicateÚ
returncoder5   r	   ÚBzrErrorÚsplitÚreÚmatchÚI)r7   r8   r9   r:   r;   r{   r‰   Ú	oldtmp_fdÚold_abspathÚ	newtmp_fdÚnew_abspathÚoldtmpfÚnewtmpfrp   rs   ÚoutÚerrÚrcÚ
lang_c_outÚ
first_lineÚmrˆ   Úmsgs                          r   Úexternal_diffr¦   þ   sÐ  € ð €O€O€Oà‡M‚M�O„O€Oà%×-Ò-°_Ð-ÑEÔEÑ€Iˆ{Ø%×-Ò-°_Ð-ÑEÔEÑ€Iˆ{ÝŒi˜	 4Ñ(Ô(€GÝŒi˜	 4Ñ(Ô(€Gðað 	×Ò˜8Ñ$Ô$Ð$Ø×Ò˜8Ñ$Ô$Ð$à�Š‰ŒˆØ�Š‰Œˆàð 	ØˆIÝŒ<˜7Ò"Ð"ð "×(Ò(¨Ñ0Ô0ˆIØ!×(Ò(¨Ñ0Ô0ˆIØØ˜iØØ˜iØØðˆõ *¨)Ñ4Ô4ˆ	àð 	&Ø�NŠN˜9Ñ%Ô%Ð%å# G¸DÐAÑAÔAˆØ×#Ò#Ñ%Ô%‰ˆˆSØŒ_ˆð 	ˆu‰ˆØ�Š7ˆ7ð
 ˆJõ (¨ÀÐFÑFÔFˆDØ×'Ò'Ñ)Ô)‰HˆC�ð �MŠM˜# ™+Ñ&Ô&Ð&ØŒ !Ò#Ð#Ý”o�oð 9@¸ðBñCô Cð Cð
 $×)Ò)¨%°Ñ3Ô3°AÔ6ˆJå”Ð5°zÅ2Ä4ÑHÔHˆAØˆyÝ”o�oØ8?¸ð'Bñ Cô Cð Cð ð  	�Š‰ŒˆØ�Š‰Œˆð	Oð 	Oð 	Oð 	ˆ�ÑÔÐØˆ�ÑÔÐÐÐð5 	�Š�cÑÔÐØ�VÐÐà�AŠvˆvØ! b SÑ)��à$ rÑ)�å”/�/Ø%( S S¨'¨'ð#3ñ 4ô 4ð 4ð ð 	�Š‰ŒˆØ�Š‰Œˆð	Oð 	Oð 	Oð 	ˆ�ÑÔÐØˆ�ÑÔÐÐÐøð 	�Š‰ŒˆØ�Š‰Œˆð	Oð 	Oð 	Oð 	ˆ�ÑÔÐØˆ�ÑÔÐÐøøøs   Á6F3K6 É-AK6 Ë6AL9c                 ó  ‡— d}d}|�bt          |¦  «        dk    r|d         }|€|                     ¦   «         }t          |¦  «        dk    r|d         }|€|                     ¦   «         }g }d}	d}
| �t          | ¦  «        dk    rd}d}
n|�|�| }d}	n| d         }| dd…         }ˆfd„}g }|€|}t          j                             |¦  «        \  }}} |||¦  «         |
r:|dk    r4|�|rt
                               ||¦  «         |                     |¦  «         t          |||¦  «        }|}|€|}||k    rkt          j                             |¦  «        \  }}} |||¦  «         |
r:|dk    r4|�|rt
                               ||¦  «         |                     |¦  «         t          ||||du ¬	¦  «        }|}|	r|�| 	                    ||¬
¦  «        }| 
                    |¦  «         t          |¦  «        dk    rpd}|�l|                     ¦   «         rX|rV|j                             ¦   «         }|r;|}t
                               |¦  «        }t          t          d¦  «        |z  ¦  «         d}|�	|||fvr|f}||||||fS )a!  Get the trees and specific files to diff given a list of paths.

    This method works out the trees to be diff'ed and the files of
    interest within those trees.

    :param path_list:
        the list of arguments passed to the diff command
    :param revision_specs:
        Zero, one or two RevisionSpecs from the diff command line,
        saying what revisions to compare.
    :param old_url:
        The url of the old branch or tree. If None, the tree to use is
        taken from the first path, if any, or the current working tree.
    :param new_url:
        The url of the new branch or tree. If None, the tree to use is
        taken from the first path, if any, or the current working tree.
    :param exit_stack:
        an ExitStack object. get_trees_and_branches_to_diff
        will register cleanups that must be run to unlock the trees, etc.
    :param apply_view:
        if True and a view is set, apply the view or check that the paths
        are within it
    :returns:
        a tuple of (old_tree, new_tree, old_branch, new_branch,
        specific_files, extra_trees) where extra_trees is a sequence of
        additional trees to search in for file-ids.  The trees and branches
        will be read-locked until the cleanups registered via the exit_stack
        param are run.
    Nr   r   Tú.Fc                 ó´   •— | �)‰                      |                      ¦   «         ¦  «         d S |�)‰                      |                     ¦   «         ¦  «         d S d S r   )Úenter_contextÚ	lock_read)ÚwtÚbrÚ
exit_stacks     €r   Úlock_tree_or_branchzBget_trees_and_branches_to_diff_locked.<locals>.lock_tree_or_branch¨  sX   ø€ Øˆ>Ø×$Ò$ R§\¢\¡^¤^Ñ4Ô4Ð4Ð4Ð4Øˆ^Ø×$Ò$ R§\¢\¡^¤^Ñ4Ô4Ð4Ð4Ð4ð ˆ^r   Ú )Úbasis_is_default)Ú
apply_viewz+*** Ignoring files outside view. View is %s)r4   Ú
get_branchÚ
controldirÚ
ControlDirÚopen_containing_tree_or_branchÚviewsÚcheck_path_in_viewrz   Ú_get_tree_to_diffÚsafe_relpath_filesr‘   Úsupports_viewsÚlookup_viewÚview_display_strr   Úgettext)Ú	path_listÚrevision_specsÚold_urlÚnew_urlr®   r²   Úold_revision_specÚnew_revision_specÚother_pathsÚmake_paths_wt_relativeÚconsider_relpathÚdefault_locationr¯   Úspecific_filesÚworking_treeÚbranchÚrelpathÚold_treeÚ
old_branchÚnew_treeÚ
new_branchÚ
view_filesÚview_strÚextra_treess       `                   r   Ú%get_trees_and_branches_to_diff_lockedrÔ   n  s_  ø€ ð@ ÐØÐØÐ!Ýˆ~ÑÔ Ò"Ð"Ø .¨qÔ 1ÐØˆØ+×6Ò6Ñ8Ô8�Ýˆ~ÑÔ Ò"Ð"Ø .¨qÔ 1ÐØˆØ+×6Ò6Ñ8Ô8�à€KØ!ÐØÐØÐ�C 	™NœN¨aÒ/Ð/àÐØ ÐÐØ	Ð	 Ð!4ØˆØ!&ÐÐà$ Qœ<ÐØ   ”mˆð5ð 5ð 5ð 5ð 5ð €NØ€Ø"ˆåÔ×<Ò<¸WÑEÔEñ "€L�&˜'àÐ˜ fÑ-Ô-Ð-Øð '˜G ršM˜MØÐ#¨
Ð#Ý×$Ò$ \°7Ñ;Ô;Ð;Ø×Ò˜gÑ&Ô&Ð&Ý Ð!2°LÀ&ÑIÔI€HØ€Jð €Ø"ˆØ�'ÒÐåÔ!×@Ò@ÀÑIÔIñ 	&ˆ�f˜gàÐ˜L¨&Ñ1Ô1Ð1Øð 	+ ¨2¢ ØÐ'¨JÐ'Ý×(Ò(¨°wÑ?Ô?Ð?Ø×!Ò! 'Ñ*Ô*Ð*Ý Ð!2°LÀ&Ø2>À$Ð2FðHñ Hô H€Hà€Jð ð # ,Ð":Ø"×5Ò5ØØ!ð 6ñ #ô #ˆð ×Ò˜+Ñ&Ô&Ð&Ý
ˆ>ÑÔ˜aÒÐØˆØÐ$¨×)DÒ)DÑ)FÔ)FÐ$Øð %à%Ô+×7Ò7Ñ9Ô9ˆJØð XØ!+�Ý ×1Ò1°*Ñ=Ô=�Ý•WÐJÑKÔKÈhÑVÑWÔWÐWð €KØÐ L¸À8Ð8LÐ$LÐ$LØ#�oˆØ�h 
¨JØ˜Kð)ð )r   c                 ó°   — |€	|�|j         }| �| j        €.|r*|�|                     ¦   «         S |                     ¦   «         S |S |                      |¦  «        S r   )rË   ÚspecÚ
basis_treeÚas_tree)rÖ   ÚtreerË   r±   s       r   r¹   r¹   ã  sf   € Ø€~˜$Ð*Ø”ˆØ€|�t”yÐ(Øð 	ØÐØ—’Ñ(Ô(Ð(à×(Ò(Ñ*Ô*Ð*àˆKØ�<Š<˜ÑÔÐr   za/zb/r7   r9   r>   Úusingc                 óà  — |€t           }|
€t          }
t          j        ¦   «         5 }|                     |                      ¦   «         ¦  «         |�,|D ])}|                     |                     ¦   «         ¦  «         Œ*|                     |                     ¦   «         ¦  «         |
                     | |||||||	|¬¦	  «	        }|                     ||¦  «        cddd¦  «         S # 1 swxY w Y   dS )a  Show in text form the changes from one tree to another.

    :param to_file: The output stream.
    :param specific_files: Include only changes to these files - None for all
        changes.
    :param external_diff_options: If set, use an external GNU diff and pass
        these options.
    :param extra_trees: If set, more Trees to use for looking up file ids
    :param path_encoding: If set, the path will be encoded as specified,
        otherwise is supposed to be utf8
    :param format_cls: Formatter class (DiffTree subclass)
    N©r?   )ÚDEFAULT_CONTEXT_AMOUNTÚDiffTreeÚ
contextlibÚ	ExitStackrª   r«   Úfrom_trees_optionsÚ	show_diff)rÍ   rÏ   r;   rÉ   Úexternal_diff_optionsr7   r9   rÓ   r>   rÚ   Ú
format_clsÚcontextr®   rÙ   Údiffers                  r   Úshow_diff_treesrç   ñ  sF  € ð( €Ý(ˆØÐÝˆ
Ý	Ô	Ñ	Ô	ð = :Ø× Ò  ×!3Ò!3Ñ!5Ô!5Ñ6Ô6Ð6ØÐ"Ø#ð ;ð ;�Ø×(Ò(¨¯ªÑ)9Ô)9Ñ:Ô:Ð:Ð:Ø× Ò  ×!3Ò!3Ñ!5Ô!5Ñ6Ô6Ð6Ø×.Ò.¨x¸À7Ø/<Ø/DØ/8¸)ÀUØ=Dð	 /ñ Fô Fˆð
 ×Ò °Ñ<Ô<ð=ð =ð =ð =ñ =ô =ð =ð =ð =ð =ð =ð =øøøð =ð =ð =ð =ð =ð =s   ¦B0C#Ã#C'Ã*C'c                 óˆ   — 	 |                       |¦  «        }n# t          $ r d}Y nw xY wt                               |¦  «        S )z7Returns a timestamp suitable for use in a patch header.r   )Úget_file_mtimer   Ú	timestampÚformat_patch_date)rÙ   rr   Úmtimes      r   Ú_patch_header_daterí     sT   € ðØ×#Ò# DÑ)Ô)ˆˆøÝ#ð ð ð Øˆˆˆðøøøå×&Ò& uÑ-Ô-Ð-s   ‚ ˜'¦'c                 óF   — ddddœ}| |k    rd||          ||         fz  gS g S )Ns   +xs   -xs   ??)TFNs   %s to %sr#   )Úold_is_xÚnew_is_xÚdescrs      r   Úget_executable_changerò      s<   € Ø ¨eÐ4Ð4€EØ�8ÒÐØ˜u Xœ°°h´ÐAÑAÐBÐBàˆ	r   c                   óX   — e Zd ZdZdZdZdZdd„Zd„ Ze	d„ ¦   «         Z
ed	„ ¦   «         Zd
S )ÚDiffPathz/Base type for command object that compare filesÚCANNOT_DIFFÚCHANGEDÚ	UNCHANGEDúutf-8c                 ó>   — || _         || _        || _        || _        dS )a)  Constructor.

        :param old_tree: The tree to show as the old tree in the comparison
        :param new_tree: The tree to show as new in the comparison
        :param to_file: The file to write comparison data to
        :param path_encoding: The character encoding to write paths in
        N©rÍ   rÏ   r;   r>   )r   rÍ   rÏ   r;   r>   s        r   r   zDiffPath.__init__2  s'   € ð !ˆŒØ ˆŒØˆŒØ*ˆÔÐÐr   c                 ó   — d S r   r#   ©r   s    r   ÚfinishzDiffPath.finish?  ó   € Øˆr   c                 óF   —  | |j         |j        |j        |j        ¦  «        S r   rú   ©ÚklassÚ	diff_trees     r   Úfrom_diff_treezDiffPath.from_diff_treeB  s.   € àˆu�YÔ'¨Ô);ØÔ&¨	Ô(?ñAô Að 	Ar   c                 óx   — | D ],}|                      ||||¦  «        }|t          j        ur|c S Œ-t          j        S r   )r…   rô   rõ   )ÚdiffersÚold_pathÚnew_pathÚold_kindÚnew_kindÚfile_differÚresults          r   Ú
_diff_manyzDiffPath._diff_manyG  sQ   € à"ð 	(ð 	(ˆKØ ×%Ò% h°¸(ÀHÑMÔMˆFØ�XÔ1Ð1Ð1Ø���ð 2õ Ô'Ð'r   N©rø   )r   r    r!   r"   rõ   rö   r÷   r   rý   Úclassmethodr  Ústaticmethodr  r#   r   r   rô   rô   (  s‡   € € € € € Ø9Ð9ð  €Kà€Gà€Ið+ð +ð +ð +ðð ð ð ðAð Añ „[ðAð ð(ð (ñ „\ð(ð (ð (r   rô   c                   ó:   — e Zd ZdZd„ Zd„ Zed„ ¦   «         Zd„ ZdS )ÚDiffKindChangez†Special differ for file kind changes.

    Represents kind change as deletion + creation.  Uses the other differs
    to do this.
    c                 ó   — || _         d S r   ©r  )r   r  s     r   r   zDiffKindChange.__init__X  s   € ØˆŒˆˆr   c                 ó   — d S r   r#   rü   s    r   rý   zDiffKindChange.finish[  rþ   r   c                 ó"   —  | |j         ¦  «        S r   r  r   s     r   r  zDiffKindChange.from_diff_tree^  s   € àˆu�YÔ&Ñ'Ô'Ð'r   c                 óÒ   — d||fv rt           j        S t                                | j        |||d¦  «        }|t           j        u r|S t                                | j        ||d|¦  «        S )zöPerform comparison

        :param old_path: Path of the file in the old tree
        :param new_path: Path of the file in the new tree
        :param old_kind: Old file-kind of the file
        :param new_kind: New file-kind of the file
        N)rô   rõ   r  r  )r   r  r  r  r	  r  s         r   r…   zDiffKindChange.diffb  sw   € ð �H˜hÐ'Ð'Ð'ÝÔ'Ð'Ý×$Ò$ØŒL˜( H¨h¸ñ>ô >ˆà•XÔ)Ð)Ð)ØˆMÝ×"Ò"ØŒL˜( H¨d°Hñ>ô >ð 	>r   N)	r   r    r!   r"   r   rý   r  r  r…   r#   r   r   r  r  Q  sf   € € € € € ðð ðð ð ðð ð ð ð(ð (ñ „[ð(ð>ð >ð >ð >ð >r   r  c                   ó   — e Zd Zd„ ZdS )ÚDiffTreeReferencec                 óV   — d||fvr| j         S |dvr| j         S |dvr| j         S | j        S )zBPerform comparison between two tree references.  (dummy)

        útree-reference)r  N©rõ   rö   ©r   r  r  r  r	  s        r   r…   zDiffTreeReference.diffv  sO   € ð  H¨hÐ#7Ð7Ð7ØÔ#Ð#ØÐ3Ð3Ð3ØÔ#Ð#ØÐ3Ð3Ð3ØÔ#Ð#ØŒ|Ðr   N©r   r    r!   r…   r#   r   r   r  r  t  ó#   € € € € € ð
ð 
ð 
ð 
ð 
r   r  c                   ó   — e Zd Zd„ ZdS )ÚDiffDirectoryc                 óV   — d||fvr| j         S |dvr| j         S |dvr| j         S | j        S )z>Perform comparison between two directories.  (dummy)

        Ú	directory)r"  Nr  r  s        r   r…   zDiffDirectory.diff…  sO   € ð ˜x¨Ð2Ð2Ð2ØÔ#Ð#ØÐ.Ð.Ð.ØÔ#Ð#ØÐ.Ð.Ð.ØÔ#Ð#ØŒ|Ðr   Nr  r#   r   r   r   r   ƒ  r  r   r   c                   ó   — e Zd Zd„ Zd„ ZdS )ÚDiffSymlinkc                 óü   — d||fvr| j         S |dk    r| j                             |¦  «        }n|€d}n| j         S |dk    r| j                             |¦  «        }n|€d}n| j         S |                      ||¦  «        S )a  Perform comparison between two symlinks

        :param old_path: Path of the file in the old tree
        :param new_path: Path of the file in the new tree
        :param old_kind: Old file-kind of the file
        :param new_kind: New file-kind of the file
        ÚsymlinkN)rõ   rÍ   Úget_symlink_targetrÏ   Údiff_symlink)r   r  r  r  r	  Ú
old_targetÚ
new_targets          r   r…   zDiffSymlink.diff”  s£   € ð ˜X xÐ0Ð0Ð0ØÔ#Ð#Ø�yÒ Ð Øœ×9Ò9¸(ÑCÔCˆJˆJØÐØˆJˆJàÔ#Ð#Ø�yÒ Ð Øœ×9Ò9¸(ÑCÔCˆJˆJØÐØˆJˆJàÔ#Ð#Ø× Ò  ¨ZÑ8Ô8Ð8r   c                 ó–  — |€7| j                              d|                     | j        d¦  «        z  ¦  «         nŠ|€7| j                              d|                     | j        d¦  «        z  ¦  «         nQ| j                              d|                     | j        d¦  «        |                     | j        d¦  «        fz  ¦  «         | j        S )Ns   === target is '%s'
r&   s   === target was '%s'
s    === target changed '%s' => '%s'
)r;   r5   r2   r>   rö   )r   r)  r*  s      r   r(  zDiffSymlink.diff_symlink¬  sö   € ØÐØŒL×ÒÐ8Ø)×0Ò0°Ô1CÀYÑOÔOñ Pñ Qô Qð Qð QàÐØŒL×ÒÐ9Ø)×0Ò0°Ô1CÀYÑOÔOñ Pñ Qô Qð Qð Qð ŒL×ÒÐGØ *× 1Ò 1°$Ô2DÀiÑ PÔ PØ *× 1Ò 1°$Ô2DÀiÑ PÔ Pð Rñ Rñ Sô Sð Sð Œ|Ðr   N)r   r    r!   r…   r(  r#   r   r   r$  r$  ’  s2   € € € € € ð9ð 9ð 9ð0ð ð ð ð r   r$  c                   ó0   — e Zd ZdZdddeefd„Zd„ Zd„ ZdS )ÚDiffTextz1970-01-01 00:00:00 +0000rø   r°   c	                 óˆ   — t                                | ||||¦  «         || _        || _        || _        || _        || _        d S r   )rô   r   Útext_differr7   r9   r>   r?   )	r   rÍ   rÏ   r;   r>   r7   r9   r/  r?   s	            r   r   zDiffText.__init__À  sL   € õ 	×Ò˜$ ¨(°G¸]ÑKÔKÐKØ&ˆÔØ"ˆŒØ"ˆŒØ*ˆÔØ*ˆÔÐÐr   c                 óx  — d||fvr| j         S |dk    rt          | j        |¦  «        }n|€| j        }n| j         S |dk    rt          | j        |¦  «        }n|€| j        }n| j         S d                     | j        |p||¦  «        }d                     | j        |p||¦  «        }|                      ||||¦  «        S )a  Compare two files in unified diff format

        :param old_path: Path of the file in the old tree
        :param new_path: Path of the file in the new tree
        :param old_kind: Old file-kind of the file
        :param new_kind: New file-kind of the file
        ÚfileNz{}{}	{})	rõ   rí   rÍ   Ú
EPOCH_DATErÏ   Úformatr7   r9   Ú	diff_text)	r   r  r  r  r	  Úold_dateÚnew_dateÚ
from_labelÚto_labels	            r   r…   zDiffText.diffÊ  sç   € ð ˜( HÐ-Ð-Ð-ØÔ#Ð#Ø�vÒÐÝ)¨$¬-¸ÑBÔBˆHˆHØÐØ”ˆHˆHàÔ#Ð#Ø�vÒÐÝ)¨$¬-¸ÑBÔBˆHˆHØÐØ”ˆHˆHàÔ#Ð#Ø×&Ò&ØŒN˜HÐ0¨°(ñ<ô <ˆ
à×$Ò$ØŒN˜HÐ0¨°(ñ<ô <ˆà�~Š~˜h¨°*¸hÑGÔGÐGr   c           
      óv  — d„ }	  || j         |¦  «        } || j        |¦  «        }|                      ||||| j        | j        | j        ¬¦  «         na# t          j        $ rO | j                             d| j	        ›|p|›d| j
        ›|p|›d�                     | j        d¦  «        ¦  «         Y nw xY w| j        S )aX  Diff the content of given files in two trees

        :param from_path: The path in the from tree. If None,
            the file is not present in the from tree.
        :param to_path: The path in the to tree. This may refer
            to a different file from from_path.  If None,
            the file is not present in the to tree.
        c                 ód   — |€g S 	 |                       |¦  «        S # t          j        $ r g cY S w xY wr   )Úget_file_linesÚ_mod_transportÚ
NoSuchFile)rÙ   rr   s     r   Ú	_get_textz%DiffText.diff_text.<locals>._get_textï  sL   € Øˆ|Ø�	ðØ×*Ò*¨4Ñ0Ô0Ð0øÝ!Ô,ð ð ð Ø�	�	�	ðøøøs   † ›/®/)r>   r?   zBinary files z and z differ
r&   )rÍ   rÏ   r/  r;   r>   r?   r	   Ú
BinaryFiler5   r7   r9   r2   rö   )r   Ú	from_pathÚto_pathr7  r8  r>  Ú	from_textÚto_texts           r   r4  zDiffText.diff_textæ  s  € ð	ð 	ð 	ð	:Ø!˜	 $¤-°Ñ;Ô;ˆIØ�i ¤¨wÑ7Ô7ˆGØ×Ò˜Z¨°H¸gØ!œ\¸Ô9KØ+/Ô+=ð ñ ?ô ?ð ?ð ?øõ Ô ð 	:ð 	:ð 	:ØŒL×ÒÐà”.�. )Ð"6¨wÐ"6Ð"6Ø”.�. 'Ð"6¨YÐ"6Ð"6ð8÷ ’6˜$Ô,¨iÑ8Ô8ñ	:ô :ð :ð :ð :ð	:øøøð Œ|Ðs   …AA ÁAB1Â0B1N)	r   r    r!   r2  rB   rÝ   r   r…   r4  r#   r   r   r-  r-  º  s]   € € € € € ð -€JàBIØ¨¸Ø5ð+ð +ð +ð +ðHð Hð Hð8ð ð ð ð r   r-  c            
       ó   — e Zd Z	 ddeeee         f         dedefd„Ze	 ddeeee         f         dededefd„¦   «         Z	edd	„¦   «         Z
d
„ Zd„ Zd„ Zed„ ¦   «         Zd„ Zd„ Z	 	 dd„Z	 	 dd„Zd„ Zd„ Zd„ ZdS )ÚDiffFromToolrø   Úcommand_templaterÍ   rÏ   c                 ó–   — dd l }t                               | ||||¦  «         || _        dd l }|                     d¬¦  «        | _        d S )Nr   z	brz-diff-r€   )r‰   rô   r   rF  ÚmkdtempÚ_root)r   rF  rÍ   rÏ   r;   r>   r‰   s          r   r   zDiffFromTool.__init__  sV   € ð 	ˆˆˆÝ×Ò˜$ ¨(°G¸]ÑKÔKÐKØ 0ˆÔØˆˆˆØ×%Ò%¨[Ð%Ñ9Ô9ˆŒ
ˆ
ˆ
r   r>   c                 ó    —  | |||||¦  «        S r   r#   )r  rF  rÍ   rÏ   r;   r>   s         r   Úfrom_stringzDiffFromTool.from_string  s$   € ð
 ˆuÐ% x°¸7Ø"ñ$ô $ð 	$r   Nc                 ó   ‡ ‡‡— ˆˆˆ fd„}|S )Nc                 óª   •— ‰g}‰�'|                      ‰                     ¦   «         ¦  «         ‰                     || j        | j        | j        ¦  «        S r   )r‘   r•   rK  rÍ   rÏ   r;   )r  Úfull_command_stringÚcommand_stringrã   r  s     €€€r   r  z8DiffFromTool.make_from_diff_tree.<locals>.from_diff_tree  sa   ø€ Ø#1Ð"2ÐØ$Ð0Ø#×*Ò*Ð+@×+FÒ+FÑ+HÔ+HÑIÔIÐIØ×$Ò$Ð%8¸)Ô:LØ%.Ô%7¸Ô9JñLô Lð Lr   r#   )r  rO  rã   r  s   ``` r   Úmake_from_diff_treez DiffFromTool.make_from_diff_tree  s7   øøø€ ð	Lð 	Lð 	Lð 	Lð 	Lð 	Lð 	Lð Ðr   c                 ó4  ‡— ||dœŠˆfd„| j         D ¦   «         }|| j         k    r|||gz  }t          j        dk    r\g }|D ]U}t          |t          ¦  «        r)|                     |                     d¦  «        ¦  «         Œ@|                     |¦  «         ŒV|S |S )N)r  r  c                 ó*   •— g | ]} |j         d i ‰¤Ž‘ŒS )r#   )r3  )Ú.0ÚtÚmy_maps     €r   ú
<listcomp>z-DiffFromTool._get_command.<locals>.<listcomp>$  s7   ø€ ð *ð *ð *¨!�8�1”8Ð%Ð%˜fÐ%Ð%ð *ð *ð *r   rƒ   r„   )rF  r�   r�   Ú
isinstancero   rz   r2   )r   r  r  ÚcommandÚcommand_encodedÚcrU  s         @r   Ú_get_commandzDiffFromTool._get_command"  sÐ   ø€ Ø&°HÐ=Ð=ˆð*ð *ð *ð *ØÔ(ð*ñ *ô *ˆà�dÔ+Ò+Ð+Ø˜ (Ð+Ñ+ˆGÝŒ<˜7Ò"Ð"Ø ˆOØð .ð .�Ý˜a¥Ñ%Ô%ð .Ø#×*Ò*¨1¯8ª8°FÑ+;Ô+;Ñ<Ô<Ð<Ð<à#×*Ò*¨1Ñ-Ô-Ð-Ð-Ø"Ð"àˆNr   c                 óÊ  — |                       ||¦  «        }	 t                               |t          j        | j        ¬¦  «        }nB# t
          $ r5}|j        t          j        k    rt          j	        |d         ¦  «        ‚‚ d }~ww xY w| j
                             |j                             ¦   «         ¦  «         |j                             ¦   «          |                     ¦   «         S )N)rb   Úcwdr   )r[  rh   rj   ri   rI  rk   rl   rm   r	   ÚExecutableMissingr;   r5   rb   ÚreadrŽ   Úwait)r   r  r  rX  Úprocrt   s         r   Ú_executezDiffFromTool._execute3  sÑ   € Ø×#Ò# H¨hÑ7Ô7ˆð	Ý×#Ò# GµJ´OØ(,¬
ð $ñ 4ô 4ˆDˆDøåð 	ð 	ð 	ØŒw�%œ,Ò&Ð&ÝÔ.¨w°q¬zÑ:Ô:Ð:àøøøøð		øøøð
 	Œ×Ò˜4œ;×+Ò+Ñ-Ô-Ñ.Ô.Ð.ØŒ×ÒÑÔÐØ�yŠy‰{Œ{Ðs   ˜,A Á
BÁ0A?Á?Bc                 ó<  — t          |dd ¦  «        �t          j        | j        ¦  «        sdS 	 t	          j        |                     d¦  «        t          j        | j        |¦  «        ¦  «         n-# t          $ r }|j	        t          j
        k    r‚ Y d }~nd }~ww xY wdS )NÚabspathFr°   T)Úgetattrr
   Úsupports_symlinksrI  re   r&  rd  Úpathjoinrk   rl   ÚEEXIST)r   rÙ   r�   rt   s       r   Ú_try_symlink_rootzDiffFromTool._try_symlink_rootA  s¬   € Ý�D˜) TÑ*Ô*Ð2ÝÔ-¨d¬jÑ9Ô9ð 3à�5ð	ÝŒJ�t—|’| BÑ'Ô'­Ô)9¸$¼*ÀfÑ)MÔ)MÑNÔNÐNÐNøÝð 	ð 	ð 	ØŒw�%œ,Ò&Ð&Øð 'Ð&Ð&Ð&Ð&øøøøð	øøøð ˆts   ®A A/ Á/
BÁ9BÂBc                  óP   — t           j        dk    rdS t          j        ¦   «         pdS )z8Returns safe encoding for passing file path to diff toolrƒ   r„   Úascii)r�   r�   Úgetfilesystemencodingr#   r   r   Ú_fenczDiffFromTool._fencL  s,   € õ Œ<˜7Ò"Ð"Ø�6õ Ô,Ñ.Ô.Ð9°'Ð9r   c                 ó¦   — |                       ¦   «         }	 ||                     |¦  «                             |¦  «        k    S # t          $ r Y dS w xY w)z8Return true if `path` may be able to pass to subprocess.F)rm  r2   ÚdecodeÚUnicodeError)r   rr   Úfencs      r   Ú_is_safepathzDiffFromTool._is_safepathV  s[   € à�zŠz‰|Œ|ˆð	Ø˜4Ÿ;š; tÑ,Ô,×3Ò3°DÑ9Ô9Ò9Ð9øÝð 	ð 	ð 	Ø�5�5ð	øøøs   –+A Á
AÁAc                 óà   — |                       ¦   «         }|                     |d¦  «                             |d¦  «        }|                     dd¦  «        }t	          j        | j        ||¦  «        S )z]Replace unsafe character in `relpath` then join `self._root`,
        `prefix` and `relpath`.r&   ú?Ú_)rm  r2   ro  r&   r
   rg  rI  )r   r�   rÌ   rq  Úrelpath_tmps        r   Ú_safe_filenamezDiffFromTool._safe_filename^  sb   € ð �zŠz‰|Œ|ˆð —n’n T¨9Ñ5Ô5×<Ò<¸TÀ9ÑMÔMˆØ!×)Ò)¨#¨sÑ3Ô3ˆÝÔ ¤
¨F°KÑ@Ô@Ð@r   Fc                 ó  — |sAt          |t          ¦  «        r,|                     |¦  «        }|                      |¦  «        r|S |                      ||¦  «        }|s|                      ||¦  «        r|S t          j        |¦  «        }	 t          j	        |¦  «         n-# t          $ r }|j        t          j        k    r‚ Y d }~nd }~ww xY w|                     |¦  «        5 }	t          |d¦  «        5 }
t          j        |	|
¦  «         d d d ¦  «         n# 1 swxY w Y   d d d ¦  «         n# 1 swxY w Y   	 |                     |¦  «        }t          j        |||f¦  «         n# t$          $ r Y nw xY w|st          j        |¦  «         |S )Nr‚   )rW  ÚWorkingTreerd  rr  rw  ri  r
   Údirnamere   Úmakedirsrk   rl   rh  Úget_fileÚopenÚpumpfileré   Úutimer   Úmake_readonly)r   rÌ   rÙ   r�   Ú
force_tempÚallow_writeÚ	full_pathÚ
parent_dirrt   ÚsourceÚtargetrì   s               r   Ú_write_filezDiffFromTool._write_fileh  s=  € àð 	!�j¨­{Ñ;Ô;ð 	!ØŸš WÑ-Ô-ˆIØ× Ò  Ñ+Ô+ð !Ø Ð à×'Ò'¨°Ñ8Ô8ˆ	Øð 	˜d×4Ò4°T¸6ÑBÔBð 	ØÐÝ”_ YÑ/Ô/ˆ
ð	ÝŒK˜
Ñ#Ô#Ð#Ð#øÝð 	ð 	ð 	ØŒw�%œ,Ò&Ð&Øð 'Ð&Ð&Ð&Ð&øøøøð	øøøð �]Š]˜7Ñ#Ô#ð 	- vÝ�Y Ñ%Ô%ð	-Ø)/ÝÔ˜V VÑ,Ô,Ð,ð	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-ñ 	-ô 	-ð 	-ð 	-ð 	-ð 	-ð 	-ð 	-øøøð 	-ð 	-ð 	-ð 	-ð	0Ø×'Ò'¨Ñ0Ô0ˆEõ ŒH�Y ¨ Ñ/Ô/Ð/Ð/øõ (ð 	ð 	ð 	ØˆDð	øøøð ð 	-ÝÔ! )Ñ,Ô,Ð,ØÐs`   Â	B Â
CÂ(CÃCÃ D*Ã1DÄD*ÄD	ÄD*ÄD	ÄD*Ä*D.Ä1D.Ä6E# Å#
E0Å/E0c                 ó‚   — |                       || j        d|¦  «        }|                       || j        d||¬¦  «        }||fS )NÚoldÚnew)r‚  )r‡  rÍ   rÏ   )r   r  r  r�  Úallow_write_newÚold_disk_pathÚnew_disk_paths          r   Ú_prepare_fileszDiffFromTool._prepare_files…  sW   € à×(Ò(Ø�d”m U¨Jñ8ô 8ˆà×(Ò(Ø�d”m U¨JØ'ð )ñ )ô )ˆð ˜mÐ+Ð+r   c                 óÖ   — 	 t          j        | j        ¦  «         d S # t          $ rA}|j        t          j        k    r!t          d| j        ›d|›d�¦  «         Y d }~d S Y d }~d S d }~ww xY w)NzThe temporary directory "z" was not cleanly removed: r¨   )r
   ÚrmtreerI  rk   rl   rm   r   )r   rt   s     r   rý   zDiffFromTool.finishŽ  s¶   € ð	AÝŒN˜4œ:Ñ&Ô&Ð&Ð&Ð&øÝð 	Að 	Að 	AØŒw�%œ,Ò&Ð&Ý�Ø15´°°¸Q¸Q¸Qð@ñ Aô Að Að Að Að Að Að Að Að 'Ð&Ð&Ð&Ð&Ð&øøøøð	Aøøøs   ‚ �
A(§0A#Á#A(c                 óŒ   — ||fdk    rt           j        S |                      ||¦  «        \  }}|                      ||¦  «         d S )N)r1  r1  )rô   rõ   rŽ  rb  )r   r  r  r  r	  rŒ  r�  s          r   r…   zDiffFromTool.diff–  sU   € Ø�hÐÐ#3Ò3Ð3ÝÔ'Ð'Ø)-×)<Ò)<Ø�hñ* ô * Ñ&ˆ˜à�Š�m ]Ñ3Ô3Ð3Ð3Ð3r   c                 ó$  — |                       ||dd¬¦  «        \  }}|                      ||¦  «        }t                               || j        ¬¦  «         t          |d¦  «        5 }|                     ¦   «         cddd¦  «         S # 1 swxY w Y   dS )z¯Use this tool to edit a file.

        A temporary copy will be edited, and the new contents will be
        returned.

        :return: The new contents of the file.
        T)r‹  r�  )r]  ÚrbN)rŽ  r[  rh   ÚcallrI  r}  r_  )r   r  r  Úold_abs_pathÚnew_abs_pathrX  Únew_files          r   Ú	edit_filezDiffFromTool.edit_file�  s×   € ð &*×%8Ò%8Ø�h°Àð &9ñ &Gô &GÑ"ˆ�là×#Ò# L°,Ñ?Ô?ˆÝ�Š˜ T¤ZˆÑ0Ô0Ð0Ý�, Ñ%Ô%ð 	#¨Ø—=’=‘?”?ð	#ð 	#ð 	#ð 	#ñ 	#ô 	#ð 	#ð 	#ð 	#ð 	#ð 	#ð 	#øøøð 	#ð 	#ð 	#ð 	#ð 	#ð 	#s   Á$BÂB	ÂB	r  r   )FF)r   r    r!   r   ro   r   r   r   r  rK  rP  r[  rb  ri  r  rm  rr  rw  r‡  rŽ  rý   r…   r˜  r#   r   r   rE  rE    s¢  € € € € € ð  'ð:ð :¨¨s°D¸´I¨~Ô)>ð :Øð:Ø&*ð:ð :ð :ð :ð ð *1ð$ð $Ø&+¨C°°c´¨NÔ&;ð$à"ð$à.2ð$ð $'ð$ð $ð $ñ „[ð$ð ðð ð ñ „[ððð ð ð"ð ð ð	ð 	ð 	ð ð:ð :ñ „\ð:ðð ð ðAð Að Að =BØ %ðð ð ð ð: =BØ',ð,ð ,ð ,ð ,ðAð Að Að4ð 4ð 4ð#ð #ð #ð #ð #r   rE  c                   óv   — e Zd ZdZej        ej        ej        gZ	 	 d
d„Z	e
d„ ¦   «         Zdd„Zd„ Zd„ Zd	„ ZdS )rÞ   a   Provides textual representations of the difference between two trees.

    A DiffTree examines two trees and where a file-id has altered
    between them, generates a textual representation of the difference.
    DiffTree uses a sequence of DiffPath objects which are each
    given the opportunity to handle a given altered fileid. The list
    of DiffPath objects can be extended globally by appending to
    DiffTree.diff_factories, or for a specific diff operation by
    supplying the extra_factories option to the appropriate method.
    rø   Nc           	      ó”  ‡ — |€t          ||||ddt          ¦  «        }|‰ _        |‰ _        |‰ _        |‰ _        g ‰ _        |�&‰ j                             ˆ fd„|D ¦   «         ¦  «         ‰ j                             ˆ fd„‰ j        D ¦   «         ¦  «         ‰ j                             |t           
                    ‰ ¦  «        g¦  «         dS )aÒ  Constructor

        :param old_tree: Tree to show as old in the comparison
        :param new_tree: Tree to show as new in the comparison
        :param to_file: File to write comparision to
        :param path_encoding: Character encoding to write paths in
        :param diff_text: DiffPath-type object to use as a last resort for
            diffing text files.
        :param extra_factories: Factories of DiffPaths to try before any other
            DiffPathsNr°   c              3   ó.   •K  — | ]} |‰¦  «        V — Œd S r   r#   ©rS  Úfr   s     €r   ú	<genexpr>z$DiffTree.__init__.<locals>.<genexpr>Ô  s+   øè è € ÐAÐA¨A   $¡¤ÐAÐAÐAÐAÐAÐAr   c              3   ó.   •K  — | ]} |‰¦  «        V — Œd S r   r#   rœ  s     €r   rž  z$DiffTree.__init__.<locals>.<genexpr>Õ  s+   øè è € ÐAÐA¨˜A˜A˜d™GœGÐAÐAÐAÐAÐAÐAr   )r-  rB   rÍ   rÏ   r;   r>   r  r‘   Údiff_factoriesr  r  )r   rÍ   rÏ   r;   r>   r4  Úextra_factoriess   `      r   r   zDiffTree.__init__¿  sÛ   ø€ ð ÐÝ  ¨8°W¸mØ!# R­ñ8ô 8ˆIà ˆŒØ ˆŒØˆŒØ*ˆÔØˆŒØÐ&ØŒL×ÒÐAÐAÐAÐA°ÐAÑAÔAÑAÔAÐAØŒ×ÒÐAÐAÐAÐA¨TÔ-@ÐAÑAÔAÑAÔAÐAØŒ×Ò˜Y­×(EÒ(EÀdÑ(KÔ(KÐLÑMÔMÐMÐMÐMr   c
           
      óÜ   ‡— |�t                                ||¦  «        g}
ng }
|r|                     ¦   «         Šdˆfd„	}nt          }t	          ||||||||	¬¦  «        } | ||||||
¦  «        S )a¿  Factory for producing a DiffTree.

        Designed to accept options used by show_diff_trees.

        :param old_tree: The tree to show as old in the comparison
        :param new_tree: The tree to show as new in the comparison
        :param to_file: File to write comparisons to
        :param path_encoding: Character encoding to use for writing paths
        :param external_diff_options: If supplied, use the installed diff
            binary to perform file comparison, using supplied options.
        :param old_label: Prefix to use for old file labels
        :param new_label: Prefix to use for new file labels
        :param using: Commandline to use to invoke an external diff tool
        Nc                 ó0   •— t          | ||||‰¦  «         dS )z}:param path_encoding: not used but required
                        to match the signature of internal_diff.
                N)r¦   )ÚolabÚolinesÚnlabÚnlinesr;   r>   r?   Úoptss          €r   Ú	diff_filez.DiffTree.from_trees_options.<locals>.diff_fileò  s#   ø€ õ ˜d F¨D°&¸'À4ÑHÔHÐHÐHÐHr   rÜ   ©NN)rE  rP  r•   rB   r-  )r  rÍ   rÏ   r;   r>   rã   r7   r9   rÚ   r?   r¡  r©  r4  r¨  s                @r   rá   zDiffTree.from_trees_optionsØ  sÇ   ø€ ð$ ÐÝ+×?Ò?ØÐ,ñ .ô  .ð /ˆOˆOð !ˆOØ ð 		&Ø(×.Ò.Ñ0Ô0ˆDðIð Ið Ið Ið Ið Ið Iõ &ˆIÝ˜X x°¸-Ø&¨	°9ÈMð[ñ [ô [ˆ	àˆu�X˜x¨°-ÀØ$ñ&ô &ð 	&r   c                 ó²   — 	 |                       ||¦  «        | j        D ]}|                     ¦   «          ŒS # | j        D ]}|                     ¦   «          Œw xY w)z¿Write tree diff to self.to_file

        :param specific_files: the specific files to compare (recursive)
        :param extra_trees: extra trees to use for mapping paths to file_ids
        )Ú
_show_diffr  rý   )r   rÉ   rÓ   ræ   s       r   râ   zDiffTree.show_diffþ  se   € ð	 Ø—?’? >°;Ñ?Ô?àœ,ð  ð  �Ø—’‘”��ð ø˜$œ,ð  ð  �Ø—’‘”��ð øøøs	   ‚6 ¶ Ac                 ó6  ‡ — ‰ j                              ‰ j        ||d¬¦  «        }d}d„ }ˆ fd„}t          ||¬¦  «        D �]W}|j        d         s|j        d         r|j        dk    rŒ)|j        d         d	k    r8‰ j                              ¦   «         st          d
|j        d         ›d�¦  «         Œr|j        \  }}	 ||¦  «        }
 ||	¦  «        }|j        d         d uo|j        d         }|j        d         d uo|j        d         }|j	        }|j        }|j
        }g }|                     t          |d         |d         ¦  «        ¦  «         |rdd                     |¦  «        fz  }nd}||fdk    r9‰ j                             d|d                              d¦  «        |
fz  ¦  «         n·||fdk    r9‰ j                             d|d                              d¦  «        |fz  ¦  «         nv|r;‰ j                             d|d                              d¦  «        |
||fz  ¦  «         n9‰ j                             d|d                              d¦  «        ||fz  ¦  «         |j        r&‰                      ||	|d         |d         ¦  «         d}|rd}�ŒY|S )NT)rÉ   rÓ   Úrequire_versionedr   c                 ó&   — | j         \  }}|}|€|}|S r   )rr   )Úchanger  r  rr   s       r   Úchanges_keyz(DiffTree._show_diff.<locals>.changes_key  s"   € Ø!'¤ÑˆH�hØˆDØˆ|Ø�ØˆKr   c                 óB   •— | �|                       ‰j        d¦  «        S d S )Nr&   )r2   r>   )rr   r   s    €r   Úget_encoded_pathz-DiffTree._show_diff.<locals>.get_encoded_path  s(   ø€ ØÐØ—{’{ 4Ô#5°yÑAÔAÐAð  Ðr   )Úkeyr   rª  r&  z
Ignoring "z3" as symlinks are not supported on this filesystem.s    (properties changed: %s)s   , r   )TFs   === removed %s '%s'
rk  )FTs   === added %s '%s'
s   === renamed %s '%s' => '%s'%s
s   === modified %s '%s'%s
)rÏ   Úiter_changesrÍ   Úsortedrr   Úkindrf  r   Ú	versionedÚ
executableÚrenamedr‘   rò   Újoinr;   r5   r2   Úchanged_contentÚ_diff)r   rÉ   rÓ   ÚiteratorÚhas_changesr±  r³  r°  ÚoldpathÚnewpathÚoldpath_encodedÚnewpath_encodedÚold_presentÚnew_presentr¹  r·  rº  Úproperties_changedÚprop_strs   `                  r   r¬  zDiffTree._show_diff
  sk  ø€ ð ”=×-Ò-¨d¬mØ=KØ:EØ@Dð .ñ Fô Fˆð ˆð	ð 	ð 	ð	Bð 	Bð 	Bð 	Bð 	Bõ ˜X¨;Ð7Ñ7Ô7ð /	 ñ /	 ˆFð ”K ”Nð ¨6¬;°q¬>ð ¸f¼kÈ\Ò>YÐ>YØØŒ{˜1Œ~ Ò*Ð*°4´=×3RÒ3RÑ3TÔ3TÐ*Ý�à7=´{À1´~°~°~ðHñIô Ið Ið Ø%œ{ÑˆG�WØ.Ð.¨wÑ7Ô7ˆOØ.Ð.¨wÑ7Ô7ˆOØ!œ; qœ>°Ð5ÐM¸&Ô:JÈ1Ô:MˆKØ!œ; qœ>°Ð5ÐM¸&Ô:JÈ1Ô:MˆKØÔ*ˆJØ”;ˆDØ”nˆGà!#ÐØ×%Ò%Ý% j°¤m°ZÀ´]ÑCÔCñEô Eð Eð "ð Ø7Ø—J’JÐ1Ñ2Ô2ð;5ñ 5��ð �à˜[Ð)¨]Ò:Ð:Ø”×"Ò"Ð#;Ø$(¨¤G§N¢N°7Ñ$;Ô$;¸_Ð#Mñ$Nñ Oô Oð Oð Oà˜{Ð+¨}Ò<Ð<Ø”×"Ò"Ð#9Ø$(¨¤G§N¢N°7Ñ$;Ô$;¸_Ð#Mñ$Nñ Oô Oð Oð Oàð ^Ø”×"Ò"Ð#EØ$(¨¤G§N¢N°7Ñ$;Ô$;¸_ÈoÐ_gÐ#hñ$iñ jô jð jð jð
 ”×"Ò"Ð#>À$ÀqÄ'Ç.Â.ÐQXÑBYÔBYØBQÐS[ðB]ñ $]ñ ^ô ^ð ^àÔ%ð  Ø—
’
˜7 G¨T°!¬W°d¸1´gÑ>Ô>Ð>Ø�Øð  Ø�ùØÐr   c                 ó²   — |€d}n| j                              |¦  «        }|€d}n| j                             |¦  «        }|                      ||||¦  «         dS )z¥Perform a diff of a single file

        :param old_path: The path of the file in the old tree
        :param new_path: The path of the file in the new tree
        N)rÍ   r·  rÏ   r½  r  s        r   r…   zDiffTree.diffO  sf   € ð ÐØˆHˆHà”}×)Ò)¨(Ñ3Ô3ˆHØÐØˆHˆHà”}×)Ò)¨(Ñ3Ô3ˆHØ�
Š
�8˜X x°Ñ:Ô:Ð:Ð:Ð:r   c                 óœ   — t                                | j        ||||¦  «        }|t           j        u r|}|€|}t	          j        |¦  «        ‚d S r   )rô   r  r  rõ   r	   ÚNoDiffFound)r   r  r  r  r	  r  Ú
error_paths          r   r½  zDiffTree._diff_  s]   € Ý×$Ò$ØŒL˜( H¨h¸ñBô Bˆà•XÔ)Ð)Ð)Ø!ˆJØÐ!Ø%�
ÝÔ$ ZÑ0Ô0Ð0ð	 *Ð)r   )rø   NNr   )r   r    r!   r"   r$  r  r   r  r   r   r  rá   râ   r¬  r…   r½  r#   r   r   rÞ   rÞ   ­  s¼   € € € € € ð	ð 	ð "Ô0Ø#Ô2Ø'Ô6ð8€Nð CJØ15ðNð Nð Nð Nð2 ð#&ð #&ñ „[ð#&ðJ
 ð 
 ð 
 ð 
 ðCð Cð CðJ;ð ;ð ;ð 1ð 1ð 1ð 1ð 1r   rÞ   Údefault)r   r   r   r   r   r,   N)T)NNT)3rß   r   re   r–   r�   Útypingr   r   r   r   r   Úglobalsr°   r	   r
   r   r<  Úregistryr   Útracer   r   r   rÙ   r   r   rÝ   r   r   rB   r1   ru   rx   r~   r¦   rÔ   r¹   ro   rç   rí   rò   rô   r  r  r   r$  r-  rE  rÞ   Úformat_registryÚregisterr#   r   r   ú<module>rÓ     s,  ðð" Ð Ð Ð Ø €€€Ø 	€	€	€	Ø 	€	€	€	Ø 
€
€
€
Ø .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .Ð .à $Ð $Ð $Ð $Ð $Ð $Ø €ˆGˆG‰IŒIð ñ ô ð ð ð ð ð ð ð ð ð ð ð ð
ð ð ð ð ð ð )Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ð (Ø 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0Ð 0ð Ð ðð ð ð ð ˜Ô0ñ ô ð ð  %°tØ &Ð6Lð'ð 'ð 'ð 'ðT EHØLPðB&ð B&ð B&ð B&ðJ"ð "ð "ð "ðL&ð &ð &Ð ðð ð ð0mð mð mðb MQðr)ð r)ð r)ð r)ðj ð  ð  ð  ð AEØ*.Ø%)¸DØ $Ø)/Ø+/Ø#Ø2ð#=ð #=à"ð#=à69ð#=ð $'ð	#=ð
 $ Cœ=ð#=ð #=ð #=ð #=ðL.ð .ð .ðð ð ð&(ð &(ð &(ð &(ð &(ñ &(ô &(ð &(ðR >ð  >ð  >ð  >ð  >ñ  >ô  >ð  >ðFð ð ð ð ˜ñ ô ð ðð ð ð ð �Hñ ô ð ð%ð %ð %ð %ð %�(ñ %ô %ð %ðPHð Hð Hð Hð Hˆxñ Hô Hð HðVe#ð e#ð e#ð e#ð e#�8ñ e#ô e#ð e#ðPy1ð y1ð y1ð y1ð y1ñ y1ô y1ð y1ðx 0�(˜3  X¤Ð.Ô/Ñ1Ô1€Ø × Ò ˜ HÑ -Ô -Ð -Ð -Ð -r   