
    6ho                        S r SSKJr  SSKJr  SSKJrJrJrJ	r	J
r
JrJrJr  0 r\R                  " \5      r\" SSSS9  S	 rS
 rS rS rg)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.

    )annotations)_)commandscopieserror
extensionspycompat	registrarscmutilsimilar   automv
   similarity_   )defaultc                    [         R                  " [        R                  S[        5      nUS   R                  SSS [        S5      45        g )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   3   s<    ""8>>9gFE	!HOO	lD!$L"MNr   c           	        SnUR                  SS5      nUR                  5          U(       d  UR                  SS5      nSUs=::  a  S::  d!  O  [        R                  " [        S5      5      eUS:  aa  [        R                  " US   U[        R                  " U5      5      n[        X(5      u  p[        R                  " US	S
9n[        X+XUS-  5      nUb=  UR                  R                  U5         [        R                  " USSU5        SSS5        U " X/UQ70 UD6sSSS5        $ ! , (       d  f       N#= f! , (       d  f       g= f)z&Hook to check for moves at commit timeN	no_automvFr   r   r   d   s+   automv.similarity must be between 0 and 100T)legacyrelativevalueg      Y@ )popwlock	configintr   Abortr   r   matchr	   byteskwargs_interestingfilesgetuipathfn_findrenamesdirstatechanging_files_markchanges)origr   repopatsoptsrenamesdisabled	thresholdr%   addedremoveduipathfns               r   r   r   :   s   GxxU+H	Y>I	(S(kkDE  1}Jh&:&:4&@ "34!?"..tN&EI4E --d3 $$T2r7; 4 B,t,t,3 
$ 43% 
s$   CD:2D)D:)
D7	3D::
Ec                    U R                  US9nUR                  nUR                  n[        R                  " U S   U S   U5      nU Vs/ s H  ofU;  d  M
  UPM     nnX44$ s  snf )zFind 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%      .N)statusr4   r5   r   
pathcopies)r.   matcherstatr4   r5   copyfs          r   r'   r'   Z   sg     ;;W;%DJJEllGT$ZdW=D/1$QE/> 0s   
	A"A"c                v   0 nUS:  ay  [         R                  " XX45       H^  u  pgnU R                  R                  (       a9  U R                  R	                  [        S5      U" U5      U" U5      US-  4-  5        XeU'   M`     U(       a0  U R                  R	                  [        S5      [        U5      -  5        U$ )zFind 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   verboser9   r   len)	r.   r6   r4   r5   
similarityr1   srcdstscores	            r   r)   r)   l   s     GA~&22 
OCe wwCD}hsmUS[AB CL 
 q783w<GHNr   N)__doc__
__future__r   mercurial.i18nr   	mercurialr   r   r   r   r	   r
   r   r   configtable
configitemr   r   r'   r)   r    r   r   <module>rM      s^   	( # 	 	 	 !!+.
 
-@$r   