[IMP] runbot: allow to define errors policy for _git decode

This commit is contained in:
Xavier-Do 2020-10-15 16:54:47 +02:00
parent 1985917702
commit 43075a59e6

View File

@ -292,7 +292,7 @@ class Repo(models.Model):
for repo in self: for repo in self:
repo.path = os.path.join(root, 'repo', _sanitize(repo.name)) repo.path = os.path.join(root, 'repo', _sanitize(repo.name))
def _git(self, cmd): def _git(self, cmd, errors='strict'):
"""Execute a git command 'cmd'""" """Execute a git command 'cmd'"""
self.ensure_one() self.ensure_one()
config_args = [] config_args = []
@ -300,7 +300,7 @@ class Repo(models.Model):
config_args = ['-c', 'core.sshCommand=ssh -i %s/.ssh/%s' % (str(Path.home()), self.identity_file)] config_args = ['-c', 'core.sshCommand=ssh -i %s/.ssh/%s' % (str(Path.home()), self.identity_file)]
cmd = ['git', '-C', self.path] + config_args + cmd cmd = ['git', '-C', self.path] + config_args + cmd
_logger.info("git command: %s", ' '.join(cmd)) _logger.info("git command: %s", ' '.join(cmd))
return subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode() return subprocess.check_output(cmd, stderr=subprocess.STDOUT).decode(errors=errors)
def _fetch(self, sha): def _fetch(self, sha):
if not self._hash_exists(sha): if not self._hash_exists(sha):