OLD | NEW |
---|---|
1 # Copyright 2013 The Chromium Authors. All rights reserved. | 1 # Copyright 2013 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 from compiled_file_system import CompiledFileSystem | 5 from compiled_file_system import CompiledFileSystem |
6 from docs_server_utils import StringIdentity | 6 from docs_server_utils import StringIdentity |
7 from file_system import FileNotFoundError | 7 from file_system import FileNotFoundError |
8 from future import Future | 8 from future import Future |
9 from path_util import ToDirectory | 9 from path_util import ToDirectory |
10 | 10 |
(...skipping 28 matching lines...) Expand all Loading... | |
39 # Identity, as computed by all file systems. | 39 # Identity, as computed by all file systems. |
40 StringIdentity(*(fs.GetIdentity() for fs in self._file_system_chain))) | 40 StringIdentity(*(fs.GetIdentity() for fs in self._file_system_chain))) |
41 | 41 |
42 def __init__(self, compiled_fs_chain, identity): | 42 def __init__(self, compiled_fs_chain, identity): |
43 '''|compiled_fs_chain| is a list of tuples (compiled_fs, file_system). | 43 '''|compiled_fs_chain| is a list of tuples (compiled_fs, file_system). |
44 ''' | 44 ''' |
45 assert len(compiled_fs_chain) > 0 | 45 assert len(compiled_fs_chain) > 0 |
46 self._compiled_fs_chain = compiled_fs_chain | 46 self._compiled_fs_chain = compiled_fs_chain |
47 self._identity = identity | 47 self._identity = identity |
48 | 48 |
49 def GetFromFile(self, path): | 49 def GetFromFile(self, path, skip_not_found=False): |
50 return self._GetImpl( | 50 return self._GetImpl( |
51 path, | 51 path, |
52 lambda compiled_fs: compiled_fs.GetFromFile(path), | 52 lambda compiled_fs: compiled_fs.GetFromFile(path, skip_not_found), |
not at google - send to devlin
2014/08/21 21:39:58
skip_not_found=skip_not_found (sorry)
| |
53 lambda compiled_fs: compiled_fs.GetFileVersion(path)) | 53 lambda compiled_fs: compiled_fs.GetFileVersion(path)) |
54 | 54 |
55 def GetFromFileListing(self, path): | 55 def GetFromFileListing(self, path): |
56 path = ToDirectory(path) | 56 path = ToDirectory(path) |
57 return self._GetImpl( | 57 return self._GetImpl( |
58 path, | 58 path, |
59 lambda compiled_fs: compiled_fs.GetFromFileListing(path), | 59 lambda compiled_fs: compiled_fs.GetFromFileListing(path), |
60 lambda compiled_fs: compiled_fs.GetFileListingVersion(path)) | 60 lambda compiled_fs: compiled_fs.GetFileListingVersion(path)) |
61 | 61 |
62 def _GetImpl(self, path, reader, version_getter): | 62 def _GetImpl(self, path, reader, version_getter): |
(...skipping 21 matching lines...) Expand all Loading... | |
84 return read_future.Get() | 84 return read_future.Get() |
85 except FileNotFoundError: | 85 except FileNotFoundError: |
86 pass | 86 pass |
87 # Try an arbitrary operation again to generate a realistic stack trace. | 87 # Try an arbitrary operation again to generate a realistic stack trace. |
88 return read_futures[0][0].Get() | 88 return read_futures[0][0].Get() |
89 | 89 |
90 return Future(callback=resolve) | 90 return Future(callback=resolve) |
91 | 91 |
92 def GetIdentity(self): | 92 def GetIdentity(self): |
93 return self._identity | 93 return self._identity |
OLD | NEW |