import argparse from common import get_patch_version, inc_patch_version, GRADLE_PROPERTIES, git_command, construct_repository_url if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--token", type=str, help="github token") args = parser.parse_args() repo_url = construct_repository_url(args.token) patch_version = get_patch_version() release_branch = f"release-{patch_version}" git_command("branch", release_branch) git_command("push", repo_url, release_branch) inc_patch_version() git_command("add", GRADLE_PROPERTIES) git_command("commit", "-m", ":arrow_up: patch version") git_command("push", repo_url, "master")
if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--token", type=str, help="github token") args = parser.parse_args() with open(PLUGIN_XML) as f: text = f.read() today = date.today() version = get_patch_version() - 1 new_text = re.sub( r"https://intellij-rust\.github\.io/.*\.html", f"https://intellij-rust.github.io/{today.year}/{today.month:02d}/{today.day:02d}/changelog-{version}.html", text) with (open(PLUGIN_XML, mode="w")) as f: f.write(new_text) repo_url = construct_repository_url(args.token) git_command("add", PLUGIN_XML) git_command("commit", "-m", "Changelog") head = git_command("rev-parse", "HEAD") release_branch = f"release-{version}" git_command("checkout", release_branch) git_command("cherry-pick", head) git_command("push", repo_url, "master") git_command("push", repo_url, release_branch)
import subprocess from typing import List, Dict from common import git_command if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--projects", type=str, help="Projects info in JSON format", required=True) args = parser.parse_args() projects: List[Dict] = json.loads(args.projects) for project in projects: name = project["name"] path = f"testData/{name}" if name == "stdlib": subprocess.run([ "cargo", "new", "--name", name, "--bin", "--vcs", "none", path ], check=True, stdout=subprocess.PIPE, stderr=subprocess.STDOUT) else: repository = project["repository"] git_command("clone", "--depth", "1", f"https://github.com/{repository}.git", path)
import argparse from common import construct_repository_url, git_command if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--token", type=str, help="github token", required=True) parser.add_argument("--tag", type=str, help="tag name", required=True) parser.add_argument("--commit", type=str, help="commit hash", required=True) args = parser.parse_args() repo_url = construct_repository_url(args.token) git_command("tag", "-d", args.tag, check=False) git_command("tag", args.tag, args.commit) git_command("push", "-f", repo_url, args.tag)
import argparse import json from typing import List, Dict from common import git_command if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--projects", type=str, help="Projects info in JSON format", required=True) args = parser.parse_args() projects: List[Dict] = json.loads(args.projects) for project in projects: name = project["name"] repository = project["repository"] git_command("clone", "--depth", "1", f"https://github.com/{repository}.git", f"testData/{name}")
import argparse from subprocess import CalledProcessError from common import git_command if __name__ == '__main__': parser = argparse.ArgumentParser() parser.add_argument("--tag", type=str, required=True, help="tag name") args = parser.parse_args() try: commit_hash = git_command("rev-list", "-n", "1", args.tag, print_stdout=False) except CalledProcessError: commit_hash = "" print(commit_hash)