in pytest_rally/plugin.py [0:0]
def pytest_cmdline_main(config):
def current_branch(repo):
# This works around `git branch --show-current` not being available
# in older versions of Git
cmd = f'git -C {repo} branch'
branches = run_command_with_output(cmd).split("\n")
current = next(filter(lambda b: b.startswith("*"), branches))
if "detached" in current:
return run_command_with_output(f'git -C {repo} rev-parse HEAD').rstrip("\n")
else:
return current.split()[1].strip()
repo = config.getoption("--track-repository", str(config.rootdir))
rev = config.getoption("--track-revision", current_branch(repo))
config.option.track_repository = repo
config.option.track_revision = rev