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

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


��Qc@sddlmZddlZddlZddlZddlZddlZddlZddlZd�Z	de
fd��YZe�Ze
d�Zd�Zddded�Zed	�Zed
�Zd�Zd�Zd
�Zd�Zd�ZejZejZejZdS(i�(t_NcCsbg|jd�D]}|d^q}|r^|ddkrI|j�q^|dd |d<n|S(s0like str.splitlines, but only split on newlines.s
i�(tsplittpop(ttexttltlines((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt
splitnewliness&
tdiffoptscBsqeZdZi	dd6ed6ed6ed6ed6ed6ed6ed	6ed
6Zej�Zd�Zd�ZRS(
s�context is the number of context lines
    text treats all files as text
    showfunc enables diff -p output
    git enables the git extended patch format
    nodates removes dates from diff headers
    ignorews ignores all whitespace changes in the diff
    ignorewsamount ignores changes in the amount of whitespace
    ignoreblanklines ignores changes whose lines are all blank
    upgrade generates git diffs to avoid data loss
    itcontextRtshowfunctgittnodatestignorewstignorewsamounttignoreblanklinestupgradecKs�xL|jD]A}|j|�}|dkr;|j|}nt|||�q
Wyt|j�|_Wn-tk
r�tj	t
d�|j��nXdS(Ns3diff context lines count must be an integer, not %r(t	__slots__tgettNonetdefaultstsetattrtintRt
ValueErrortutiltAbortR(tselftoptstktv((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt__init__0s
cs6t�fd��jD��}|j|�t|�S(Nc3s$|]}|t�|�fVqdS(N(tgetattr(t.0R(R(s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pys	<genexpr>>s(tdictRtupdateR(RtkwargsR((Rs3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytcopy=s
(	t__name__t
__module__t__doc__tFalseRtkeysRRR#(((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyRs

	
cCsp|jrtj|d�}n|jr<tj|d�}n|rl|jrltjdd|�jd�}n|S(Niis
+s
(RtbdifftfixwsR
Rtretsubtstrip(RRtblank((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytwscleanDs		!c
cs�g|D]!}t||�r"dp%d^q}g|D]!}t||�rPdpSd^q5}dt|�}}dt|�}}	xE||ks�||	kr�||d}
}}|
|ks�|
dks�|	ks�|dkrLd}x*|
|kr||
dkr|
d7}
q�t||	krH||dkrH|d7}qWnGxD|
|kr�||
dkr�||dkr�|
d7}
|d7}qOW||||
||||g|fV|
}|}q�WdS(Niit=t~(R/tlen(
tbase1tlines1tbase2tlines2RRts1te1ts2te2ti1ti2tbtype((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt
splitblockMs&../
'c
cs�|d	krt}n|js'|jrNt||t�}t||t�}ntj||�}xWt|�D]I\}}|dkr�||d}	nddddg}	|	d|d|	d|dg}	|	d|	dks�d|	dkr�d}
|j	r�|d	krt
|�}n|d	kr7t
|�}nt|dj||	d|	d!��}t|dj||	d|	d!��}||kr�d}
q�n|	|
fVn|dfVqmWd	S(
s�Return (block, type) tuples, where block is an mdiff.blocks
    line entry. type is '=' for blocks matching exactly one another
    (bdiff blocks), '!' for non-matching blocks and '~' for blocks
    matching only after having filtered blank lines. If refine is True,
    then '~' blocks are refined and are only made of blank lines.
    line1 and line2 are text1 and text2 split with splitnewlines() if
    they are already available.
    iiiit!tR1R0N(RtdefaultoptsRR
R/R'R)tblockst	enumerateRRtjoin(
ttext1ttext2RR4R6trefinetdifftiR7tsttypetoldtnew((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt	allblocksgs0		"(	''cs�d�fd�}|r$|r$dStjd�}tj|�}tj|�}�jr�tj|�sytj|�r�|r�|r�t|�t|�kr�||kr�dSd|g}	n�|set|�}|dkr�||�}
ndd||||�f}
dd	||||�f}d
t|�}|
||gg|D]}
d|
^qK}	n1|s
t|�}dd||||�f}
|dkr�d||�}ndd	||||�f}d
t|�}|
||gg|D]}
d|
^q�	n�t|�}t|�}tt	||||d���}	|	sPdS|	j
dd||||�f�|	j
dd||||�f�xAtt|	��D]-}|	|ddkr�|	|cd7<q�q�Wdj|	�S(Ncs6�jr�jrd|S|r2d|kr2dSdS(Ns	%s
t s	
s
(R
R(tdatetfn(R(s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytdatetag�s
R@isBinary file %s has changed
s--- /dev/null%ss--- %s%ssa/s+++ %s%ssb/s@@ -0,0 +1,%d @@
t+s+++ /dev/null%ss@@ -1,%d +0,0 @@
t-Rs
--- a/%s%sis
+++ b/%s%si�s
s
\ No newline at end of file
(ii(
RRtdatestrtpconvertRtbinaryR2Rtlistt_unidifftinserttxrangeRD(tatadtbtbdtfn1tfn2RRRtepochRtl1tl2tl3tetaltbltln((Rs3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytunidiff�sJ(0--!##c#sP�fd���fd�}ddg�����fd�}d}d}x�t||��|�D]�\}	}
|	\}}}
}|
dkr�|
dkrg|||
||7}qgqgng}�||!}||
|!}|
|8}
||8}||�}||
�}d}|rk||d�jdkrL|}|d}|d	}qkx||�D]}|VqYWn|r�||d<||d	<|d
}n|||||g}g�||!D]}d|^q�|t|�)g|D]}d|^q�|t|�)g|D]}d
|^q|t|�)qgW|rLx||�D]}|Vq:WndS(Ncs&|�j}||kr"|}n|S(N(R(RR2tret(R(s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt
contextend�s
	cs!|�j}|dkrdS|S(Ni(R(RRk(R(s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytcontextstart�s
iR@c
3sL|\}}}}}�|t���}||}||||}d}	�jr��\}
}	x\t|d|
dd�D]@}�|dj�r|d�|j�d }	|	�d<Pq|q|W|�d<n|r�d7}n|r�d7}nd|||||	fVx|D]}|VqWx$t||�D]}d�|Vq1WdS(NR@ii�iROi(s@@ -%d,%d +%d,%d @@%s
(R2R	R[tisalnumtrstrip(
thunktastartta2tbstarttb2tdeltataendtalentblentfunctlastposRItx(RlRctlastfuncR(s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt	yieldhunk�s.
	!



	
	R?R1iiiRORTRS(RRNRR2(tt1tt2RcRdRRmR}RptignoredlinesRJtstypeta1Rrtb1RtRuRLRMRqRstprevR{((RlRcR|Rs3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyRY�sL'%








.'+cCs�d�}dd�}|dkr*d}n|dkr?d}n||krOdSg}|jd�|jdt|��x0|tj|��D]}|j||��q�W|jd�dj|�S(	s print base85-encoded binary diffcSsmt|�}|dkr5ttd�|d�}nt|dtd�d�}d|tj|t�fS(NitAiR\s%c%s
(R2tchrtordtbase85t	b85encodetTrue(tlineR((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytfmtline/s
i4cssCt|�}d}x*||kr>||||!V||7}qWdS(Ni(R2(RtcsizeRRI((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytchunk7s
R@sGIT binary patch
sliteral %s
s
N(RtappendR2tzlibtcompressRD(ttottnR�R�RkR((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytb85diff-s			

cCs�d}g}xh|t|�krvtjd|||d!�\}}}|d7}|j||||!�||7}qWdj|�S(Nis>llliR@(R2tstructtunpackR�RD(tbintpostttp1tp2R((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt	patchtextPs&
cCs5t|�dkr"tj|d�Stj||g�S(Nii(R2Rtbuffertmpatchtpatches(R\R�((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytpatchZscCs@gtj||�D])}|d|d|d|df^qS(Niii(R)RB(R\R^td((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pytget_matching_blocksascCstjddd|�S(Ns>llli(R�tpack(tlength((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyttrivialdiffheaderds(ti18nRR)R�RR+R�R�R�RtobjectRRAR�R/R>RR'RNRjRYR�R�R�R�R�R�tpatchedsizettextdiff(((s3/sys/lib/python2.7/site-packages/mercurial/mdiff.pyt<module>s$$0	
,			*8d	#	
					

Bell Labs OSI certified Powered by Plan 9

(Return to Plan 9 Home Page)

Copyright © 2021 Plan 9 Foundation. All Rights Reserved.
Comments to webmaster@9p.io.