mirror of
https://github.com/ClickHouse/ClickHouse.git
synced 2024-11-09 17:14:47 +00:00
Get rid of broken get_commits().reversed
This commit is contained in:
parent
cb1b7dc43c
commit
370ce5ef63
@ -9,6 +9,7 @@ from urllib.parse import quote
|
||||
from unidiff import PatchSet # type: ignore
|
||||
|
||||
from build_download_helper import get_gh_api
|
||||
from ci_config import Labels
|
||||
from env_helper import (
|
||||
GITHUB_EVENT_PATH,
|
||||
GITHUB_REPOSITORY,
|
||||
@ -16,7 +17,6 @@ from env_helper import (
|
||||
GITHUB_SERVER_URL,
|
||||
GITHUB_UPSTREAM_REPOSITORY,
|
||||
)
|
||||
from ci_config import Labels
|
||||
from get_robot_token import get_best_robot_token
|
||||
from github_helper import GitHub
|
||||
|
||||
@ -459,16 +459,18 @@ class PRInfo:
|
||||
sync_repo = gh.get_repo(GITHUB_REPOSITORY)
|
||||
sync_pr = sync_repo.get_pull(self.number)
|
||||
# Find the commit that is in both repos, upstream and cloud
|
||||
sync_commits = sync_pr.get_commits().reversed
|
||||
upstream_commits = upstream_pr.get_commits().reversed
|
||||
# Do not ever use `reversed` here, otherwise the list of commits is not full
|
||||
sync_commits = list(sync_pr.get_commits())
|
||||
upstream_commits = list(upstream_pr.get_commits())
|
||||
# Github objects are compared by _url attribute. We can't compare them directly and
|
||||
# should compare commits by SHA1
|
||||
upstream_shas = [c.sha for c in upstream_commits]
|
||||
logging.info("Commits in upstream PR:\n %s", ", ".join(upstream_shas))
|
||||
sync_shas = [c.sha for c in sync_commits]
|
||||
logging.info("Commits in sync PR:\n %s", ", ".join(reversed(sync_shas)))
|
||||
logging.info("Commits in sync PR:\n %s", ", ".join(sync_shas))
|
||||
|
||||
# find latest synced commit
|
||||
# find latest synced commit, search from the latest
|
||||
upstream_commits.reverse()
|
||||
last_synced_upstream_commit = None
|
||||
for commit in upstream_commits:
|
||||
if commit.sha in sync_shas:
|
||||
|
Loading…
Reference in New Issue
Block a user