in sync/upstream.py [0:0]
def update_modified_sync(git_gecko: Repo, git_wpt: Repo, sync: UpstreamSync) -> None:
assert sync._lock is not None
if len(sync.gecko_commits) == 0:
# In the case that there are no gecko commits, we presumably had a backout
# In this case we don't touch the wpt commits, but just mark the PR
# as closed. That's pretty counterintuitive, but it turns out that GitHub
# will only let you reopen a closed PR if you don't change the branch head in
# the meantime. So we carefully avoid touching the wpt side until something
# relands and we have a chance to reopen the PR
logger.info("Sync has no commits, so marking as incomplete")
sync.status = "incomplete" # type: ignore
if not sync.pr:
logger.info("Sync was already fully applied upstream, not creating a PR")
return
else:
sync.status = "open" # type: ignore
try:
sync.update_wpt_commits()
except AbortError:
# If we got a merge conflict and the PR doesn't exist yet then try
# recreating the commits on top of the current sync point in order that
# we get a PR and it's visible that it fails
if not sync.pr:
logger.info("Applying to origin/master failed; "
"retrying with the current sync point")
from .landing import load_sync_point
sync_point = load_sync_point(git_gecko, git_wpt)
sync.set_wpt_base(sync_point["upstream"])
try:
sync.update_wpt_commits()
except AbortError:
# Reset the base to origin/master
sync.set_wpt_base("origin/master")
with env.bz.bug_ctx(sync.bug) as bug:
bug.add_comment("Failed to create upstream wpt PR due to "
"merge conflicts. This requires fixup from a wpt sync "
"admin.")
needinfo_users = [item.strip() for item in
(env.config["gecko"]["needinfo"]
.get("upstream", "")
.split(","))]
needinfo_users = [item for item in needinfo_users if item]
bug.needinfo(*needinfo_users)
raise
sync.update_github()