build: actually run import-patches on gclient sync (#17885)

This commit is contained in:
Jeremy Apthorp 2019-04-23 10:28:26 -07:00 committed by Charles Kerr
parent bb9e92a5d9
commit 341592119f
3 changed files with 13 additions and 8 deletions

View file

@ -10,7 +10,7 @@ from lib.patches import patch_from_dir
def apply_patches(dirs): def apply_patches(dirs):
for patch_dir, repo in dirs.iteritems(): for patch_dir, repo in dirs.iteritems():
git.am(repo=repo, patch_data=patch_from_dir(patch_dir), git.import_patches(repo=repo, patch_data=patch_from_dir(patch_dir),
committer_name="Electron Scripts", committer_email="scripts@electron") committer_name="Electron Scripts", committer_email="scripts@electron")

View file

@ -17,13 +17,7 @@ def main(argv):
help="use 3-way merge to resolve conflicts") help="use 3-way merge to resolve conflicts")
args = parser.parse_args(argv) args = parser.parse_args(argv)
# save the upstream HEAD so we can refer to it when we later export patches git.import_patches(
git.update_ref(
repo='.',
ref='refs/patches/upstream-head',
newvalue='HEAD'
)
git.am(
repo='.', repo='.',
patch_data=patch_from_dir(args.patch_dir), patch_data=patch_from_dir(args.patch_dir),
threeway=args.threeway threeway=args.threeway

View file

@ -86,6 +86,17 @@ def apply_patch(repo, patch_path, directory=None, index=False, reverse=False):
return applied_successfully 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"""
update_ref(
repo=repo,
ref='refs/patches/upstream-head',
newvalue='HEAD'
)
am(repo=repo, **kwargs)
def get_patch(repo, commit_hash): def get_patch(repo, commit_hash):
args = ['git', '-C', repo, 'diff-tree', args = ['git', '-C', repo, 'diff-tree',
'-p', '-p',