Adding upstream version 2.16.0.
Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
parent
d3b459fcc0
commit
ea92097ba5
34 changed files with 301 additions and 126 deletions
|
@ -36,24 +36,36 @@ class RevInfo(NamedTuple):
|
|||
return cls(config['repo'], config['rev'], None)
|
||||
|
||||
def update(self, tags_only: bool, freeze: bool) -> 'RevInfo':
|
||||
git_cmd = ('git', *git.NO_FS_MONITOR)
|
||||
|
||||
if tags_only:
|
||||
tag_cmd = ('git', 'describe', 'FETCH_HEAD', '--tags', '--abbrev=0')
|
||||
tag_cmd = (
|
||||
*git_cmd, 'describe',
|
||||
'FETCH_HEAD', '--tags', '--abbrev=0',
|
||||
)
|
||||
else:
|
||||
tag_cmd = ('git', 'describe', 'FETCH_HEAD', '--tags', '--exact')
|
||||
tag_cmd = (
|
||||
*git_cmd, 'describe',
|
||||
'FETCH_HEAD', '--tags', '--exact',
|
||||
)
|
||||
|
||||
with tmpdir() as tmp:
|
||||
git.init_repo(tmp, self.repo)
|
||||
cmd_output_b('git', 'fetch', 'origin', 'HEAD', '--tags', cwd=tmp)
|
||||
cmd_output_b(
|
||||
*git_cmd, 'fetch', 'origin', 'HEAD', '--tags',
|
||||
cwd=tmp,
|
||||
)
|
||||
|
||||
try:
|
||||
rev = cmd_output(*tag_cmd, cwd=tmp)[1].strip()
|
||||
except CalledProcessError:
|
||||
cmd = ('git', 'rev-parse', 'FETCH_HEAD')
|
||||
cmd = (*git_cmd, 'rev-parse', 'FETCH_HEAD')
|
||||
rev = cmd_output(*cmd, cwd=tmp)[1].strip()
|
||||
|
||||
frozen = None
|
||||
if freeze:
|
||||
exact = cmd_output('git', 'rev-parse', rev, cwd=tmp)[1].strip()
|
||||
exact_rev_cmd = (*git_cmd, 'rev-parse', rev)
|
||||
exact = cmd_output(*exact_rev_cmd, cwd=tmp)[1].strip()
|
||||
if exact != rev:
|
||||
rev, frozen = exact, rev
|
||||
return self._replace(rev=rev, frozen=frozen)
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import itertools
|
||||
import logging
|
||||
import os.path
|
||||
import shlex
|
||||
import shutil
|
||||
import sys
|
||||
from typing import Optional
|
||||
|
@ -100,19 +101,17 @@ def _install_hook_script(
|
|||
args = ['hook-impl', f'--config={config_file}', f'--hook-type={hook_type}']
|
||||
if skip_on_missing_config:
|
||||
args.append('--skip-on-missing-config')
|
||||
params = {'INSTALL_PYTHON': sys.executable, 'ARGS': args}
|
||||
|
||||
with open(hook_path, 'w') as hook_file:
|
||||
contents = resource_text('hook-tmpl')
|
||||
before, rest = contents.split(TEMPLATE_START)
|
||||
to_template, after = rest.split(TEMPLATE_END)
|
||||
|
||||
before = before.replace('#!/usr/bin/env python3', shebang())
|
||||
_, after = rest.split(TEMPLATE_END)
|
||||
|
||||
hook_file.write(before + TEMPLATE_START)
|
||||
for line in to_template.splitlines():
|
||||
var = line.split()[0]
|
||||
hook_file.write(f'{var} = {params[var]!r}\n')
|
||||
hook_file.write(f'INSTALL_PYTHON={shlex.quote(sys.executable)}\n')
|
||||
# TODO: python3.8+: shlex.join
|
||||
args_s = ' '.join(shlex.quote(part) for part in args)
|
||||
hook_file.write(f'ARGS=({args_s})\n')
|
||||
hook_file.write(TEMPLATE_END + after)
|
||||
make_executable(hook_path)
|
||||
|
||||
|
|
|
@ -290,7 +290,7 @@ def _run_hooks(
|
|||
verbose=args.verbose, use_color=args.color,
|
||||
)
|
||||
retval |= current_retval
|
||||
if retval and config['fail_fast']:
|
||||
if retval and (config['fail_fast'] or hook.fail_fast):
|
||||
break
|
||||
if retval and args.show_diff_on_failure and prior_diff:
|
||||
if args.all_files:
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue