OLD | NEW |
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 # Use of this source code is governed by a BSD-style license that can be | 2 # Use of this source code is governed by a BSD-style license that can be |
3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
4 | 4 |
5 import posixpath | 5 import posixpath |
6 import sys | 6 import sys |
7 | 7 |
8 from file_system import FileSystem, StatInfo, FileNotFoundError | 8 from file_system import FileSystem, StatInfo, FileNotFoundError |
9 from future import Future | 9 from future import Future |
10 from object_store_creator import ObjectStoreCreator | 10 from object_store_creator import ObjectStoreCreator |
(...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
72 if dir_stat is None: | 72 if dir_stat is None: |
73 dir_stat = self._file_system.Stat(dir_path) | 73 dir_stat = self._file_system.Stat(dir_path) |
74 assert dir_stat is not None # should raise a FileNotFoundError | 74 assert dir_stat is not None # should raise a FileNotFoundError |
75 self._stat_object_store.Set(dir_path, dir_stat) | 75 self._stat_object_store.Set(dir_path, dir_stat) |
76 | 76 |
77 if path == dir_path: | 77 if path == dir_path: |
78 stat_info = dir_stat | 78 stat_info = dir_stat |
79 else: | 79 else: |
80 file_version = dir_stat.child_versions.get(file_path) | 80 file_version = dir_stat.child_versions.get(file_path) |
81 if file_version is None: | 81 if file_version is None: |
82 raise FileNotFoundError('No stat found for %s in %s' % (path, dir_path)) | 82 raise FileNotFoundError('No stat found for %s in %s (found %s)' % |
| 83 (path, dir_path, dir_stat.child_versions)) |
83 stat_info = StatInfo(file_version) | 84 stat_info = StatInfo(file_version) |
84 | 85 |
85 return stat_info | 86 return stat_info |
86 | 87 |
87 def Read(self, paths, binary=False): | 88 def Read(self, paths, binary=False): |
88 '''Reads a list of files. If a file is in memcache and it is not out of | 89 '''Reads a list of files. If a file is in memcache and it is not out of |
89 date, it is returned. Otherwise, the file is retrieved from the file system. | 90 date, it is returned. Otherwise, the file is retrieved from the file system. |
90 ''' | 91 ''' |
91 read_object_store = (self._read_binary_object_store if binary else | 92 read_object_store = (self._read_binary_object_store if binary else |
92 self._read_object_store) | 93 self._read_object_store) |
(...skipping 27 matching lines...) Expand all Loading... |
120 uncached, | 121 uncached, |
121 results, | 122 results, |
122 self, | 123 self, |
123 read_object_store)) | 124 read_object_store)) |
124 | 125 |
125 def GetIdentity(self): | 126 def GetIdentity(self): |
126 return self._file_system.GetIdentity() | 127 return self._file_system.GetIdentity() |
127 | 128 |
128 def __repr__(self): | 129 def __repr__(self): |
129 return '%s of <%s>' % (type(self).__name__, repr(self._file_system)) | 130 return '%s of <%s>' % (type(self).__name__, repr(self._file_system)) |
OLD | NEW |