Skip to content
This repository has been archived by the owner on Jul 30, 2024. It is now read-only.

Rename PR branch variables #32

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions read-skipfile-results
Original file line number Diff line number Diff line change
Expand Up @@ -218,15 +218,15 @@ def run(raw_args=None):
github_repo = g.get_repo(f"{username}/{repo_name}")

# Base patch - base patch for PRs
base_patch = "origin/master"
next_pr_base_patch = "master"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

next_base_branch?

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

maybe we should say:
base_branch = next_base_branch = "master"


# If there are any formatting updates, make these
if repo.index.diff("HEAD"):
summary = "Skipfile formatting updates"
message = "Clean up skipfile formatting."
base = "master"
pr_base_patch = next_pr_base_patch
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Then we don't need this or?

head = f"formatting-update-{date_str}-{patch_count}"
base_patch = head
next_pr_base_patch = head

logger.debug(
"branches:" + "\n".join([str(b.name) for b in github_repo.get_branches()])
Expand All @@ -249,7 +249,7 @@ def run(raw_args=None):
github_repo,
summary,
message,
base,
pr_base_patch,
head,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we use head here and not the next_pr_base_patch variable ?

)

Expand Down Expand Up @@ -363,8 +363,9 @@ def run(raw_args=None):
# head name for update
head = f"skipfile-update-{date_str}-{patch_count}"

# Check out the base patch
repo.git.checkout(base_patch)
# Check out the base patch - this doesn't move since we want to
# create the different PRs in parallel after applying formatter
repo.git.checkout(next_pr_base_patch)

skipfile["skiplist"] = new_skiplist

Expand Down Expand Up @@ -392,7 +393,7 @@ def run(raw_args=None):
+ f"{squad_build_urls}"
)
# set base patch for PR
base = base_patch
pr_base_patch = next_pr_base_patch

if len(summary) > 50:
# Truncate the commit summary to < 50 characters for git commit
Expand All @@ -414,7 +415,7 @@ def run(raw_args=None):
github_repo,
summary,
message,
base,
pr_base_patch,
head,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Same here

)

Expand All @@ -423,7 +424,7 @@ def run(raw_args=None):
new_skipitem = None
# Log commit to file
with open(f"{head}.diff", "w") as file:
diff = popen(f"git diff {base} {head}").read()
diff = popen(f"git diff {pr_base_patch} {head}").read()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

head is used here too, should it or ?

file.write(f"{summary}\n{message}\n{diff}")

return 0
Expand Down
Loading