2019-08-23 21:16:30 +07:00
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
# target branch '-' source branch '-' base32 unique '-forwardport'
|
|
|
|
import itertools
|
2019-09-11 20:04:19 +07:00
|
|
|
import re
|
2019-08-23 21:16:30 +07:00
|
|
|
|
|
|
|
MESSAGE_TEMPLATE = """{message}
|
|
|
|
|
|
|
|
closes {repo}#{number}
|
|
|
|
|
|
|
|
{headers}Signed-off-by: {name} <{login}@users.noreply.github.com>"""
|
|
|
|
REF_PATTERN = r'{target}-{source}-\w{{8}}-forwardport'
|
|
|
|
|
|
|
|
class Commit:
|
2019-09-11 20:04:19 +07:00
|
|
|
def __init__(self, message, *, author=None, committer=None, tree, reset=False):
|
2019-08-23 21:16:30 +07:00
|
|
|
self.id = None
|
|
|
|
self.message = message
|
|
|
|
self.author = author
|
|
|
|
self.committer = committer
|
|
|
|
self.tree = tree
|
2019-09-11 20:04:19 +07:00
|
|
|
self.reset = reset
|
2019-08-23 21:16:30 +07:00
|
|
|
|
|
|
|
def validate_all(repos, refs, contexts=('ci/runbot', 'legal/cla')):
|
|
|
|
""" Post a "success" status for each context on each ref of each repo
|
|
|
|
"""
|
|
|
|
for repo, branch, context in itertools.product(repos, refs, contexts):
|
|
|
|
repo.post_status(branch, 'success', context)
|
2019-09-11 20:04:19 +07:00
|
|
|
|
|
|
|
class re_matches:
|
|
|
|
def __init__(self, pattern, flags=0):
|
|
|
|
self._r = re.compile(pattern, flags)
|
|
|
|
|
|
|
|
def __eq__(self, text):
|
|
|
|
return self._r.match(text)
|
|
|
|
|
|
|
|
def __repr__(self):
|
|
|
|
return '~' + self._r.pattern + '~'
|