Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(57)

Unified Diff: tools/release/update_node.py

Issue 2747123002: Add --commit option and some polish to update_node.py. (Closed)
Patch Set: address comments Created 3 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « tools/release/test_update_node.py ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/release/update_node.py
diff --git a/tools/release/update_node.py b/tools/release/update_node.py
index d4d2eafa114794a27294bf21d16ba9929a9eca38..f715547587d2b7f072d2df9e30c55420d3f6a294 100755
--- a/tools/release/update_node.py
+++ b/tools/release/update_node.py
@@ -34,7 +34,7 @@ ADD_TO_GITIGNORE = [ "/testing/gtest/*",
def RunGclient(path):
assert os.path.isdir(path)
print ">> Running gclient sync"
- subprocess.check_call("gclient sync --nohooks", cwd=path, shell=True)
+ subprocess.check_call(["gclient", "sync", "--nohooks"], cwd=path)
def UninitGit(path):
target = os.path.join(path, ".git")
@@ -53,15 +53,15 @@ def UpdateTarget(repository, options):
UninitGit(target)
git_commands = [
- "git init", # initialize target repo
- "git remote add origin %s" % source, # point to the source repo
- "git fetch origin HEAD", # sync to the current branch
- "git reset --hard FETCH_HEAD", # reset to the current branch
- "git clean -fd" # delete removed files
+ ["git", "init"], # initialize target repo
+ ["git", "remote", "add", "origin", source], # point to the source repo
+ ["git", "fetch", "origin", "HEAD"], # sync to the current branch
+ ["git", "reset", "--hard", "FETCH_HEAD"], # reset to the current branch
+ ["git", "clean", "-fd"], # delete removed files
]
try:
for command in git_commands:
- subprocess.check_call(command, cwd=target, shell=True);
+ subprocess.check_call(command, cwd=target)
except:
raise
finally:
@@ -87,12 +87,26 @@ def UpdateGitIgnore(options):
for x in content:
gitignore.write("%s\n" % x)
+def CreateCommit(options):
+ print ">> Creating commit."
+ # Find git hash from source.
+ githash = subprocess.check_output(["git", "rev-parse", "--short", "HEAD"],
+ cwd=options.v8_path).strip()
+ # Create commit at target.
+ git_commands = [
+ ["git", "checkout", "-b", "update_v8_to_%s" % githash], # new branch
+ ["git", "add", "."], # add files
+ ["git", "commit", "-m", "Update V8 to %s" % githash] # new commit
+ ]
+ for command in git_commands:
+ subprocess.check_call(command, cwd=options.node_path)
+
def ParseOptions(args):
parser = argparse.ArgumentParser(description="Update V8 in Node.js")
parser.add_argument("v8_path", help="Path to V8 checkout")
parser.add_argument("node_path", help="Path to Node.js checkout")
- parser.add_argument("--gclient", dest="gclient",
- action="store_true", help="Run gclient sync")
+ parser.add_argument("--gclient", action="store_true", help="Run gclient sync")
+ parser.add_argument("--commit", action="store_true", help="Create commit")
options = parser.parse_args(args)
assert os.path.isdir(options.v8_path)
options.v8_path = os.path.abspath(options.v8_path)
@@ -110,6 +124,8 @@ def Main(args):
UpdateGitIgnore(options)
for repo in SUB_REPOSITORIES:
UpdateTarget(repo, options)
+ if options.commit:
+ CreateCommit(options)
if __name__ == "__main__":
Main(sys.argv[1:])
« no previous file with comments | « tools/release/test_update_node.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698