-=[ Mr. Bumblebee ]=-
_Indonesia_

Path : /usr/lib/python2.7/dist-packages/bzrlib/
File Upload :
Current File : //usr/lib/python2.7/dist-packages/bzrlib/merge3.pyc


Nc@@sddlmZddlmZmZmZdZdZdefdYZ	dZ
edkrdd	lZej
e
ejnd	S(
i(tabsolute_import(terrorstpatiencediffttextfilecC@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((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt	intersects

cC@sj||||krtSxKtt||t||D]$\}}||||kr:tSq:WtSdS(s?Compare a[astart:aend] == b[bstart:bend], without slicing.
    N(tFalsetziptxrangetTrue(tatastarttaendtbtbstarttbendtiatib((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt
compare_range3s.tMerge3c	B@seZdZeedZdddddddedZdZdZdZ	d	Z
d
ZedZ
dZd
ZRS(s3-way merge of texts.

    Given BASE, OTHER, THIS, tries to produce a combined text
    incorporating the changes from both BASE->OTHER and BASE->THIS.
    All three will typically be sequences of lines.cC@sX|s0tj|tj|tj|n||_||_||_||_dS(sConstructor.

        :param base: lines in BASE
        :param a: lines in A
        :param b: lines in B
        :param is_cherrypick: flag indicating if this merge is a cherrypick.
            When cherrypicking b => a, matches with b and base do not conflict.
        :param allow_objects: if True, do not require that base, a and b are
            plain Python strs.  Also prevents BinaryFile from being raised.
            Lines can be any sequence of comparable and hashable Python
            objects.
        N(Rtcheck_text_linestbaseRRt
is_cherrypick(tselfRRRRt
allow_objects((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt__init__Hs


			s<<<<<<<s=======s>>>>>>>c	c@sd}	t|jdkr\|jdjdr:d}	q\|jdjdr\d}	q\n|rw|rwtjn|r|d|}n|r|d|}n|r|r|d|}n|j}
|tkr|j|
}
nx|
D]}|d}|dkr@xt|d|dD]}
|j	|
Vq'Wq|d	ksX|d
krxCt|d|dD]}
|j|
VqpWq|dkrxt|d|dD]}
|j
|
VqWq|dkr||	Vx+t|d
|dD]}
|j|
VqW|dk	rO||	Vx.t|d|dD]}
|j	|
Vq6Wn||	Vx+t|d|dD]}
|j
|
VqpW||	Vqt|qWdS(s'Return merge in cvs-like form.
        s
is
s
t t	unchangediiRtsameRtconflictiiiiN(
tlenRtendswithRtCantReprocessAndShowBaset
merge_regionsRtreprocess_merge_regionstrangeRRRt
ValueError(Rtname_atname_bt	name_basetstart_markert
mid_markert
end_markertbase_markert	reprocesstnewlineR'tttwhatti((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pytmerge_lines^sR	

			cc@sx|jD]u}|d}|dkr^xVt|d|dD]}d|j|VqAWq
|dksv|dkrx	t|d|dD]}|dd|j|VqWq
|d	krxt|d|dD]}d
|j|VqWq
|dkrvdVx/t|d
|dD]}d|j|VqWdVx/t|d|dD]}d|j|VqTWdVq
t|q
WdS(shReturn merge with conflicts, showing origin of lines.

        Most useful for debugging merge.
        iR!iisu | RR"s | Rsb | R#s<<<<
iisA | s----
iisB | s>>>>
N(R'R)RRRR*(RR4R5R6((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pytmerge_annotateds(
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'RRRR*(RR4R5((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pytmerge_groupss
   cc@sd}}}x|jD]\}}}}}}	||}
||}||}||}
|sg|rt|j|||j||}|rd||fVnt|j|||j||}t|j|||j||}|r|rd||fVn|r|rd||fVnq|r|r|jrexH|j||||||D]}|VqSWqd||||||fVntd|}|}n|}|
dkrd||fV|}|}|	}qqWdS(	spReturn 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]

        Method is as follows:

        The two sequences align only on regions which match the base
        and both descendents.  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_regionsRRRRRt_refine_cherrypick_conflicttAssertionError(RtizRRtzmatchtzendtamatchRtbmatchRtmatchlentlen_atlen_btlen_baseR"tequal_atequal_btnode((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyR'sF%





			c	c@stjd|j||!|j||!j}d}d}	d}	t}
x|D]\}}}
||}||	}|dkrnc|
rd||||||||	||fVn0t}
d||||||||	||fV||
}||
}	qNW|||ks|	||kr|
rNd||||||||	||fVqt}
d||||||||	||fVn|
sd||||||fVndS(s:When cherrypicking b => a, ignore matches with b and base.iR#N(RtPatienceSequenceMatcherRRRtget_matching_blocksRR(RtzstartR?RRRRtmatchest
last_base_idxt
last_b_idxt	yielded_atbase_idxtb_idxt	match_lentconflict_z_lentconflict_b_len((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyR;,s<	&



 cc@sBx;|D]3}|ddkr(|Vqn|\}}}}}}}	|j||!}
|j||	!}tjd|
|j}|}
|}x|d D]u\}}}||7}||7}|j|
|||}|dk	r|Vnd|||fV||}
||}qW|j|
|||	}|dk	r|VqqWdS(sWhere there are conflict regions, remove the agreed lines.

        Lines where both A and B have made the same changes are
        eliminated.
        iR#iR"N(RRRRIRRJtmismatch_region(RR'tregionttypeR=R>RR@RRAta_regiontb_regionRLtnext_atnext_bt	region_iat	region_ibt
region_lentreg((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyR(Ts0


	
cC@s5||ks||kr1ddd||||fSdS(NR#(R(RZR\R[R]((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyRUsscC@sd}}tjd|j|jj}tjd|j|jj}t|}t|}g}x||krr||krr||\}}	}
||\}}}
t|||
f|||
f}|rD|d}|d}||}|	||}|||}||}||}|j	||||||fn||
||
kre|d7}qm|d7}qmWt|j}t|j}t|j}|j	||||||f|S(sReturn a list of sync regions, where both descendents 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.
        iiN(
RRIRRRRJRR$Rtappend(RRRtamatchestbmatchesRCRDtsltabaseR@talentbbaseRAtblenR6tintbasetintendtintlentasubtbsubRR((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyR:xs>
#


	


c	C@stjd|j|jj}tjd|j|jj}g}x|r|r|dd}||dd}|dd}||dd}t||f||f}|r|j|n||kr|d=qK|d=qKW|S(s8Return a list of ranges in base that are not conflicted.iiN(	RRIRRRRJRRR`(	Rtamtbmtuncta1ta2tb1tb2R6((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pytfind_unconflicteds"
N(t__name__t
__module__t__doc__RRRR7R8R9R'R;R(tstaticmethodRUR:Rt(((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyRAs$.		"	[	(		=cC@swt|ddj}t|ddj}t|ddj}t|||}tjj|jdS(Nitrtii(tfilet	readlinesRtsyststdoutt
writelinesR8(targvRRRtm3((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pytmains
t__main__N(t
__future__RtbzrlibRRRRRtobjectRRRuR|texitR(((s1/usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt<module>s			

Copyright © 2017 || Recoded By Mr.Bumblebee