Пример #1
0
def modified_regions(old_data, new_data):
    regions = Regions()
    beg = None
    for pbeg, pend, fbeg, fend in bdiff.blocks(old_data, new_data):
        if beg is not None and beg != fbeg:
            regions.append(beg, fbeg)
        beg = fend
    return regions
Пример #2
0
def modified_regions(old_data, new_data):
    regions = Regions()
    beg = None
    for pbeg, pend, fbeg, fend in bdiff.blocks(old_data, new_data):
        if beg is not None and beg != fbeg:
            regions.append(beg, fbeg)
        beg = fend
    return regions
Пример #3
0
def make_offsets(ws1, ws2):
    offsets_map={}
    blk=blocks('\n'.join(ws1),'\n'.join(ws2))
    for i1,i2,j1,j2 in blk:
        if i2>i1:
            for i,j in izip(xrange(i1,i2),xrange(j1,j2)):
                offsets_map[i]=j
    return offsets_map
Пример #4
0
def modified_lines(old_data, new_data, max_lines):
    from itertools import count
    from mercurial import bdiff, mdiff

    modified = set()
    counter = count()
    for pbeg, pend, fbeg, fend in bdiff.blocks(old_data, new_data):
        for i in counter:
            if i < fbeg:
                modified.add(i)
            elif i + 1 >= fend:
                break
            elif i > max_lines:
                break
    return modified
Пример #5
0
def modified_lines(old_data, new_data, max_lines):
    from itertools import count
    from mercurial import bdiff, mdiff

    modified = set()
    counter = count()
    for pbeg, pend, fbeg, fend in bdiff.blocks(old_data, new_data):
        for i in counter:
            if i < fbeg:
                modified.add(i)
            elif i + 1 >= fend:
                break
            elif i > max_lines:
                break
    return modified