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

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


��c@s�ddlZddlZddlZddlZddlZddlZddlZddlZddl	Z	ddl
mZddlm
Z
mZmZddlZddlZddlZddlZddlZddlZddlZddlZddlZejd�Zdefd��YZd�Zd�Zd	efd
��YZ d�Z!defd
��YZ"defd��YZ#de#fd��YZ$de$fd��YZ%defd��YZ&de#fd��YZ'ejd�Z(ejd�Z)ddddgZ*defd��YZ+d efd!��YZ,d"efd#��YZ-d$�Z.d%�Z/d&�Z0d'�Z1d(�Z2d)dd*�Z3d)dd+�Z4d,�Z5ddd-�Z7ddd.d/�Z8ddd0�Z9dd1�Z:d)ddd.d2�Z;d)d3�Z<d4efd5��YZ=de>d6d7�Z?ddddddd8d9�Z@d:�ZAd;�ZBd<�ZCd=�ZDd>�ZEd?e>d@�ZFdA�ZGdS(Bi�N(t_(thextnullidtshortsdiff --git a/(.*) b/(.*)t
PatchErrorcBseZRS((t__name__t
__module__(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRscsud��d���fd�}�fd�}�fd�}��fd�}�fd�}dtfd	��Y}t}g}d
g}	tj|d�s�||�}nx�|D]�}
|j|
�|
jd�r�||�S|
jd
�r�||�S�|
|�rEt}|
jdd�dj�|	krg|||�Sq�|
jd�r�|r�|||�Sq�W||�S(s6return an iterator of individual patches from a streamcSs`|r|dd	krtS|dd
kr.tS|jdd�}t|�dko_d|dkS(Nit s	t-t+s: ii(Rs	(RRR	(tTruetFalsetsplittlen(tlinetinheadertl((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytisheaderscSstjdj|��S(Nt(t	cStringIOtStringIOtjoin(tlines((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytchunk%sc3s�t}x`|D]X}|j�s(t}n|rX|jd�rX�|�Vg}t}n|j|�q
W|r}�|�VndS(Ns# HG changeset patch(R
tstripRt
startswithtappend(tstreamtcurRR(R(s3/sys/lib/python2.7/site-packages/mercurial/patch.pythgsplit(s
		c3s�xY|D]Q}|jd�rKx#t�|d��D]}|Vq3Wg}n|j|�qW|r�x&t�|d��D]}|VqyWndS(NsFrom i(RRR(RRRtc(R(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	mboxsplit8s
		c	3s�d�}x|D]}|j|�qW�|�}tjj�j|�}|j�se||�VnFd}x=|j�D]/}|j�}||kr�qxn||�VqxWdS(NcSsBtj�}tjj|dt�}|j|�|jd�|S(Ntmangle_from_i(RRtemailt	GeneratorRtflattentseek(tmtfptg((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytmsgfpFs


s
text/plainstext/x-diffstext/x-patch(s
text/plainstext/x-diffstext/x-patch(RR!tParsertparsetis_multiparttwalktget_content_type(	RRR(RRR%tok_typestparttct(R(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	mimesplitEs	
c3s�t}xj|D]b}|rC�||�rC�|�Vg}t}n|rb�||�rbt}n|j|�q
W|r��|�VndS(N(RR
R(RRRR(RR(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytheadersplit\s
		c3s�|�VdS(N((R(R(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	remainderlstfitercBs#eZd�Zd�Zd�ZRS(cSs
||_dS(N(R&(tselfR&((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt__init__pscSs|S(N((R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt__iter__sscSs"|jj�}|st�n|S(N(R&treadlinet
StopIteration(R5R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytnextvs	(RRR6R7R:(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR4os		scontent-typeR:s# HG changeset patchsFrom t:iis--- (	tobjectRtutiltsafehasattrRRR
Rtlower(RRRR1R2R3R4RRtmimeheadersR((RRs3/sys/lib/python2.7/site-packages/mercurial/patch.pyRs4	
	

	



"cCs�tjdtjtjB�}tjdd�\}}tj|d�}y�tj	j	�j
|�}|d}|d}|r�|r�djd�|j�D��d}nd	|j
d
d�k}	d'}
d'}d'}g}
|rL|jd�r#|jd
�}|dkr#||dj�}q#ntjdd|�}|jd|�n|rf|jd|�nd}d(}d}x�|j�D]�}|j�}|jd|�||kr�q�n|jdt�}|j|�}|r�}t}t}|jd|jd��|d7}tj�}x�||jd� j�D]f}|jd�r�|r�|jd�t}t}|jd�|j�d'}n�r]|jd�r�|d}|jd|�qx|jd�r�d}
qx|jd�r�d }qx|jd!�r|d"}qx|jd#�rB|
j |d j��qx|jd$�sxt}qxn|d%krx|	rxt}n|r=|r=|j!|�|j!d�q=q=W|j"�}|r|j!|�|j#d�s�j!d�q�q�|r�|r�|dkr�|d|7}q�q�WWn!|j$�tj%|��nX|rg|j|�rgd&||f}n|j$�|s�tj%|�d'|||
|d'd'd'fS|
r�|
j&d�p�d'}|
r�|
j&d�p�d'}||||
||||fS()sGextract patch from data read from fileobj.

    patch can be a normal patch or contained in an email message.

    return tuple (filename, message, user, date, branch, node, p1, p2).
    Any item in the returned tuple can be None. If filename is None,
    fileobj did not contain a patch. Caller must unlink filename when done.s|^(?:Index:[ \t]|diff[ \t]|RCS file: |retrieving revision [0-9]+(\.[0-9]+)*$|---[ \t].*?^\+\+\+[ \t]|\*\*\*[ \t].*?^---[ \t])tprefixs	hg-patch-twtSubjecttFroms
css|]}dj|�VqdS(s: N(R(t.0th((s3/sys/lib/python2.7/site-packages/mercurial/patch.pys	<genexpr>�ssgit-send-emailsX-MailerRs[PATCHt]iis\n[ \t]+RsSubject: %s
s	From: %s
s
text/plainstext/x-diffstext/x-patchsContent-Type: %s
tdecodesfound patch at byte %d
s# HG changeset patchspatch generated by hg export
s# User is# Date s	# Branch i	s
# Node ID i
s	# Parent s# s---s%s
%sN(s
text/plainstext/x-diffstext/x-patch('tretcompilet	MULTILINEtDOTALLttempfiletmkstemptostfdopenR!R)R*RtitemstgettNoneRtfindtlstriptsubtdebugR,R-tget_payloadR
tsearchRtstartRRt
splitlinesR$ttruncateRtwritetgetvaluetendswithtclosetunlinktpop(tuitfileobjtdiffretfdttmpnamettmpfptmsgtsubjecttusertgitsendmailtdatetnodeidtbranchtparentstpendt
diffs_seenR.tmessageR/tcontent_typetpayloadR%thgpatcht
hgpatchheadert
ignoretexttcfpRtp1tp2((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytextract�s�	

&
 


	



	





t	patchmetacBsMeZdZd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(s�Patched file metadata

    'op' is the performed operation within ADD, DELETE, RENAME, MODIFY
    or COPY.  'path' is patched file path. 'oldpath' is set to the
    origin file when 'op' is either COPY or RENAME, None otherwise. If
    file mode is changed, 'mode' is a tuple (islink, isexec) where
    'islink' is True if the file is a symlink and 'isexec' is True if
    the file is executable. Otherwise, 'mode' is None.
    cCs1||_d|_d|_d|_t|_dS(NtMODIFY(tpathRStoldpathtmodetopRtbinary(R5R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6s
				cCs'|d@}|d@}||f|_dS(Ni i@(R�(R5R�tislinktisexec((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytsetmodes

cCsCt|j�}|j|_|j|_|j|_|j|_|S(N(R}RR�R�R�R�(R5tother((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytcopyscCs3|dkr|jdkS|d|jp.|jkS(Ns	/dev/nulltADDsa/(R�R�R(R5tafile((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_ispatchinga%s
cCs*|dkr|jdkS|d|jkS(Ns	/dev/nulltDELETEsb/(R�R(R5tbfile((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_ispatchingb*s
cCs|j|�o|j|�S(N(R�R�(R5R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
ispatching/scCsd|j|jfS(Ns<patchmeta %s %r>(R�R(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt__repr__2s(
RRt__doc__R6R�R�R�R�R�R�(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR}s							cCs�d}g}x�|D]�}|jd�}|jd�r�tj|�}|r�|rb|j|�n|jd�}t|�}q�q|r|jd�r�|j|�d}qn|jd�r�d|_|d|_	q�|jd�r�d	|_
q�|jd
�r d|_|d	|_	q�|jd�r?|d
|_
q�|jd�rZd|_q�|jd�r�d|_|jt|dd
��q�|jd�r�|jt|dd
��q�|jd�r�t
|_q�qqW|r�j|�n|S(s9extract git-style metadata about patches from <patchname>s 
s
diff --git a/is--- srename from tRENAMEis
rename to i
s
copy from tCOPYscopy to isdeleted fileR�snew file mode R�i�s	new mode sGIT binary patchN(RStrstripRtgitretmatchRtgroupR}R�R�RR�tintR
R�(tlrtgpt
gitpatchesRR%tdst((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytreadgitpatch5sL

			t
linereadercBs,eZd�Zd�Zd�Zd�ZRS(cCs||_g|_dS(N(R&tbuf(R5R&((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6cs	cCs#|dk	r|jj|�ndS(N(RSR�R(R5R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytpushgscCs1|jr$|jd}|jd=|S|jj�S(Ni(R�R&R8(R5R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR8ks
	

ccs,x%tr'|j�}|sPn|VqWdS(N(R
R8(R5R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR7rs
	(RRR6R�R8R7(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�as			tabstractbackendcBs>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs
||_dS(N(Rc(R5Rc((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6zscCs
t�dS(sWReturn target file data and flags as a (data, (islink,
        isexec)) tuple.
        N(tNotImplementedError(R5tfname((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytgetfile}scCs
t�dS(s	Write data to target file fname and set its mode. mode is a
        (islink, isexec) tuple. If data is None, the file content should
        be left unchanged. If the file is modified after being copied,
        copysource is set to the original file name.
        N(R�(R5R�tdataR�t
copysource((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytsetfile�scCs
t�dS(sUnlink target file.N(R�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRa�scCsdS(s�Write rejected lines for fname. total is the number of hunks
        which failed to apply and total the total number of hunks for this
        files.
        N((R5R�tfailedttotalR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytwriterej�scCs
t�dS(N(R�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytexists�s(RRR6R�R�RaR�R�(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�ys					t	fsbackendcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCs,tt|�j|�tj|�|_dS(N(tsuperR�R6tscmutiltopener(R5Rctbasedir((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6�scCstjj|jj|�S(N(RORRR�tbase(R5tf((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_join�scCs�|j|�}tjj|�r:tj|�ttffSt}y tj|�jd@dk}Wn+t	k
r�}|j
t
jkr��q�nX|jj
|�t|ffS(Ni@i(R�RORR�treadlinkR
Rtlstattst_modetOSErrorterrnotENOENTR�tread(R5R�RR�te((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s 
cCs�|\}}|dkr8tj|j|�||�dS|rT|jj||�n8|jj||�|r�tj|j|�tt�ndS(N(	RSR=tsetflagsR�R�tsymlinkR]RR
(R5R�R�R�R�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��scCs tj|j|�dt�dS(Nt
ignoremissing(R=t
unlinkpathR�R
(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRa�scCsZ|d}|jjtd�|||f�|j|d�}|j|�|j�dS(Ns.rejs7%d out of %d hunks FAILED -- saving rejects to file %s
RB(RctwarnRR�t
writelinesR`(R5R�R�R�RR&((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s
		
cCstjj|j|��S(N(RORtlexistsR�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s(	RRR6R�R�R�RaR�R�(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s							tworkingbackendcBs5eZd�Zd�Zd�Zd�Zd�ZRS(cCsStt|�j||j�||_||_t�|_t�|_g|_	dS(N(
R�R�R6troottrepot
similaritytsettremovedtchangedtcopied(R5RcR�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6�s		cCsB|jj|dkr>|j|�r>ttd�|��ndS(Nt?s$cannot patch %s: file is not tracked(R�tdirstateR�RR(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_checkknown�s%cCse|j|�tt|�j||||�|dk	rQ|jj||f�n|jj|�dS(N(	R�R�R�R�RSR�RR�tadd(R5R�R�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s

cCsG|j|�tt|�j|�|jj|�|jj|�dS(N(R�R�R�RaR�R�R�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRa�s
cCs%|jd}t|j�}x6|jD]+\}}tj|j|j|||�q&W|jr�|j	t
|j��x6|jD](}||jjkr~|j|�q~q~Wn|r|jj
�}|r�|D]!}tj|jj||�^q�}ntj|j|d|j�nt
|j�S(NR�(R�RSR�R�R�R�tdirstatecopyRcR�tforgettsortedR�tdiscardtgetcwdR=tpathtoR�t	addremoveR�(R5twctxt
addremovedtsrcR�R�tcwd((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR`�s 
#	.(RRR6R�R�RaR`(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s
				t	filestorecBs2eZdd�Zdd�Zd�Zd�ZRS(cCsYd|_i|_d|_||_|jdkrCdd|_nd|_i|_dS(Niiiii(RSR�tfilestcreatedtmaxsizetsizeR�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6�s					cCs�|jdks+t|�|j|jkrY|||f|j|<|jt|�7_n}|jdkr�tjdd�}tj|�|_nt	|j
�}|jj||�|j
d7_
|||f|j|<dS(NiRAs	hg-patch-i(
R�R
R�R�R�RSRMtmkdtempR�tstrR�R]R�(R5R�R�R�R�R�tfn((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s+cCsk||jkr|j|S|js3||jkr<t�n|j|\}}}|jj|�||fS(N(R�R�R�tIOErrorR�(R5R�R�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s	cCs#|jrtj|jj�ndS(N(R�tshutiltrmtreeR�(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR`s	N(RRRSR6R�R�R`(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s
	trepobackendcBsGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cCsVtt|�j|�||_||_||_t�|_t�|_i|_	dS(N(
R�R�R6R�tctxtstoreR�R�R�R�(R5RcR�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6s			cCs,||jkr(ttd�|��ndS(Ns$cannot patch %s: file is not tracked(R�RR(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�'scCs\y|j|}Wntjk
r-t�nX|j�}|j�d|kd|kffS(NRtx(R�terrortLookupErrorR�tflagsR�(R5R�tfctxR�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�+s
cCs{|r|j|�n|dkr8|j|j�}n|jj||||�|jj|�|rw||j|<ndS(N(	R�RSR�R�R�R�R�R�R�(R5R�R�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�3scCs!|j|�|jj|�dS(N(R�R�R�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRa=s
cCs
||jkS(N(R�(R5R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�AscCs|j|jBS(N(R�R�(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR`Ds(	RRR6R�R�R�RaR�R`(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s					
		s*@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@s.(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)tstricttcrlftlftautot	patchfilecBsJeZdd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(R�c
Cs�|j|_||_d|_||_||_g|_t|_	t
|_|j|_|j
|_|jdk|_|jdk|_yV|jdkr�|j|j�\}}t
|_	n1|j|j�d \}}|j	|j�|_	t|_|rtj|�|_n|jdkr-||_n|jr�|jdjd�rXd|_n"|jdjd�rzd|_n|d	kr�g}x>|jD]3}	|	jd�r�|	d
 d}	n|j|	�q�W||_q�nWnGtk
r&|jrt|_n|jdkr'ttf|_q'nX|jrP|jjtd�|j�ni|_d|_d|_d|_g|_t|_|j t�d|_!dS(
NR�R�R�R�iis
s
R�i�s!unable to find '%s' for patching
(sADDsCOPYsRENAME("RR�teolmodeRSteoltbackendRcRRR�R
tmissingR�R�R�R�tcreatetremoveR�tmdifft
splitnewlinesR_RR�R�Rthashtdirtytoffsettskewtrejtfileprintedt	printfilethunks(
R5RcR�R�R�R�R�R�tnlinesR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6Msd									
		 						
cCs�|jdkr|j}n|jdkr3d}nd}|jdkr�|r�|dkr�g}xB|D]:}|r�|ddkr�|d |}n|j|�qgW|}n|jj|dj|�||j�dS(NR�R�s
s
R�i�R(R�R�RR�R�RR�(R5R�RR�R�trawlinesR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s	!
	cCsk|jr
dS|s|jjr+t|_ntd�|j}|rW|jj|�n|jj|�dS(Nspatching file %s
(R�RctverboseR
RR�R�tnote(R5R�ts((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s	csG|jj|g�}t|�dkrC|jd�fd��n|S(Nitkeycst|��S(N(tabs(R�(tlinenum(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt<lambda>�s(R�RRR
tsort(R5RR	tcand((R	s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	findlines�scCs�|js
dStjj|j�}d||fg}xR|jD]G}x>|jD]3}|j|�|ddkrO|jd�qOqOWq?W|jj|jt	|j�|j
|�dS(Ns--- %s
+++ %s
i�s
s
\ No newline at end of file
(R�RORtbasenameR�thunkRR�R�R
R(R5R�RR�R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	write_rej�s	
cCs�|j�sUttd�|j|jt|j�|jt|j�|j	f��n|j
d7_
|jr�|jj
|�dS|jr�jr�jr�|jjtd|j��n|jjtd�|j�|jj
|�dSt|t�rS|jr|jj|j�n4|j�|j(|jt|j��7_t|_dS|}|jdks�|jd	kr�|jr�|j �}n|j!dt"�\}}}}||j7}|}|j#dkrRt$j%||j|�dkrR|jr|jj|j�nB||j||t|�+|jt|�t|�7_t|_dSi|_&x9t'|j�D](\}}	|j&j(|	g�j
|�qkWx�t)d
�D]�}
x�tt"gD]�}|j!|
|�\}}}}||j|j#}t*|t|j��}|r*|j+|dd|�}n	|g}x
|D]}
|set$j%||j|
�dkr:||j|
|
t|�+|jt|�t|�7_|
||_#t|_|
||
}|
rtd�}|j,t�|jj||j|
d|
|f�n0td�}|jj-||j|
d|f�|
Sq:Wq�Wq�W|j,t�|jjtd
�|j|f�|jj
|�dS(Nsbad hunk #%d %s (%d %d %d %d)ii�s-cannot create %s: destination already exists
sfile %s already exists
iR�R�R�is9Hunk #%d succeeded at %d with fuzz %d (offset %d lines).
s,Hunk #%d succeeded at %d (offset %d lines).
sHunk #%d FAILED at %d
(scrlfR�(.tcompleteRRtnumbertdescR
tatlenatbtlenbRR�R�RR�R�R�RcR�R�t
isinstancetbinhunkR�R�RatnewRR�R
R�R�R�t
getnormalizedtfuzzitRR�tdiffhelpersttesthunkR�t	enumeratet
setdefaulttxrangetminR
RR(R5RFthorigtoldtoldstartRtnewstartt
orig_startR�RtfuzzlenttoponlyRRR�Ri((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytapply�s�*				
			 	
%
	
$
#cCs?|jr(|j|j|j|j�n|j�t|j�S(N(R�R�R�RR�RR
R�(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR`s	
(	RRR6R�RR
RR*R`(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�Ls7					`RcBsPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cCs�||_||_|g|_g|_g|_d|_|_d|_|_	|dk	r�|rr|j
|�q�|j|�ndS(N(RRRRRRStstartaRtstartbRtread_context_hunktread_unified_hunk(R5RtnumR�tcontext((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6$s				cCs�d�}t|j|jdd�}|j|_|j|_|j|_||j�|_||j�|_|j|_|j|_|j|_|j	|_	|S(s1Return a copy with line endings normalized to LF.cSsHg}x;|D]3}|jd�r3|d d}n|j|�q
W|S(Ns
i�s
(R_R(RRR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	normalize5s
N(
RRRRSRRR+R,RR(R5R1tnh((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR2s		cCsntj|j�}|s4ttd�|j��n|j�\|_|_|_	|_
|jdkrsd|_nt|j�|_|j
dkr�d|_
nt|j
�|_
t|j�|_t|j	�|_	t
j||j|j|j
|j|j�xYt|jd�dkr\|jd=|jd=|jd=|jd8_|j
d8_
qW|j|�dS(Nsbad hunk #%dii�i(tunidescR�RRRRtgroupsR+RR,RRSR�RtaddlinesRRRR
t_fixnewline(R5R�R%((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR.Js*$!



cCs|j�|_tj|j�}|sCttd�|j��n|j�\|_}t	|j�|_|dkr�|j}nt	|�|j|_|jr�|jd7_nx�t|j�D]�}|j�}|j
d�r�j|�Pn|d}|j
d�s|j
d�r*d|}n;|j
d�rFd	|}nttd
�|j|f��|jj|�|jj|�q�W|j�}|j
d�r�|jdd }||jd<||jd<|j�}ntj|�}|sttd�|j��n|j�\|_}t	|j�|_|dkrN|j}nt	|�|j|_|jr|jd7_nd}	x�t|j�D]�}|j�}|j
d�r�jdd }||jd<||j|	d<q�n|s|j|�Pn|d}|j
d
�s*|j
d�r7d|}na|j
d�rSd	|}nEt|j�dkry|j|�Pnttd
�|j|f��|jj|�x|tr&|	t|j�kr�d}
n
|j|	}
|	d7}	|
|kr��|
j
d�rq�q�|jj|	d|�Pq�Wq�W|js|xE|jD]7}|j
d�sb|j
d	�r>|jj|�q>q>Wn|js�xI|jD];}|j
d�s�|j
d	�r�|jj|d�q�q�Wnd|j|j|j|jf|_|j|jd<|j|�dS(Nsbad hunk #%dis---is- s! Rs  Rsbad hunk #%d old text line %ds\ i�s+ R	iRs@@ -%d,%d +%d,%d @@
(R8RtcontextdescR�RRRR4R+R�RSRR!RR�RRRR,RRR
R
tinsertR6(R5R�R%taendR�RRtutbendthunkiRF((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR-es�	





	





		

			cCsK|j�}|jd�r:tj|j|j|j�n
|j|�dS(Ns\ (R8RRtfix_newlineRRRR�(R5R�R((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6�scCs.t|j�|jko-t|j�|jkS(N(R
RRRR(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�sc	Cs%t|t|��}|rd}d}t|j�}xAt|d�D]/}|j|dddkru|d7}qGPqGW|s�xHt|d�D]3}|j||dddkr�|d7}q�Pq�Wnt||�}t||�}||t|�|!||t|�|!|fS||dfS(NiiR(R"R
RR!(	R5R$RtfuzzR)ttoptbotthlenR�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_fuzzit�s$

/cCs�|j|j|j||�\}}}|j|}|j|}|jrc|dkrc|d8}n|jr�|dkr�|d8}n||||fS(Nii(RBRRR+R,RR(R5R>R)R$RR?R%R&((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s'



(
RRR6RR.R-R6RRBR(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR#s				g			RcBs2eZdZd�Zd�Zd�Zd�ZRS(s6A binary patch file. Only understands literals so far.cCs/d|_dg|_||_|j|�dS(NsGIT binary patch
(RSttextRt_fnamet_read(R5R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR6�s		cCs
|jdk	S(N(RCRS(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRscCs
|jgS(N(RC(R5((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRsc	Cs�d�}xQtr\|||j�}|sFttd�|j��n|jd�rPqqWt|dj��}g}|||j�}x�t|�dkrk|d}|dkr�|dkr�t	|�t	d�d}nt	|�t	d	�d
}y"|j
tj|d�| �Wn8t
k
rU}ttd�|jt|�f��nX|||j�}q�Wtjdj|��}t|�|kr�ttd
�|jt|�|f��n||_dS(NcSs&|j�}|j|�|jd�S(Ns
(R8RR�(R�RR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytgetlines
s"could not extract "%s" binary datasliteral iiitZtARis&could not decode "%s" binary patch: %sRs%"%s" length is %d bytes, should be %d(R
RRRRDRR�R�R
tordRtbase85t	b85decodet
ValueErrorR�tzlibt
decompressRRC(	R5R�RFRR�tdecRR�RC((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRE
s6		
"(RRR�R6RRRE(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s
			cCsX|djd�}|jd�}|dkrP|jd�}|dkrP|Sn|| S(Nis
s	iR(R�RT(R�Rti((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
parsefilename,scCs�t|�}d}|dkr.d|j�fS|}x�|dkr�|jd|�}|dkr�ttd�|||f��n|d7}x.||dkr�||dkr�|d7}q�W|d8}q7W|| j�||j�fS(NiRt/i�s*unable to strip away %d of %d dirs from %si(R
R�RTRRRU(RRtpathlenRPtcount((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	pathstrip6s
#cCs/|dk}|dk}|o9|jdko9|jdk}|o]|jdko]|jdk}t||�\}	}
|o�|j|
�}t||�\}}
|
|
kr�|}n|o�|j|
�}|o�|o�|}|
|
jd�d }|
|
jd�d }|r\||kr\|
j|
�r\|jdkr\|jdkr\t}t	}n|	|kot|
j|
�}d}|s�|r�|r�|r�|
p�|
}q�|r�|
}q�n|s�s�|r�|
p�|
}q�s�
}q�td���nt
|�}|rd|_n|r+d|_n|S(Ns	/dev/nulliRRis&undefined source and destination filesR�R�(R+RR,RRUR�trfindRR
RRSRRR}R�(R�t
afile_origt
bfile_origRRtnullatnullbR�R�tabaseR�tgoodatbbaseR�tgoodbR�tabasedirtbbasedirtisbackupR�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
makepatchmetaHsH$$	!		cCs�d}y|jj�}|j}Wn)tk
rMtj|jj��}nXt|�}|j|�t|�}|j	|�|S(s�
    Git patches can emit:
    - rename a to b
    - change b
    - copy a to c
    - change c

    We cannot apply this sequence as-is, the renamed 'a' could not be
    found for it would have been renamed already. And we cannot copy
    from 'b' instead because 'b' would have been changed already. So
    we scan the git patch for copy and rename commands so we can
    perform the copies ahead of time.
    i(
R&ttellR�RRR�R�R�R�R$(R�t	firstlinetposR&tgitlrR�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytscangitpatchys



ccsCd}d}d}d}t}}d}d}d}	t|�}
x�tr�j�}|s_Pn||kr�|	r�|ddks�|	tk	r�|jd�s�|jd�r�d}|r�|dj||�r�|j�}n|jd�rt|
|j	�}
n=|	dkr%|jd�r%t}	nt
||d|
|	�}
|d7}|r�t}d|||
|rr|j�pudffVnd	|
fVnH|jd
�r�tj
|jd��}|s�qCn|dkrt|
|�}dg|D]!}|jdkr�j�^q�V|j�nd|jd�}d|jd�}xX|r�|dj||�r�|j�}dd|j	d|j	d|j�ffVqEW|s�ttd�|d��n|d}t}n|jd�r7|
j�}|jd�s|
j|�qCnt}t}	t|�}t|�}n�|jd�r�|
j�}|jd�st|
j|�qCn|
j�}|
j|�|jd�s�|
j|�qCnt}t}	t|�}t|�}n|rCt}t}|}d}qCqCWxA|r>|j�}dd|j	d|j	d|j�ffVq�S(sDRead a patch and yield the following events:
    - ("file", afile, bfile, firsthunk): select a new target file.
    - ("hunk", hunk): a new hunk is ready to be applied, follows a
    "file" event.
    - ("git", gitchanges): current diff is in git format, gitchanges
    maps filenames to gitpatch records. Unique event.
    Riit@s***************sGIT binary patchi�tfileRs
diff --git a/s 
tgitR�R�sa/sb/is'failed to synchronize metadata for "%s"s---s+++s***N(sCOPYsRENAME(RSRR�R
R8RR�RbRRRR�R�R�R�RgR�treverseR�RRR�RQ(R&R�R�tstatethunknumtemitfiletnewfileR�tBFILER0R�R�R�RFR%R'tl2tl3((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	iterhunks�s�
		
,#
 /
	




	ic
Cs"t||t||d|d|�S(sNReads a patch from fp and tries to apply it.

    Returns 0 for a clean patch, -1 if any rejects were found and 1 if
    there was any fuzz.

    If 'eolmode' is 'strict', the patch content and patched file are
    read in binary mode. Otherwise, line endings are ignored when
    patching then normalized according to 'eolmode'.
    RR�(t
_applydiffR�(RcR&R�R�RR�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	applydiff�s
csX�fd�}d}d}	d}
x
t|�D]�}}|dkry|
sRq.n|
j|�}
|
dkr-d}	q-q.|dkr�|
r�||
j�7}d}
n|\}}}}|r�|j�|_|jr||j�|_qnt||||��}|jdkr)|j|j�n|s)|jdkrT|j|j�q.nd\}}|jdkr�|j	|j�d	 \}}n|j
r�|j
}|jd
kr�d}q�n|s�|r.|jdkr|j|j�rtt
d�|j��n|j|j|||j�q.q.ny|||||d
|�}
Wq-tk
r�}|jt|�d�d}
|d7}q.q-Xq.|dkrx�|D]o}||j�}y|j	|�\}}Wn+tk
r�|jtjkr
�q
q�X|j|||�q�Wq.tjt
d�|��q.W|
rJ||
j�7}n|rTdS|	S(Ncst|�d�dS(Ni(RU(tp(R(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytpstripsiRiRiR�R�R�iR�Rs,cannot create %s: destination already existsR�s
Rjsunsupported parser state: %si�(NN(sRENAMEsCOPY(sADDsRENAMEsCOPY(RSRsR*R`RR�RbR�RaR�R�R�RRR�R�R�R�R�R�R=tAbort(RcR&tpatcherR�R�RR�Rwtrejectsterrtcurrent_fileRltvaluestretR�R�t
first_hunkR�R�R�tinstRR�((Rs3/sys/lib/python2.7/site-packages/mercurial/patch.pyRts�				




c	Cs;t}g}|j}	|	r8|jdtj|	��ntjd|dj|�|tj|�f�}
z'x |
D]}|j�}|j|d�|j	d�r�tj
|�}t}
|j|�qs|jd�dkrt
}|
s|j|d�t
}
n|j|d�qs|jd�dkrB|j|d�qs|jd	�dkrs|
sw|j|d�t
}
n|j|d�qsqsWWd
|r�|�}|j�}	|	r�|D]}tj|j|	|�^q�}ntj||d|�nX|
j�}|r7ttd�tj|�d��n|S(
stuse <patcher> to apply <patchname> to the working directory.
    returns whether patch was applied with fuzz factor.s-d %ss%s %s -p%d < %sRs
spatching file s	with fuzzissaving rejects to filetFAILEDNR�spatch command failed: %s(RR�RR=t
shellquotetpopenRR�RRtparsepatchoutputR�RTR
R�tlistR�R�R�R�R`RRtexplainexit(RcR�Ryt	patchnameRR�R�R>targsR�R&Rtpftprinted_filetcfilesR�tcode((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt_externalpatchUsP	
		+c		Cs6|dkrt�}n|dkr<|jddd�}n|j�tkrjtjtd�|��n|j�}t�}yt	|d�}Wnt
k
r�|}nXz%t||||d|d|�}Wd||kr�j�n|j
|j��|j�X|dkr,ttd	���n|dkS(
NtpatchR�R�s!unsupported line endings type: %strbRR�ispatch failed to apply(RSR�tconfigR?teolmodesR=RxRR�topent	TypeErrorRuR`tupdateR(	RcR�tpatchobjRR�R�R�R&R~((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytpatchbackend�s,	



icCs+t|||�}t||||||�S(swuse builtin patch to apply <patchobj> to the working directory.
    returns whether patch was applied with fuzz factor.(R�R�(RcR�R�RR�R�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
internalpatch�sc	Cs.t||||�}t||||||�S(N(R�R�(	RcR�R�R�R�RR�R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	patchrepo�sc		sw�fd�}	i}
|r1tj|�|
d<ntj|||||	|||
�}|rs|||g�|_n|S(Nc	s@�j|�\}\}}}tj||d|d|d|�S(NR�R�R�(R�R0t
memfilectx(R�tmemctxRR�R�R�R�(R�(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
getfilectx�sRo(tencodingt	fromlocalR0R�t_text(R�RpRCRkRmRoR�R�teditorR�textraR�((R�s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
makememctx�sc	Cs�|jdd�}|dkr*t�}nyB|rOt|||||||�St|||||||�SWn(tk
r�}tjt|���nXdS(s�Apply <patchname> to the working directory.

    'eolmode' specifies how end of lines should be handled. It can be:
    - 'strict': inputs are read in binary mode, EOLs are preserved
    - 'crlf': EOLs are ignored when patching and reset to CRLF
    - 'lf': EOLs are ignored when patching and reset to LF
    - None: get it from user settings, default to 'strict'
    'eolmode' is ignored when using an external patcher program.

    Returns whether patch was applied with fuzz factor.
    RcR�N(	R�RSR�R�R�RR=RxR�(	RcR�R�RR�R�R�RyR{((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s

c
CsCt||j�}t|d�}zt�}x�|�D]�}}|dkr|\}	}
}}|r�t|j|d�d|_|jr�t|j|d�d|_q�nt||	|
||�}|j	|j�|j
dkr(|j	|j�q(q:|dkr:tjt
d�|��q:q:W|SWd|j�XdS(	NR�RiiR�RRjsunsupported parser state: %s(shunksgit(R�R�R�R�RsRURR�RbR�R�R=RxRR`(
RcR�t	patchpathRR�R&R�RlR}R�R�RR�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytchangedfiles�s&		# tGitDiffRequiredcBseZRS((RR(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��stdiffcs�d|j���fd�}tjd�o9�jd�d|d�d|d�d|dd�d|dd�d	|d
d	�d|dd�d
|dd|j��S(Nc	s1�r�j|�p0|�|p$|dd��S(Nt	untrusted(RRRS(Rtnametgetter(toptstsectionR�(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRR�sRCRjtnodatestshowfunct
show_functiontignorewstignore_all_spacetignorewsamounttignore_space_changetignoreblanklinestignore_blank_linesR0tunifiedR�(RSt
configboolR�tdiffoptsRRR�(RcR�R�R�RR((R�R�R�s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s	Rc
s�|dkrtj}n|r8|r8�jj�}nd�}|���|��|�|s�j��d|�}n|d \����r��r��r�gSd��jjr�tp�t	}	g||gD]}
|
r�|	|
�^q��i�|j
s|jr!tj
����n����������f
d�}|jr�|j
r�y2�fd�}t||jdt�|��SWq�tk
r�||jdt�d�SXn
||d�SdS(s�yields diff of changes to files between two nodes, or node and
    working directory.

    if node1 is None, use first dirstate parent instead.
    if node2 is None, compare node1 with working directory.

    losedatafn(**kwarg) is a callable run when opts.upgrade=True and
    every time some change cannot be represented with the current
    patch format. Return False to upgrade to git patch format, True to
    accept the loss or raise an exception to abort the diff. It is
    called with the name of current file being diffed as 'fn'. If set
    to None, patches will always be upgraded to git format when
    necessary.

    prefix is a filename prefix that is prepended to all filenames on
    display (used for subrepos).
    cs(i�tj����fd�}|S(Ncs}|j|d�j|��}|�kr_t��dkrL��j�=n|j��|<n
�j|��j|�|S(Ntfilelogi(tfilectxRRR
tpopleftR�R�R(R�R�R�(tcachetorder(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�s

(R=tdeque(R�((R�R�s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
lrugetfilectxs
R�ic
s+t���������||��S(N(ttrydiff(R�tlosedata(
taddedR�tctx1tctx2R�tmodifiedRAR�R�trevs(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytdifffn6scs$�s�d|�r t�ndS(NR�(R�(R�(t
losedatafn(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�;sRjN(RSR�tdefaultoptsR�RztstatusRct	debugflagRRRjtupgradetcopiest
pathcopiesR�R�RR�R
(
R�tnode1tnode2R�tchangesR�R�RAR�thexfunctnodeR�R�((R�R�R�R�R�R�R�RAR�R�R�s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR��s6		

+*#
c	os|ddddddd d!g}d"d#d$g}t}xB|||�D]1}|jd�}xt|�D]\}}	|dkr�d%Vn|r�|	jd
�r�t}q�n|	r�|	ddkr�t}n|	}
|r�r�ddkr�j�}
n|}|r|}nx=|D]*\}}
|
j|�r|
|
fVPqqW|	dfV|	|
kre|	t|
�dfVqeqeWqCWdS(&s@yields 2-tuples of (output, label) based on the output of func()R�s
diff.difflineR�s
diff.extendedtrenameR$Rtdeleteds---sdiff.file_as+++sdiff.file_bRhs	diff.hunkRsdiff.deletedR	s
diff.inserteds
iRs +-@\s+-sdiff.trailingwhitespaceN(sdiffs
diff.diffline(scopys
diff.extended(srenames
diff.extended(solds
diff.extended(snews
diff.extended(R�s
diff.extended(s---sdiff.file_a(s+++sdiff.file_b(Rhs	diff.hunk(Rsdiff.deleted(R	s
diff.inserted(s
R(RRRRR
R�R
(tfuncR�tkwtheadprefixesttextprefixestheadRRRPRt	striplinetprefixesRAtlabel((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	difflabelEsF				cOstt||�S(sBlike diff(), but yields 2-tuples of (output, label) for ui.write()(R�R�(R�R�((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytdiffuinsc&#s��fd�}d�}
�fd�}d�}��fd�}tj|j��}|j�}t�}idd6dd	6d
d6}tg|j�D]\}}||f^q��}�jr�d}nx�t	|||�D]�}d}d}t
}g}||kr!|||�j�}n||krE|||�j�}n||}}�jsa|
rp||kr||j|�}||ks�||krz�jrm||kr�||}n
||}||j|�} |
|| |�||kr||krd}!|j
|�nd
}!|jd|!||�f�|jd|!||�f�|||�j�}q�|
|�n9�jr�|jd|�n|j|�r�|
|�ntj|�r�jr�d}q�
|�n�jrm|rm|
|�qmqp||kr��jr�||krG|||krG||||ksw||kr�|||kr�||||kr�t}q�|jd||j|��tj|�r�d}q�qm|s�tj|�rm|
|�qmqp|j|�}"|j|�}#tj|�ptj|�}$�jrN|
|||"||#�|$rmd}qmqp|$s`|#|"krp|
|�qpn|r��js�|r�|jd|||�||�|��n|dkr�j||�}%|%r8||||�||�g�q8n?tj|||tj|j��||�||�d��}%|rg|%sVt|�dkrgdj|�Vn|%rx|%Vqxq�q�WdS(Ncstj�|�S(N(t	posixpathR(R�(RA(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyRuscSs5||kr1|jd|�|jd|�ndS(Nsold mode %s
snew mode %s
(R(theadertomodetnmode((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
addmodehdrxscsh�jrdt|�}|dkr;|jdt|��qd|dkrd|jdt|��qdndS(Nis
index %s..%s
isindex %s,%s..%s
(RjR
Rttuple(tmetaR�RP(R�(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytaddindexmeta}s	cSsF|stt�St|�}tjd|�}|j|�|j�S(Nsblob %d(RRR
R=tsha1R�t	hexdigest(RCRR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytgitindex�s

cs~�jrd||f}n^�jjst|rgdjg|D]}d|^q;�}d||f}qzd|}nd}|S(Nsdiff --git a/%s b/%s
Rs-r %ssdiff %s %s
sdiff %s
R(RjRctquietR(RRR�Rtrevtrevinfo(R�R�(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytdiffline�s	&
t120000Rt100755R�t100644RR�R�s%s from %s
s	%s to %s
snew file mode %s
R�sdeleted file mode %s
iR�i(R=tdatestrRmtmanifestR�tdictRQRjRSR�R
R�R�R�RR�RR8R�tb85difftunidiffR
R(&R�R�R�R�R�R�R�R�R�R�R�RARR�R�R�R�tdate1tman1tgonetgitmodetktvtcopytoR�ttottntdodiffR�RRR�R�R�toflagtnflagR�RC((R�RAR�s3/sys/lib/python2.7/site-packages/mercurial/patch.pyR�rs�		
	1		
	


	
		
				+%c
Cs�ddddtf\}}}}}xe|D]]\}}}}	t|tj|��}t|||�}||7}||7}|p�|	}q+W|||||fS(Ni(RtmaxR�tcolwidth(
tstatstmaxfiletmaxtotaltaddtotaltremovetotalR�R�RtrR((s3/sys/lib/python2.7/site-packages/mercurial/patch.pytdiffstatsums$

csjtjd�}g�dddtf\���������fd�}x|D]}|jd�r�|�ddt���|jd�r�tj|�jd��q[|jd�r[|j|�jd��q[qU|jd�r|jd	�r�d7�qU|jd
�r4|jd�r4�d7�qU|jd�sR|jd
�rUt�qUqUW|��S(Ns^diff .*-r [a-z0-9]+\s(.*)$ics&�r"�j����f�ndS(N(R((taddstfilenametisbinarytremovestresults(s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt	addresultsR�s
diff --git a/isdiff -rR	s+++ Rs--- sGIT binary patchsBinary file(	RIRJRSRRR�RYR�R
(RReRR((R
RRR
Rs3/sys/lib/python2.7/site-packages/mercurial/patch.pytdiffstatdatas*



iPc
sYg}t|�}t|�\}�}}}tt���}	|rZ|	dkrZd}	n||	|d��dkr�d�n��fd�}
x�|D]\}}}
}|r�d}n
||
}d|
|�}d|
|
�}|jd|d	|tj|�|	|||f�q�W|rL|jtd
�t|�||f�ndj|�S(Niii
cs1��kr|St|��tt|���S(N(RR�tbool(RP(t
graphwidthR(s3/sys/lib/python2.7/site-packages/mercurial/patch.pytscale5stBinR	Rs %s%s |  %*s %s%s
Rs5 %d files changed, %d insertions(+), %d deletions(-)
R(	RR	R
R�RR�RRR(RtwidthRjtoutputRtmaxnamet	totaladdsttotalremovest	hasbinaryt
countwidthRRR
R
RRTtplusestminuses((RRs3/sys/lib/python2.7/site-packages/mercurial/patch.pytdiffstat)s.			
	cos�x�t||�j�D]�}|r�|ddkr�|jdd�\}}|ddfVtjd|�}|r�|jd�dfVntjd	|�}|r�|jd�d
fVq�n|dfVd
VqWdS(sOlike diffstat(), but yields 2-tuples of (output, label) for
    ui.write()
    i�s+-RiRs\++isdiffstat.inserteds-+sdiffstat.deleteds
N(s
R(RR[trsplitRIRYR�(R�R�RR�tgraphR%((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt
diffstatuiOs(HRtemail.ParserR!ROR�RIR�RMRMR�ti18nRR�RRRRJR�R�R=RR�R�R�R0RJR�t	ExceptionRRR|R<R}R�R�R�R�R�R�R�R3R7R�R�RRRQRURbRgRsRuRtR�RSR�R�R�R�R�R�R�RR�R�R�R�R�R	RRR!(((s3/sys/lib/python2.7/site-packages/mercurial/patch.pyt<module>	shH$`		o.	, /0%+��0	
		1		c
Q	/	J	)		�	&

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.