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

Unified Diff: py/utils/gs_utils.py

Issue 697043003: Add source generation to GSUtils.download_file. (Closed) Base URL: https://skia.googlesource.com/common.git@master
Patch Set: Address comments. 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: py/utils/gs_utils.py
diff --git a/py/utils/gs_utils.py b/py/utils/gs_utils.py
index fd9999c3872fc4c1d2c7a3492bd2da74c0dc6265..a125b68a633e28d7d8161af242a2e91c4359e869 100644
--- a/py/utils/gs_utils.py
+++ b/py/utils/gs_utils.py
@@ -411,7 +411,7 @@ class GSUtils(object):
q.join()
def download_file(self, source_bucket, source_path, dest_path,
- create_subdirs_if_needed=False):
+ create_subdirs_if_needed=False, source_generation=None):
"""Downloads a single file from Google Cloud Storage to local disk.
Args:
@@ -420,10 +420,13 @@ class GSUtils(object):
dest_path: full path (local-OS-style) on local disk to copy the file to
create_subdirs_if_needed: boolean; whether to create subdirectories as
needed to create dest_path
+ source_generation: the generation version of the source
"""
b = self._connect_to_bucket(bucket=source_bucket)
key = Key(b)
key.name = source_path
+ if source_generation:
+ key.generation = source_generation
if create_subdirs_if_needed:
_makedirs_if_needed(os.path.dirname(dest_path))
with open(dest_path, 'w') as f:
« 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