mirror of
https://github.com/odoo/runbot.git
synced 2025-03-22 19:05:45 +07:00

The original method was to `git diff | git apply` in order to get a complete overview of conflicts generated by the forward port (if any). However this turns out to have a huge issue in the presence of renamed or removed files: in that case `git apply` will simply not do anything, and fail with a completely clean working copy. Which is very much undesirable. -> alternative method, squash the PR to a single commit then cherry-pick that single commit, this should provide us with proper conflicts & their markers. Also add tests for conflicts due to deleted files...
37 lines
1.1 KiB
Python
37 lines
1.1 KiB
Python
# -*- coding: utf-8 -*-
|
|
# target branch '-' source branch '-' base32 unique '-forwardport'
|
|
import itertools
|
|
import re
|
|
|
|
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:
|
|
def __init__(self, message, *, author=None, committer=None, tree, reset=False):
|
|
self.id = None
|
|
self.message = message
|
|
self.author = author
|
|
self.committer = committer
|
|
self.tree = tree
|
|
self.reset = reset
|
|
|
|
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)
|
|
|
|
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 + '~'
|