in sync/landing.py [0:0]
def reapply_local_commits(self, gecko_commits_landed):
# The local commits to apply are everything that hasn't been landed at this
# point in the process
commits = [item for item in self.unlanded_gecko_commits()
if item.canonical_rev not in gecko_commits_landed]
landing_commit = self.gecko_commits[-1]
git_work_gecko = self.gecko_worktree.get()
logger.debug("Reapplying commits: %s" % " ".join(item.canonical_rev for item in commits))
if not commits:
return
already_applied = landing_commit.metadata.get("reapplied-commits")
if already_applied:
already_applied = [item.strip() for item in already_applied.split(",")]
else:
already_applied = []
already_applied_set = set(already_applied)
unapplied_gecko_commits = [item for item in commits if item.canonical_rev
not in already_applied_set]
try:
for i, commit in enumerate(unapplied_gecko_commits):
def msg_filter(_):
msg = landing_commit.msg
reapplied_commits = (already_applied +
[commit.canonical_rev for commit in commits[:i + 1]])
metadata = {"reapplied-commits": ", ".join(reapplied_commits)}
return msg, metadata
logger.info(f"Reapplying {commit.sha1} - {commit.msg}")
# Passing in a src_prefix here means that we only generate a patch for the
# part of the commit that affects wpt, but then we need to undo it by adding
# the same dest prefix
commit = commit.move(git_work_gecko,
msg_filter=msg_filter,
src_prefix=env.config["gecko"]["path"]["wpt"],
dest_prefix=env.config["gecko"]["path"]["wpt"],
three_way=True,
amend=True)
if commit is None:
break
except AbortError as e:
err_msg = (
f"Landing wpt failed because reapplying commits failed:\n{e.message}"
)
env.bz.comment(self.bug, err_msg)
raise AbortError(err_msg)