build: remove dead python methods and helper (#28884)

This commit is contained in:
Samuel Attard 2021-04-28 00:39:30 -07:00 committed by GitHub
parent e373df3bc3
commit 56c3103e73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 0 additions and 275 deletions

View file

@ -77,25 +77,6 @@ def am(repo, patch_data, threeway=False, directory=None, exclude=None,
proc.returncode))
def apply_patch(repo, patch_path, directory=None, index=False, reverse=False):
args = ['git', '-C', repo, 'apply',
'--ignore-space-change',
'--ignore-whitespace',
'--whitespace', 'fix'
]
if directory:
args += ['--directory', directory]
if index:
args += ['--index']
if reverse:
args += ['--reverse']
args += ['--', patch_path]
return_code = subprocess.call(args)
applied_successfully = (return_code == 0)
return applied_successfully
def import_patches(repo, **kwargs):
"""same as am(), but we save the upstream HEAD so we can refer to it when we
later export patches"""
@ -107,52 +88,12 @@ def import_patches(repo, **kwargs):
am(repo=repo, **kwargs)
def get_patch(repo, commit_hash):
args = ['git', '-C', repo, 'diff-tree',
'-p',
commit_hash,
'--' # Explicitly tell Git `commit_hash` is a revision, not a path.
]
return subprocess.check_output(args).decode('utf-8')
def get_head_commit(repo):
args = ['git', '-C', repo, 'rev-parse', 'HEAD']
return subprocess.check_output(args).decode('utf-8').strip()
def update_ref(repo, ref, newvalue):
args = ['git', '-C', repo, 'update-ref', ref, newvalue]
return subprocess.check_call(args)
def reset(repo):
args = ['git', '-C', repo, 'reset']
subprocess.check_call(args)
def commit(repo, author, message):
"""Commit whatever in the index is now."""
# Let's setup committer info so git won't complain about it being missing.
# TODO: Is there a better way to set committer's name and email?
env = os.environ.copy()
env['GIT_COMMITTER_NAME'] = 'Anonymous Committer'
env['GIT_COMMITTER_EMAIL'] = 'anonymous@electronjs.org'
args = ['git', '-C', repo, 'commit',
'--author', author,
'--message', message
]
return_code = subprocess.call(args, env=env)
committed_successfully = (return_code == 0)
return committed_successfully
def get_upstream_head(repo):
args = [
'git',