Plan 9 from Bell Labs’s /usr/web/sources/contrib/jas/root/sys/lib/python2.7/site-packages/hgext/win32text.pyc

Copyright © 2021 Plan 9 Foundation.
Distributed under the MIT License.
Download the Plan 9 distribution.


��Qc@sNdZddlmZddlmZddlmZddlZdZej	dej
�Zidd	6d
d6Zidd	6d
d6Z
dddd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Zied6ed6ed6ed6ed6ed6ed6ed6Zd�Zd �Zd!�Zd"�Zd#�ZdS($s�perform automatic newline conversion

  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
i�(t_(tshort(tutilNtinternals	(^|[^
])
tCRLFs
tCRs
tclevertmacc	CsR||krN|rN|rN|rN|jtd�|t||jd�f�ndS(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.
thgrc(twarnRt
newlinestrtjoin(tstnewlinetuitrepotfilename((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytchecknewline9scKs t|d|�tjd|�S(Ns
s\1
(Rtre_single_lftsub(Rtcmdtkwargs((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
dumbdecodeEscCs|jdd�S(Ns
s
(treplace(RR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
dumbencodeJscKs t|d|�|jdd�S(Ns
s
(RR(RRR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
macdumbdecodeMscCs|jdd�S(Ns
s
(R(RR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
macdumbencodeQscKs#tj|�st|||�S|S(N(RtbinaryR(RRR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytcleverdecodeTscCs tj|�st||�S|S(N(RRR(RR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytcleverencodeYs
cKs#tj|�st|||�S|S(N(RRR(RRR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt	macdecode^scCs tj|�st||�S|S(N(RRR(RR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt	macencodecs
sdumbdecode:sdumbencode:s
cleverdecode:s
cleverencode:smacdumbdecode:smacdumbencode:s
macdecode:s
macencode:c	Ks~t}t�}|d}xtt|�d||j�dd�D]�	||	}
x�|
j�D]�}||ksa||ksa||
kr�qan|j|�|
|j�}tj	|�ra||kra|s�j
td�t|�n|j
td�t
|
j��|f�t}qaqaWqDW|rz|dkrzt|j�}
t|}|j
td�|
|
||f�n|S(Nttipii�s=attempt to commit or push text file(s) using %s line endings
s
in %s: %s
tpretxnchangegroups�
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:
(tFalsetsettxrangetlentrevtfilestaddtdataRRR	RR
RtnodetTruetlowert	filterstr(RRthooktypeR*R
RthalttseenR R&tctfR)tcrlftfilter((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
forbidnewliness,	
1
$
)

cKst||||d|�S(Ns
(R5(RRR.R*R((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt
forbidcrlf�scKst||||d|�S(Ns
(R5(RRR.R*R((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytforbidcr�scCsA|j�sdSx*tj�D]\}}|j||�qWdS(N(tlocalt_filterst	iteritemst
adddatafilter(RRtnametfn((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt	reposetup�scCs/|jddt�r+|jtd��ndS(Nt	win32textR	sNwin32text is deprecated: http://mercurial.selenic.com/wiki/Win32TextExtension
(t
configboolR+R	R(R((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytextsetup�s(t__doc__tmercurial.i18nRtmercurial.nodeRt	mercurialRtret
testedwithtcompilet	MULTILINERR
R-tNoneRRRRRRRRRR9R5R6R7R>RA(((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt<module>*s>								
	*			

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to [email protected].