`Qc@sNdZddlmZddlmZddlmZddlZdZej dej Z idd 6d d 6Z id d 6d d 6Z ddddZdZdZdZdZdZdZdZdZied6ed6ed6ed6ed6ed6ed6ed6ZdZd Zd!Zd"Zd#ZdS($sperform 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||jdfndS(NsWARNING: %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|jddS(Ns s (treplace(R R((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt dumbencodeJscKs t|d||jddS(Ns s (RR(R RR((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt macdumbdecodeMscCs|jddS(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 s dumbdecode:s dumbencode:s cleverdecode:s cleverencode:smacdumbdecode:smacdumbencode:s macdecode:s macencode:c Ks~t}t}|d}x tt|d||jddD]} || } x| jD]} | |ksa| |ksa| | krqan|j| | | j} tj |  ra|| kra|s|j t dt |n|j t dt | j| ft}qaqaWqDW|rz|dkrzt |j} t|}|j t d| | ||fn|S(Nttipiis=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 forbidcrlfscKst||||d|S(Ns (R5(RRR.R*R((s3/sys/lib/python2.7/site-packages/hgext/win32text.pytforbidcrscCsA|jsdSx*tjD]\}}|j||qWdS(N(tlocalt_filterst iteritemst adddatafilter(RRtnametfn((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt reposetups cCs/|jddtr+|jtdndS(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.pytextsetups(t__doc__tmercurial.i18nRtmercurial.nodeRt mercurialRtret testedwithtcompilet MULTILINERR R-tNoneRRRRRRRRRR9R5R6R7R>RA(((s3/sys/lib/python2.7/site-packages/hgext/win32text.pyt*s>           *