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 get_commit(value): if not value: raise BadTag(value) tag = series_conf.firstword(value) if not self.commit_match.match(tag): raise BadTag(tag) return tag
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
try: commit = repo.revparse_single(args.rev) except ValueError: print("Error: \"%s\" is not a valid revision." % (args.rev, ), file=sys.stderr) sys.exit(1) except KeyError: print("Error: revision \"%s\" not found in \"%s\"." % (args.rev, repo_path), file=sys.stderr) sys.exit(1) if args.followup: with Patch(io.BytesIO(commit.message.encode())) as patch: try: fixes = series_conf.firstword(patch.get("Fixes")[0]) except IndexError: print("Error: no \"Fixes\" tag found in commit \"%s\"." % (str(commit.id)[:12]), file=sys.stderr) sys.exit(1) fixes = str(repo.revparse_single(fixes).id) series = open("series") cwd = os.getcwd() os.chdir("patches") try: with series_conf.find_commit(fixes, series) as ( name, patch, ):
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:
lib.series_header(series[1]), inside, 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),))
lib.series_header(series[1]), inside, 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] added_nb = len(added) removed_nb = len(removed) if added_nb or removed_nb: print("%d commits added, %d commits removed from base to remote." % (added_nb, removed_nb,))
repo = pygit2.Repository(repo_path) try: commit = repo.revparse_single(args.rev) except ValueError: print("Error: \"%s\" is not a valid revision." % (args.rev,), file=sys.stderr) sys.exit(1) except KeyError: print("Error: revision \"%s\" not found in \"%s\"." % (args.rev, repo_path), file=sys.stderr) sys.exit(1) if args.followup: with Patch(io.BytesIO(commit.message.encode())) as patch: try: fixes = series_conf.firstword(patch.get("Fixes")[0]) except IndexError: print("Error: no \"Fixes\" tag found in commit \"%s\"." % (str(commit.id)[:12]), file=sys.stderr) sys.exit(1) fixes = str(repo.revparse_single(fixes).id) series = open("series") cwd = os.getcwd() os.chdir("patches") try: with series_conf.find_commit(fixes, series) as (name, patch,): destination = os.path.dirname(name) references = " ".join(patch.get("References")) except exc.KSNotFound: print("Error: no patch found which contains commit %s." %