Skip to content

Commit 2ddb65c

Browse files
committed
Auto merge of rust-lang#87532 - tlyu:bootstrap-rev-list, r=jyn514
bootstrap.py: use `git rev-list` for robustness Use `git rev-list` instead of `git log` to be more robust against UI changes in git. Also, use the full email address for bors, because `--author` uses a substring match. Based on rust-lang#87513, but is separate because it's less minimal and may require additional manual testing. ~Open questions:~ * ~Should the `merge_base` search also use `--first-parent`?~ * ~Do we exclude non-merge commits from bors? There are a few, and I'm not sure what they have in common. Some of them look like squashes, and some look like they're in rollup branches.~ r? `@jyn514` `@rustbot` label +A-rustbuild +C-cleanup
2 parents d4ad1cf + e0d7a59 commit 2ddb65c

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/bootstrap/bootstrap.py

+8-4
Original file line numberDiff line numberDiff line change
@@ -464,16 +464,17 @@ def download_toolchain(self, stage0=True, rustc_channel=None):
464464
# LLVM more often than necessary.
465465
#
466466
# This git command finds that commit SHA, looking for bors-authored
467-
# merges that modified src/llvm-project.
467+
# merges that modified src/llvm-project or other relevant version
468+
# stamp files.
468469
#
469470
# This works even in a repository that has not yet initialized
470471
# submodules.
471472
top_level = subprocess.check_output([
472473
"git", "rev-parse", "--show-toplevel",
473474
]).decode(sys.getdefaultencoding()).strip()
474475
llvm_sha = subprocess.check_output([
475-
"git", "log", "--author=bors", "--format=%H", "-n1",
476-
"--no-patch", "--first-parent",
476+
"git", "rev-list", "--author=bors@rust-lang.org", "-n1",
477+
"--merges", "--first-parent", "HEAD",
477478
"--",
478479
"{}/src/llvm-project".format(top_level),
479480
"{}/src/bootstrap/download-ci-llvm-stamp".format(top_level),
@@ -665,7 +666,10 @@ def maybe_download_ci_toolchain(self):
665666

666667
# Look for a version to compare to based on the current commit.
667668
# Only commits merged by bors will have CI artifacts.
668-
merge_base = ["git", "log", "--author=bors", "--pretty=%H", "-n1"]
669+
merge_base = [
670+
"git", "rev-list", "[email protected]", "-n1",
671+
"--merges", "--first-parent", "HEAD"
672+
]
669673
commit = subprocess.check_output(merge_base, universal_newlines=True).strip()
670674

671675
# Warn if there were changes to the compiler or standard library since the ancestor commit.

0 commit comments

Comments
 (0)