mirror of
https://github.com/odoo/runbot.git
synced 2025-03-15 23:45:44 +07:00
[IMP] forwardport: logging during cherrypick process
* fix small error which generated an extra commit in case of conflict probably (would create a `temp` commit, then put the conflict information on an empty commit on top of it). Avoids committing the cherrypick though a probable alternative would be to commit the message with `amend`. * improve the cherrypick header: instead of one log line per commit, put all commits within the sole header log line (with a newline), should make things less noisy * put *all* log records below the correct logger (two of them were on the toplevel logger) * log a purported inflateInit error as warning, should be sent to Sentry instead of having to wait for people to wonder why the thing is completely broken
This commit is contained in:
parent
560c6e6b16
commit
1b7040cd26
@ -854,7 +854,9 @@ This PR targets %s and is part of the forward-port chain. Further PRs will be cr
|
||||
# switch back to the PR branch
|
||||
conf.checkout(fp_branch_name)
|
||||
# cherry-pick the squashed commit to generate the conflict
|
||||
conf.with_params('merge.renamelimit=0').with_config(check=False).cherry_pick(squashed)
|
||||
conf.with_params('merge.renamelimit=0')\
|
||||
.with_config(check=False)\
|
||||
.cherry_pick(squashed, no_commit=True)
|
||||
|
||||
# if there was a single commit, reuse its message when committing
|
||||
# the conflict
|
||||
@ -887,9 +889,10 @@ stderr:
|
||||
prev = original_head = working_copy.stdout().rev_parse('HEAD').stdout.decode().strip()
|
||||
|
||||
commits = self.commits()
|
||||
logger.info("%s: %s commits in %s", self, len(commits), original_head)
|
||||
for c in commits:
|
||||
logger.debug('- %s (%s)', c['sha'], c['commit']['message'])
|
||||
logger.info("%s: copy %s commits to %s\n%s", self, len(commits), original_head, '\n'.join(
|
||||
'- %s (%s)' % (c['sha'], c['commit']['message'].splitlines()[0])
|
||||
for c in commits
|
||||
))
|
||||
|
||||
for commit in commits:
|
||||
commit_sha = commit['sha']
|
||||
@ -907,15 +910,20 @@ stderr:
|
||||
conf = configured.with_config(stdout=subprocess.PIPE, stderr=subprocess.PIPE, check=False)
|
||||
# first try with default / low renamelimit
|
||||
r = conf.cherry_pick(commit_sha)
|
||||
_logger.debug("Cherry-picked %s: %s\n%s\n%s", commit_sha, r.returncode, r.stdout.decode(), _clean_rename(r.stderr.decode()))
|
||||
logger.debug("Cherry-picked %s: %s\n%s\n%s", commit_sha, r.returncode, r.stdout.decode(), _clean_rename(r.stderr.decode()))
|
||||
if r.returncode:
|
||||
# if it failed, retry with high renamelimit
|
||||
configured.reset('--hard', prev)
|
||||
r = conf.with_params('merge.renamelimit=0').cherry_pick(commit_sha)
|
||||
_logger.debug("Cherry-picked %s (renamelimit=0): %s\n%s\n%s", commit_sha, r.returncode, r.stdout.decode(), _clean_rename(r.stderr.decode()))
|
||||
logger.debug("Cherry-picked %s (renamelimit=0): %s\n%s\n%s", commit_sha, r.returncode, r.stdout.decode(), _clean_rename(r.stderr.decode()))
|
||||
|
||||
if r.returncode: # pick failed, reset and bail
|
||||
logger.info("%s: failed", commit_sha)
|
||||
# try to log inflateInit: out of memory errors as warning, they
|
||||
# seem to return the status code 128
|
||||
logger.log(
|
||||
logging.WARNING if r.returncode == 128 else logging.INFO,
|
||||
"forward-port of %s (%s) failed at %s",
|
||||
self, self.display_name, commit_sha)
|
||||
configured.reset('--hard', original_head)
|
||||
raise CherrypickError(
|
||||
commit_sha,
|
||||
|
Loading…
Reference in New Issue
Block a user