ansible-test local change detection: use --base-branch if specified (#69508)

pull/69592/head
Felix Fontein 4 years ago committed by GitHub
parent ecea15c508
commit 43acd61901
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -0,0 +1,2 @@
bugfixes:
- "ansible-test - for local change detection, allow to specify branch to compare to with ``--base-branch`` for all types of tests (https://github.com/ansible/ansible/pull/69508)."

@ -203,9 +203,11 @@ class LocalChanges:
# diff of all tracked files from fork point to working copy
self.diff = self.git.get_diff([self.fork_point])
@staticmethod
def is_official_branch(name): # type: (str) -> bool
def is_official_branch(self, name): # type: (str) -> bool
"""Return True if the given branch name an official branch for development or releases."""
if self.args.base_branch:
return name == self.args.base_branch
if name == 'devel':
return True

@ -309,6 +309,9 @@ def parse_args():
test.add_argument('--metadata',
help=argparse.SUPPRESS)
test.add_argument('--base-branch',
help='base branch used for change detection')
add_changes(test, argparse)
add_environments(test)
@ -527,9 +530,6 @@ def parse_args():
choices=SUPPORTED_PYTHON_VERSIONS + ('default',),
help='python version: %s' % ', '.join(SUPPORTED_PYTHON_VERSIONS))
sanity.add_argument('--base-branch',
help=argparse.SUPPRESS)
sanity.add_argument('--enable-optional-errors',
action='store_true',
help='enable optional errors')

@ -193,6 +193,7 @@ class TestConfig(EnvironmentConfig):
self.unstaged = args.unstaged # type: bool
self.changed_from = args.changed_from # type: str
self.changed_path = args.changed_path # type: t.List[str]
self.base_branch = args.base_branch # type: str
self.lint = args.lint if 'lint' in args else False # type: bool
self.junit = args.junit if 'junit' in args else False # type: bool
@ -241,7 +242,6 @@ class SanityConfig(TestConfig):
self.list_tests = args.list_tests # type: bool
self.allow_disabled = args.allow_disabled # type: bool
self.enable_optional_errors = args.enable_optional_errors # type: bool
self.base_branch = args.base_branch # type: str
self.info_stderr = self.lint

Loading…
Cancel
Save