HEX
Server: Apache
System: Linux p102.lithium.hosting 4.18.0-553.141.1.el8_10.x86_64 #1 SMP Fri Jul 10 17:48:02 UTC 2026 x86_64
User: bvzmoamr (9955)
PHP: 8.1.34
Disabled: syslog
Upload Files
File: //proc/thread-self/root/lib64/python2.7/site-packages/mercurial/patch.pyo
�
1�3\c@@s�ddlmZmZddlZddlZddlZddlZddlZddlZddl	Z	ddl
Z
ddlZddlZddl
Z
ddlmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZm Z!ddl"m#Z#m$Z$m%Z%ej&Z&ej'd�Z(ej'd	�Z)ej'd
�Z*ej+Z+d�Z,dWdXdYgZ-ej.d��Z/d�Z0de1fd��YZ2d�Z3de1fd��YZ4de1fd��YZ5de5fd��YZ6de6fd��YZ7de1fd ��YZ8d!e5fd"��YZ9ej'd#�Z:ej'd$�Z;d%d&d'd(gZ<d)e1fd*��YZ=d+e1fd,��YZ>d-e1fd.��YZ?d/�Z@dd0�ZBd1e1fd2��YZCd3e1fd4��YZDd5�ZEd6�ZFdd7�ZGd8�ZHd9�ZId:�ZJd;�ZKd<�ZLd=�ZMdd>d%d?�ZNd@�ZOdd>d%dA�ZPdB�ZQdd%dC�ZRd>dd%ddD�ZSdd%dE�ZTdd>dd%ddF�ZUdd>dG�ZVdHeWfdI��YZXejYZZejYZYej[Z[ddddddd>d>dddJ�
Z\ddddddd>d>ddK�	Z]dL�Z^dM�Z_dN�Z`dO�ZadP�ZbdQ�ZcdR�ZddS�ZedTdU�ZfdV�ZgdS(Zi(tabsolute_importtprint_functionNi(t_(thextshort(
tcopiest
diffhelpertdiffutiltencodingterrortmailtmdifftpathutiltpycompattscmutiltsimilartutiltvfs(tdateutiltprocutilt
stringutilsdiff --git a/(.*) b/(.*)s(\t+|[^\t]+)s2(\t+| +|[a-zA-Z0-9_\x80-\xff]+|[^ 	a-zA-Z0-9_�-�])c@sud��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 streamcS@s^|r|jd	�rtS|jd
�r,tS|jdd�}t|�dko]d|dkS(Nt s	t-t+s: iii(Rs	(RRR(t
startswithtTruetFalsetsplittlen(tlinetinheadertl((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytisheader>scS@stdj|��S(Nt(tstringiotjoin(tlines((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytchunkHsc3@s�t}x`|D]X}|j�s(t}n|rX|jd�rX�|�Vg}t}n|j|�q
W|r}�|�VndS(Ns# HG changeset patch(RtstripRRtappend(tstreamtcurRR(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pythgsplitKs
		c3@s�xY|D]Q}|jd�rKx#t�|d��D]}|Vq3Wg}n|j|�qW|r�x&t�|d��D]}|VqyWndS(NsFrom i(RRR'(R(R)Rtc(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	mboxsplit[s
		c	3@s�d�}x|D]}|j|�qW�|�}tj|�}|j�s\||�VnFd}x=|j�D]/}|j�}||kr�qon||�VqoWdS(NcS@s?t�}tjj|dt�}|j|�|jd�|S(Ntmangle_from_i(R"temailt	GeneratorRtflattentseek(tmtfptg((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytmsgfpis
	

s
text/plainstext/x-diffstext/x-patch(s
text/plainstext/x-diffstext/x-patch(R'R
tparsetis_multiparttwalktget_content_type(	R(R)R5RR+R2tok_typestparttct(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	mimespliths	
c3@s�t}xj|D]b}|rC�||�rC�|�Vg}t}n|rb�||�rbt}n|j|�q
W|r��|�VndS(N(RRR'(R(R)RR(R%R (s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytheadersplits
		c3@s�|�VdS(N((R)(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	remainder�stfitercB@s)eZd�Zd�Zd�ZeZRS(cS@s
||_dS(N(R3(tselfR3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__init__�scS@s|S(N((RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__iter__�scS@s"|jj�}|st�n|S(N(R3treadlinet
StopIteration(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytnext�s	(t__name__t
__module__RBRCRFt__next__(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR@�s			scontent-typeRFs# HG changeset patchsFrom t:iis--- (	tobjectRRtsafehasattrR'RRRtlower(R(R*R,R=R>R?R@RR)tmimeheadersR((R%R s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR<s4	
	
	



"tDatetdatetBranchtbranchsNode IDtnodeidcc@satjdd�\}}tj|d�}zt||||�VWd|j�tj|�XdS(s�extract patch from data read from fileobj.

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

    return a dictionary. Standard keys are:
      - filename,
      - message,
      - user,
      - date,
      - branch,
      - node,
      - p1,
      - p2.
    Any item can be missing from the dictionary. If filename is missing,
    fileobj did not contain a patch. Caller must unlink filename when done.tprefixs	hg-patch-twbN(R
tmkstemptostfdopent_extracttclosetunlink(tuitfileobjtfdttmpnamettmpfp((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytextract�s
cC@s|tjdtjtjB�}i}tj|�}|doKtj|d�}|dohtj|d�|d<|r�|dr�djd�|j�D��d}ng}|r |j	d�r�|j
d�}	|	d	kr�||	d
j�}q�ntjdd|�}|j
d
|�n|drB|j
d|d�nd	}
d$}d}x�|j�D]�}
tj|
j��}|j
d|�||kr�qan|
jdt�}|j|�}|r�t}t}t}|j
d|jd	��|
d
7}
t�}xv||jd	� j�D][}|j	d�rt|rt|j
d�t}t}|jd	�|j�d}n�|r:|j	d�r�|d|d<|j
d|d�qO|j	d�r�|j|dj��qO|j	d�r1xMtD]<\}}d|}|j	|�r�|t|�||<q�q�WqOt}n|dkrOt}n|r|r|j|�|jd�qqW|j �}|r�|j|�|j!d�s�|jd�q�q�qa|
ra|ra|dkra|d|7}qaqaW|r|j	|�rd||f}n||d <|j"�|re|j#d	�|d!<|re|j#d	�|d"<qen|
rx||d#<n|S(%Ns}^(?:Index:[ \t]|diff[ \t]-|RCS file: |retrieving revision [0-9]+(\.[0-9]+)*$|---[ \t].*?^\+\+\+[ \t]|\*\*\*[ \t].*?^---[ \t])tSubjecttFromtusers
cs@s*|] }djttj|��VqdS(s: N(R#tmapRt
strtolocal(t.0th((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�ss[PATCHt]iis\n[ \t]+RsSubject: %s
s	From: %s
s
text/plainstext/x-diffstext/x-patchR!sContent-Type: %s
tdecodesfound patch at byte %d
s# HG changeset patchspatch generated by hg export
s# User is	# Parent i	s# s# %s s---s%s
%stmessagetp1tp2tfilename(s
text/plainstext/x-diffstext/x-patch($tretcompilet	MULTILINEtDOTALLR
R6t
headdecodeR#titemsRtfindtlstriptsubtdebugR8R
tbytestrR9tget_payloadRtsearchRtstartR"t
splitlinesR1ttruncatetNoneR'tpatchheadermapRtwritetgetvaluetendswithRZtpop(R\R]R_R`tdiffretdatatmsgtsubjecttparentstpendt
diffs_seenR:RkR;tcontent_typetpayloadR2thgpatcht
hgpatchheadert
ignoretexttcfpRtheadertkeyRT((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRY�s�	!

	 


	
		




t	patchmetacB@sMeZdZd�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.
    cC@s1||_d|_d|_d|_t|_dS(NtMODIFY(tpathRtoldpathtmodetopRtbinary(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBLs
				cC@s'|d@}|d@}||f|_dS(Ni i@(R�(RAR�tislinktisexec((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytsetmodeSs

cC@sCt|j�}|j|_|j|_|j|_|j|_|S(N(R�R�R�R�R�R�(RAtother((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytcopyXscC@s3|dkr|jdkS|d|jp.|jkS(Ns	/dev/nulltADDsa/(R�R�R�(RAtafile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_ispatchinga`s
cC@s*|dkr|jdkS|d|jkS(Ns	/dev/nulltDELETEsb/(R�R�(RAtbfile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_ispatchingbes
cC@s|j|�o|j|�S(N(R�R�(RAR�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
ispatchingjscC@sd|j|jfS(Ns<patchmeta %s %r>(R�R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__repr__ms(
RGRHt__doc__RBR�R�R�R�R�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�Bs							cC@s�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(RtrstripRtgitretmatchR'tgroupR�R�R�R�R�tintRR�(tlrtgpt
gitpatchesRR2tdst((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytreadgitpatchpsL

			t
linereadercB@s,eZd�Zd�Zd�Zd�ZRS(cC@s||_g|_dS(N(R3tbuf(RAR3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�s	cC@s#|dk	r|jj|�ndS(N(RR�R'(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytpush�scC@s1|jr$|jd}|jd=|S|jj�S(Ni(R�R3RD(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRD�s
	

cC@st|jd�S(NR!(titerRD(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRC�s(RGRHRBR�RDRC(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s			tabstractbackendcB@sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@s
||_dS(N(R\(RAR\((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�scC@s
t�dS(s�Return target file data and flags as a (data, (islink,
        isexec)) tuple. Data is None if file is missing/deleted.
        N(tNotImplementedError(RAtfname((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytgetfile�scC@s
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�(RAR�R�R�t
copysource((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytsetfile�scC@s
t�dS(sUnlink target file.N(R�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[�scC@sdS(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((RAR�tfailedttotalR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytwriterej�R!cC@s
t�dS(N(R�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytexists�scC@s
t�dS(N(R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZ�s(	RGRHRBR�R�R[R�R�RZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s						t	fsbackendcB@s>eZd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@s,tt|�j|�tj|�|_dS(N(tsuperR�RBtvfsmodRtopener(RAR\tbasedir((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�scC@s�|jj|�r.|jj|�ttffSt}y#|jj|�jd@dk}Wn+tk
r�}|jtj	kr��q�nXy |jj
|�t|ffSWn,tk
r�}|jtj	kr��ndSXdS(Ni@i(NN(
R�R�treadlinkRRtlstattst_modetOSErrorterrnotENOENTtreadtIOErrorR(RAR�R�te((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s#
 cC@s�|\}}|dkr2|jj|||�dS|rN|jj||�n2|jj||�|r�|jj|tt�ndS(N(RR�tsetflagstsymlinkR�RR(RAR�R�R�R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��scC@s5|jjdd�}|jj|dtd|�dS(Ntexperimentaltremoveemptydirst
ignoremissingtrmdir(R\t
configboolR�t
unlinkpathR(RAR�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[�scC@sZ|d}|jjtd�|||f�|j|d�}|j|�|j�dS(Ns.rejs7%d out of %d hunks FAILED -- saving rejects to file %s
tw(R\twarnRR�t
writelinesRZ(RAR�R�R�R$R3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s
		
cC@s|jj|�S(N(R�tlexists(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s(RGRHRBR�R�R[R�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s						tworkingbackendcB@s5eZd�Zd�Zd�Zd�Zd�ZRS(cC@sStt|�j||j�||_||_t�|_t�|_g|_	dS(N(
R�R�RBtroottrepot
similaritytsettremovedtchangedtcopied(RAR\R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBs		cC@sB|jj|dkr>|j|�r>ttd�|��ndS(Nt?s$cannot patch %s: file is not tracked(R�tdirstateR�t
PatchErrorR(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_checkknown
s%cC@se|j|�tt|�j||||�|dk	rQ|jj||f�n|jj|�dS(N(	R�R�R�R�RR�R'R�tadd(RAR�R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s

cC@sG|j|�tt|�j|�|jj|�|jj|�dS(N(R�R�R�R[R�R�R�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[s
cC@s�|jd}t|j�}x6|jD]+\}}tj|j|j|||�q&W|jr�|j	t
|j��x6|jD](}||jjkr~|j|�q~q~Wn|r�tj
|j||j�nt
|j�S(N(R�RR�R�R�RtdirstatecopyR\R�tforgettsortedR�tdiscardtmarktouchedR�(RAtwctxR�tsrcR�tf((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZs
#	(RGRHRBR�R�R[RZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s
				t	filestorecB@s2eZdd�Zdd�Zd�Zd�ZRS(cC@sYd|_i|_d|_||_|jdkrCdd|_nd|_i|_dS(Niiiii(RR�tfilestcreatedtmaxsizetsizeR�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB1s					cC@s�|jdks+t|�|j|jkrY|||f|j|<|jt|�7_n{|jdkr�tjdd�}tj	|�|_nd|j
}|jj||�|j
d7_
|||f|j|<dS(NiRTs	hg-patch-s%di(
R�RR�R�R�RR
tmkdtempR�RR�R�R�(RAR�R�R�R�R�tfn((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�;s+
cC@sf||jkr|j|S|js3||jkr7dS|j|\}}}|jj|�||fS(N(NNN(R�R�R�RR�(RAR�R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�IscC@s#|jrtj|jj�ndS(N(R�tshutiltrmtreetbase(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZQs	N(RGRHRRBR�R�RZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�0s
	trepobackendcB@sGeZd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(cC@sVtt|�j|�||_||_||_t�|_t�|_i|_	dS(N(
R�R�RBR�tctxtstoreR�R�R�R�(RAR\R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBVs			cC@s,||jkr(ttd�|��ndS(Ns$cannot patch %s: file is not tracked(R�R�R(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�_scC@sWy|j|}Wntjk
r(dSX|j�}|j�d|kd|kffS(NRtx(NN(R�R	tLookupErrorRtflagsR�(RAR�tfctxR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�cscC@s{|r|j|�n|dkr8|j|j�}n|jj||||�|jj|�|rw||j|<ndS(N(	R�RR�R�R�R�R�R�R�(RAR�R�R�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�kscC@s!|j|�|jj|�dS(N(R�R�R�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[us
cC@s
||jkS(N(R�(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�yscC@s|j|jBS(N(R�R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZ|s(	RGRHRBR�R�R�R[R�RZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�Us					
		s*@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@s.(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)tstricttcrlftlftautot	patchfilecB@sJeZdd�Zd�Zd�Zd�Zd�Zd�Zd�ZRS(Rc
C@s�|j|_||_d|_||_||_g|_t|_	t
|_|j|_|j
|_|jd
k|_|jdk|_|jdkr�|j|j�\}}n|j|j�d \}}|dk	r�|jdkp�|j	|j�|_	t|_|r!tj|�|_n|jdkr<||_n|jr$|jdjd�rgd|_n"|jdjd�r�d|_n|d	kr�g}x>|jD]3}	|	jd�r�|	d
 d}	n|j|	�q�W||_q�q$n6|jrt|_n|jdkr$ttf|_n|jrc|jjtd�|j�|jjtd��ni|_d|_d|_d|_g|_t|_|jt�d|_ dS(NR�R�R�R�iis
s
Ri����s!unable to find '%s' for patching
sB(use '--prefix' to apply patch relative to the current directory)
(R�R�R�(!R�R�teolmodeRteoltbackendR\R$RR�RtmissingR�R�R�R�tcreatetremoveR�Rt
splitnewlinesR�R'R�Rthashtdirtytoffsettskewtrejtfileprintedt	printfilethunks(
RAR\R�R
R�RR�R�tnlinesR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�sb							$										
cC@s�|jdkr|j}n|jdkr3d}nd}|jdkr�|r�|dkr�g}xA|D]9}|r�|jd�r�|d |}n|j|�qgW|}n|jj|dj|�||j�dS(NRRs
s
Ri����R!(RR	R�R'R
R�R#R�(RAR�R$R�R	trawlinesR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s	!
	cC@sk|jr
dS|s|jjr+t|_ntd�|j}|rW|jj|�n|jj|�dS(Nspatching file %s
(RR\tverboseRRR�R�tnote(RAR�ts((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s	c@sG|jj|g�}t|�dkrC|jd�fd��n|S(NiR�c@st|��S(N(tabs(R�(tlinenum(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt<lambda>�R!(RtgetRtsort(RARRtcand((Rs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	findlines�scC@s�|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
(RRWR�tbasenameR�thunkR'R
R�RR(RAR�R$R�R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	write_rej�s	
c	C@s�|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�rY|jr|jj|j�n:|j|j�}||j(|jt|�7_t|_dS|}|jdks�|jd	kr�|jr�|j �}n|j!dt"�\}}}}||j7}|}|j#dkrRt$j%||j|�rR|jr|jj|j�nB||j||t|�+|jt|�t|�7_t|_dSi|_&x9t'|j�D](\}	}
|j&j(|
g�j
|	�qkWx�t)j*|jj+d
d�d�D]�}x�tt"gD]�}|j!||�\}}}}||j|j#}t,|t|j��}|r@|j-|dd|�}
n	|g}
x|
D]�}|sut$j%||j|�rP||j||t|�+|jt|�t|�7_|||_#t|_|||}|rtd�}|j.t�|jj||j|d||f�n0td
�}|jj/||j|d|f�|SqPWq�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
iRRRtpatchtfuzzs9Hunk #%d succeeded at %d with fuzz %d (offset %d lines).
s,Hunk #%d succeeded at %d (offset %d lines).
sHunk #%d FAILED at %d
(RR(0tcompleteR�RtnumbertdescRtatlenatbtlenbRRRR'R�RR�R\R�R�t
isinstancetbinhunkR
R
R[tnewR$RRRRR	t
getnormalizedtfuzzitRRRttesthunkRt	enumeratet
setdefaultR
txranget	configinttminR"RR(RARhRthorigtoldtoldstartR1tnewstartt
orig_startR�RtfuzzlenttoponlyR!RR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytapply�s�*			
	
'			 )	

	
$
#cC@s?|jr(|j|j|j|j�n|j�t|j�S(N(RR�R�R$R�R%RR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZVs	
(	RGRHRBR�RR"R%RARZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s8					`R�cB@s�eZdZejd�Zejd�Zejd�Zejd�Zejd�Z	ejd�Z
d�Zd�Zd	�Z
d
�Zd�Zd�Zd
�Zd�Zd�Zd�ZRS(spatch header
    sdiff --git a/(.*) b/(.*)$sdiff -r .* (.*)$s(?:index|deleted file) s(?:new file|deleted file) s(?:index|deleted|copy|rename) s(?:new file)cC@s||_g|_dS(N(R�R(RAR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBfs	cC@std�|jD��S(Ncs@s|]}|jd�VqdS(sindex N(R(RgRh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>ks(tanyR�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�jsc
C@s�x�|jD]�}|jd�r6|jtd��Pn|jj|�r{|j|�|j�rw|jtd��nPn|jd�r�|jtd�t|j�t	g|jD]}t
|j|j�^q��f�Pn|j|�q
WdS(Nsindex s-this modifies a binary file (all or nothing)
sthis is a binary file
s---s%d hunks, %d lines changed
(
R�RR�Rt	pretty_reR�R�RRtsumtmaxtaddedR�(RAR3Rh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytprettyms
6cC@s|jdj|j��dS(NR!(R�R#R�(RAR3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�~sc@st�fd��jD��S(Nc3@s!|]}�jj|�VqdS(N(tallhunks_reR�(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�s(RBR�(RA((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pytallhunks�scC@so|jj|jd�}|rN|j�\}}||krD|gS||gS|jj|jd�j�SdS(Ni(t
diffgit_reR�R�tgroupstdiff_re(RAR�tfromfilettofile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s
cC@s|j�dS(Ni����(R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRn�scC@s ddjtt|j���S(Ns<header %s>R(R#RetreprR�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��sc@st�fd��jD��S(Nc3@s!|]}�jj|�VqdS(N(t
newfile_reR�(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�s(RBR�(RA((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	isnewfile�sc@sJt�j�dk}�j�o$|}|pIt�fd��jD��S(Nic3@s!|]}�jj|�VqdS(N(t
special_reR�(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�s(RR�RQRB(RAt	nocontenttemptynewfile((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pytspecial�s(RGRHR�RoRpRJRLRHRCRRRPRBR�RGR�RIR�RnR�RQRU(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�\s"						
			t
recordhunkcB@s_eZdZd	d�Zd�Zd�Zd�Zd�Zd�Z	e	Z
d�Zd�ZRS(
sKpatch hunk

    XXX shouldn't we merge this with the other hunk class?
    c	@s�t�fd�}	||_|	|t�\}
|_||
|_||
|_|	|t�\}|_||_||_|j	|j�\|_
|_dS(Nc@sZ�dk	rPt|��}|dkrP|r<|||fS||� fSqPnd|fS(Ni(RR(R$treversetdelta(t
maxcontext(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyttrimcontext�s(RR�RtbeforetfromlinettolinetaftertprocR$tcountchangesRFR�(RAR�R\R]R_R[R$R^RYRZttrimedbeforet_trimedafter((RYs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�s
	

		cC@set|t�stS|j|jkod|j|jkod|j|jkod|jj�|jj�kS(N(R/RVRR$R_R\R�R�(RAtv((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__eq__�scC@s4tt|j�t|jj��|j|jf�S(N(RttupleR$R�R�R\R_(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__hash__�scC@sftg|D]}|jd�r
|^q
�}tg|D]}|jd�r8|^q8�}||fS(shunk -> (n+,n-)RR(RR(RAR$RhR�trem((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR`�s..cC@s~idd6dd6dd6}g|jD]%}d||dd!|df^q%}t|j|j|j|j|j||j�S(s�return another recordhunk which is the reverse of the hunk

        If this hunk is diff(A, B), the returned hunk is diff(B, A). To do
        that, swap fromline/toline and +/- signs while keep other things
        unchanged.
        RRs\s%s%sii(R$RVR�R]R\R_R[R^(RAR2RR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytreversehunk�s5cC@s�t|j�t|j�}|jrE|jddkrE|d8}n||j}||j}|jd|j||j||jo�d|jf�|jdj	|j|j
|j��dS(Ni����s\ No newline at end of file
is@@ -%d,%d +%d,%d @@%s
RR!(RR[R^R�RFR�R\R]R_R#R$(RAR3RXtfromlenttolen((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s


	cC@s
|jj�S(N(R�Rn(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRn�scC@sd|j�|jfS(Ns<hunk %r@%d>(RnR\(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��sN(
RGRHR�RRBRdRfR`RhR�RGRnR�(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRV�s							cC@s�iitd�d6td�d6td�d6d6itd�d6td	�d6td
�d6d6itd�d6td
�d6td�d6d6S(Nsapply change %d/%d to '%s'?RAsdiscard change %d/%d to '%s'?R�srecord change %d/%d to '%s'?trecordtmultiplesapply this change to '%s'?sdiscard this change to '%s'?srecord this change to '%s'?tsingles0[Ynesfdaq?]$$ &Yes, apply this change$$ &No, skip this change$$ &Edit this change manually$$ &Skip remaining changes to this file$$ Apply remaining changes to this &file$$ &Done, skip remaining changes and files$$ Apply &all changes to all remaining files$$ &Quit, applying no changes$$ &? (display help)s8[Ynesfdaq?]$$ &Yes, discard this change$$ &No, skip this change$$ &Edit this change manually$$ &Skip remaining changes to this file$$ Discard remaining changes to this &file$$ &Done, skip remaining changes and files$$ Discard &all changes to all remaining files$$ &Quit, discarding no changes$$ &? (display help)s4[Ynesfdaq?]$$ &Yes, record this change$$ &No, skip this change$$ &Edit this change manually$$ &Skip remaining changes to this file$$ Record remaining changes to this &file$$ &Done, skip remaining changes and files$$ Record &all changes to all remaining files$$ &Quit, recording no changes$$ &? (display help)thelp(R(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytgetmessages�s





c@sVt���dkrd�n���fd�}t�}i}d
\}}dtd�|D��}}	x�|D]�}
|t|
j�7}d}d}dj|
j�}||kr�qrn|j|�|dkr�|
j	��nt
d�t
d�jd	�|
j�D��}
||||
d�\}}}}|s@qrn|
g||
j�<|
j
�r~||
j�c|
j7<qrnx�t|
j�D]r\}}|dkr�|dkr�|j	��n|	dkr��d
�|j�}
n8|t|
j�|}�d�||	|j�f}
||||
|�\}}}}|r�|rotj|�}|j|7_n||j�j|�q�|dk	r�xh|D]I}x@|jD]5}|r�|j|7_n||j�j|�q�Wq�Wq�||j|j7}q�WqrWtg|j�D].}
|
dj�s@t|
�dkr|
^qg�ifS(s:Interactively filter patch chunks into applied-only chunksRkc@s�d}|dk	r"||||fS|dk	r>||||fSxztr��d�}�jd||f�}�jd�|dkr�xA�j|�dD],\}}�jd|tj|�f�q�WqAn�|dkr�t}	n�|dkr�t}	n�|dkr"|dkr9�jtd	���jd�qAn|j	j
�rn�jtd
���jd�qAndtd�}
tjd
ddd�\}}d}
zct
jtj|d��}|j	j|�|j|�|jdjg|
j�D]}d|^q���|j��j�}�jd||fdi�j�d6dd�}	|	dkr��jtd�|	�wAnt|d�}t�}
xEt
j|�D]4}t
j|�}|jd�s�|
j|�q�q�W|j�|
jd�t|
�}Wdtj|�~
Xt}	n�|dkr;t}	}no|dkrTt}	}nV|dkrmt}	}n=|dkr�t}	}n$|d kr�t j!td!���n|	|||fSWdS("s�prompt query, and process base inputs

        - y/n for the rest of file
        - y/n for the rest
        - ? (help)
        - q (quit)

        Return True/False and possibly updated skipfile and skipall.
        Rns%s %ss
iis%s - %s
iis cannot edit patch for whole files!cannot edit patch for binary files---s�
To remove '-' lines, make them ' ' lines (context).
To remove '+' lines, delete them.
Lines starting with # will be removed from the patch.

If the patch applies cleanly, the edited hunk will immediately be
added to the record list. If it does not apply cleanly, a rejects
file will be generated: you can use that when you try again. If
all lines of the hunk are removed, then the edit is aborted and
the hunk is left unchanged.
RTs
hg-editor-tsuffixs.diffRUs# s%s "%s"tenvirontHGUSERt
blockedtagtfilterpatchs editor exited with exit code %d
trbt#Niiiiis	user quit("RRtpromptchoiceR�textractchoicesRRMRRR�R�R
RVRtnativeeolwriterRWRXR#R}RZt	geteditortsystemtusernameR�topenR"titerfilet
fromnativeeolRR1t
parsepatchR[R	tAbort(tskipfiletskipalltqueryR%t
newpatchestrespstrR+tttrettphelptpatchfdtpatchfnt	ncpatchfpR�titeditortpatchfpR(tmessagest	operationR\(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytprompt(s�
	
 $		




3
		


	



ics@s|]}t|j�VqdS(N(RR(RgRh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�siR!sexamine changes to %s?s and cs@s|]}d|VqdS(s'%s'N((RgR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�sRmRlN(NN(RoRR�RDRRR#R�R�RGRR�RnRIR5R�R]R'R�RFt
itervaluesRU(R\theadersR�R�tseentappliedR�R�tposR�Rht	fixoffsetthdrR�R�tnpR�R%tidxR�tnewpatchtnewhunk((R�R�R\s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRt!sf		_	

	&!
"R$cB@sPeZd�Zd�Zd�Zd�Zd�Zd�Zd�Zd�Z	RS(cC@s�||_||_|g|_g|_g|_d|_|_d|_|_	|dk	r�|rr|j
|�q�|j|�ndS(N(R)R*R$R+R-RtstartaR,tstartbR.tread_context_hunktread_unified_hunk(RAR*tnumR�tcontext((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�s				cC@s�d�}t|j|jdd�}|j|_|j|_|j|_||j�|_||j�|_|j|_|j|_|j|_|j	|_	|S(s1Return a copy with line endings normalized to LF.cS@sHg}x;|D]3}|jd�r3|d d}n|j|�q
W|S(Ns
i����s
(R�R'(R$RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	normalize�s
N(
R$R*R)RR+R-R�R�R,R.(RAR�tnh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR2�s		cC@s�tj|j�}|s4ttd�|j��n|j�\|_|_|_	|_
|jdkrsd|_nt|j�|_|j
dkr�d|_
nt|j
�|_
t|j�|_t|j	�|_	y/t
j||j|j|j
|j|j�Wn5tjk
r<}ttd�|j|f��nXxYt|jd�dkr�|jd=|jd=|jd=|jd8_|j
d8_
q@W|j|�dS(Nsbad hunk #%disbad hunk #%d: %si����i(tunidescR�R*R�RR)RKR�R,R�R.RR�RtaddlinesR$R+R-R	t
ParseErrorRt_fixnewline(RAR�R2R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s0$#


cC@s|j�|_tj|j�}|sCttd�|j��n|j�\|_}t	|j�|_|dkr�|j}nt	|�|j|_|jr�|jd7_nx�tj
|j�D]�}|j�}|jd�r�|j|�Pn|d}|jd�s |jd�r-d|}n;|jd�rId	|}nttd
�|j|f��|jj|�|jj|�q�W|j�}|jd�r�|jdd }||jd<||jd<|j�}ntj|�}|sttd�|j��n|j�\|_}t	|j�|_|dkrQ|j}nt	|�|j|_|jr�|jd7_nd}	x�tj
|j�D]�}|j�}|jd�r�|jdd }||jd<||j|	d<q�n|s|j|�Pn|d}|jd
�s0|jd�r=d|}na|jd�rYd	|}nEt|j�dkr|j|�Pnttd
�|j|f��|jj|�x|tr,|	t|j�kr�d}
n
|j|	}
|	d7}	|
|kr�Pq�|
jd�rq�q�|jj|	d|�Pq�Wq�W|js�xE|jD]7}|jd�sh|jd	�rD|jj|�qDqDWn|js�xI|jD];}|jd�s�|jd	�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+ RiR!s@@ -%d,%d +%d,%d @@
(RDR*tcontextdescR�R�RR)RKR�R�RR,R
R7RR�R+R'R$R�R.R-RRtinsertR�(RAR�R2taendR�RRtutbendthunkiRh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s�	





	





		

			cC@sK|j�}|jd�r:tj|j|j|j�n
|j|�dS(Ns\ (RDRRt
fixnewlineR$R+R-R�(RAR�R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�dscC@s.t|j�|jko-t|j�|jkS(N(RR+R,R-R.(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR(ksc	C@s)t|t|��}|rd}d}t|j�}xCtj|d�D].}|j|djd�rw|d7}qJPqJW|s�xJtj|d�D]2}|j||djd�r�|d7}q�Pq�Wnt||�}t||�}||t|�|!||t|�|!|fS||dfS(NiiR(R9RR$R
R7R(	RAR;R1R'R@ttoptbotthlenR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_fuzzitns$

/cC@s�|j|j|j||�\}}}|j|}|j|}|jrc|dkrc|d8}n|jr�|dkr�|d8}n||||fS(Nii(R�R+R-R�R�R,R.(RAR'R@R;R1R�R<R=((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR3�s'



(
RGRHRBR2R�R�R�R(R�R3(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR$�s				g			R0cB@s2eZdZd�Zd�Zd�Zd�ZRS(sA binary patch file.cC@s8d|_t|_dg|_||_|j|�dS(NsGIT binary patch
(RttextRRXR$t_fnamet_read(RAR�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB�s
			cC@s
|jdk	S(N(R�R(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR(�scC@s/|jr%t|jdj|��gS|jgS(NR!(RXt
applybindeltaR�R#(RAR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR1�s	c	C@sd�}d}x�tr�|||j�}|sLttd�|j��n|jd�rut|dj��}Pn|jd�rt|dj��}t|_PqqWg}|||j�}x�t	|�dkr�|dd!}|d	kr|d
krt
|�t
d
�d}nt
|�t
d�d}y"|jtj
|d�| �Wn;tk
r�}ttd
�|jtj|�f��nX|||j�}q�Wtjdj|��}t	|�|kr�ttd�|jt	|�|f��n||_dS(NcS@s&|j�}|j|�|jd�S(Ns
(RDR'R�(R�R$R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytgetline�s
is"could not extract "%s" binary datasliteral isdelta iitZtAR+is&could not decode "%s" binary patch: %sR!s%"%s" length is %d bytes, should be %d(RR$R�RR�RR�R�RXRtordR'Rt	b85decodet
ValueErrorRtforcebytestrtzlibt
decompressR#R�(	RAR�R�R�RtdecRR�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s@			
" (RGRHR�RBR(R1R�(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR0�s
			cC@sX|djd�}|jd�}|dkrP|jd�}|dkrP|Sn|| S(Nis
s	iR(R�Ru(tstrRR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
parsefilename�scC@sIg}x<|D]4}tj|d�r4|j�}n|j|�q
W|S(s�reverse the signs in the hunks given as argument

    This function operates on hunks coming out of patch.filterpatch, that is
    a list of the form: [header1, hunk1, hunk2, header2...]. Example usage:

    >>> rawpatch = b"""diff --git a/folder1/g b/folder1/g
    ... --- a/folder1/g
    ... +++ b/folder1/g
    ... @@ -1,7 +1,7 @@
    ... +firstline
    ...  c
    ...  1
    ...  2
    ... + 3
    ... -4
    ...  5
    ...  d
    ... +lastline"""
    >>> hunks = parsepatch([rawpatch])
    >>> hunkscomingfromfilterpatch = []
    >>> for h in hunks:
    ...     hunkscomingfromfilterpatch.append(h)
    ...     hunkscomingfromfilterpatch.extend(h.hunks)

    >>> reversedhunks = reversehunks(hunkscomingfromfilterpatch)
    >>> from . import util
    >>> fp = util.stringio()
    >>> for c in reversedhunks:
    ...      c.write(fp)
    >>> fp.seek(0) or None
    >>> reversedpatch = fp.read()
    >>> print(pycompat.sysstr(reversedpatch))
    diff --git a/folder1/g b/folder1/g
    --- a/folder1/g
    +++ b/folder1/g
    @@ -1,4 +1,3 @@
    -firstline
     c
     1
     2
    @@ -2,6 +1,6 @@
     c
     1
     2
    - 3
    +4
     5
     d
    @@ -6,3 +5,2 @@
     5
     d
    -lastline

    Rh(RRLRhR'(RtnewhunksR+((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytreversehunks�s8
c@s�dtf�fd��Y}|�}t�}|jdj|��|jd�d}xft|�D]X\}}y|j||||�Wn'tk
r�td||f��nX|}qdW~|j	�S(sDpatch -> [] of headers -> [] of hunks

    If maxcontext is not None, trim context lines if necessary.

    >>> rawpatch = b'''diff --git a/folder1/g b/folder1/g
    ... --- a/folder1/g
    ... +++ b/folder1/g
    ... @@ -1,8 +1,10 @@
    ...  1
    ...  2
    ... -3
    ...  4
    ...  5
    ...  6
    ... +6.1
    ... +6.2
    ...  7
    ...  8
    ... +9'''
    >>> out = util.stringio()
    >>> headers = parsepatch([rawpatch], maxcontext=1)
    >>> for header in headers:
    ...     header.write(out)
    ...     for hunk in header.hunks:
    ...         hunk.write(out)
    >>> print(pycompat.sysstr(out.getvalue()))
    diff --git a/folder1/g b/folder1/g
    --- a/folder1/g
    +++ b/folder1/g
    @@ -2,3 +2,2 @@
     2
    -3
     4
    @@ -6,2 +5,4 @@
     6
    +6.1
    +6.2
     7
    @@ -8,1 +9,2 @@
     8
    +9
    tparserc@s�eZdZd�Zd�Z�fd�Zd�Zd�Zd�Zd�Z	iied6ed	6ed
6ed6d	6ied	6ed
6ed6ed6d6ied6ed	6ed6d
6ied6ed
6d6ied6d6Z
RS(
spatch parsing state machinecS@sLd|_d|_d|_d|_g|_g|_g|_g|_dS(NiR!(	R\R]R_RR�R�R[R$R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBBs							cS@s@|\}}}}}t|�|_t|�|_||_dS(N(R�R\R]R_(RAtlimitst	fromstarttfromendttostartttoendR_((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytaddrangeLsc	@s�|jr�t|j|j|j|j|j|j|��}|jjj|�|jt	|j�|j
7_|jt	|j�|j7_g|_g|_n||_dS(N(
R$RVR�R\R]R_R[RR'RR�RFR�(RAR�Rh(RY(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
addcontextRs		cS@s.|jr!|j|_g|_n||_dS(N(R�R[R$(RAR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytaddhunk]s	cS@s6|jg�t|�}|jj|�||_dS(N(R�R�R�R'(RAR�Rh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytnewfilecs
cS@sdS(N((RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytaddotheriscS@s|jg�|jS(N(R�R�(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytfinishedls
R�tfileR$trangeR�(RGRHR�RBR�R�R�R�R�R�ttransitions((RY(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�@s.	
					



R!iR�sunhandled transition: %s -> %s(
RKR"R�R#R1t	scanpatchR�tKeyErrorR�R�(toriginalchunksRYR�tpR3tstatetnewstateR�((RYs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s+A		


cC@s�t|�}d}|dkr2d||j�fS|}x�|dkr�|jd|�}|dkr�ttd�|||f��n|d7}x5||dkr�|||d!dkr�|d7}q�W|d8}q;W|| j�|||j�fS(s�turn a path from a patch into a path suitable for the repository

    prefix, if not empty, is expected to be normalized with a / at the end.

    Returns (stripped components, path in repository).

    >>> pathtransform(b'a/b/c', 0, b'')
    ('', 'a/b/c')
    >>> pathtransform(b'   a/b/c   ', 0, b'')
    ('', '   a/b/c')
    >>> pathtransform(b'   a/b/c   ', 2, b'')
    ('a/b/', 'c')
    >>> pathtransform(b'a/b/c', 0, b'd/e/')
    ('', 'd/e/a/b/c')
    >>> pathtransform(b'   a//b/c   ', 2, b'd/e/')
    ('a//b/', 'd/e/c')
    >>> pathtransform(b'a/b/c', 3, b'')
    Traceback (most recent call last):
    PatchError: unable to strip away 1 of 3 dirs from a/b/c
    iR!t/i����s*unable to strip away %d of %d dirs from %si(RR�RuR�RRv(R�R&RTtpathlenR�tcount((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
pathtransform�s
*cC@s;|dk}|dk}|o9|jdko9|jdk}|o]|jdko]|jdk}	t|||�\}
}|o�|j|�}t|||�\}
}||kr�|}n|o�|j|�}|o�|o�|}||jd�d }||jd�d }|rb||krb|j|�rb|jdkrb|jdkrbt}t	}n|
|
koz|j|�}d}|s�|r�|r�|r�|}q�|}q�|r�|}q�n|s|s�|r�|}q|}q|s�|}qttd���nt
|�}|r%d|_n|	r7d|_n|S(Ns	/dev/nulliR�is&undefined source and destination filesR�R�(R�R,R�R.R�R�trfindRRRRR�RR�R�(R
t
afile_origt
bfile_origR$R&RTtnullatnullbRR
tabaseR�tgoodatbbaseR�tgoodbRtabasedirtbbasedirtisbackupR�R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
makepatchmeta�sP$$	!						c	#@sttjd�}t|���fd�}xCt�jd�D]/}|jd�sa|jd�r�d�}|||�}�j�}|jd�r��j�}|||g7}n
�j|�d|fVq=|jd	�rd�d||�fd��fVq=|jd�r8d�d||�fd��fVq=|j|�}|rad|j�fVq=d|fVq=WdS(s�like patch.iterhunks, but yield different events

    - ('file',    [header_lines + fromfile + tofile])
    - ('context', [context_lines])
    - ('hunk',    [hunk_lines])
    - ('range',   (-start,len, +start,len, proc))
    s'@@ -(\d+),(\d+) \+(\d+),(\d+) @@\s*(.*)c@sT|g}xDt�jd�D]0}||�r>|j|�q�j|�PqW|S(sscan lr while predicate holdsR!(R�RDR'R�(tfirstR�R$R(R�(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	scanwhile�s	
R!s
diff --git a/sdiff -r cS@s'|jdd�}|p&|ddkS(Niis---tdiff(s---R�(RR(RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	notheaderss---R�Rs\R�c@s
|j��S(N(R(R(tcs(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRR!RRR$c@s
|j��S(N(R(R(R�(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRR!R�R�N(Rs\(RR(RRs\(	RoRpR�R�RDRR�R�RK(	R3tlines_reR�RR�R�RMRNR2((R�R�s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s.	
  cC@s�d}y|jj�}|j}Wn&tk
rJt|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(	R3ttellR�R"R�R�R�R�R1(R�t	firstlineR�R3tgitlrR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytscangitpatchs



cc@s<d}d}d}d}t}}d}d}d}	t|�}
x�t|
jd�D]�}||kr�|	r{|jd�s�|	tk	r�|jd�s�|jd�r�d}|r�|dj||�r�|j�}n|jd�r�t|
|j	�}
n=|	dkr|jd�rt
}	nt||d|
|	�}
|d7}|ryt}d|||
|rk|j�pndffVnd	|
fVnH|jd
�r�t
j|jd��}|s�qSn|dkrt|
|�}dg|D]!}|jdkr�|j�^q�fV|j�nd|jd�}d|jd�}xX|r�|dj||�r�|j�}dd|j	d|j	d|j�ffVq>W|s�ttd�|d��n|d}t
}n|jd�r0|
j�}|jd�s	|
j|�qSnt
}t}	t|�}t|�}n�|jd�r�|
j�}|jd�sm|
j|�qSn|
j�}|
j|�|jd�s�|
j|�qSnt
}t
}	t|�}t|�}n|rSt}t
}|}d}qSqSWxA|r7|j�}dd|j	d|j	d|j�ffVq�WdS(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.
    R!iit@s***************sGIT binary patchi����R�R$s
diff --git a/s 
tgitR�R�sa/sb/is'failed to synchronize metadata for "%s"s---s+++s***N(R�R�(RRR�R�RDRR�R�R0R�RR$R�R�R�R�R�R�RWR�R�RR�R�(R3R�R�R�thunknumtemitfileR�R�tBFILER�R�R�R�RhR2R4tl2tl3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	iterhunks8s�
	
,#
 /
	




	c
C@sxd�}d}||�}||}||�}||}d}x0|t|�krst|||d!�}|d7}|d@r*d}d}|d@r�t|||d!�}|d7}n|d@r�|t|||d!�d>O}|d7}n|d@r'|t|||d!�d	>O}|d7}n|d@r]|t|||d!�d
>O}|d7}n|d	@r�t|||d!�}|d7}n|d@r�|t|||d!�d>O}|d7}n|d@r�|t|||d!�d	>O}|d7}n|dkrd
}n||}	||||	!7}qD|dkr^||}	||||	!7}||7}qDttd���qDW|S(s_Apply a binary delta hunk
    The algorithm used is the algorithm from git's patch-delta.c
    cS@sBd}x5tj|�D]$}|d7}t|�d@s|SqW|S(Niii�(R
RyR�(tbinchunkR�R+((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	deltahead�s
R!iii�iiiiii i@isunexpected delta opcode 0(RR�R�R(
RR�RtoutRR�tcmdRR�t
offset_end((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��sX	

















	


R!cC@s(t||t||d|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'.
    R&RTR(t
_applydiffR(R\R3R
R�R&RTR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	applydiff�s
cC@sD|r@tj|j|j�|�}|dkr@|d7}q@n|S(NR!R�(Rt	canonpathR�tgetcwd(R�RT((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_canonprefix�s
c@sut|j�����fd�}d}	d}
d}xt|�D]\}}
|dkr�|sgqCn|j|
�}|dkrJd}
qJqC|dkr�|r�|	|j�7}	d}n|
\}}}}|r||j�|_|jr||j�|_qnt||||���}|j	dkrA|j
|j�n|si|j	dkrl|j
|j�qCnd\}}|j	dkr�|j|j�d	 \}}|dkr�tt
d
�|j��q�n|jr�|j}|j	dkr�d}q�n|s|rC|j	dkrD|j|j�rDtt
d
�|j��n|j|j|||j�qCqCny|||||d|�}WqJtk
r�}|jt|�d�d}|	d7}	qCqJXqC|dkr1xp|
D]L}||j�}|j|�\}}|dkrq�|j|||�q�WqCtjt
d�|��qCW|rg|	|j�7}	n|	rqdS|
S(Nc@st|�d��dS(Ni(R�(R�(RTR&(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytpstrip�siR$iR�R�R�R�issource file '%s' does not existR�R!s,cannot create %s: destination already existsRs
R�sunsupported parser state: %si����(NN(R�R�(R�R�R�(R	R�RR�RARZR�R�R�R�R[R�R�RR�R�R�R�R�R	R�(R\R3tpatcherR
R�R&RTRR
trejectsterrtcurrent_fileR�tvaluesR�R�R�t
first_hunkR�R�R�tinstR�((RTR&s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�s�					



cC@st}g}|j}	|	r8|jdtj|	��nd|dj|�|tj|�f}
|jd|
�tj|
d�}z0x)tj	|�D]}|j
�}|j|d�|jd�r�tj
|�}
t}|j|
�q�|jd�d	kr<t}|s(|j|
d�t}n|j|d�q�|jd
�d	kre|j|d�q�|jd�d	kr�|s�|j|
d�t}n|j|d�q�q�WWd|r�tj|||�nX|j�}|rttd
�tj|���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 < %sRsUsing external patch tool: %s
Rus
spatching file s	with fuzzissaving rejects to filetFAILEDNspatch command failed: %s(RR�R'Rt
shellquoteR#RxtpopenRR~R�RRtparsepatchoutputR�RuRR�RR�RZR�Rtexplainexit(R\R�Rt	patchnameR&R�R�R'targstcwdRR3Rtpftprinted_filetcode((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_externalpatch9sJ	%		c
C@s9|dkrt�}n|dkr9|jdd�}n|j�tkrgtjtd�|��n|j�}t�}yt	|d�}Wnt
k
r�|}nXz+t||||d|d|d|�}	Wd||kr�|j�n|j
|j��|j�X|	dkr/ttd	���n|	dkS(
NR&R	s!unsupported line endings type: %sRuR&RTRispatch failed to apply(RR�tconfigRMteolmodesR	R�RR�R}t	TypeErrorRRZtupdateR�(
R\R
tpatchobjR&RTR�RR�R3R�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytpatchbackendes,	



c	C@s.t|||�}t|||||||�S(swuse builtin patch to apply <patchobj> to the working directory.
    returns whether patch was applied with fuzz factor.(R�R#(	R\R�R"R&RTR�RR�R
((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
internalpatch�sc	
C@s1t||||�}	t||	|||||�S(N(R�R#(
R\R�R�R�R"R&RTR�RR
((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	patchrepo�sc		C@sk|jdd�}|dkr*t�}n|rLt|||||||�St||||||||�S(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.
    R\R&N(RRR�RR$(	R\R�RR&RTR�RR�R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR&�s

cC@sRt||j�}t||�}t|d��}t�}xt|�D]�\}}	|dkr|	\}
}}}
|
r�t|
j|d|�d|
_|
jr�t|
j|d|�d|
_q�nt	||
||||�}
|j
|
j�|
jdkr@|j
|
j�q@qI|dkrItj
td�|��qIqIW|SWdQXdS(	NRuR�iR�R$R�sunsupported parser state: %s(R$R�(R�R�R	R}R�R�R�R�R�R�R�R�R	R�R(R\R�t	patchpathR&RTR
R3R�R�RR�R�RR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytchangedfiles�s(	 		 tGitDiffRequiredcB@seZRS((RGRH(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR(�scc@s�x�t|d|d|d|d|d|d|d|d|d	|	�	D]�\}}}
}|
dk	rs|
||�}nd
jtd�|D�g��}|
r�|s�t|
�dkr�d
j|
�d
Vn|rC|VqCqCWdS(s5yields 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).

    relroot, if not empty, must be normalized with a trailing /. Any match
    patterns that fall outside it will be ignored.

    copy, if not empty, should contain mappings {dst@y: src@x} of copy
    information.

    hunksfilterfn, if not None, should be a function taking a filectx and
    hunks generator that may yield filtered hunks.
    tnode1tnode2R�tchangestoptst
losedatafnRTtrelrootR�R!cs@s!|]\}}t|�VqdS(N(tlist(Rgthrangethlines((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>�sis
N(t	diffhunksRR#RDR(R�R)R*R�R+R,R-RTR.R�t
hunksfilterfntfctx1tfctx2R�RR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR��s+"c
@s�|dkrtj}n|r8|r8�
jj�}nd�}
|
���
|��
|�t}�dkr�|j�r��g}tj�|dd�}t	}n|s��j
�d|�}n|d \���	�r��r��	r�gS�
jjrt
}
nt}
g�j��j�gD]}|r$|
|�^q$��dkr�i�|jsf|jr�tj��d|��q�n�dk	r�|s��fd�}|���|���|�	��	t	}nt�fd��j�D���nt��}t��}t�	�}x7�D]/}|�kr"|j|�|j|�q"q"Wx*�	D]"}|�kr\|j|�q\q\Wt|��t|��t|��	x6t�j��D]"\}}|�kr��|=q�q�Wtj�
t||B|B��}tj�
�j��j�g|����������	�
�fd	�}|jr�|jr�y2�fd
�}t||jdt�|��SWq�t k
r�||jdt	�d�SXn
||d�SdS(
s�Yield diff of changes to files in the form of (`header`, `hunks`) tuples
    where `header` is a list of diff headers and `hunks` is an iterable of
    (`hunkrange`, `hunklines`) tuples.

    See diff() for the meaning of parameters.
    c@s(i�tj����fd�}|S(Nc@s}|j|d�j|��}|�kr_t��dkrL��j�=n|j��|<n
�j|��j|�|S(Ntfilelogi(tfilectxRRtpopleftR6R
R'(R�R�R(tcachetorder(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
getfilectx	s

(tcollectionstdeque(R;((R9R:s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
lrugetfilectx�s
R!tdefaultR�R�ic@s&g|D]}|j��r|^qS(N(R(RR�(R.(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	filterrel/	sc3@s?|]5\}}|j��r|j��r||fVqdS(N(R(RgR�R�(R.(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>6	s	c@s.t�	�
�������||���
S(N(ttrydiff(R,tlosedata(RFR�tctx1tctx2R;tmodifiedRTR.R�R�trevs(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdifffnU	sc@s$�s�d|�r t�ndS(NR�(R((R�(R-(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBZ	sR�N(!RRtdefaultoptsR�RlRtalwaysRR�RtstatusR\t	debugflagRRtnodeR�tupgradeRt
pathcopiestdictt	iteritemsR�R
R�R�R/Rtt
matchfilest
prefetchfilestrevR�R((R�R)R*R�R+R,R-RTR.R�R>trelfilteredtpatsthexfuncRLR@tmodifiedsettaddedsett
removedsetR�R�R�t
prefetchmatchRGRB((RFR�RCRDR;R-RERTR.R�R�RFs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR2�sz			

			7	%


%-#
cc@s�x�|D]�}|jd�}|j�}|jd�r@d}n+|jd�rXd}ntjd|��x?tj|�D].}|jd�r�|dfVq{||fVq{W||kr�|t|�d	fVn||kr|t|�d
fVqqWdS(s1yield tokens for a list of lines in a single hunks
Rsdiff.deletedRs
diff.insertedsunexpected hunk line: %ss	sdiff.tabsdiff.trailingwhitespaceR!N(R�RR	tProgrammingErrorttabsplittertfindallR(t	hunklinesRt	chomplinet	striplinetlabelttoken((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffsinglehunkd	s 
		c c@svd}d}xi|D]a}|dd!dkr=||d7}q|dd!dkra||d7}qtjd|��qW|s�|r�xt|�D]}|Vq�WdStj|�}tj|�}g|D]"}|dkr�|n|d^q�}g|D]"}|dkr|n|d^q�}	dj|�}
dj|	�}g}g}
tj|
|d	|d
|	�}x�|D]�\\}}}}}|dk}x:tjdj|||!��D]}|j	||f�q�Wx:tjdj|||!��D]}|
j	||f�q�WqqWx\dd|fdd
|
fgD]<\}}}t
}x$|D]\}}|rt||fVt}n|jd�}|r�|d }|jd�r�|d }n|t
|�}|j�}|t
|�}nx[tj|�D]J}d|dd!krd}n|r#|d}n
|d}||fVq�W|rN|rV|dfVn|dfVt
}qNqNWq2WdS(sEyield tokens for a list of lines in a single hunk, with inline colorsR!iiRRsunexpected hunk line: %sNs
tlines1tlines2t!sdiff.deleteds
diff.insertedi����s
s	sdiff.tabs.changeds
.unchangedsdiff.trailingwhitespace(R	R[RctwordsplitterR]R#Rt	allblocksRR'RRR�RR�R\( R^R+R-RR�taltblRtalntblntantbntatokenstbtokenstblocksta1ta2tb1tb2tbtypeR�RbRTRattokenst
nextisnewlinetisendoflinetchompt	endoflinet	endspacestmaybetabtcurrentlabel((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffsinglehunkinline|	sl
	//&&	

	

c/@s?|jd�r%|djr%t�nt�ddddd d!d"d#d$d%g
}d&g}t}g���fd�}x�|||�D]�}|jd�}t|�}	xtt|�D]f\}
}|r�|jd�rt}qn|r|jd'�rt	}nt}|r+|r+|jd(�r+t	}n|}
|r@|}
n|ry|}|
d|	kri|d7}n�j
|�q�x|�D]}|Vq�W|j�}xa|
D]N\}}|j|�r�||fV||kr�|t|�dfVnPq�q�W|dfV|
d|	kr�d)Vq�q�Wx|�D]}|Vq(Wq�WdS(*s@yields 2-tuples of (output, label) based on the output of func()R,R�s
diff.difflineR�s
diff.extendedtrenameR;R1tdeletedtindexR�s---sdiff.file_as+++sdiff.file_bR�s	diff.hunkc3@s0�r,x���D]}|VqWg�(ndS(N((Rb(t
dodiffhunkt
hunkbuffer(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytconsumehunkbuffer�	s	s
RRRs\isdiff.trailingwhitespaceR!N(R�s
diff.diffline(R�s
diff.extended(R�s
diff.extended(R;s
diff.extended(R1s
diff.extended(R�s
diff.extended(R�s
diff.extended(R�s
diff.extended(s---sdiff.file_a(s+++sdiff.file_b(R�s	diff.hunk(RRRR�s\(RR(s
R!(RtworddiffRRcRRRR5RRR'R�(tfuncRtkwtheadprefixesttextprefixestheadR�R%R$t	linecountR�RtdifflinetprefixestbufferedlineRbR`RTRa((R�R�s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	difflabel�	sh						
	
cO@stt||�S(sBlike diff(), but yields 2-tuples of (output, label) for ui.write()(R�R�(RR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffui
scc@s\t�}tg|j�D]\}}||f^q�}t|�t|�}	}
xt|||�D]�}d}||}
}||	kr�d}
||krF|jr�||}
|
|
kr�|
|kr�d}|j|
�q�d}q�qFnW||
krFd}|jrF||krC|||	krC||||krCqhqCqFn|
||fVqhWdS(sgenerates tuples (f1, f2, copyop), where f1 is the name of the file
    before and f2 is the the name after. For added files, f1 will be None,
    and for removed files, f2 will be None. copyop may be set to None, 'copy'
    or 'rename' (the latter two only if opts.git is set).R�R�N(R�RORtR�RR�R�(RERFR�R�R,tgonetkRctcopytoRXRYR�tcopyoptf1tf2((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
_filepairs
s,	1
	
	c
*c@s!d�}
|	jrd}}nd}d}d�}d�}tj|j��}tj|j��}idd6d	d
6dd6}|dkr#|jjdd
�s�|jjdd�r#xh|||t|�t|j��D];}|d!k	r�|j	|�r�t
d||f��q�q�Wnx�t|||||	�D]�\}}}d!}d!}d!}d!}d!}d!}|r�|||�}|	js�|
r�|j
|�}q�n|r�|||�}|	js�|
r�|j
|�}q�n|	jr�t}ntd�||gD��}|
r�|	jr�|s|||ks||rD||�s|||�rW|s||rd|s||r�|r�||kr�|
|p�|�q�n|p�|} |p�|}!tj|| t|��} tj||!t|��}!g}"|	jr|"jd|| ||!f�|s,|"jd||�q7|sJ|"jd||�q7||||}#}$|#|$kr�|"jd|#�|"jd|$�n|d!k	r7|	jr�tj|| ||!�d}%|"jd|%�n|"jd|| f�|"jd||!f�q7n,|r7|jjr7|"j|| |��n|r�|	jsc|	jr�|	jr�|	jr�|d!k	rxd}n|d!k	r�|d!k	r�|j|�r�d}q�d}q�n6|d!k	r�|j�}n|d!k	r�|j�}n|rW|	jrW|	jrWtj||�}&|&rB|"jd|
|�|
|�f�nd!|&gff}'n�|	jr�|	jdkr�|}(|(d!kr�|}(n|"jd|
|�d|	j!|
|�d|	j!||(f�ntj||||| |!d|d |	�\})}'|"j |)�|||"|'fVq<Wd!S("swgiven input data, generate a diff and yield it in blocks

    If generating a diff would lose data like flags or binary data and
    losedatafn is not None, it will be called.

    relroot is removed and prefix is added to every path in the diff output.

    If relroot is not empty, this function expects every path in modified,
    added, removed and copy to start with it.cS@sK|sd}nt|�}tjd|�}|j|�t|j��S(NR!sblob %d(Rthashlibtsha1R!Rtdigest(R�RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytgitindex9
s	
R!sa/sb/cS@s4djg|D]}d|^q
�}d||fS(NRs-r %ss
diff %s %s(R#(R�RFRStrevinfo((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR�G
s&cS@s|dkp|j�dkS(Ni(RR�(R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytisemptyK
st120000Rt100755R�t100644tdevelsall-warningss
check-relroots%file %s doesn't start with relroot %scs@s'|]}|dk	r|j�VqdS(N(Rtisbinary(RgR�((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys	<genexpr>m
ssdiff --git %s%s %s%ssnew file mode %ssdeleted file mode %ssold mode %ssnew mode %sidssimilarity index %d%%s
%s from %ss%s to %ssssindex %s..%sisindex %s..%s %sR�R,N(!tnoprefixRtdatestrRPR\R�R/RRRtAssertionErrorR�R�RR�RRBt	posixpathR#RR'tshowsimilarityRtscoretquiettnobinaryR�tcmpR�Rtb85difftunidifftextend(*R�RFRCRDRERFR�R�R;R,R-RTR.R�taprefixtbprefixR�R�tdate1tdate2tgitmodeR�R�R�R�tcontent1tcontent2R4R5tflag1tflag2R�tpath1tpath2R�tmode1tmode2tsimR�Rtflagtuheaders((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRA-
s�		
		!/(		
			
"
						
c
C@s�ddddtf\}}}}}xe|D]]\}}}}	t|tj|��}t|||�}||7}||7}|p�|	}q+W|||||fS(Ni(RRERtcolwidth(
tstatstmaxfiletmaxtotaltaddtotaltremovetotalR�R�R+R�R-((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffstatsum�
s$

c@s|tjd�}g�dddtf\���������fd�}t}x|D]}|jd�r�|�t}ddt���|jd�r�tj|�jd��qm|jd�rm|j|�jd��qmq[|jd	�rt}q[|jd
�r#|r#�d7�q[|jd�rF|rF�d7�q[|jd�sd|jd
�r[t�q[q[W|��S(Ns^diff .*-r [a-z0-9]+\s(.*)$ic@s&�r"�j����f�ndS(N(R'((taddsRnR�tremovestresults(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt	addresult�
sR�s
diff --git a/isdiff -ris@@RRsGIT binary patchsBinary file(	RoRpRRRRR�R{R�(R$R�R�RR((R�RnR�R�R�s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffstatdata�
s2
	


iPc	@s]g}t|�}t|�\}�}}}tt���}|rZ|dkrZd}n|||d��dkr�d�n��fd�}	x�|D]�\}
}}}
|
r�d}nd||}d|	|�}d|	|�}|jd	|
d
|tj|
�||||f�q�W|rP|jtd�t|�||f�ndj|�S(
Niii
c@s1��kr|St|��tt|���S(N(RER�tbool(R�(t
graphwidthR�(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytscale
stBins%dRRs %s%s |  %*s %s%s
Rs5 %d files changed, %d insertions(+), %d deletions(-)
R!(	R�R�RR�R'RR�RR#(R$twidthtoutputR�tmaxnamet	totaladdsttotalremovest	hasbinaryt
countwidthR�RnR�R�R�R�tplusestminuses((R�R�s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffstat�
s.				co@s�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+-RiR!s\++isdiffstat.inserteds-+sdiffstat.deleteds
N(s
R!(R�R}trsplitRoR{R�(RR�RtnametgraphR2((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt
diffstatui$s(RORP(RQRR(sNode IDRS(ht
__future__RRR<t
contextlibR�R.R�R�RWR�RoR�R�ti18nRRLRRR!RRRRR	R
RRR
RRRRR�tutilsRRRR"RpR�R\RgR�RR�tcontextmanagerRaRYRKR�R�R�R�R�R�R�R�R�R�RRR�RVRoRRtR$R0R�R�R�R�R�R�R�R�R�RR	RRR#R$R%R&R't	ExceptionR(tdiffalloptstdiffoptstdifffeatureoptsR�R2RcRR�R�R�RAR�R�R�R�(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt<module>	s�X			�		d.	,"2,%+�HO	.��8	
	?|	&	7	0		`	8
	T	,			-t		E	G		!	�		'&