mirror of https://github.com/mongodb/mongo
SERVER-107417 Fix codeowners on github prs with merge commits (#38392)
GitOrigin-RevId: 8448d3e840f79da1ccce3ac9f3c6191efa59f1f5
This commit is contained in:
parent
8103ff206a
commit
139bf52e29
|
|
@ -323,7 +323,7 @@ def add_allowed_unowned_files(output_lines: List[str]) -> None:
|
||||||
), "Somehow there were allowed unowned files but a path was not found."
|
), "Somehow there were allowed unowned files but a path was not found."
|
||||||
|
|
||||||
output_lines.append(f"# The following lines are added from {allowed_unowned_files_path}")
|
output_lines.append(f"# The following lines are added from {allowed_unowned_files_path}")
|
||||||
for file in allowed_unowned_files:
|
for file in sorted(allowed_unowned_files):
|
||||||
output_lines.append(f"{file}")
|
output_lines.append(f"{file}")
|
||||||
# adds a newline
|
# adds a newline
|
||||||
output_lines.append("")
|
output_lines.append("")
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
[tool.poetry]
|
[tool.poetry]
|
||||||
name = "bazel_rules_mongo"
|
name = "bazel_rules_mongo"
|
||||||
version = "0.1.10"
|
version = "0.1.11"
|
||||||
description = "Bazel rule we use to ship common code between bazel repos"
|
description = "Bazel rule we use to ship common code between bazel repos"
|
||||||
authors = ["Trevor Guidry <trevor.guidry@mongodb.com>"]
|
authors = ["Trevor Guidry <trevor.guidry@mongodb.com>"]
|
||||||
readme = "README.md"
|
readme = "README.md"
|
||||||
|
|
|
||||||
|
|
@ -94,13 +94,20 @@ def get_diff_revision(expansions_file: str = None, branch: str = None) -> str:
|
||||||
else:
|
else:
|
||||||
expansions = get_expansions(expansions_file)
|
expansions = get_expansions(expansions_file)
|
||||||
if expansions.get("is_patch", None):
|
if expansions.get("is_patch", None):
|
||||||
# patches from the cli have the changes uncommited, but are added to the git index by evergreen
|
# In github patches, evergreen does not give us the merge-base as the revision
|
||||||
# patches from pull requests have the changes in commits
|
# we need to get the merge base ourselves
|
||||||
# in both cases we can compare against the base commit evergreen exposes as the revision expansion
|
if expansions.get("github_pr_number", None):
|
||||||
diff_commit = expansions.get("revision")
|
local_head = repo.head.commit
|
||||||
|
remote_branch_name = expansions.get("branch_name")
|
||||||
|
remote_head = repo.heads[remote_branch_name].commit
|
||||||
|
diff_commit = repo.git.merge_base(local_head.hexsha, remote_head.hexsha)
|
||||||
|
else:
|
||||||
|
# In cli patch builds the revision should already be the merge base
|
||||||
|
diff_commit = expansions.get("revision")
|
||||||
else:
|
else:
|
||||||
# in waterfall runs we just want to compare to the previous commit
|
# in waterfall runs we just want to compare to the previous commit
|
||||||
diff_commit = repo.git.execute(["git", "rev-parse", "HEAD^1"])
|
diff_commit = repo.git.execute(["git", "rev-parse", "HEAD^1"])
|
||||||
|
print(f"CI base commit to diff from: {diff_commit}")
|
||||||
|
|
||||||
assert diff_commit, "ERROR: not able to obtain diff commit"
|
assert diff_commit, "ERROR: not able to obtain diff commit"
|
||||||
return diff_commit
|
return diff_commit
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue