From af892c7d7b4a32edbef6624a61e6be02bb5db7b8 Mon Sep 17 00:00:00 2001 From: Ivan Lezhankin Date: Tue, 20 Apr 2021 17:25:50 +0300 Subject: [PATCH] Use 'release' label from PRs --- utils/github/backport.py | 19 ++++++++----------- utils/keeper-bench/CMakeLists.txt | 2 +- 2 files changed, 9 insertions(+), 12 deletions(-) diff --git a/utils/github/backport.py b/utils/github/backport.py index d2687b893a4..589124324b1 100644 --- a/utils/github/backport.py +++ b/utils/github/backport.py @@ -25,24 +25,23 @@ class Backport: def getPullRequests(self, from_commit): return self._gh.get_pull_requests(from_commit) - def getBranchesWithLTS(self): - branches = [] - for pull_request in self._gh.find_pull_requests("release-lts"): + def getBranchesWithRelease(self): + branches = set() + for pull_request in self._gh.find_pull_requests("release"): if not pull_request['merged'] and not pull_request['closed']: - branches.append(pull_request['headRefName']) + branches.add(pull_request['headRefName']) return branches - def execute(self, repo, upstream, until_commit, number, run_cherrypick, find_lts=False): + def execute(self, repo, upstream, until_commit, run_cherrypick): repo = LocalRepo(repo, upstream, self.default_branch_name) all_branches = repo.get_release_branches() # [(branch_name, base_commit)] - last_branches = set([branch[0] for branch in all_branches[-number:]]) - lts_branches = set(self.getBranchesWithLTS() if find_lts else []) + release_branches = self.getBranchesWithRelease() branches = [] # iterate over all branches to preserve their precedence. for branch in all_branches: - if branch[0] in last_branches or branch[0] in lts_branches: + if branch[0] in release_branches: branches.append(branch) if not branches: @@ -115,8 +114,6 @@ if __name__ == "__main__": parser.add_argument('--token', type=str, required=True, help='token for Github access') parser.add_argument('--repo', type=str, required=True, help='path to full repository', metavar='PATH') parser.add_argument('--til', type=str, help='check PRs from HEAD til this commit', metavar='COMMIT') - parser.add_argument('-n', type=int, dest='number', help='number of last release branches to consider') - parser.add_argument('--lts', action='store_true', help='consider branches with LTS') parser.add_argument('--dry-run', action='store_true', help='do not create or merge any PRs', default=False) parser.add_argument('--verbose', '-v', action='store_true', help='more verbose output', default=False) parser.add_argument('--upstream', '-u', type=str, help='remote name of upstream in repository', default='origin') @@ -129,4 +126,4 @@ if __name__ == "__main__": cherrypick_run = lambda token, pr, branch: CherryPick(token, 'ClickHouse', 'ClickHouse', 'core', pr, branch).execute(args.repo, args.dry_run) bp = Backport(args.token, 'ClickHouse', 'ClickHouse', 'core') - bp.execute(args.repo, args.upstream, args.til, args.number, cherrypick_run, args.lts) + bp.execute(args.repo, args.upstream, args.til, cherrypick_run) diff --git a/utils/keeper-bench/CMakeLists.txt b/utils/keeper-bench/CMakeLists.txt index 7efd2c24f82..cb4bb60a34e 100644 --- a/utils/keeper-bench/CMakeLists.txt +++ b/utils/keeper-bench/CMakeLists.txt @@ -1,2 +1,2 @@ add_executable(keeper-bench Generator.cpp Runner.cpp Stats.cpp main.cpp) -target_link_libraries(keeper-bench PRIVATE dbms) +target_link_libraries(keeper-bench PRIVATE dbms clickhouse_common_zookeeper)