§
    	^µck  ã                   ó–   — d Z ddlmZ ddlmZmZmZmZmZm	Z	m
Z
mZ i Z e	j        e¦  «        Z eddd¬¦  «         d„ Zd	„ Zd
„ Zd„ ZdS )ax  check for unrecorded moves at commit time (EXPERIMENTAL)

This extension checks at commit/amend time if any of the committed files
comes from an unrecorded mv.

The threshold at which a file is considered a move can be set with the
``automv.similarity`` config option. This option takes a percentage between 0
(disabled) and 100 (files must be identical), the default is 95.

é    )Ú_)ÚcommandsÚcopiesÚerrorÚ
extensionsÚpycompatÚ	registrarÚscmutilÚsimilaró   automvó
   similarityé_   )Údefaultc                 ó¨   — t          j        t          j        dt          ¦  «        }|d                              ddd t          d¦  «        f¦  «         d S )Ns   commité   ó    s	   no-automvs%   disable automatic file move detection)r   Úwrapcommandr   ÚtableÚmvcheckÚappendr   )ÚuiÚentrys     ú./usr/lib/python3/dist-packages/hgext/automv.pyÚextsetupr   2   sQ   € ÝÔ"¥8¤>°9½gÑFÔF€EØ	ˆ!„H‡O‚OØ	ˆl˜D¥!Ð$LÑ"MÔ"MÐNñô ð ð ð r   c                 óx  — t          j        |¦  «        }d}|                     dd¦  «        }|s§|                     dd¦  «        }d|cxk    rdk    s#n t	          j        t          d¦  «        ¦  «        ‚|dk    r[t          j        |d         ||¦  «        }t          ||¦  «        \  }	}
t          j
        |d	¬
¦  «        }t          |||	|
|dz  ¦  «        }|                     ¦   «         5  |�t          j        |dd|¦  «          | ||g|¢R i t          j        |¦  «        ¤Žcddd¦  «         S # 1 swxY w Y   dS )z&Hook to check for moves at commit timeNs	   no_automvFr   r   r   éd   s+   automv.similarity must be between 0 and 100T)Úlegacyrelativevalueg      Y@© )r   ÚbyteskwargsÚpopÚ	configintr   ÚAbortr   r
   ÚmatchÚ_interestingfilesÚgetuipathfnÚ_findrenamesÚwlockÚ_markchangesÚ	strkwargs)Úorigr   ÚrepoÚpatsÚoptsÚrenamesÚdisabledÚ	thresholdr#   ÚaddedÚremovedÚuipathfns               r   r   r   9   s³  € åÔ Ñ%Ô%€DØ€GØ�xŠx˜ eÑ,Ô,€HØð 
Ø—L’L ¨MÑ:Ô:ˆ	Ø�IÐ$Ð$Ò$Ð$ Ò$Ð$Ð$Ð$Ý”+�aÐ NÑOÔOÑPÔPÐPØ�qŠ=ˆ=Ý”M $ t¤*¨d°DÑ9Ô9ˆEÝ.¨t°UÑ;Ô;‰NˆE�7ÝÔ*¨4ÀTÐJÑJÔJˆHÝ"Ø�h  w°	¸EÑ0Añô ˆGð 
�Š‰Œð Að AØÐÝÔ   r¨2¨wÑ7Ô7Ð7Øˆt�B˜Ð@˜tÐ@Ð@Ð@¥xÔ'9¸$Ñ'?Ô'?Ð@Ð@ðAð Að Að Añ Aô Að Að Að Að Að Að Aøøøð Að Að Að Að Að As   Ã*8D/Ä/D3Ä6D3c                 ó´   ‡— |                       |¬¦  «        }|j        }|j        }t          j        | d         | d         |¦  «        Šˆfd„|D ¦   «         }||fS )z½Find what files were added or removed in this commit.

    Returns a tuple of two lists: (added, removed). Only files not *already*
    marked as moved are included in the added list.

    )r#   ó   .Nc                 ó   •— g | ]}|‰v¯|‘Œ	S r   r   )Ú.0ÚfÚcopys     €r   ú
<listcomp>z%_interestingfiles.<locals>.<listcomp>]   s   ø€ Ð/Ð/Ð/�1 ¨$  ˆQ   r   )Ústatusr1   r2   r   Ú
pathcopies)r+   ÚmatcherÚstatr1   r2   r9   s        @r   r$   r$   P   se   ø€ ð �;Š;˜Wˆ;Ñ%Ô%€DØŒJ€EØŒl€GåÔ˜T $œZ¨¨d¬°WÑ=Ô=€Dà/Ð/Ð/Ð/˜Ð/Ñ/Ô/€Eà�'ˆ>Ðr   c                 ój  — i }|dk    rqt          j        | |||¦  «        D ]Y\  }}}| j        j        rB| j                             t          d¦  «         ||¦  «         ||¦  «        |dz  fz  ¦  «         |||<   ŒZ|r7| j                             t          d¦  «        t          |¦  «        z  ¦  «         |S )z¦Find what files in added are really moved files.

    Any file named in removed that is at least similarity% similar to a file
    in added is seen as a rename.

    r   s)   detected move of %s as %s (%d%% similar)
r   s   detected move of %d files
)r   Úfindrenamesr   Úverboser;   r   Úlen)	r+   r3   r1   r2   Ú
similarityr.   ÚsrcÚdstÚscores	            r   r&   r&   b   sÖ   € ð €GØ�A‚~€~Ý&Ô2Ø�%˜ *ñ 
ô  
ð 	ð 	‰OˆC��eð ŒwŒð Ø”—’ÝÐCÑDÔDØ�x ‘}”} h h¨s¡m¤m°U¸S±[ÐAñBñô ð ð ˆG�C‰LˆLØð IØŒ�Š•qÐ7Ñ8Ô8½3¸w¹<¼<ÑGÑHÔHÐHØ€Nr   N)Ú__doc__Úmercurial.i18nr   Ú	mercurialr   r   r   r   r   r	   r
   r   ÚconfigtableÚ
configitemr   r   r$   r&   r   r   r   ú<module>rL      s  ðð	ð 	ð* Ð Ð Ð Ð Ð ð	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð 	ð €Ø!ˆYÔ! +Ñ.Ô.€
à 
€
ØØØðñ ô ð ðð ð ðAð Að Að.ð ð ð$ð ð ð ð r   