\x89\x50\x4E\x47\x0D\x0A\x1A\x0A PNG  \x89\x50\x4E\x47\x0D\x0A\x1A\x0A  13\c@@sddlmZddlmZddlmZmZmZddlm Z de fdYZ dZ d Z d efd YZd Zd ZdZdS(i(tabsolute_importi(t_(terrortmdifftpycompat(t stringutiltCantReprocessAndShowBasecB@seZRS((t__name__t __module__(((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyRscC@sLt|d|d}t|d|d}||krD||fSdSdS(sGiven two ranges return the range where they intersect or None. >>> intersect((0, 10), (0, 6)) (0, 6) >>> intersect((0, 10), (5, 15)) (5, 10) >>> intersect((0, 10), (10, 15)) >>> intersect((0, 9), (10, 15)) >>> intersect((0, 9), (7, 15)) (7, 9) iiN(tmaxtmintNone(tratrbtsatsb((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt intersect"s   cC@sp||||krtSxQttj||tj||D]$\}}||||kr@tSq@WtSdS(s?Compare a[astart:aend] == b[bstart:bend], without slicing. N(tFalsetzipRtxrangetTrue(tatastarttaendtbtbstarttbendtiatib((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt compare_range8st Merge3Textc B@sqeZdZd d d dZd d d dddd d ed ZdZdZdZ d Z d Z RS( s3-way merge of texts. Given strings BASE, OTHER, THIS, tries to produce a combined text incorporating the changes from both BASE->OTHER and BASE->THIS.cC@s||_||_||_|dkr9tj|}n|dkrWtj|}n|dkrutj|}n||_||_||_dS(N( tbasetexttatexttbtextR Rt splitnewlinestbaseRR(tselfRR R!R#RR((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt__init__Is        s<<<<<<>>>>>>c c@sJt|_d} t|jdkre|jdjdrCd} qe|jdjdred} qen|r|r|d|}n|r|r|d|}n|r|r|d|}n|j} | r|j| } nxc| D][} | d} | dkr4x<t| d| dD]}|j|VqWq| d ksL| d kr}xt| d| dD]}|j|VqdWq| d krxt| d| dD]}|j |VqWq| d kr6|d krx^t| d| dD]}|j|VqWqB|dkr@x!t| d| dD]}|j |Vq'WqBt |_|dk ra|| Vnx+t| d| dD]}|j|VqyW|dk r|| Vx.t| d| dD]}|j|VqWn|dk r|| Vnx+t| d| dD]}|j |VqW|dk rB|| VqBqt | qWdS(s'Return merge in cvs-like form. s is s t t unchangediiRtsameRtconflicttlocaliitotheriiN( Rt conflictstlenRtendswitht merge_regionstminimizetrangeR#RRR t ValueError(R$tname_atname_bt name_baset start_markert mid_markert end_markert base_markert localorotherR0tnewlineR/tttwhatti((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt merge_linesWsd                      cc@sx|jD]}|d}|dkrI||j|d|d!fVq |dksa|dkr||j|d|d!fVq |dkr||j|d|d!fVq |dkr||j|d|d!|j|d |d !|j|d |d !fVq t|q Wd S(sYield sequence of line groups. Each one is a tuple: 'unchanged', lines Lines unchanged from base 'a', lines Lines taken from a 'same', lines Lines taken from a (and equal to b) 'b', lines Lines taken from b 'conflict', base_lines, a_lines, b_lines Lines from base were changed to either a or b and conflict. iR'iiRR(RR)iiiiN(R/R#RRR2(R$R<R=((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt merge_groupss       cc@sd}}}x|jD]}|\}}}}} } ||} ||} | |} ||}| sm| rit|j|||j||}t|j|| |j||}t|j|||j|| }|rd||fVns|r| rd|| fVnU|r#| r#d||fVn7| rN| rNd|||||| fVn td|}| }n|}| dkrd||fV|}|}| }qqWdS( sReturn sequences of matching and conflicting regions. This returns tuples, where the first value says what kind we have: 'unchanged', start, end Take a region of base[start:end] 'same', astart, aend b and a are different from base but give the same result 'a', start, end Non-clashing insertion from a[start:end] 'conflict', zstart, zend, astart, aend, bstart, bend Conflict between a and b, with z as common ancestor Method is as follows: The two sequences align only on regions which match the base and both descendants. These are found by doing a two-way diff of each one against the base, and then finding the intersections between those regions. These "sync regions" are by definition unchanged in both and easily dealt with. The regions in between can be in any of three cases: conflicted, or changed on only one side. iR(RRR)s#can't handle a=b=base but unmatchedR'N(tfind_sync_regionsRRR#RtAssertionError(R$tizRRtregiontzmatchtzendtamatchRtbmatchRtmatchlentlen_atlen_btlen_basetequal_atequal_bR(((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyR/s>          c c@sxz|D]r}|ddkr(|Vqn|\}}}}}}} ||} | |} d} xH| | kr| | kr|j|| |j|| kr| d7} q`W| } d} xP| | kr| | kr|j|| d|j| | dkr| d7} qW| }| dkr.d||| fVnd|||| |||| | |fV|dkrd|||fVqqWdS(s Trim conflict regions of lines where A and B sides match. Lines where both A and B have made the same changes at the beginning or the end of each merge region are eliminated from the conflict region and are instead considered the same. iR)iR(N(RR(R$R/RDtissuetz1tz2ta1ta2tb1tb2talentblentiit startmatchest endmatches((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyR0s0   "*   cC@sd}}tj|j|j}tj|j|j}t|}t|}g}x||kr`||kr`||\}} } ||\} } } t||| f| | | f}|r2|d}|d}||}| ||}| || }||}||}|j||||||fn|| | | krS|d7}q[|d7}q[Wt|j}t|j }t|j } |j||||| | f|S(sReturn a list of sync regions, where both descendants match the base. Generates a list of (base1, base2, a1, a2, b1, b2). There is always a zero-length sync region at the end of all the files. ii( Rtget_matching_blocksRR R!R-RtappendR#RR(R$RRtamatchestbmatchesRJRKtsltabaseRGRVtbbaseRHRWR>tintbasetintendtintlentasubtbsubRR((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyRA:s:   #       c C@stj|j|j}tj|j|j}g}x|r|r|dd}||dd}|dd}||dd}t||f||f}|r|j|n||kr|d=q9|d=q9W|S(s8Return a list of ranges in base that are not conflicted.ii(RR[RR R!RR\( R$tamtbmtuncRRRSRTRUR>((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pytfind_unconflictedws   N( RRt__doc__R R%RR?R@R/R0RARj(((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyRDs  8 " Y ' =cC@sptj|rltd|}|jdsH|jtd|n|jdsltj|qln|S(sUverifies that text is non-binary (unless opts[text] is passed, then we just warn)s%s looks like a binary file.tquiets warning: %s ttext(RtbinaryRtgettwarnRtAbort(Rmtpathtuitoptstmsg((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt _verifytextscC@s\t|dkr*tjtdn|}x$t|D]\}}|||W|S(Niscan only specify three labels.(R-RRqRt enumerate(tdefaultst overridestresultR>toverride((s;/usr/lib64/python2.7/site-packages/mercurial/simplemerge.pyt _picklabelss c @stjfd}jdd}d\}}} |dkrt|j|jdgjdg\}}} ny(||} ||} ||} Wntjk rdSXt| | | } ijddd6t d6}|dkr)d|d s  M