
    	^cV              	       @   d Z ddlZddlmZ ddlmZ ddlmZmZm	Z	 ddl
mZ dZi Z e	j        e          Z edd	d
            ej        dej                  ZdddZdddZd"dZd Zd Zd Zd Zd Zd Zd Zd ZeeeeeeeedZd Zd Zd Z d Z!d  Z"d! Z#dS )#a  perform automatic newline conversion (DEPRECATED)

  Deprecation: The win32text extension requires each user to configure
  the extension again and again for each clone since the configuration
  is not copied when cloning.

  We have therefore made the ``eol`` as an alternative. The ``eol``
  uses a version controlled file for its configuration and each clone
  will therefore use the right settings from the start.

To perform automatic newline conversion, use::

  [extensions]
  win32text =
  [encode]
  ** = cleverencode:
  # or ** = macencode:

  [decode]
  ** = cleverdecode:
  # or ** = macdecode:

If not doing conversion, to make sure you do not commit CRLF/CR by accident::

  [hooks]
  pretxncommit.crlf = python:hgext.win32text.forbidcrlf
  # or pretxncommit.cr = python:hgext.win32text.forbidcr

To do the same check on a server to prevent CRLF/CR from being
pushed or pulled::

  [hooks]
  pretxnchangegroup.crlf = python:hgext.win32text.forbidcrlf
  # or pretxnchangegroup.cr = python:hgext.win32text.forbidcr
    N)_)short)cmdutil
extensions	registrar)
stringutils   ships-with-hg-core	   win32text   warnT)defaults	   (^|[^])
s   CRLFs   CR)   
   s   clevers   macc                     || v rS|rS|rS|rS|                     t          d          |t          |         |j                            d          fz             d S d S d S d S d S )Ns   WARNING: %s already has %s line endings
and does not need EOL conversion by the win32text plugin.
Before your next commit, please reconsider your encode/decode settings in 
Mercurial.ini or %s.
s   hgrc)warnr   
newlinestrvfsjoin)snewlineuirepofilenames        1/usr/lib/python3/dist-packages/hgext/win32text.pychecknewliner   M   s    
 !|||x|D|
F  G,dhmmG.D.DEF	
 	
 	
 	
 	
 |||||||    c                 T    t          | dfi | t                              d|           S )Nr   s   \1
)r   re_single_lfsubr   cmdkwargss      r   
dumbdecoder!   ^   s0    G&&v&&&J***r   c                 .    |                      dd          S )Nr      
replacer   r   s     r   
dumbencoder'   d   s    99We$$$r   c                 J    t          | dfi | |                     dd          S Nr   r#   )r   r%   r   s      r   macdumbdecoder*   h   s.    E$$V$$$99UE"""r   c                 .    |                      dd          S r)   r$   r&   s     r   macdumbencoder,   m   s    99UE"""r   c                 J    t          j        |           st          | |fi |S | S N)r   binaryr!   r   s      r   cleverdecoder0   q   s2    Q ,!S++F+++Hr   c                 N    t          j        |           st          | |          S | S r.   )r   r/   r'   r&   s     r   cleverencoder2   w   s*    Q "!S!!!Hr   c                 J    t          j        |           st          | |fi |S | S r.   )r   r/   r*   r   s      r   	macdecoder4   }   s2    Q /Q..v...Hr   c                 N    t          j        |           st          | |          S | S r.   )r   r/   r,   r&   s     r   	macencoder6      s*    Q %Q$$$Hr   )s   dumbdecode:s   dumbencode:s   cleverdecode:s   cleverencode:s   macdumbdecode:s   macdumbencode:s
   macdecode:s
   macencode:c           	      V   d}t                      }|d         }t          |j                                        ||                                         dz
  d          D ]}	||	         }
|
                                D ]}||v s||vs||
vr|                    |           |
|                                         }t          j	        |          s~||v rz|s0| 
                    t          d          t          |         z             | 
                    t          d          t          |
                                          |fz             d}ь|r[|dk    rUt          |                                         }t           |         }| 
                    t          d	          ||||fz             |S )
NFs   tip   s=   attempt to commit or push text file(s) using %s line endings
s
   in %s: %s
Ts   pretxnchangegroups   
To prevent this mistake in your local repository,
add to Mercurial.ini or .hg/hgrc:

[hooks]
pretxncommit.%s = python:hgext.win32text.forbid%s

and also consider adding:

[extensions]
win32text =
[encode]
** = %sencode:
[decode]
** = %sdecode:
)setrange	changelogtiprevrevfilesadddatar   r/   r   r   r   r   nodelower	filterstr)r   r   hooktyperB   r   r    haltseentipr>   cfrA   crlffilters                  r   forbidnewlinerM      s   D55D v,CT^**,,d4jnn.>.>.BBGG  I 	 	ADyyASLLAQJJHHQKKKQ499;;D$T** 
w$ GG7  %W-	.   .))U16688__a,@@AAA	   
000'"((**7#
$   T66*!+	
 	
 	
& Kr   c                 $    t          | |||dfi |S )Nr   rM   r   r   rE   rB   r    s        r   
forbidcrlfrQ      s     T8T7EEfEEEr   c                 $    t          | |||dfi |S )Nr   rO   rP   s        r   forbidcrrS      s     T8T5CCFCCCr   c                     |                                 sd S t                                          D ]\  }}|                    ||           d S r.   )local_filtersitemsadddatafilter)r   r   namefns       r   	reposetupr[      sW    ::<< NN$$ % %b4$$$$% %r   c                 .   |j         }|                                5  |d         d         D ]C}	|                    |	          }
|
*|
j        r#|                    |	|
j        d|
j                   D	 d d d            n# 1 swxY w Y    | |||||g|R i |S )Ns   revertr   T)
p1_trackedp2_info)dirstateparentchange	get_entryr]   update_filetrackedr^   )origr   ctxnamesuipathfnactionsargsr    dsr   entrys              r   wrap_revertrl      s   	B			 
 
	*1- 		 		HLL**E # NN #' %	 #   			
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 4c5(GEdEEEfEEEs   AA<<B B c                     |                      dd          r"|                     t          d                     t          j        t
          dt                     d S )Nr	   r
   sK   win32text is deprecated: https://mercurial-scm.org/wiki/Win32TextExtension
_performrevert)
configboolr   r   r   wrapfunctionr   rl   )r   s    r   extsetuprq      s_    	}}\7++ 

G 	
 	
 	
 G%5{CCCCCr   )NNN)$__doc__remercurial.i18nr   mercurial.noder   	mercurialr   r   r   mercurial.utilsr   
testedwithconfigtable
configitemcompile	MULTILINEr   r   rD   r   r!   r'   r*   r,   r0   r2   r4   r6   rV   rM   rQ   rS   r[   rl   rq    r   r   <module>r~      s  " "J 
			                           
 ' & & & & & #
!Y!+..
 

    rz.",77u--
//	
 
 
 
"+ + +% % %# # #
# # #         ""$$	 	1 1 1hF F FD D D% % %F F F"	D 	D 	D 	D 	Dr   