def gen_diff(co, handle, precursors, lines, txn): pres, plen = simplify_precursors(co, handle, co.contents, precursors, txn) file_points = [] for pre, index in pres: info = handle_contents_at_point(co, handle, pre, txn) file_points.append((info['lines'], info['line points'], info['points'])) result, ms, newlines = find_resolution(file_points, lines) # explanation of conditions: # 1: check for a merge # 2: check if new lines were added by the user # 3: safety for the 4th condition # 4: check if the first match in the first (only) file covers everything if len(pres) > 1 or \ len(newlines) != 0 or \ not len(ms[0]) or \ ms[0][0][2] != len(file_points[0][0]): # create a set of correct matches, minus ones which are optimized out matches = [[] for i in xrange(plen)] i = 0 for pre, index in pres: matches[index] = ms[i] i += 1 return {'matches': matches, 'newlines': newlines} return None
def gen_diff(co, handle, precursors, lines, txn): pres, plen = simplify_precursors(co, handle, co.contents, precursors, txn) file_points = [] for pre, index in pres: info = handle_contents_at_point(co, handle, pre, txn) file_points.append( (info['lines'], info['line points'], info['points'])) result, ms, newlines = find_resolution(file_points, lines) # explanation of conditions: # 1: check for a merge # 2: check if new lines were added by the user # 3: safety for the 4th condition # 4: check if the first match in the first (only) file covers everything if len(pres) > 1 or \ len(newlines) != 0 or \ not len(ms[0]) or \ ms[0][0][2] != len(file_points[0][0]): # create a set of correct matches, minus ones which are optimized out matches = [[] for i in xrange(plen)] i = 0 for pre, index in pres: matches[index] = ms[i] i += 1 return {'matches': matches, 'newlines': newlines} return None
def gen_file_points(prune): file_points, points = [], ['1'] true_pre_heads = simplify_precursors(co, handle, co.contents, pre_heads, txn)[0] # don't use pre_heads which are ancestors of rhead for pre, index in true_pre_heads: if prune and is_ancestor(co, pre, rhead, txn): continue info = handle_contents_at_point(co, handle, pre, txn, dcache=dcache) if info is None: continue points = dmerge(points, info['points']) file_points.append((info['lines'], info['line points'], info['points'])) return (file_points, points)
def gen_file_points(prune): file_points, points = [], ['1'] true_pre_heads = simplify_precursors(co, handle, co.contents, pre_heads, txn)[0] # don't use pre_heads which are ancestors of rhead for pre, index in true_pre_heads: if prune and is_ancestor(co, pre, rhead, txn): continue info = handle_contents_at_point(co, handle, pre, txn, dcache=dcache) if info is None: continue points = dmerge(points, info['points']) file_points.append( (info['lines'], info['line points'], info['points'])) return (file_points, points)