def patches_per_section(inside_lines): """ Returns an OrderedDict result[Head][] patch file name """ result = collections.OrderedDict([ (head, [],) for head in flatten((git_sort.remotes, (git_sort.oot,),))]) current_head = git_sort.remotes[0] for line in inside_lines: try: current_head = parse_section_header(line) except exc.KSNotFound: pass if not series_conf.filter_patches(line): continue name = series_conf.firstword(line) result[current_head].append(name) for head, names in list(result.items()): if not names: del result[head] return result
def patches_per_section(inside_lines): """ Returns an OrderedDict result[Head][] patch file name """ result = collections.OrderedDict([( head, [], ) for head in flatten(( git_sort.remotes, (git_sort.oot, ), ))]) current_head = git_sort.remotes[0] for line in inside_lines: try: current_head = parse_section_header(line) except exc.KSNotFound: pass if not series_conf.filter_patches(line): continue name = series_conf.firstword(line) result[current_head].append(name) for head, names in list(result.items()): if not names: del result[head] return result
def series_header(series): """ Return the block of lines at the top of series that are not patch files entries or automatically generated comments. These lines should be prepended to the output. """ header = [] for line in series: if series_conf.filter_patches(line): break try: parse_section_header(line) except exc.KSNotFound: pass else: break header.append(line) return header
def series_header(series): """ Return the block of lines at the top of series that are not patch files entries or automatically generated comments. These lines should be prepended to the output. """ header = [] for line in series: if series_conf.filter_patches(line): break try: parse_section_header(line) except exc.KSNotFound: pass else: break header.append(line) return header
if __name__ == "__main__": local_path, base_path, remote_path, merged_path = sys.argv[1:5] repo_path = lib.repo_path() repo = pygit2.Repository(repo_path) index = lib.git_sort.SortIndex(repo) # (before, inside, after, set(inside),) local, base, remote = (( s[0], s[1], s[2], set([ series_conf.firstword(l) for l in s[1] if series_conf.filter_patches(l) ]), ) for s in [ series_conf.split(open(s_path)) for s_path in ( local_path, base_path, remote_path, ) ]) added = remote[3] - base[3] removed = base[3] - remote[3] moved = set(lib.list_moved_patches(base[1], remote[1])) if added or removed: print("%d commits added, %d commits removed from base to remote." % (
lib.series_footer(series[1]), series[2],)] if __name__ == "__main__": local_path, base_path, remote_path, merged_path = sys.argv[1:5] repo_path = lib.repo_path() repo = pygit2.Repository(repo_path) index = lib.git_sort.SortIndex(repo) # (before, inside, after, set(inside),) local, base, remote = ( (s[0], s[1], s[2], set([series_conf.firstword(l) for l in s[1] if series_conf.filter_patches(l)]),) for s in [ series_conf.split(open(s_path)) for s_path in (local_path, base_path, remote_path,) ] ) added = remote[3] - base[3] removed = base[3] - remote[3] moved = set(lib.list_moved_patches(base[1], remote[1])) if added or removed: print("%d commits added, %d commits removed from base to remote." % (len(added), len(removed),)) if moved: print("%d commits changed section from base to remote." % (len(moved),))