-=[ Mr. Bumblebee ]=-
_Indonesia_
Nc @@ s d d l m Z d d l m Z m Z m Z d Z d Z d e f d YZ d Z
e d k r d d l Z e j
e
e j n d S(
i ( t absolute_import( t errorst patiencedifft textfilec C@ sL t | d | d } t | d | d } | | k rD | | f Sd Sd S( s Given 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)
i i N( t maxt mint None( t rat rbt sat sb( ( s1 /usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt intersect s
c C@ sj | | | | k r t SxK t t | | t | | D]$ \ } } | | | | k r: t Sq: Wt Sd S( s? Compare a[astart:aend] == b[bstart:bend], without slicing.
N( t Falset zipt xranget True( t at astartt aendt bt bstartt bendt iat ib( ( s1 /usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt
compare_range3 s .t Merge3c B@ s e Z d Z e e d Z d d d d d d d e d Z d Z d Z d Z d Z
d
Z e d Z
d Z d
Z RS( s 3-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.c C@ sX | s0 t j | t j | t j | n | | _ | | _ | | _ | | _ d S( s Constructor.
: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( R t check_text_linest baseR R t
is_cherrypick( t selfR R R R t
allow_objects( ( s1 /usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt __init__H s
s <<<<<<<s =======s >>>>>>>c c@ s d } t | j d k r\ | j d j d r: d } q\ | j d j d r\ d } q\ n | rw | rw t j n | r | d | } n | r | d | } n | r | r | d | } n | j }
| t k r | j |
}
n x|
D]} | d } | d k r@xt | d | d D] }
| j |
Vq'Wq | d k sX| d
k rxCt | d | d D] }
| j |
VqpWq | d k rxt | d | d D] }
| j
|
VqWq | d k r| | Vx+ t | d
| d D] }
| j |
VqW| d k rO| | Vx. t | d | d D] }
| j |
Vq6Wn | | Vx+ t | d | d D] }
| j
|
VqpW| | Vq t | q Wd S( s' Return merge in cvs-like form.
s
i s
s
t t unchangedi i R t sameR t conflicti i i i N(
t lenR t endswithR t CantReprocessAndShowBaset
merge_regionsR t reprocess_merge_regionst rangeR R R t
ValueError( R t name_at name_bt name_baset start_markert
mid_markert
end_markert base_markert reprocesst newlineR' t tt whatt i( ( s1 /usr/lib/python2.7/dist-packages/bzrlib/merge3.pyt merge_lines^ sR
c c@ s x| j D]u} | d } | d k r^ xVt | d | d D] } d | j | VqA Wq
| d k sv | d k r x t | d | d D] } | d d | j | Vq Wq
| d k r x t | d | d D] } d
| j | Vq Wq
| d k rvd Vx/ t | d
| d D] } d | j | VqWd Vx/ t | d | d D] } d | j | VqTWd Vq
t | q
Wd S( sh Return merge with conflicts, showing origin of lines.
Most useful for debugging merge.
i R! i i s u | R R"