Skip to content

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
Signed-off-by: Jakub Kicinski <[email protected]>
  • Loading branch information
kuba-moo committed Nov 30, 2023
1 parent 1d3eb93 commit cf44002
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
3 changes: 3 additions & 0 deletions pw/patchwork.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,9 @@ def get_by_msgid(self, object_type, msgid):
msgid = urllib.parse.quote(msgid)
return self._get(f'{object_type}/?msgid={msgid}&project={self._project}', api='').json()

def get_mbox_direct(self, url):
return self._request(url).content.decode()

def get_mbox(self, object_type, identifier):
url = f'{self._proto}{self.server}/{object_type}/{identifier}/mbox/'
return self._request(url).content.decode()
Expand Down
21 changes: 20 additions & 1 deletion trivial-net-brancher.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

from core import NIPA_DIR
from core import log, log_open_sec, log_end_sec, log_init
from core import Tree
from core import Tree, Patch, PatchApplyError
from pw import Patchwork

"""
Expand Down Expand Up @@ -109,6 +109,25 @@ def apply_pending_patches(pw, config, tree) -> None:
things = pwe_get_pending(pw, config)
log_end_sec()

log_open_sec("Applying pending submissions")
seen_series = set()
applied_series = set()
for entry in things:
series_id = pwe_series_id_or_none(entry)
if 'pull_url' in entry:
pass
elif series_id and series_id not in seen_series:
seen_series.add(series_id)
mbox_url = entry["series"][0]["mbox"]
data = pw.get_mbox_direct(mbox_url)
p = Patch(data)
try:
tree.apply(p)
applied_series.add(series_id)
except PatchApplyError:
pass
log_end_sec()


def create_new(pw, config, state, tree, tgt_remote) -> None:
now = datetime.datetime.now(datetime.UTC)
Expand Down

0 comments on commit cf44002

Please sign in to comment.