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

Unified Diff: sky/tools/resurrect.py

Issue 732193002: Add a little script for resurrecting pre-fork Blink files (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 6 years, 1 month 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sky/tools/resurrect.py
diff --git a/sky/tools/resurrect.py b/sky/tools/resurrect.py
new file mode 100755
index 0000000000000000000000000000000000000000..878eca5e181a153b7d3ba9139f71f0c2f36f95fe
--- /dev/null
+++ b/sky/tools/resurrect.py
@@ -0,0 +1,38 @@
+#!/usr/bin/env python
+# Copyright 2014 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+# Knows how to pull down files from the version of Blink we forked from.
+
+import argparse
+import requests
+import os
+import sys
+
+FORK_VERSION = "086acdd04cbe6fcb89b2fc6bd438fb8819a26776"
+
+parser = argparse.ArgumentParser("Tool for resurrecting pre-fork Blink files.")
+parser.add_argument("path", help="Path from Blink's Source root to the file."
+ "e.g. core/dom/ExecutionContextTask.h")
+args = parser.parse_args()
+
+BASE_URL = "http://blink.lc/blink/plain/Source/%s?id=%s"
+url = BASE_URL % (args.path, FORK_VERSION)
+response = requests.get(url)
+if response.status_code != 200:
+ print "Load failure: %s" % url
+ sys.exit(0)
+contents = response.text
+
+file_name = os.path.basename(args.path)
+
+if os.path.exists(file_name):
+ print "%s exists, do you want to overwrite [y/N]?" % file_name
+ if raw_input().lower() not in ('y', 'yes'):
+ print "Aborting."
+ sys.exit(1)
+
+with open(file_name, "w+") as output:
+ output.write(contents)
+ print "Wrote %s" % file_name
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698