Skip to content
Merged
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
47 changes: 24 additions & 23 deletions src/ghstack/submit.py
Original file line number Diff line number Diff line change
Expand Up @@ -1479,6 +1479,30 @@ def push_updates(
push_branches: List[str] = []
force_push_branches: List[str] = []

for s in reversed(diffs_to_submit):
# It is VERY important that we do base updates BEFORE real
# head updates, otherwise GitHub will spuriously think that
# the user pushed a number of patches as part of the PR,
# when actually they were just from the (new) upstream
# branch

for diff, b in s.push_branches:
if b == "orig":
q = force_push_branches
elif b == "base":
q = base_push_branches
else:
q = push_branches
q.append(push_spec(diff, branch(s.username, s.ghnum, b)))
# Careful! Don't push master.
# TODO: These pushes need to be atomic (somehow)
if base_push_branches:
self._git_push(base_push_branches)
if push_branches:
self._git_push(push_branches, force=self.force)
if force_push_branches:
self._git_push(force_push_branches, force=True)

for s in reversed(diffs_to_submit):
# NB: GraphQL API does not support modifying PRs
assert not s.closed
Expand Down Expand Up @@ -1516,29 +1540,6 @@ def push_updates(
body=stack_desc,
)

# It is VERY important that we do base updates BEFORE real
# head updates, otherwise GitHub will spuriously think that
# the user pushed a number of patches as part of the PR,
# when actually they were just from the (new) upstream
# branch

for diff, b in s.push_branches:
if b == "orig":
q = force_push_branches
elif b == "base":
q = base_push_branches
else:
q = push_branches
q.append(push_spec(diff, branch(s.username, s.ghnum, b)))
# Careful! Don't push master.
# TODO: These pushes need to be atomic (somehow)
if base_push_branches:
self._git_push(base_push_branches)
if push_branches:
self._git_push(push_branches)
if force_push_branches:
self._git_push(force_push_branches, force=True)

# Report what happened
def format_url(s: DiffMeta) -> str:
return "https://{github_url}/{owner}/{repo}/pull/{number}".format(
Expand Down