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

Side by Side Diff: gcl.py

Issue 11190067: Revert "Fix a specific use case for the CQ." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Created 8 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« 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
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """\ 6 """\
7 Wrapper script around Rietveld's upload.py that simplifies working with groups 7 Wrapper script around Rietveld's upload.py that simplifies working with groups
8 of files. 8 of files.
9 """ 9 """
10 10
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after
116 def GetCachedFile(filename, max_age=60*60*24*3, use_root=False): 116 def GetCachedFile(filename, max_age=60*60*24*3, use_root=False):
117 """Retrieves a file from the repository and caches it in GetCacheDir() for 117 """Retrieves a file from the repository and caches it in GetCacheDir() for
118 max_age seconds. 118 max_age seconds.
119 119
120 use_root: If False, look up the arborescence for the first match, otherwise go 120 use_root: If False, look up the arborescence for the first match, otherwise go
121 directory to the root repository. 121 directory to the root repository.
122 122
123 Note: The cache will be inconsistent if the same file is retrieved with both 123 Note: The cache will be inconsistent if the same file is retrieved with both
124 use_root=True and use_root=False. Don't be stupid. 124 use_root=True and use_root=False. Don't be stupid.
125 """ 125 """
126 if not os.path.isdir(GetCacheDir()):
127 os.makedirs(GetCacheDir())
128
129 if filename not in FILES_CACHE: 126 if filename not in FILES_CACHE:
130 # Don't try to look up twice. 127 # Don't try to look up twice.
131 FILES_CACHE[filename] = None 128 FILES_CACHE[filename] = None
132 # First we check if we have a cached version. 129 # First we check if we have a cached version.
133 try: 130 try:
134 cached_file = os.path.join(GetCacheDir(), filename) 131 cached_file = os.path.join(GetCacheDir(), filename)
135 except (gclient_utils.Error, subprocess2.CalledProcessError): 132 except (gclient_utils.Error, subprocess2.CalledProcessError):
136 return None 133 return None
137 if (not os.path.exists(cached_file) or 134 if (not os.path.exists(cached_file) or
138 (time.time() - os.stat(cached_file).st_mtime) > max_age): 135 (time.time() - os.stat(cached_file).st_mtime) > max_age):
(...skipping 1321 matching lines...) Expand 10 before | Expand all | Expand 10 after
1460 raise 1457 raise
1461 print >> sys.stderr, ( 1458 print >> sys.stderr, (
1462 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith ' 1459 'AppEngine is misbehaving and returned HTTP %d, again. Keep faith '
1463 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e)) 1460 'and retry or visit go/isgaeup.\n%s') % (e.code, str(e))
1464 return 1 1461 return 1
1465 1462
1466 1463
1467 if __name__ == "__main__": 1464 if __name__ == "__main__":
1468 fix_encoding.fix_encoding() 1465 fix_encoding.fix_encoding()
1469 sys.exit(main(sys.argv[1:])) 1466 sys.exit(main(sys.argv[1:]))
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