Browse Source

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

Jeremy Apthorp 6 years ago
parent
commit
341592119f
3 changed files with 13 additions and 8 deletions
  1. 1 1
      script/apply_all_patches.py
  2. 1 7
      script/git-import-patches
  3. 11 0
      script/lib/git.py

+ 1 - 1
script/apply_all_patches.py

@@ -10,7 +10,7 @@ from lib.patches import patch_from_dir
 
 def apply_patches(dirs):
   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")
 
 

+ 1 - 7
script/git-import-patches

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

+ 11 - 0
script/lib/git.py

@@ -86,6 +86,17 @@ def apply_patch(repo, patch_path, directory=None, index=False, reverse=False):
   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):
   args = ['git', '-C', repo, 'diff-tree',
           '-p',