-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/mercurial/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/mercurial/patch.pyc


\,Tc@sddlZddlZddlZddlZddlZddlZddlZddlZddlZddl	Zddl
ZddlmZddl
mZmZddlZddlZddlZddlZddlZddlZddlZddlZejdZdefdYZdZdZd	efd
YZdZ defd
YZ!defdYZ"de"fdYZ#de#fdYZ$defdYZ%de"fdYZ&ejdZ'ejdZ(ddddgZ)defdYZ*d efd!YZ+d"efd#YZ,d$Z-d%Z.d&Z/d'Z0d(Z1d)Z2d*dd+Z3d*dd,Z4d-Z5ddd.Z7ddd/d0Z8ddd1Z9d*ddd/d2Z:d*d3Z;d4efd5YZ<de=d6d7Z>ddddddd8d9Z?d:Z@d;ZAd<ZBd=ZCd>ZDd?e=d@ZEdAZFdS(BiN(t_(thextshortsdiff --git a/(.*) b/(.*)t
PatchErrorcBseZRS((t__name__t
__module__(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRscsuddfd}fd}fd}fd}fd}dtfd	Y}t}g}d
g}	tj|ds||}nx|D]}
|j|
|
jdr|||S|
jd
r|||S|
|rEt}|
jdddj|	krg|||Sq|
jdr|r|||SqW||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/usr/lib/python2.7/dist-packages/mercurial/patch.pytisheaderscSstjdj|S(Nt(t	cStringIOtStringIOtjoin(tlines((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytchunk(sc3st}x`|D]X}|js(t}n|rX|jdrX|Vg}t}n|j|q
W|r}|VndS(Ns# HG changeset patch(R	tstripR
t
startswithtappend(tstreamtcurRR
(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pythgsplit+s
		c3sxY|D]Q}|jdrKx#t|dD]}|Vq3Wg}n|j|qW|rx&t|dD]}|VqyWndS(NsFrom i(RRR(RRR
tc(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	mboxsplit;s
		c	3sd}x|D]}|j|qW|}tjjj|}|jse||VnFd}x=|jD]/}|j}||krqxn||VqxWdS(NcSsBtj}tjj|dt}|j||jd|S(Ntmangle_from_i(RRtemailt	GeneratorR
tflattentseek(tmtfptg((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytmsgfpIs


s
text/plainstext/x-diffstext/x-patch(s
text/plainstext/x-diffstext/x-patch(RR tParsertparsetis_multiparttwalktget_content_type(	RRR'R
RR$tok_typestparttct(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	mimesplitHs	
c3st}xj|D]b}|rC||rC|Vg}t}n|rb||rbt}n|j|q
W|r|VndS(N(R
R	R(RRRR
(RR(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytheadersplit_s
		c3s|VdS(N((R(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	remainderostfitercBs#eZdZdZdZRS(cSs
||_dS(N(R%(tselfR%((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt__init__sscSs|S(N((R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt__iter__vscSs"|jj}|stn|S(N(R%treadlinet
StopIteration(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytnextys	(RRR5R6R9(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR3rs		scontent-typeR9s# HG changeset patchsFrom t:iis--- (	tobjectR
tutiltsafehasattrRRR	Rtlower(RRRR0R1R2R3RRtmimeheadersR
((RRs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs4	
	

	



"cCstjdtjtjB}tjdd\}}tj|d}ytj	j	j
|}|d}|d}|r|rdjd|jDd}nd%}	d%}
d%}g}|r4|jd	r|jd
}
|
dkr||
dj}qntjd
d|}|jd|n|rN|jd|nd}d&}d}x|jD]}|j}|jd|||krqmn|jdt}|j|}|rt}t}t}|jd|jd|d7}tj}x{||jd jD]`}|jdrz|rz|jdt}t}|jd|jd%}n|rE|jdr|d}|jd|qZ|jdr|d}	qZ|jdr|d}qZ|jdr|d }
qZ|jd!r*|j|djqZ|jd"sZt}qZn|d#krZt}n|r%|r%|j ||j dq%q%W|j!}|r|j ||j"ds|j dqqqm|rm|rm|dkrm|d|7}qmqmWWn!|j#tj$|nX|rI|j|rId$||f}n|j#|stj$|d%|||	|d%d%d%fS|r|j%dpd%}|r|j%dpd%}||||	||
||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/usr/lib/python2.7/dist-packages/mercurial/patch.pys	<genexpr>ss[PATCHt]iis\n[ \t]+RsSubject: %s
s	From: %s
s
text/plainstext/x-diffstext/x-patchRsContent-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)RtitemstNoneRtfindtlstriptsubtdebugR+R,tget_payloadR	tsearchR
tstartRRt
splitlinesR#ttruncateRtwritetgetvaluetendswithtclosetunlinktpop(tuitfileobjtdiffretfdttmpnamettmpfptmsgtsubjecttusertdatetnodeidtbranchtparentstpendt
diffs_seenR-tmessageR.tcontent_typetpayloadR$thgpatcht
hgpatchheadert
ignoretexttcfpR
tp1tp2((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytextracts	

&
 


	



	





t	patchmetacBsMeZdZdZdZdZdZdZdZdZ	RS(sPatched 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(tpathRQtoldpathtmodetopR
tbinary(R4R|((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5s
				cCs'|d@}|d@}||f|_dS(Ni i@(R~(R4R~tislinktisexec((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytsetmodes

cCsCt|j}|j|_|j|_|j|_|j|_|S(N(RzR|R}R~RR(R4tother((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytcopyscCs3|dkr|jdkS|d|jp.|jkS(Ns	/dev/nulltADDsa/(RR}R|(R4tafile((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_ispatchinga's
cCs*|dkr|jdkS|d|jkS(Ns	/dev/nulltDELETEsb/(RR|(R4tbfile((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_ispatchingb,s
cCs|j|o|j|S(N(RR(R4RR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
ispatching1scCsd|j|jfS(Ns<patchmeta %s %r>(RR|(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt__repr__4s(
RRt__doc__R5RRRRRR(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRz	s							cCsd}g}x|D]}|jd}|jdrtj|}|r|rb|j|n|jd}t|}qq|r|jdr|j|d}qn|jdrd|_|d|_	q|jdr|d	|_
q|jd
r d|_|d	|_	q|jdr?|d
|_
q|jdrZd|_q|jdrd|_|jt|dd
q|jdr|jt|dd
q|jdrt
|_qqqW|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 fileRsnew file mode Ris	new mode sGIT binary patchN(RQtrstripRtgitretmatchRtgroupRzRR}R|RtintR	R(tlrtgpt
gitpatchesR
R$tdst((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytreadgitpatch7sL

			t
linereadercBs,eZdZdZdZdZRS(cCs||_g|_dS(N(R%tbuf(R4R%((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5es	cCs#|dk	r|jj|ndS(N(RQRR(R4R
((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytpushiscCs1|jr$|jd}|jd=|S|jjS(Ni(RR%R7(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR7ms
	

ccs,x%tr'|j}|sPn|VqWdS(N(R	R7(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR6ts
	(RRR5RR7R6(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRcs			tabstractbackendcBs>eZdZdZdZdZdZdZRS(cCs
||_dS(N(Ra(R4Ra((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5|scCs
tdS(sWReturn target file data and flags as a (data, (islink,
        isexec)) tuple.
        N(tNotImplementedError(R4tfname((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytgetfilescCs
tdS(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(R4RtdataR~t
copysource((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytsetfilescCs
tdS(sUnlink target file.N(R(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR_scCsdS(sWrite 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((R4RtfailedttotalR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytwriterejscCs
tdS(N(R(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytexistss(RRR5RRR_RR(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR{s					t	fsbackendcBsGeZdZdZdZdZdZdZdZRS(cCs,tt|j|tj||_dS(N(tsuperRR5tscmutiltopener(R4Ratbasedir((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5scCstjj|jj|S(N(RNR|RRtbase(R4tf((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_joinscCs|jj|r.|jj|ttffSt}y#|jj|jd@dk}Wn+tk
r}|jtj	krqnX|jj
|t|ffS(Ni@i(RRtreadlinkR	R
tlstattst_modetOSErrorterrnotENOENTtread(R4RRte((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs#
cCs|\}}|dkr2|jj|||dS|rN|jj||n2|jj|||r|jj|ttndS(N(RQRtsetflagstsymlinkR[R
R	(R4RRR~RRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRscCs|jj|dtdS(Nt
ignoremissing(Rt
unlinkpathR	(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR_scCsZ|d}|jjtd|||f|j|d}|j||jdS(Ns.rejs7%d out of %d hunks FAILED -- saving rejects to file %s
RA(RatwarnRRt
writelinesR^(R4RRRRR%((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs
		
cCs|jj|S(N(Rtlexists(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs(	RRR5RRRR_RR(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs							tworkingbackendcBs5eZdZdZdZdZdZRS(cCsStt|j||j||_||_t|_t|_g|_	dS(N(
RRR5troottrepot
similaritytsettremovedtchangedtcopied(R4RaRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5s		cCsB|jj|dkr>|j|r>ttd|ndS(Nt?s$cannot patch %s: file is not tracked(RtdirstateRRR(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_checkknowns%cCse|j|tt|j|||||dk	rQ|jj||fn|jj|dS(N(	RRRRRQRRRtadd(R4RRR~R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs

cCsG|j|tt|j||jj||jj|dS(N(RRRR_RRR(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR_s
cCs|jd}t|j}x6|jD]+\}}tj|j|j|||q&W|jr|j	t
|jx6|jD](}||jjkr~|j|q~q~Wn|rtj
|j||jnt
|jS(N(RRQRRRRtdirstatecopyRaRtforgettsortedRtdiscardtmarktouchedR(R4twctxRtsrcRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR^s
#	(RRR5RRR_R^(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs
				t	filestorecBs2eZddZddZdZdZRS(cCsYd|_i|_d|_||_|jdkrCdd|_nd|_i|_dS(Niiiii(RQRtfilestcreatedtmaxsizetsizeR(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5s					cCs|jdks+t||j|jkrY|||f|j|<|jt|7_n}|jdkrtjdd}tj||_nt	|j
}|jj|||j
d7_
|||f|j|<dS(NiR@s	hg-patch-i(
RRRRRRQRLtmkdtempRtstrRR[R(R4RRR~RRtfn((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs+cCsk||jkr|j|S|js3||jkr<tn|j|\}}}|jj|||fS(N(RRRtIOErrorR(R4RRR~R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs	cCs#|jrtj|jjndS(N(RtshutiltrmtreeR(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR^s	N(RRRQR5RRR^(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs
	trepobackendcBsGeZdZdZdZdZdZdZdZRS(cCsVtt|j|||_||_||_t|_t|_i|_	dS(N(
RRR5RtctxtstoreRRRR(R4RaRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5s			cCs,||jkr(ttd|ndS(Ns$cannot patch %s: file is not tracked(RRR(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR%scCs\y|j|}Wntjk
r-tnX|j}|jd|kd|kffS(NRtx(RterrortLookupErrorRtflagsR(R4RtfctxR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR)s
cCs{|r|j|n|dkr8|j|j}n|jj|||||jj||rw||j|<ndS(N(	RRQRRRRRRR(R4RRR~R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR1scCs!|j||jj|dS(N(RRR(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR_;s
cCs
||jkS(N(R(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR?scCs|j|jBS(N(RR(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR^Bs(	RRR5RRRR_RR^(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs					
		s*@@ -(\d+)(?:,(\d+))? \+(\d+)(?:,(\d+))? @@s.(?:---|\*\*\*) (\d+)(?:,(\d+))? (?:---|\*\*\*)tstricttcrlftlftautot	patchfilecBsJeZddZdZdZdZdZdZdZRS(Rc
Cs|j|_||_d|_||_||_g|_t|_	t
|_|j|_|j
|_|jdk|_|jdk|_yV|jdkr|j|j\}}t
|_	n1|j|jd \}}|j	|j|_	t|_|rtj||_n|jdkr-||_n|jr|jdjdrXd|_n"|jdjdrzd|_n|d	krg}x>|jD]3}	|	jdr|	d
 d}	n|j|	qW||_qnWnGtk
r&|jrt|_n|jdkr'ttf|_q'nX|jrP|jjtd|jni|_d|_d|_d|_g|_t|_|j td|_!dS(
NRRRRiis
s
Ris!unable to find '%s' for patching
(sADDsCOPYsRENAME("R|RteolmodeRQteoltbackendRaRR
RR	tmissingR~R}RRtcreatetremoveRtmdifft
splitnewlinesR]RRRRthashtdirtytoffsettskewtrejtfileprintedt	printfilethunks(
R4RaRRRRRR~tnlinesR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5Ksd									
		 						
cCs|jdkr|j}n|jdkr3d}nd}|jdkr|r|dkrg}xB|D]:}|r|ddkr|d |}n|j|qgW|}n|jj|dj|||jdS(NRRs
s
RiR(RRRRRRR(R4RRR~RtrawlinesR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs	!
	cCsk|jr
dS|s|jjr+t|_ntd|j}|rW|jj|n|jj|dS(Nspatching file %s
(RRatverboseR	RRRtnote(R4Rts((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs	csG|jj|g}t|dkrC|jdfdn|S(Nitkeycst|S(N(tabs(R(tlinenum(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt<lambda>s(RtgetRtsort(R4RRtcand((Rs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	findlinesscCs|js
dStjj|j}d||fg}xR|jD]G}x>|jD]3}|j||ddkrO|jdqOqOWq?W|jj|jt	|j|j
|dS(Ns--- %s
+++ %s
is
s
\ No newline at end of file
(RRNR|tbasenameRthunkRRRRR(R4RRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	write_rejs	
c	Cs|jsUttd|j|jt|j|jt|j|j	fn|j
d7_
|jr|jj
|dS|jr|jr|jr|jjtd|jn|jjtd|j|jj
|dSt|trY|jr|jj|jn:|j|j}||j(|jt|7_t|_dS|}|jdks|jd	kr|jr|j }n|j!dt"\}}}}||j7}|}|j#dkrXt$j%||j|dkrX|jr|jj|jnB||j||t|+|jt|t|7_t|_dSi|_&x9t'|jD](\}	}
|j&j(|
gj
|	qqWxt)d
D]}xtt"gD]}|j!||\}}}}||j|j#}t*|t|j}|r0|j+|dd|}
n	|g}
x
|
D]}|skt$j%||j|dkr@||j||t|+|jt|t|7_|||_#t|_|||}|rtd}|j,t|jj||j|d||fn0td}|jj-||j|d|f|Sq@WqWqW|j,t|jjtd
|j|f|jj
|dS(Nsbad hunk #%d %s (%d %d %d %d)iis-cannot create %s: destination already exists
sfile %s already exists
iRRRis9Hunk #%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tatlenatbtlenbRRRRRRRRaRRt
isinstancetbinhunkRRR_tnewRRR	RRRt
getnormalizedtfuzzitR
RtdiffhelpersttesthunkRt	enumeratet
setdefaulttxrangetminRRR(R4RERthorigtoldtoldstartRtnewstartt
orig_startRRtfuzzlenttoponlyRRRg((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytapplys*			
	
			 	
%
	
$
#cCs?|jr(|j|j|j|jn|jt|jS(N(RRRRR~R
RR(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR^s	
(	RRR5RRRR
R$R^(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRJs7					aR	cBsPeZdZdZdZdZdZdZdZdZ	RS(cCs||_||_|g|_g|_g|_d|_|_d|_|_	|dk	r|rr|j
|q|j|ndS(N(RR
R	RRRQtstartaRtstartbRtread_context_hunktread_unified_hunk(R4R
tnumRtcontext((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5#s				cCsd}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}|jdr3|d d}n|j|q
W|S(Ns
is
(R]R(RRR
((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	normalize4s
N(
R	R
RRQRRR%R&RR(R4R+tnh((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR1s		cCsntj|j}|s4ttd|jn|j\|_|_|_	|_
|jdkrsd|_nt|j|_|j
dkrd|_
nt|j
|_
t|j|_t|j	|_	t
j||j|j|j
|j|jxYt|jddkr\|jd=|jd=|jd=|jd8_|j
d8_
qW|j|dS(Nsbad hunk #%diii(tunidescRR
RRRtgroupsR%RR&RRQRRtaddlinesR	RRRt_fixnewline(R4RR$((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR(Is*$!



cCs|j|_tj|j}|sCttd|jn|j\|_}t	|j|_|dkr|j}nt	||j|_|jr|jd7_nxt|jD]}|j}|j
dr|j|Pn|d}|j
ds|j
dr*d|}n;|j
drFd	|}nttd
|j|f|jj||jj|qW|j}|j
dr|jdd }||jd<||jd<|j}ntj|}|sttd|jn|j\|_}t	|j|_|dkrN|j}nt	||j|_|jr|jd7_nd}	xt|jD]}|j}|j
dr|jdd }||jd<||j|	d<qn|s|j|Pn|d}|j
d
s*|j
dr7d|}na|j
drSd	|}nEt|jdkry|j|Pnttd
|j|f|jj|x|tr&|	t|jkrd}
n
|j|	}
|	d7}	|
|krPq|
j
drqq|jj|	d|PqWqW|js|xE|jD]7}|j
dsb|j
d	r>|jj|q>q>Wn|jsxI|jD];}|j
ds|j
d	r|jj|dqqWnd|j|j|j|jf|_|j|jd<|j|dS(Nsbad hunk #%dis---is- s! Rs  Rsbad hunk #%d old text line %ds\ is+ RiRs@@ -%d,%d +%d,%d @@
(R7R
tcontextdescRRRRR.R%RRQRRRRRRR	R&RRRR	tinsertR0(R4RR$taendRRRtutbendthunkiRE((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR'ds	





	





		

			cCsK|j}|jdr:tj|j|j|jn
|j|dS(Ns\ (R7RRtfix_newlineR	RRR(R4RR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR0scCs.t|j|jko-t|j|jkS(N(RRRRR(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRsc	Cs%t|t|}|rd}d}t|j}xAt|dD]/}|j|dddkru|d7}qGPqGW|sxHt|dD]3}|j||dddkr|d7}qPqWnt||}t||}||t||!||t||!|fS||dfS(NiiR(RRR	R(	R4RRtfuzzR#ttoptbotthlenR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_fuzzits$

/cCs|j|j|j||\}}}|j|}|j|}|jrc|dkrc|d8}n|jr|dkr|d8}n||||fS(Nii(R<RRR%R&RR(R4R8R#RRR9RR ((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs'



(
RRR5RR(R'R0RR<R(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR	"s				g			RcBs2eZdZdZdZdZdZRS(sA binary patch file.cCs8d|_t|_dg|_||_|j|dS(NsGIT binary patch
(RQttextR
tdeltaR	t_fnamet_read(R4RR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR5s
			cCs
|jdk	S(N(R=RQ(R4((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRscCs/|jr%t|jdj|gS|jgS(NR(R>t
applybindeltaR=R(R4R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs	c	Csd}d}xtr|||j}|sLttd|jn|jdrut|dj}Pn|jdrt|dj}t|_PqqWg}|||j}xt	|dkr|d}|d	kr|d
krt
|t
d
d}nt
|t
dd}y"|jtj
|d| Wn8tk
r}ttd
|jt|fnX|||j}qWtjdj|}t	||krttd|jt	||fn||_dS(NcSs&|j}|j||jdS(Ns
(R7RR(RR	R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytgetline
s
is"could not extract "%s" binary datasliteral isdelta iitZtARis&could not decode "%s" binary patch: %sRs%"%s" length is %d bytes, should be %d(R	R	RRR?RRRR>RtordRtbase85t	b85decodet
ValueErrorRtzlibt
decompressRR=(	R4RRBRR
tdecRRR=((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR@s@			
"(RRRR5RRR@(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs
			cCsX|djd}|jd}|dkrP|jd}|dkrP|Sn|| S(Nis
s	iR(RRR(RRti((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
parsefilename3scCst|}d}|dkr.d|jfS|}x|dkr|jd|}|dkrttd|||fn|d7}x.||dkr||dkr|d7}qW|d8}q7W|| j||jfS(NiRt/is*unable to strip away %d of %d dirs from %si(RRRRRRRS(R|RtpathlenRLtcount((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	pathstrip=s
#cCs/|dk}|dk}|o9|jdko9|jdk}|o]|jdko]|jdk}t||\}	}
|o|j|
}t||\}}
|
|
kr|}n|o|j|
}|o|o|}|
|
jdd }|
|
jdd }|r\||kr\|
j|
r\|jdkr\|jdkr\t}t	}n|	|kot|
j|
}d}|s|r|r|r|
p|
}q|r|
}qn|s|s|r|
p|
}q|s|
}qttdnt
|}|rd|_n|r+d|_n|S(Ns	/dev/nulliRNis&undefined source and destination filesRR(R%RR&RRQRtrfindRR	R
RQRRRzR(Rt
afile_origt
bfile_origR	RtnullatnullbRRtabaseRtgoodatbbaseRtgoodbRtabasedirtbbasedirtisbackupRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
makepatchmetaOsH$$	!		cCsd}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%ttellRRRRRRRR#(Rt	firstlinetposR%tgitlrR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytscangitpatchs



ccsCd}d}d}d}t}}d}d}d}	t|}
xtr|
j}|s_Pn||kr|	r|ddks|	tk	r|jds|jdrd}|r|dj||r|j}n|jdrt|
|j	}
n=|	dkr%|jdr%t}	nt
||d|
|	}
|d7}|rt}d|||
|rr|jpudffVnd	|
fVnH|jd
rtj
|jd}|sqCn|dkrt|
|}dg|D]!}|jdkr|j^qfV|jnd|jd}d|jd}xX|r|dj||r|j}dd|j	d|j	d|jffVqEW|sttd|dn|d}t}n|jdr7|
j}|jds|
j|qCnt}t}	t|}t|}n|jdr|
j}|jdst|
j|qCn|
j}|
j||jds|
j|qCnt}t}	t|}t|}n|rCt}t}|}d}qCqCWxA|r>|j}dd|j	d|j	d|jffVqWdS(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 patchitfileR	s
diff --git a/s 
tgitRRsa/sb/is'failed to synchronize metadata for "%s"s---s+++s***N(sCOPYsRENAME(RQR
RR	R7RRR`RR|R	RRRRRcRtreverseRRRRRM(R%RRtstatethunknumtemitfiletnewfileRtBFILER*RRRRER$R&tl2tl3((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	iterhunkss
		
,#
 /
	




	c
Cs@d}d}||}||}||}||}d}x|t|kr;t||}|d7}|d@rd}d}|d@rt||}|d7}n|d@r|t||d>O}|d7}n|d@r|t||d	>O}|d7}n|d@r:|t||d
>O}|d7}n|d	@rat||}|d7}n|d@r|t||d>O}|d7}n|d@r|t||d	>O}|d7}n|dkrd
}n||}	||||	!7}qD|dkr&||}	||||	!7}||7}qDttdqDW|S(s_Apply a binary delta hunk
    The algorithm used is the algorithm from git's patch-delta.c
    cSs9d}x,|D]$}|d7}t|d@s
|Sq
W|S(Niii(RE(tbinchunkRLR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	deltaheads

Riiiiiiiii i@isunexpected delta opcode 0(RRERR(
RpRRqtoutRRLtcmdRRt
offset_end((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRAsX	

















	


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(RaR%RRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	applydiff5s
csXfd}d}d}	d}
x
t|D]\}}|dkry|
sRq.n|
j|}
|
dkr-d}	q-q.|dkr|
r||
j7}d}
n|\}}}}|r||j|_|jr||j|_qnt||||}|jdkr)|j|jn|s)|jdkrT|j|jq.nd\}}|jdkr|j	|jd	 \}}n|j
r|j
}|jd
krd}qn|s|r.|jdkr|j|jrtt
d|jn|j|j|||jq.q.ny|||||d
|}
Wq-tk
r}|jt|dd}
|d7}q.q-Xq.|dkrx|D]o}||j}y|j	|\}}Wn+tk
r}|jtjkr
q
qX|j|||qWq.tjt
d|q.W|
rJ||
j7}n|rTdS|	S(Ncst|ddS(Ni(RQ(tp(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytpstripEsiR	iReRRRiRRs,cannot create %s: destination already existsRs
Rfsunsupported parser state: %si(NN(sRENAMEsCOPY(sADDsRENAMEsCOPY(RQRoR$R^R|R}R^RR_RR~RRRRRRRRRR<tAbort(RaR%tpatcherRRRRRxtrejectsterrtcurrent_fileRhtvaluestretRRt
first_hunkRRR~tinstR|R((Rs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRuBs				




cCst}g}|j}	|	r8|jdtj|	ntjd|dj||tj|f}
z'x |
D]}|j}|j|d|j	drtj
|}t}
|j|qs|jddkrt
}|
s|j|dt
}
n|j|dqs|jddkrB|j|dqs|jd	dkrs|
sw|j|dt
}
n|j|dqsqsWWd
|rtj|||nX|
j}|rttdtj|dn|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 filetFAILEDNspatch command failed: %s(R
RRR<t
shellquotetpopenRRRRtparsepatchoutputRRRR	RRRR^RRtexplainexit(RaRRzt	patchnameRRRR8targstcwdR%R
tpftprinted_filetcode((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt_externalpatchsF	
		c		Cs6|dkrt}n|dkr<|jddd}n|jtkrjtjtd|n|j}t}yt	|d}Wnt
k
r|}nXz%t||||d|d|}Wd||kr|jn|j
|j|jX|dkr,ttd	n|dkS(
NtpatchRRs!unsupported line endings type: %strbRRispatch failed to apply(RQRtconfigR>teolmodesR<RyRRtopent	TypeErrorRvR^tupdateR(	RaRtpatchobjRRRRR%R((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytpatchbackends,	



icCs+t|||}t||||||S(swuse builtin patch to apply <patchobj> to the working directory.
    returns whether patch was applied with fuzz factor.(RR(RaRRRRRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
internalpatchsc	Cs.t||||}t||||||S(N(RR(	RaRRRRRRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	patchreposcCsh|jdd}|dkr*t}n|rLt|||||||St|||||||S(sApply <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.
    RaRN(RRQRRR(RaRRRRRRRz((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs

c
CsCt||j}t|d}zt}xt|D]\}}|dkr|\}	}
}}|rt|j|dd|_|jrt|j|dd|_qnt||	|
||}|j	|j|j
dkr(|j	|jq(q:|dkr:tjt
d|q:q:W|SWd|jXdS(	NRReiRR	Rfsunsupported parser state: %s(shunksgit(RRRRRoRQR|R}R^RRR<RyRR^(
RaRt	patchpathRRR%RRhR~RRRR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytchangedfiless&		# tGitDiffRequiredcBseZRS((RR(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRstdiffcsd|jfd}tjdo9jdd|dd|dd|dd|ddd|d	dd
|dd
d|d
dd|dd|j	S(Ncs1rj|p0||p$|ddS(Nt	untrusted(RRQ(Rtnametgetter(toptstsectionR(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRsR=Rftnodatestnobinarytshowfunct
show_functiontignorewstignore_all_spacetignorewsamounttignore_space_changetignoreblanklinestignore_blank_linesR*tunifiedR(RQt
configboolRtdiffoptsRR(RaRRRR((RRRs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs	Rc

s|dkrtj}n|r8|r8	jj}nd}|	|	||s	jd|}n|d \rrrgSd
	jjrtpt	}	gj
j
gD]}
|
r|	|
^q
i|js|jr-t
jn	
f
d}|jr|jry2fd}t||jdt|SWqtk
r||jdtdSXn
||dSdS(syields 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(itjfd}|S(Ncs}|j|dj|}|kr_tdkrLj=n|j|<n
j|j||S(Ntfilelogi(tfilectxRRtpopleftRRR(RRR(tcachetorder(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
getfilectx@s

(R<tdeque(R((RRs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
lrugetfilectx=s
Ric
s+t	||S(N(ttrydiff(Rtlosedata(
taddedRtctx1tctx2RtmodifiedR@RRtrevs(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdifffn_scs$sd|r tndS(NR(R(R(t
losedatafn(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRdsRfN(RQRtdefaultoptsRRwtstatusRat	debugflagRRtnodeRftupgradetcopiest
pathcopiestlistRR
RR	(
Rtnode1tnode2RtchangesRRR@RthexfuncRRR((RRRRRRRR@RRRs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyR#s6		

7*#
c	os|ddddddd d!g}d"d#d$g}t}xB|||D]1}|jd}xt|D]\}}	|dkrd%Vn|r|	jd
rt}qn|	r|	ddkrt}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()Rs
diff.difflineRs
diff.extendedtrenameRRtdeleteds---sdiff.file_as+++sdiff.file_bRds	diff.hunkRsdiff.deletedRs
diff.inserteds
iRs +-@\s+-sdiff.trailingwhitespaceN(sdiffs
diff.diffline(scopys
diff.extended(srenames
diff.extended(solds
diff.extended(snews
diff.extended(Rs
diff.extended(s---sdiff.file_a(s+++sdiff.file_b(Rds	diff.hunk(Rsdiff.deleted(Rs
diff.inserted(s
R(R
RRRR	RR(tfuncRtkwtheadprefixesttextprefixestheadRRRLR
t	striplinetprefixesR@tlabel((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	difflabelnsF				cOstt||S(sBlike diff(), but yields 2-tuples of (output, label) for ui.write()(RR(RR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdiffuisc&
#sfd}d}
fd}d}fd}tj|j}|j}t}idd6dd	6d
d6}tg|jD]\}}||f^q}jrd}nxt	|||D]}d}d}t
}g}||kr!|||j}n||krE|||j}n||}}jsa|
r||ks||kr|dkr||j|}||ks||krjr||kr||}n
||}||j|} |
|| |||kr-||kr-d}!|j
|nd
}!|jd|!||f|jd|!||f|||j}q|
|n9jr|jd|n|j|r|
|ntj|rjrd}q|
|njr|r|
|qq||ks>||kr|dkrjr||krw|||krw||||ks||kr|||kr||||krt}q|jd||j|tj|rd}qq|stj|r|
|qq|j|}"|j|}#tj|pHtj|}$jr~|
|||"||#|$rd}qq|$s|#|"kr|
|qn|rjs|r|jd||||||n|dkr3jr3tj||}%|%rr||||||gqrn?tj|||tj|j||||d}%|r|%st|dkrdj|Vn|%r|%VqqqWdS(Ncstj|S(N(t	posixpathR(R(R@(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRscSs5||kr1|jd||jd|ndS(Nsold mode %s
snew mode %s
(R(theadertomodetnmode((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
addmodehdrscshjrdt|}|dkr;|jdt|qd|dkrd|jdt|qdndS(Nis
index %s..%s
isindex %s,%s..%s
(RfRRttuple(tmetaRRL(R(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytaddindexmetas	cSsE|sd}nt|}tjd|}|j||jS(NRsblob %d(RR<tsha1Rt	hexdigest(R=RR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytgitindexs	
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(RfRatquietR(RRRR
trevtrevinfo(RR(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdifflines	&
t120000Rt100755Rt100644RRRs%s from %s
s	%s to %s
snew file mode %s
Rsdeleted file mode %s
iRi(R<tdatestrRjtmanifestRtdictRPRfRQRR	RRRRRR
R2RRtb85difftunidiffRR(&RRRRRRRRRRRR@RRRRRtdate1tman1tgonetgitmodetktvtcopytoRttottntdodiffRRRR~RRtoflagtnflagRR=((RR@Rs3/usr/lib/python2.7/dist-packages/mercurial/patch.pyRs		
	1		
$	


	
		
$				+%c
Csddddtf\}}}}}xe|D]]\}}}}	t|tj|}t|||}||7}||7}|p|	}q+W|||||fS(Ni(R
tmaxtencodingtcolwidth(
tstatstmaxfiletmaxtotaltaddtotaltremovetotalRRRtrR((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdiffstatsum)s$

csjtjd}gdddtf\fd}x|D]}|jdr|ddt|jdrtj|jdq[|jdr[|j|jdq[qU|jd	r|jd
rd7qU|jdr4|jdr4d7qU|jd
sR|jdrUtqUqUW|S(Ns^diff .*-r [a-z0-9]+\s(.*)$ics&r"jfndS(N(R((taddstfilenametisbinarytremovestresults(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt	addresult:sRs
diff --git a/isdiff -riRs+++ Rs--- sGIT binary patchsBinary file(	RHRIRQR
RRRWRR	(RRcR
R
((RRRRR	s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdiffstatdata4s*



iPc	sYg}t|}t|\}}}}tt}	|rZ|	dkrZd}	n||	|ddkrdnfd}
x|D]\}}}
}|rd}n
||
}d|
|}d|
|
}|jd|d	|tj||	|||fqW|rL|jtd
t|||fndj|S(Niii
cs1kr|St|tt|S(N(RRtbool(RL(t
graphwidthR(s3/usr/lib/python2.7/dist-packages/mercurial/patch.pytscale^stBinRRs %s%s |  %*s %s%s
Rs5 %d files changed, %d insertions(+), %d deletions(-)
R(	RRRRRRRRR(RtwidthRftoutputRtmaxnamet	totaladdsttotalremovest	hasbinaryt
countwidthRRRRRRPtplusestminuses((R
Rs3/usr/lib/python2.7/dist-packages/mercurial/patch.pytdiffstatRs.			
	cosxt||jD]}|r|ddkr|jdd\}}|ddfVtjd|}|r|jddfVntjd	|}|r|jdd
fVqn|dfVd
VqWdS(sOlike diffstat(), but yields 2-tuples of (output, label) for
    ui.write()
    is+-RiRs\++isdiffstat.inserteds-+sdiffstat.deleteds
N(s
R(RRYtrsplitRHRWR(RRR
RtgraphR$((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt
diffstatuixs(GRR RNRRHRRLRIRtemail.Generatortemail.Parserti18nRRRRRFRRR<RRRRRIRt	ExceptionRRRyR;RzRRRRRRRR-R1RRR	RRMRQR^RcRoRARvRuRRQRRRRRRR
RRRRRRRRR(((s3/usr/lib/python2.7/dist-packages/mercurial/patch.pyt<module>	sjH$`		n.	, /,%+8	
		1		c	8
Q	*	J	)				&

Copyright © 2017 || Recoded By Mr.Bumblebee