\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c @@sddlmZmZddlZddlZddlZddlZddlZddlZddl Z ddl Z ddl Z ddl Z ddl Z ddlmZddlmZmZddlmZmZmZmZmZmZmZmZmZmZmZmZm Z!ddl"m#Z#m$Z$m%Z%ej&Z&e j'dZ(e j'd Z)e j'd Z*ej+Z+d Z,dWdXdYgZ-ej.dZ/dZ0de1fdYZ2dZ3de1fdYZ4de1fdYZ5de5fdYZ6de6fdYZ7de1fd YZ8d!e5fd"YZ9e j'd#Z:e j'd$Z;d%d&d'd(gZ<d)e1fd*YZ=d+e1fd,YZ>d-e1fd.YZ?d/Z@dd0ZBd1e1fd2YZCd3e1fd4YZDd5ZEd6ZFdd7ZGd8ZHd9ZId:ZJd;ZKd<ZLd=ZMdd>d%d?ZNd@ZOdd>d%dAZPdBZQdd%dCZRd>dd%ddDZSdd%dEZTdd>dd%ddFZUdd>dGZVdHeWfdIYZXejYZZejYZYej[Z[ddddddd>d>dddJ Z\ddddddd>d>ddK Z]dLZ^dMZ_dNZ`dOZadPZbdQZcdRZddSZedTdUZfdVZgdS(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 @suddfd}fd}fd}fd}fd}dtfd Y}t}g}d g} tj|d s||}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 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@st}x`|D]X}|js(t}n| rX|jdrX|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@sxY|D]Q}|jdrKx#t|dD] }|Vq3Wg}n|j|qW|rx&t|dD] }|VqyWndS(NsFrom i(RRR'(R(R)Rtc(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt mboxsplit[s   c 3@sd}x|D]}|j|qW|}tj|}|js\||VnFd}x=|jD]/}|j}||krqon||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/plains text/x-diffs text/x-patch(s text/plains text/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@st}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.pyt headersplits    c3@s|VdS(N((R)(R%(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt remainderstfitercB@s)eZdZdZdZeZRS(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}|stn|S(N(R3treadlinet StopIteration(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytnexts (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--- ( tobjectRRt safehasattrR'RRRtlower( R(R*R,R=R>R?R@RR)t mimeheadersR((R%R s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR<s4       "tDatetdatetBranchtbranchsNode IDtnodeidcc@satjdd\}}tj|d}zt||||VWd|jtj|XdS(sextract 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.pytextracts  cC@s|tjdtjtjB}i}tj|}|doKtj|d}|dohtj|d|d<| r|d rdjd|jDd}ng}|r |j dr|j d} | d kr|| d j }qntj d d |}|j d |n|drB|j d|dnd } d$} d} x|jD]} tj| j}|j d||| krqan| jdt}|j|}|rt}t}t}|j d|jd | d 7} t}xv||jd  jD][}|j drt| rt|j dt}t}|jd |jd}n|r:|j dr|d|d<|j d|dqO|j dr|j|dj qO|j dr1xMtD]<\}}d|}|j |r|t|||ss[PATCHt]iis\n[ \t]+Rs Subject: %s s From: %s s text/plains text/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/plains text/x-diffs text/x-patch($tretcompilet MULTILINEtDOTALLR R6t headdecodeR#titemsRtfindtlstriptsubtdebugR8R tbytestrR9t get_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.pyRYs !                     t patchmetacB@sMeZdZdZdZdZdZdZdZdZ 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. 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(RARtislinktisexec((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytsetmodeSs  cC@sCt|j}|j|_|j|_|j|_|j|_|S(N(RRRRRR(RAtother((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytcopyXs     cC@s3|dkr|jdkS|d|jp.|jkS(Ns /dev/nulltADDsa/(RRR(RAtafile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt _ispatchinga`s  cC@s*|dkr|jdkS|d|jkS(Ns /dev/nulltDELETEsb/(RR(RAtbfile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt _ispatchingbes  cC@s|j|o|j|S(N(RR(RARR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt ispatchingjscC@sd|j|jfS(Ns(RR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__repr__ms( RGRHt__doc__RBRRRRRR(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBs       cC@sd}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|_|j t |dd q|jdr|j t |dd q|jdrt |_qqqW|r|j|n|S(s9extract git-style metadata about patches from 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(RtrstripRtgitretmatchR'tgroupRRRRRtintRR(tlrtgpt gitpatchesRR2tdst((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt readgitpatchpsL      t linereadercB@s,eZdZdZdZdZRS(cC@s||_g|_dS(N(R3tbuf(RAR3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBs cC@s#|dk r|jj|ndS(N(RRR'(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytpushs cC@s1|jr$|jd}|jd=|S|jjS(Ni(RR3RD(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRDs    cC@st|jdS(NR!(titerRD(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRCs(RGRHRBRRDRC(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs   tabstractbackendcB@sGeZdZdZdZdZdZdZdZRS(cC@s ||_dS(N(R\(RAR\((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBscC@s tdS(sReturn 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.pytgetfilescC@s 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(RARRRt copysource((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytsetfilescC@s tdS(sUnlink target file.N(R(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[scC@sdS(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((RARtfailedttotalR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytwriterejscC@s tdS(N(R(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytexistsscC@s tdS(N(R(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZs( RGRHRBRRR[RRRZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs      t fsbackendcB@s>eZdZdZdZdZdZdZRS(cC@s,tt|j|tj||_dS(N(tsuperRRBtvfsmodRtopener(RAR\tbasedir((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBscC@s|jj|r.|jj|ttffSt}y#|jj|jd@dk}Wn+tk r}|jtj krqnXy |jj |t|ffSWn,t k r}|jtj krndSXdS(Ni@i(NN( RRtreadlinkRRtlstattst_modetOSErrorterrnotENOENTtreadtIOErrorR(RARRte((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs#  cC@s|\}}|dkr2|jj|||dS|rN|jj||n2|jj|||r|jj|ttndS(N(RRtsetflagstsymlinkRRR(RARRRRRR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs  cC@s5|jjdd}|jj|dtd|dS(Nt experimentaltremoveemptydirst ignoremissingtrmdir(R\t configboolRt unlinkpathR(RARR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR[scC@sZ|d}|jjtd|||f|j|d}|j||jdS(Ns.rejs7%d out of %d hunks FAILED -- saving rejects to file %s tw(R\twarnRRt writelinesRZ(RARRRR$R3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs    cC@s|jj|S(N(Rtlexists(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs(RGRHRBRRR[RR(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs     tworkingbackendcB@s5eZdZdZdZdZdZRS(cC@sStt|j||j||_||_t|_t|_g|_ dS(N( RRRBtroottrepot similaritytsettremovedtchangedtcopied(RAR\RR((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(RtdirstateRt PatchErrorR(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt _checkknown s%cC@se|j|tt|j|||||dk rQ|jj||fn|jj|dS(N( RRRRRRR'Rtadd(RARRRR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs   cC@sG|j|tt|j||jj||jj|dS(N(RRRR[RRR(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 |jx6|jD](}||jj kr~|j |q~q~Wn|rtj |j||jnt |jS(N(RRRRRRt dirstatecopyR\RtforgettsortedRtdiscardt marktouchedR(RAtwctxRtsrcRtf((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZs # (RGRHRBRRR[RZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs     t filestorecB@s2eZddZddZdZdZRS(cC@sYd|_i|_d|_||_|jdkrCdd|_nd|_i|_dS(Niiiii(RRtfilestcreatedtmaxsizetsizeR(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB1s     cC@s|jdks+t||j|jkrY|||f|j|<|jt|7_n{|jdkrtjdd}tj ||_nd|j }|jj |||j d7_ |||f|j ||jD]3} | jdr| d d} n|j| qW||_qq$n6|jrt|_ n|j dkr$ttf|_ n|j rc|jjtd |j|jjtd ni|_d|_d|_d|_g|_t|_|jtd|_ dS(NRRRRiis s Ris!unable to find '%s' for patching sB(use '--prefix' to apply patch relative to the current directory) (RRR(!RRteolmodeRteoltbackendR\R$RRRtmissingRRRRtcreatetremoveRR t splitnewlinesRR'RRthashtdirtytoffsettskewtrejt fileprintedt printfilethunks( RAR\RR RRRRtnlinesR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBsb           $                cC@s|jdkr|j}n|jdkr3d}nd}|jdkr|r|dkrg}xA|D]9}|r|jdr|d |}n|j|qgW|}n|jj|dj|||jdS(NRRs s RiR!(RR RR'R RR#R(RARR$RR trawlinesR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs  !  cC@sk|jr dS|s|jjr+t|_ntd|j}|rW|jj|n|jj|dS(Nspatching file %s (RR\tverboseRRRRtnote(RARts((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs  c@sG|jj|g}t|dkrC|jdfdn|S(NiRc@st|S(N(tabs(R(tlinenum(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyts(RtgetRtsort(RARRtcand((Rs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt findlinesscC@s|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 ( RRWRtbasenameRthunkR'R RRR(RARR$RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt write_rejs  c C@s|jsUttd|j|jt|j|jt|j|j fn|j d7_ |j r|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#dkrRt$j%||j|rR|jr |jj|jnB||j||t|+|jt|t|7_t|_dSi|_&x9t'|jD](\} } |j&j(| gj | qkWxt)j*|jj+d d dD]} xtt"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| |fn0td }|jj/||j|d|f| SqPWqWqW|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 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(0tcompleteRRtnumbertdescRtatlenatbtlenbRR RR'RR RR\RRt isinstancetbinhunkR R R[tnewR$RRRRR t getnormalizedtfuzzitRRRttesthunkRt enumeratet setdefaultR txranget configinttminR"RR(RARhRthorigtoldtoldstartR1tnewstartt orig_startRRtfuzzlenttoponlyR!RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytapplys  *      '    )        $ #cC@s?|jr(|j|j|j|jn|jt|jS(N(RRRR$RR%RR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRZVs  ( RGRHRBRRR"R%RARZ(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs 8   `RcB@seZdZejdZejdZejdZejdZejdZ ejdZ dZ dZ d Z d Zd Zd Zd ZdZdZdZRS(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(RR(RAR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBfs cC@std|jDS(Ncs@s|]}|jdVqdS(sindex N(R(RgRh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys ks(tanyR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRjsc C@sx|jD]}|jdr6|jtdPn|jj|r{|j||jrw|jtdnPn|jdr|jtdt|jt g|jD]}t |j |j ^qfPn|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 ( RRRRt pretty_reRRRRtsumtmaxtaddedR(RAR3Rh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytprettyms   6cC@s|jdj|jdS(NR!(RR#R(RAR3((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR~sc@stfdjDS(Nc3@s!|]}jj|VqdS(N(t allhunks_reR(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys s(RBR(RA((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pytallhunksscC@so|jj|jd}|rN|j\}}||krD|gS||gS|jj|jdjSdS(Ni(t diffgit_reRRtgroupstdiff_re(RARtfromfilettofile((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs  cC@s|jdS(Ni(R(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRnscC@s ddjtt|jS(Ns
R(R#RetreprR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRsc@stfdjDS(Nc3@s!|]}jj|VqdS(N(t newfile_reR(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys s(RBR(RA((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt isnewfilesc@sJtjdk}jo$|}|pItfdjDS(Nic3@s!|]}jj|VqdS(N(t special_reR(RgRh(RA(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys s(RRRQRB(RAt nocontentt emptynewfile((RAs5/usr/lib64/python2.7/site-packages/mercurial/patch.pytspecials(RGRHRRoRpRJRLRHRCRRRPRBRRGRRIRRnRRQRU(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR\s"        t recordhunkcB@s_eZdZd dZdZdZdZdZdZ e Z dZ dZ RS( sKpatch hunk XXX shouldn't we merge this with the other hunk class? c @stfd} ||_| |t\} |_|| |_|| |_| |t\} |_||_||_|j |j\|_ |_ dS(Nc@sZdk rPt|}|dkrP|r<|||fS|| fSqPnd|fS(Ni(RR(R$treversetdelta(t maxcontext(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt trimcontexts  ( RRRtbeforetfromlinettolinetaftertprocR$t countchangesRFR( RARR\R]R_R[R$R^RYRZt trimedbeforet _trimedafter((RYs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBs     cC@set|tstS|j|jkod|j|jkod|j|jkod|jj|jjkS(N(R/RVRR$R_R\RR(RAtv((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__eq__s cC@s4tt|jt|jj|j|jfS(N(RttupleR$RRR\R_(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt__hash__scC@sftg|D]}|jdr |^q }tg|D]}|jdr8|^q8}||fS(shunk -> (n+,n-)RR(RR(RAR$RhRtrem((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||jS(sreturn 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$RVRR]R\R_R[R^(RAR2RR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt reversehunks5cC@st|jt|j}|jrE|jddkrE|d8}n||j}||j}|jd|j||j||jod|jf|jdj |j|j |jdS(Nis\ No newline at end of file is@@ -%d,%d +%d,%d @@%s RR!( RR[R^RRFRR\R]R_R#R$(RAR3RXtfromlenttolen((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs    cC@s |jjS(N(RRn(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRnscC@sd|j|jfS(Ns (RnR\(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRsN( RGRHRRRBRdRfR`RhRRGRnR(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRVs     cC@siitdd6tdd6tdd6d6itdd6td d6td d6d 6itd d6td d6tdd6d6S(Nsapply change %d/%d to '%s'?RAsdiscard change %d/%d to '%s'?Rsrecord 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.pyt getmessagess     c@sVtd krdnfd}t}i}d \}}dtd|D}} x|D]} |t| j7}d }d} dj| j} | |krqrn|j| |d kr| j nt dt djd | j D} |||| d \}}}}|s@qrn| g|| j <| j r~|| j c| j7||||fSxztrd}jd||f}jd|dkrxAj|dD],\}}jd|tj|fqWqAn|dkrt} n|dkrt} n|dkr"|dkr9jtd jdqAn|j j rnjtd jdqAnd td } t j d ddd\} } d} zct jtj| d}|j j||j||jdjg| jD]}d|^q|jj}jd|| fdijd6dd} | dkrjtd| wAnt| d}t} xEt j|D]4}t j|}|jds| j|qqW|j| jdt| }Wdtj| ~ Xt} n|dkr;t} }no|dkrTt} }nV|dkrmt} }n=|dkrt} }n$|d krt j!td!n| |||fSWdS("sprompt 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 blockedtagt filterpatchs editor exited with exit code %d trbt#Niiiiis user quit("RRt promptchoiceRtextractchoicesRRMRRRRR RVRtnativeeolwriterRWRXR#R}RZt geteditortsystemtusernameRtopenR"titerfilet fromnativeeolRR1t parsepatchR[R tAbort(tskipfiletskipalltqueryR%t newpatchestrespstrR+tttrettphelptpatchfdtpatchfnt ncpatchfpRtiteditortpatchfpR(tmessagest operationR\(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytprompt(s       $          3                  ics@s|]}t|jVqdS(N(RR(RgRh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys 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 sRmRlN(NN(RoRRRDRRR#RRRGRRRnRIR5RR]R'RRFt itervaluesRU(R\theadersRRtseentappliedRRtposRRht fixoffsetthdrRRtnpRR%tidxRtnewpatchtnewhunk((RRR\s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRt!sf   _       &!    "R$cB@sPeZdZdZdZdZdZdZdZdZ 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*tnumRtcontext((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBs      cC@sd}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}|jdr3|d d}n|j|q W|S(Ns is (RR'(R$RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt normalizes  N( R$R*R)RR+R-RRR,R.(RARtnh((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR2s        cC@stj|j}|s4ttd|jn|j\|_|_|_ |_ |jdkrsd|_nt |j|_|j dkrd|_ nt |j |_ t |j|_t |j |_ y/t j||j|j|j |j|jWn5tjk r<}ttd|j|fnXxYt|jddkr|jd=|jd=|jd=|jd8_|j d8_ q@W|j|dS(Ns bad hunk #%disbad hunk #%d: %sii(tunidescRR*RRR)RKRR,RR.RRRtaddlinesR$R+R-R t ParseErrorRt _fixnewline(RARR2R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs0$  #   c C@s|j|_tj|j}|sCttd|jn|j\|_}t |j|_|dkr|j}nt ||j|_ |jr|j d7_ nxt j |j D]}|j}|jdr|j|Pn|d}|jds |jdr-d|}n;|jdrId |}nttd |j|f|jj||jj|qW|j}|jd r|jd d }||jd <||jd <|j}ntj|}|sttd|jn|j\|_}t |j|_|dkrQ|j}nt ||j|_|jr|jd7_nd} xt j |jD]}|j}|jd r|jd d }||jd <||j| d>> 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 reversehunkss 8 c@sdtffdY}|}t}|jdj||jdd}xft|D]X\}}y|j||||Wn'tk rtd||fnX|}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@seZdZdZdZfdZdZdZdZdZ iied6ed 6ed 6ed 6d 6ied 6ed 6ed 6ed 6d6ied6ed 6ed 6d 6ied6ed 6d 6ied 6d 6Z RS( spatch parsing state machinecS@sLd|_d|_d|_d|_g|_g|_g|_g|_dS(NiR!( R\R]R_RRRR[R$R(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRBBs       cS@s@|\}}}}}t||_t||_||_dS(N(RR\R]R_(RAtlimitst fromstarttfromendttostartttoendR_((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytaddrangeLsc @s|jrt|j|j|j|j|j|j|}|jjj||jt |j|j 7_|jt |j|j 7_g|_g|_n||_ dS(N( R$RVRR\R]R_R[RR'RRRFR(RARRh(RY(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt addcontextRs   cS@s.|jr!|j|_g|_n||_dS(N(RR[R$(RAR$((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytaddhunk]s   cS@s6|jgt|}|jj|||_dS(N(RRRR'(RARRh((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(RR(RA((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytfinishedls RtfileR$trangeR( RGRHRRBRRRRRRt transitions((RY(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR@s.             R!iRsunhandled transition: %s -> %s( RKR"RR#R1t scanpatchRtKeyErrorRR(toriginalchunksRYRtpR3tstatetnewstateR((RYs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs+A     cC@st|}d}|dkr2d||jfS|}x|dkr|jd|}|dkrttd|||fn|d7}x5||dkr|||d!dkr|d7}qW|d8}q;W|| j|||jfS(sturn 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/is*unable to strip away %d of %d dirs from %si(RRRuRRRv(RR&RTtpathlenRtcount((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt pathtransforms     *cC@s;|dk}|dk}|o9|jdko9|jdk}|o]|jdko]|jdk} t|||\} } | o|j| } t|||\} }| |kr| }n| o|j|}| o| o| }| | jdd }||jdd }|rb||krb| j|rb|jdkrb|jdkrbt}t }n| | koz|j| }d}|s| r|r|r| }q|}q| r| }qn|s|s|r| }q|}q|s| }qt t dnt |}|r%d|_n| r7d|_n|S(Ns /dev/nulliRis&undefined source and destination filesRR(RR,RR.RRtrfindRRRRRRRR(R t afile_origt bfile_origR$R&RTtnullatnullbR R tabaseRtgoodatbbaseRtgoodbR tabasedirtbbasedirtisbackupRR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt makepatchmetasP  $$  !           c #@sttjd}t|fd}xCtjdD]/}|jdsa|jdrd}|||}j}|jdrj}|||g7}n j|d|fVq=|jd rdd ||fd fVq=|jdr8dd||fdfVq=|j|}|rad|jfVq=d|fVq=WdS(slike 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}xDtjdD]0}||r>|j|qj|PqW|S(sscan lr while predicate holdsR!(RRDR'R(tfirstRR$R(R(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt scanwhiles   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---RRs\Rc@s |jS(N(R(R(tcs(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRsRRR$c@s |jS(N(R(R(R(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRsRRN(Rs\(RR(RRs\( RoRpRRRDRRRRK( R3tlines_reRRRRRMRNR2((RRs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs.        cC@sd}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( R3ttellRR"RRRRR1(Rt firstlineRR3tgitlrR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt scangitpatchs      cc@s<d}d}d}d}t}}d}d}d} t|} xt| jdD]} ||kr| r{| jds| tk r| jds| jdrd} |r|dj||r|j} n| jdrt| | j } n=| dkr| jdrt } nt | |d| | } |d7}|ryt}d||| | rk| j pndffVnd | fVnH| jd rt j| jd }|sqSn|dkrt| | }d g|D]!}|jdkr|j ^qfV|jnd|jd}d|jd}xX|r|dj|| r|j} dd| j d| j d| j ffVq>W|sttd|dn|d} t }n| jdr0| j}|jds | j|qSnt }t} t| }t|}n| jdr| j}|jdsm| j|qSn| j}| j||jds| j|qSnt }t } t| }t|}n|rSt}t }|}d}qSqSWxA|r7|j} dd| j d| j d| j ffVqWdS(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 patchiRR$s diff --git a/s tgitRRsa/sb/is'failed to synchronize metadata for "%s"s---s+++s***N(RR(RRRRRDRRRR0RRR$RRRRRRRWRRRRR(R3RRRthunknumtemitfileRRtBFILERRRRRhR2R4tl2tl3((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@rt|||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 @rt|||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}qDttdqDW|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(tbinchunkRR+((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt deltaheads  R!iiiiiiiii i@isunexpected delta opcode 0(RRRR( RRRtoutRRtcmdRRt offset_end((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRsX                           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 RR&RTR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt applydiffs cC@sD|r@tj|j|j|}|dkr@|d7}q@n|S(NR!R(R t canonpathRtgetcwd(RRT((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt _canonprefixs  c@sut|jfd}d} d} d} xt|D]\} } | dkr| sgqCn| j| }|dkrJd} qJqC| dkr| r| | j7} d} n| \}}}}|r||j|_|jr||j|_qnt||||}|j dkrA|j |jn|si|j dkrl|j |jqCnd\}}|j dkr|j |jd \}}|dkrt t d |jqn|jr|j}|j d krd }qn|s|rC|j dkrD|j|jrDt t d |jn|j|j|||jqCqCny|||||d|} WqJt k r}|jt|dd} | d7} qCqJXqC| dkr1xp| D]L}||j}|j |\}}|dkrq|j|||qWqCtjt d| qCW| rg| | j7} n| rqdS| S(Nc@st|ddS(Ni(R(R(RTR&(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytpstripsiR$iRRRRissource file '%s' does not existRR!s,cannot create %s: destination already existsRs Rsunsupported parser state: %si(NN(RR(RRR(R RRRRARZRRRRR[RRRRRRRRR R(R\R3tpatcherR RR&RTRR trejectsterrt current_fileRtvaluesRRRt first_hunkRRRtinstR((RTR&s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs                     cC@s t}g}|j} | r8|jdtj| nd|dj||tj|f} |jd| tj| d} z0x)tj | D]} | j } |j | d| j drtj | } t}|j| q| jdd kr<t}|s(|j| dt}n|j| dq| jd d kre|j| dq| jd d kr|s|j| dt}n|j| dqqWWd |rtj|||nX| j}|rttd tj|n|S(stuse to apply 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(RRR'Rt shellquoteR#RxtpopenRR~RRRtparsepatchoutputRRuRRRRRZRRt explainexit(R\RR t patchnameR&RRR'targstcwdRR3Rtpft printed_filetcode((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt_externalpatch9sJ %     c C@s9|dkrt}n|dkr9|jdd}n|jtkrgtjtd|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(RRtconfigRMteolmodesR RRRR}t TypeErrorRRZtupdateR( R\R tpatchobjR&RTRRRR3R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt patchbackendes,            c C@s.t|||}t|||||||S(swuse builtin patch to apply to the working directory. returns whether patch was applied with fuzz factor.(RR#( R\RR"R&RTRRRR ((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt internalpatchsc C@s1t||||} t|| |||||S(N(RR#( R\RRRR"R&RTRRR ((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt patchreposc C@sk|jdd}|dkr*t}n|rLt|||||||St||||||||S(sApply 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(RRRRR$( R\RRR&RTRRRR ((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR&s    c C@sRt||j}t||}t|d}t}xt|D]\}} |dkr| \} } } } | rt| j|d|d| _| jrt| j|d|d| _qnt || | | ||} |j | j| j dkr@|j | jq@qI|dkrIt j td|qIqIW|SWdQXdS( NRuRiRR$Rsunsupported parser state: %s(R$R(RRR R}RRRRRRRRR RR(R\Rt patchpathR&RTR R3RRRRRRR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt changedfiless(       tGitDiffRequiredcB@seZRS((RGRH(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR(sc c@sxt|d|d|d|d|d|d|d|d|d |  D]\} } } }| dk r| dk sytd | | |}nd jtd |Dg}| r|st| d krdj| dVn|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. tnode1tnode2Rtchangestoptst losedatafnRTtrelrootRs-fctx2 unexpectly None in diff hunks filteringR!cs@s!|]\}}t|VqdS(N(tlist(Rgthrangethlines((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys sis N(t diffhunksRtAssertionErrorR#RDR(RR)R*RR+R,R-RTR.Rt hunksfilterfntfctx1tfctx2RRR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRs+  "c  @s|d krtj}n| r8| r8 jj}nd} |  | |t} dkr|jrg} tj| dd}t } n|sj d|}n|d \  r r rgS j j rt } nt} gjjgD]}|r$| |^q$ d kri|jsf|jrtjd|qnd k r| sfd}|||  t } ntfdjDnt}t}t }x7D]/}|kr"|j||j|q"q"Wx* D]"}|kr\|j|q\q\Wt|t|t| x6tjD]"\}}|kr|=qqWtj t||B|B}tj jjg| f d }|jr|j ry2fd }t||jd t|SWqt k r||jd t d SXn ||d Sd S( sYield 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(itjfd}|S(Nc@s}|j|dj|}|kr_tdkrLj=n|j|6 s c@s.t || S(N(ttrydiff(R,tlosedata( RFRtctx1tctx2R<tmodifiedRTR.RRtrevs(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdifffnU sc@s$ sd| r tndS(NR(R((R(R-(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRCZ sRN(!RR t defaultoptsRRlRtalwaysRRRtstatusR\t debugflagRRtnodeRtupgradeRt pathcopiestdictt iteritemsRR RRR/Rtt matchfilest prefetchfilestrevRR((RR)R*RR+R,R-RTR.RR?t relfilteredtpatsthexfuncRMRAt modifiedsettaddedsett removedsetRRRt prefetchmatchRHRC(( RFRRDRER<R-RFRTR.RRRGs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyR2sz          7      %            %-# cc@sx|D]}|jd}|j}|jdr@d}n+|jdrXd}ntjd|x?tj|D].}|jdr|dfVq{||fVq{W||kr|t|d fVn||kr|t|d fVqqWd S( s1yield tokens for a list of lines in a single hunks Rs diff.deletedRs diff.insertedsunexpected hunk line: %ss sdiff.tabsdiff.trailingwhitespaceR!N(RRR tProgrammingErrort tabsplittertfindallR(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| rxt|D] }|VqWdStj|}tj|}g|D]"}|dkr|n|d^q}g|D]"}|dkr|n|d^q} dj|} dj| } g} g} tj| | d |d | }x|D]\\}}}}}|d k}x:tjdj|||!D]}| j ||fqWx:tjdj|||!D]}| j ||fqWqqWx\dd | fdd | fgD]<\}}}t }x$|D]\}}|rt||fVt }n|j d}|r|d }|j dr|d }n|t |}|j}|t |}nx[tj|D]J}d|dd!krd}n|r#|d}n |d}||fVqW|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.insertedis s sdiff.tabs.changeds .unchangedsdiff.trailingwhitespace(R R\Rdt wordsplitterR^R#R t allblocksRR'RRRRRR]( R_R+R-RRtaltblRtalntblntantbntatokenstbtokenstblocksta1ta2tb1tb2tbtypeRRcRTRbttokenst nextisnewlinet isendoflinetchompt endoflinet endspacestmaybetabt currentlabel((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffsinglehunkinline| sl  // &&         c /@s?|jdr%|djr%tntddddd d!d"d#d$d%g }d&g}t}gfd}x|||D]}|jd}t|} xtt|D]f\} } |r| jdrt}qn| r| jd' rt }nt} | r+| r+| jd(r+t } n|} |r@|} n| ry| }| d| kri|d7}nj |qx|D] }|VqW| j }xa| D]N\}}|j|r||fV| |kr| t|dfVnPqqW| dfV| d| krd)VqqWx|D] }|Vq(WqWdS(*s@yields 2-tuples of (output, label) based on the output of func()R,Rs diff.difflineRs diff.extendedtrenameR;R1tdeletedtindexRs---s diff.file_as+++s diff.file_bRs diff.hunkc3@s0r,xD] }|VqWg(ndS(N((Rc(t dodiffhunkt hunkbuffer(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytconsumehunkbuffer s s RRRs\isdiff.trailingwhitespaceR!N(Rs diff.diffline(Rs diff.extended(Rs diff.extended(R;s diff.extended(R1s diff.extended(Rs diff.extended(Rs diff.extended(Rs diff.extended(s---s diff.file_a(s+++s diff.file_b(Rs diff.hunk(RRRRs\(RR(s R!( RtworddiffRRdRRRR5RRR'R(tfuncRtkwt headprefixest textprefixestheadRR%R$t linecountRRtdifflinetprefixest bufferedlineRcRaRTRb((RRs5/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()(RR(RR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffui scc@s\t}tg|jD]\}}||f^q}t|t|} } xt|||D]} d} | | } }| | krd} | |krF|jr|| } | | kr| |krd} |j| qd} qqFnW| | 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).RRN(RRPRtRRRR(RFRFRRR,tgonetkRctcopytoRYRZRtcopyoptf1tf2((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 6d d6}| dkr#|jjd d s|jjd dr#xh|||t|t|jD];}|d!k r|j |  rt d|| fqqWnxt ||||| D]\}}}d!}d!}d!}d!}d!}d!}|r|||}| j s| r|j |}qn|r|||}| j s| r|j |}qn| jrt}ntd||gD}| r| j r|s|||ks|| rD||s|||rW| s|| rd|s||r|r||kr| |p|qn|p|} |p|}!tj| | t| } tj| |!t| }!g}"| j r |"jd|| ||!f|s,|"jd||q7|sJ|"jd||q7||||}#}$|#|$kr|"jd|#|"jd|$n|d!k r7| jrtj|| ||!d}%|"jd|%n|"jd|| f|"jd||!fq7n,|r7|jj r7|"j|| |n|r| j sc| j r| jr| j r|d!k rxd}n|d!k r|d!k r|j| rd}qd}qn6|d!k r|j}n|d!k r|j}n|rW| j rW| j rWtj||}&|&rB|"jd| || |fnd!|&gff}'n| j r| jdkr|}(|(d!kr|}(n|"jd| |d| j!| |d| j!||(fntj||||| |!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|jS(NR!sblob %d(Rthashlibtsha1R!Rtdigest(RRR((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#(RRGRTtrevinfo((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRG s&cS@s|dkp|jdkS(Ni(RR(R((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pytisemptyK st120000Rt100755Rt100644tdevels all-warningss check-relroots%file %s doesn't start with relroot %scs@s'|]}|dk r|jVqdS(N(Rtisbinary(RgR((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pys m ssdiff --git %s%s %s%ssnew file mode %ssdeleted file mode %ss old mode %ss new mode %sidssimilarity index %d%%s %s from %ss%s to %ssss index %s..%sisindex %s..%s %sRR,N(!tnoprefixRtdatestrRPR\RR/RRRR3RRRRRRBt posixpathR#RR'tshowsimilarityRtscoretquiettnobinaryRtcmpRR tb85difftunidifftextend(*RRGRDRERFRFRRR<R,R-RTR.RtaprefixtbprefixRRtdate1tdate2tgitmodeRRRRtcontent1tcontent2R5R6tflag1tflag2Rtpath1tpath2Rtmode1tmode2tsimRRtflagtuheaders((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyRB- s     !/(            "               c C@sddddtf\}}}}}xe|D]]\}}}} t|tj|}t|||}||7}||7}|p| }q+W|||||fS(Ni(RRERtcolwidth( tstatstmaxfiletmaxtotaltaddtotalt removetotalRRR+RR-((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt diffstatsum s$  c@s|tjd}gdddtf\fd}t}x|D]}|jdr|t}ddt|jdrtj|jdqm|jdrm|j|jdqmq[|jd rt}q[|jd r#| r#d7q[|jd rF| rFd7q[|jd sd|jd r[tq[q[W|S(Ns^diff .*-r [a-z0-9]+\s(.*)$ic@s&r"jfndS(N(R'((taddsRnRtremovestresults(s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt addresult sRs diff --git a/isdiff -ris@@RRsGIT binary patchs Binary file( RoRpRRRRRR{R(R$RRRR((RRnRRRs5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt diffstatdata s2     iPc @s]g}t|}t|\}}}}tt}|rZ|dkrZd}n|||ddkrdnfd} x|D]\} } } } | rd}nd| | }d| | }d| | }|jd | d |tj| ||||fqW|rP|jtd t|||fnd j|S( Niii c@s1kr|St|tt|S(N(RERtbool(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!( RRRRR'RRRR#(R$twidthtoutputRtmaxnamet totaladdst totalremovest hasbinaryt countwidthRRnRRRRtplusestminuses((RRs5/usr/lib64/python2.7/site-packages/mercurial/patch.pytdiffstat s.      co@sxt||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+-RiR!s\++isdiffstat.inserteds-+sdiffstat.deleteds N(s R!(RR}trsplitRoR{R(RRRtnametgraphR2((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt diffstatui$ s (RORP(RQRR(sNode IDRS(ht __future__RRR=t contextlibRR.RRRWRRoRRti18nRRMRRR!RRRRR R R R R RRRRRtutilsRRRR"RpRR]RhRRRtcontextmanagerRaRYRKRRRRRRRRRRRRRRVRoRRtR$R0RRRRRRRRRRR RRR#R$R%R&R't ExceptionR(t diffalloptstdiffoptstdifffeatureoptsRR2RdRRRRRBRRRR(((s5/usr/lib64/python2.7/site-packages/mercurial/patch.pyt s           X     d. ,"2,%+HO . 8 ? | & 7 0  ` 8  T ,         - t  E G  ! ' &