^cV @dZddlZddlmZddlmZddlmZmZm Z ddl m Z dZ iZ e je Zedd d ejd ejZd ddZdddZd"dZdZdZdZdZdZdZdZdZeeeeeeeedZdZdZdZ dZ!d Z"d!Z#dS)#aperform 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) stringutilsships-with-hg-core win32textwarnT)defaults (^|[^ ]) sCRLFsCR)  scleversmacc||vrS|rS|rS|rS|td|t||jdfzdSdSdSdSdS)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. shgrc)warnr newlinestrvfsjoin)snewlineuirepofilenames 1/usr/lib/python3/dist-packages/hgext/win32text.py checknewlinerMs !|||x|D|  F   G,dhmmG.D.DE  F     |||||||c Tt|dfi|td|S)Nr s\1 )r re_single_lfsubrcmdkwargss r dumbdecoder!^s0G&&v&&&   J * **rc.|ddS)Nr  replacerrs r dumbencoder'ds 99We $ $$rc Jt|dfi||ddSNr r#)rr%rs r macdumbdecoder*hs.E$$V$$$ 99UE " ""rc.|ddSr)r$r&s r macdumbencoder,ms 99UE " ""rc Jtj|st||fi|S|SN)rbinaryr!rs r cleverdecoder0qs2  Q  ,!S++F+++ HrcNtj|st||S|Sr.)rr/r'r&s r cleverencoder2ws*  Q  "!S!!! Hrc Jtj|st||fi|S|Sr.)rr/r*rs r macdecoder4}s2  Q  /Q..v... HrcNtj|st||S|Sr.)rr/r,r&s r macencoder6s*  Q  %Q$$$ Hr)s dumbdecode:s dumbencode:s cleverdecode:s cleverencode:smacdumbdecode:smacdumbencode:s macdecode:s macencode:c Vd}t}|d}t|j||dz dD]} || } | D]} | |vs| |vs| | vr|| | | } tj | s~|| vrz|s0| tdt|z| tdt| | fzd}ь|r[|dkrUt|} t |}| td | | ||fz|S) NFstips=attempt to commit or push text file(s) using %s line endings s in %s: %s Tspretxnchangegroups 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: )setrange changelogtiprevrevfilesadddatarr/rrrrnodelower filterstr)rrhooktyperBrr haltseentipr>cfrAcrlffilters r forbidnewlinerMs D 55D v,CT^**,,d4jnn.>.>.BBGG I  ADyyASLLAQJJ HHQKKKQ499;;D$T** w$GG7%W- ..))U16688__a,@@AAA    000'"((**7#   $   T66*! +   & Krc $t||||dfi|S)Nr rMrrrErBr s r forbidcrlfrQs T8T7 E Ef E EErc $t||||dfi|S)Nr rOrPs rforbidcrrSs T8T5 C CF C CCrc|sdStD]\}}|||dSr.)local_filtersitems adddatafilter)rrnamefns r reposetupr[sW ::<<NN$$%%b 4$$$$%%rc.|j}|5|ddD]C} || } | *| jr#|| | jd| jD dddn #1swxYwY||||||g|Ri|S)NsrevertrT) p1_trackedp2_info)dirstate parentchange get_entryr] update_filetrackedr^) origrctxnamesuipathfnactionsargsr dsrentrys r wrap_revertrls B      *1-  HLL**E #NN  #' % #                 4c5(G Ed E E Ef E EEsAA<<BBc|ddr"|tdtjt dt dS)Nr r sKwin32text is deprecated: https://mercurial-scm.org/wiki/Win32TextExtension _performrevert) configboolrrr wrapfunctionrrl)rs rextsetuprqs_ }}\7++   G     G%5{CCCCCr)NNN)$__doc__remercurial.i18nrmercurial.noder mercurialrrrmercurial.utilsr testedwith configtable configitemcompile MULTILINErrrDrr!r'r*r,r0r2r4r6rVrMrQrSr[rlrqrrr~s""J   '&&&&& #  !Y !+ . .  rz.",77 u - -  / /     "+++ %%%### ###            ""$$  111hFFFDDD%%%FFF" D D D D Dr