##// END OF EJS Templates
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite...
copies-rust: rename Oracle.is_ancestor to Oracle.is_overwrite The core information that we want here is about "does information from revision X overwrite information in Y". To do so, we check is X is an ancestors of Y, but this is an implementation details, they could be other ways. We update the naming to clarify this (and align more with wording used in upcoming changesets. For people curious about other ways: for example we could record the overwrite graph as it happens and reuse that to check if X overwrite Y, without having to do potential expensive `is_ancestor` call on the revision graph. Differential Revision: https://phab.mercurial-scm.org/D9496

File last commit:

r43346:2372284d default
r46769:ecbb2fc9 default
Show More
automation.py
74 lines | 1.7 KiB | text/x-python | PythonLexer
Gregory Szorc
automation: perform tasks on remote machines...
r42191 #!/usr/bin/env python3
#
# automation.py - Perform tasks on remote machines
#
# Copyright 2019 Gregory Szorc <gregory.szorc@gmail.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import os
import pathlib
import subprocess
import sys
import venv
HERE = pathlib.Path(os.path.abspath(__file__)).parent
REQUIREMENTS_TXT = HERE / 'requirements.txt'
SOURCE_DIR = HERE.parent.parent
VENV = SOURCE_DIR / 'build' / 'venv-automation'
def bootstrap():
venv_created = not VENV.exists()
VENV.parent.mkdir(exist_ok=True)
venv.create(VENV, with_pip=True)
if os.name == 'nt':
venv_bin = VENV / 'Scripts'
pip = venv_bin / 'pip.exe'
python = venv_bin / 'python.exe'
else:
venv_bin = VENV / 'bin'
pip = venv_bin / 'pip'
python = venv_bin / 'python'
Augie Fackler
formatting: blacken the codebase...
r43346 args = [
str(pip),
'install',
'-r',
str(REQUIREMENTS_TXT),
'--disable-pip-version-check',
]
Gregory Szorc
automation: perform tasks on remote machines...
r42191
if not venv_created:
args.append('-q')
subprocess.run(args, check=True)
os.environ['HGAUTOMATION_BOOTSTRAPPED'] = '1'
Augie Fackler
formatting: blacken the codebase...
r43346 os.environ['PATH'] = '%s%s%s' % (venv_bin, os.pathsep, os.environ['PATH'])
Gregory Szorc
automation: perform tasks on remote machines...
r42191
subprocess.run([str(python), __file__] + sys.argv[1:], check=True)
def run():
import hgautomation.cli as cli
# Need to strip off main Python executable.
cli.main()
if __name__ == '__main__':
try:
if 'HGAUTOMATION_BOOTSTRAPPED' not in os.environ:
bootstrap()
else:
run()
except subprocess.CalledProcessError as e:
sys.exit(e.returncode)
except KeyboardInterrupt:
sys.exit(1)