Skip to content
Open
Show file tree
Hide file tree
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
11 changes: 6 additions & 5 deletions core/tree.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,14 @@
from core import Patch


# TODO: add patch and CmdError as init here
class PatchApplyError(Exception):
pass
def __init__(self, err):
super().__init__(err)


class PullError(Exception):
pass
def __init__(self, err):
super().__init__(err)


class TreeNotClean(Exception):
Expand Down Expand Up @@ -237,7 +238,7 @@ def _apply_patch_safe(self, patch):
self.git(["am", "--abort"])
except CMD.CmdError:
pass
raise PatchApplyError(e) from e
raise PatchApplyError(e.stderr) from e

def apply(self, thing):
if isinstance(thing, Patch):
Expand Down Expand Up @@ -278,7 +279,7 @@ def _pull_safe(self, pull_url, trust_rerere, ff):
self.git(["merge", "--abort"])
except CMD.CmdError:
pass
raise PullError(e) from e
raise PullError(e.stderr) from e

def pull(self, pull_url, reset=True, trust_rerere=None, ff=None):
core.log_open_sec("Pulling " + pull_url)
Expand Down
19 changes: 13 additions & 6 deletions pw_brancher.py
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,12 @@ def pwe_get_pending(pw, config) -> List:
return things


def apply_pending_patches(pw, config, tree) -> Tuple[List, List]:
def pwe_set_apply_error(pw, patch_id, branch_name, e):
pw.post_check(patch_id, name="contest", state="fail", url="",
desc=f"Conflicts with pending/net patches ({branch_name}): {e}")


def apply_pending_patches(pw, config, tree, branch_name) -> Tuple[List, List]:
log_open_sec("Get pending submissions from patchwork")
things = pwe_get_pending(pw, config)
log(f"Have {len(things)} pending things from patchwork")
Expand All @@ -139,8 +144,8 @@ def apply_pending_patches(pw, config, tree) -> Tuple[List, List]:
try:
tree.pull(entry["pull_url"], reset=False)
applied_prs.add(entry["id"])
except PullError:
pass
except PullError as e:
pwe_set_apply_error(pw, entry["id"], branch_name, e)
else:
log_open_sec("Applying: " + entry["series"][0]["name"])
seen_series.add(series_id)
Expand All @@ -150,8 +155,10 @@ def apply_pending_patches(pw, config, tree) -> Tuple[List, List]:
try:
tree.apply(p)
applied_series.add(series_id)
except PatchApplyError:
pass
except PatchApplyError as e:
series_pw = pw.get("series", series_id)
for patch in series_pw["patches"]:
pwe_set_apply_error(pw, patch["id"], branch_name, e)
log_end_sec()
log_end_sec()

Expand Down Expand Up @@ -280,7 +287,7 @@ def create_new(pw, config, state, tree, tgt_remote) -> None:

state["hashes"][branch_name] = tree.head_hash()

series, prs = apply_pending_patches(pw, config, tree)
series, prs = apply_pending_patches(pw, config, tree, branch_name)
state["info"][branch_name] |= {"series": series, "prs": prs}

extras = apply_local_patches(config, tree)
Expand Down
Loading