sys.exit(1) repo_path = lib.repo_path() repo = pygit2.Repository(repo_path) try: commit = str(repo.revparse_single(args.rev).id) except KeyError: print("Error: revision \"%s\" not found in \"%s\"." % (args.rev, repo_path), file=sys.stderr) sys.exit(1) series = open("series") cwd = os.getcwd() os.chdir("patches") try: with series_conf.find_commit(commit, series) as (name, patch,): print("Commit %s already present in patch\n\t%s" % ( commit[:12], name,)) references = " ".join(patch.get("References")) if references: print("for\n\t%s" % (references,)) try: top = subprocess.check_output( ("quilt", "--quiltrc", "-", "top",), cwd=cwd, stderr=subprocess.STDOUT,).decode().strip() except subprocess.CalledProcessError as err: if err.output.decode() == "No patches applied\n": top = None else: raise
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." % (fixes[:12], ), file=sys.stderr) sys.exit(1) os.chdir(cwd) print("Info: using references \"%s\" from patch \"%s\" which contains " "commit %s." % (references, name, fixes[:12])) else:
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." % (fixes[:12],), file=sys.stderr) sys.exit(1) os.chdir(cwd) print("Info: using references \"%s\" from patch \"%s\" which contains " "commit %s." % (references, name, fixes[:12])) else: destination = args.destination references = args.references tmpdir = tempfile.mkdtemp(prefix="qcp.")
repo_path = lib.repo_path() repo = pygit2.Repository(repo_path) try: commit = str(repo.revparse_single(args.rev).id) except KeyError: print("Error: revision \"%s\" not found in \"%s\"." % (args.rev, repo_path), file=sys.stderr) sys.exit(1) series = open("series") cwd = os.getcwd() os.chdir("patches") try: with series_conf.find_commit(commit, series) as ( name, patch, ): print("Commit %s already present in patch\n\t%s" % ( commit[:12], name, )) references = " ".join(patch.get("References")) if references: print("for\n\t%s" % (references, )) try: top = subprocess.check_output( ( "quilt",