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

Unified Diff: tools/get_archive.py

Issue 10860015: Prevent get_archive.py from going into an infinite loop if you request a (Closed) Base URL: http://dart.googlecode.com/svn/branches/bleeding_edge/dart/
Patch Set: Created 8 years, 4 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 | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: tools/get_archive.py
===================================================================
--- tools/get_archive.py (revision 10904)
+++ tools/get_archive.py (working copy)
@@ -161,6 +161,8 @@
else:
# Now try to find one with a nearby CL num.
revision_num = int(revision_num) - 1
+ if revision_num <= 0:
+ too_early_error()
return latest
get_from_gsutil(name, directory, version_file, latest_pattern, osdict,
@@ -286,6 +288,13 @@
print 'Successfully downloaded to %s' % directory
return 0
+def too_early_error():
+ """Quick shortcutting function, to return early if someone requests a revision
+ that is smaller than the earliest stored. This saves us from doing repeated
+ requests until we get down to 0."""
+ print ('Unable to download requested revision because it is earlier than the '
+ 'earliest revision stored.')
+ sys.exit(1)
def main():
parser = optparse.OptionParser(usage='usage: %prog [options] download_name')
@@ -296,17 +305,25 @@
args, positional = parser.parse_args()
if positional[0] == 'dartium':
+ if args.revision < 4285:
Emily Fortuna 2012/08/17 19:52:02 I'm not a fan of hard-coding the "earliest revisio
+ return too_early_error()
get_dartium_revision('Dartium', DARTIUM_DIR, DARTIUM_VERSION,
DARTIUM_LATEST_PATTERN, DARTIUM_PERMANENT_PATTERN,
args.revision)
elif positional[0] == 'chromedriver':
+ if args.revision < 7823:
+ return too_early_error()
get_dartium_revision('chromedriver', CHROMEDRIVER_DIR, CHROMEDRIVER_VERSION,
CHROMEDRIVER_LATEST_PATTERN,
CHROMEDRIVER_PERMANENT_PATTERN, args.revision)
elif positional[0] == 'sdk':
+ if args.revision < 9761:
+ return too_early_error()
get_sdk_revision('sdk', SDK_DIR, SDK_VERSION, SDK_LATEST_PATTERN,
SDK_PERMANENT, args.revision)
elif positional[0] == 'drt':
+ if args.revision < 5342:
+ return too_early_error()
get_dartium_revision('DumpRenderTree', DRT_DIR, DRT_VERSION,
DRT_LATEST_PATTERN, DRT_PERMANENT_PATTERN,
args.revision)
« 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