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