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

Side by Side 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 unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file.
5
6 # Knows how to pull down files from the version of Blink we forked from.
7
8 import argparse
9 import requests
10 import os
11 import sys
12
13 FORK_VERSION = "086acdd04cbe6fcb89b2fc6bd438fb8819a26776"
14
15 parser = argparse.ArgumentParser("Tool for resurrecting pre-fork Blink files.")
16 parser.add_argument("path", help="Path from Blink's Source root to the file."
17 "e.g. core/dom/ExecutionContextTask.h")
18 args = parser.parse_args()
19
20 BASE_URL = "http://blink.lc/blink/plain/Source/%s?id=%s"
21 url = BASE_URL % (args.path, FORK_VERSION)
22 response = requests.get(url)
23 if response.status_code != 200:
24 print "Load failure: %s" % url
25 sys.exit(0)
26 contents = response.text
27
28 file_name = os.path.basename(args.path)
29
30 if os.path.exists(file_name):
31 print "%s exists, do you want to overwrite [y/N]?" % file_name
32 if raw_input().lower() not in ('y', 'yes'):
33 print "Aborting."
34 sys.exit(1)
35
36 with open(file_name, "w+") as output:
37 output.write(contents)
38 print "Wrote %s" % file_name
OLDNEW
« 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