Plan 9 from Bell Labs’s /usr/web/sources/contrib/bichued/root/sys/lib/python/mercurial/mdiff.pyc

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


�
�c	@s�ddklZddkZddkZddkZddkZddkZd�Zdefd��YZ	e	�Z
d�Zd�Zde
d�Ze
d	�Zd
�Zd�Zd�Zd
�ZeiZeiZeiZdS(i�(t_NcCsng}|id�D]}||dq~}|o5|ddjo|i�qj|dd |d<n|S(s0like str.splitlines, but only split on newlines.s
i�(tsplittpop(ttextt_[1]tltlines((s"/sys/lib/python/mercurial/mdiff.pyt
splitnewliness.tdiffoptscBsqeZdZhdd<ed<ed<ed<ed<ed<ed<ed	<Zei�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 blankitcontextRtshowfunctgittnodatestignorewstignorewsamounttignoreblanklinescKs�xN|iD]C}|i|�}|djo|i|}nt|||�q
Wyt|i�|_Wn/tj
o#ti	t
d�|i��nXdS(Ns3diff context lines count must be an integer, not %r(t	__slots__tgettNonetdefaultstsetattrtintR	t
ValueErrortutiltAbortR(tselftoptstktv((s"/sys/lib/python/mercurial/mdiff.pyt__init__-s

(t__name__t
__module__t__doc__tFalseRtkeysRR(((s"/sys/lib/python/mercurial/mdiff.pyRs							cCs�|iotidd|�}n9|io.tidd|�}tidd|�}n|iotidd|�}n|S(Ns[ 	]+tt s[ 	]+
s
s
+(R
tretsubRR(RR((s"/sys/lib/python/mercurial/mdiff.pytwsclean<s


cCs�dg}|io|id�n|oD|io9|idig}|D]}|d|qM~��n|io&|id|�|id|�n|i|�di|�dS(Ntdiffs--gitR$s-r %ssa/%ssb/%ss
(Rtappendtjoin(trevstatbRtpartsRtrev((s"/sys/lib/python/mercurial/mdiff.pytdifflineFs	
9

cs-t��fd�}|o|odSntid�}	�iomti|�pti|�oM|o5|o.t|�t|�jo||jodSnd�g}
n�p�t|�}|djod||	t�}ndd�||�f}dd	|||�f}d
t|�}
|||
gg}|D]}|d|qF~}
nL|p�t|�}dd�||�f}|djod||	t�}ndd	|||�f}d
t|�}
|||
gg}|D]}|d|q�}
n�t|�}t|�}t	t
||||d�d	|d���}
|
pdSnd|
dd ||�f|
d<d|
dd ||�f|
d<xCtt|
��D]/}|
|ddjo|
|cd7<q�q�W|o#|
idt
|�|���ndi|
�S(NcsB�io�iod|Sn|od�jodSndS(Ns	%s
R$s	
s
(RR(tdatetaddtab(tfn1R(s"/sys/lib/python/mercurial/mdiff.pytdatetagTs
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%s%si�ii�s
s
\ No newline at end of file
(ii(tTrueRtdatestrRtbinarytlenRRR!tlisttbunidifftxrangetinsertR0R*(R,tadR-tbdR3tfn2trRR4tepochRtl1tl2tl3Rtet_[2]taltbltln((R3Rs"/sys/lib/python/mercurial/mdiff.pytunidiffSsH+4
6
6/""#c#s�fd���fd�}����fd�}d|d|g}	�iotid��nti||�}
d}x^t|
�D]P\}}
|djo|
|d}nddddg}g}|d}|
d}|d	}|
d
}�||!}|||!}|o|oq�n�ip�ip
�i	o<t
�di|��t
�di|��joq�q�n||�}||�}d}|oc||d�idjo|}|d}|d	}q
x|||	�D]}|Vq�}	n|o"||d<||d	<|d}n|||||g}g}�||!D]}|d
|qZ~|t
|�)g}|D]}|d|q�~|t
|�)g}|D]}|d|q�~|t
|�)q�W|o#x |||	�D]}|Vq�dS(Ncs(|�i}||jo
|}n|S(N(R	(RR:tret(R(s"/sys/lib/python/mercurial/mdiff.pyt
contextend�s


cs&|�i}|djodSn|S(Ni(R	(RRM(R(s"/sys/lib/python/mercurial/mdiff.pytcontextstart�s

c
3s0|ox|D]}|VqWn|\}}}}}�|t���}||}	||||}
d}�ioXxUt|ddd�D]9}�|i�}�i|�od|d }Pq�q�Wnd|d|	|d|
|fVx|D]}|Vq�$t||�D]}d�|VqWdS(NR#ii�R$i(s@@ -%d,%d +%d,%d @@%s
(R:R
R=trstriptmatch(
thunktheadertxtastartta2tbstarttb2tdeltataendtalentblentfunctt(RNRDtfuncreR(s"/sys/lib/python/mercurial/mdiff.pyt	yieldhunk�s0




	s--- %s	
s+++ %s	
s\wiiiiR#iR$R6R5(R
R%tcompiletbdifftblocksRt	enumerateR
RRR'R*R	R:(tt1tt2RDREtheader1theader2RROR`RSR(RRtits1tsRYta1RVtb1RXtoldtnewRURWtprevRTRRHt_[3]((R_RNRDRs"/sys/lib/python/mercurial/mdiff.pyR<�sb








1
	


6/3cCs�d}g}xj|t|�joVtid|||d!�\}}}|d7}|i||||!�||7}qWdi|�S(Nis>llliR#(R:tstructtunpackR)R*(tbintposR^tp1tp2R((s"/sys/lib/python/mercurial/mdiff.pyt	patchtext�s&
cCsti||g�S(N(tmpatchtpatches(R,Rt((s"/sys/lib/python/mercurial/mdiff.pytpatchscCsHg}ti||�D]*}||d|d|d|dfq~S(Niii(RbRc(R,R-Rtd((s"/sys/lib/python/mercurial/mdiff.pytget_matching_blocksscCstiddd|�S(Ns>llli(Rrtpack(tlength((s"/sys/lib/python/mercurial/mdiff.pyttrivialdiffheaders(ti18nRRbRyRR%RrRtobjectRtdefaultoptsR'R0RRLR<RxR{R}R�Rztpatchedsizettextdiff(((s"/sys/lib/python/mercurial/mdiff.pys<module>s $	
$		
	
7m	
					

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.