[FIX] runbot_merge: a few warnings

This commit is contained in:
Xavier Morel 2018-06-12 10:40:50 +02:00 committed by xmo-odoo
parent 323aa20053
commit 35f33cee6d
5 changed files with 9 additions and 10 deletions

View File

@ -1,11 +1,9 @@
import collections
import functools
import logging
import pprint
import requests
from odoo.exceptions import UserError
from . import exceptions
_logger = logging.getLogger(__name__)

View File

@ -198,7 +198,7 @@ class Repo(object):
def is_ancestor(self, sha, of):
assert not git.is_ancestor(self.objects, sha, of=of)
def _read_ref(self, r, ref):
def _read_ref(self, _, ref):
obj = self.refs.get(ref)
if obj is None:
return (404, None)
@ -282,7 +282,7 @@ class Repo(object):
"tree": {"sha": body['tree']},
"parents": [{"sha": sha}],
})
def _read_commit(self, r, sha):
def _read_commit(self, _, sha):
c = self.objects.get(sha)
if not isinstance(c, Commit):
return (404, None)
@ -349,7 +349,7 @@ class Repo(object):
return (200, {})
def _remove_label(self, r, number, label):
def _remove_label(self, _, number, label):
print('remove_label', number, label)
try:
pr = self.issues[int(number)]
@ -384,7 +384,7 @@ class Repo(object):
# get common ancestor (base) of commits
try:
base = git.merge_base(self.objects, target, sha)
except Exception as e:
except Exception:
return (400, {'message': "No common ancestor between %(base)s and %(head)s" % body})
try:
tid = git.merge_objects(
@ -534,7 +534,7 @@ class Commit(object):
return git.make_commit(self.tree, self.message, self.author, self.committer, parents=self.parents)[0]
def __str__(self):
parents = '\n'.join('parent {p}' for p in self.parents) + '\n'
parents = '\n'.join('parent {}'.format(p) for p in self.parents) + '\n'
return """commit {}
tree {}
{}author {}

View File

@ -40,6 +40,10 @@ def make_commit(tree, message, author, committer=None, parents=()):
def walk_ancestors(store, commit, exclude_self=True):
"""
:param store: mapping of hashes to commit objects (w/ a parents attribute)
:param str commit: starting commit's hash
:param exclude_self: whether the starting commit shoudl be returned as
part of the sequence
:rtype: Iterator[(str, int)]
"""
q = [(commit, 0)]
while q:

View File

@ -48,7 +48,6 @@ import collections
import configparser
import itertools
import re
import signal
import socket
import subprocess
import sys

View File

@ -4,8 +4,6 @@ import pytest
import odoo
from fake_github import git
@pytest.fixture
def repo(make_repo):
return make_repo('repo')