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 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode |
| 7 from future import Future |
6 import xml.dom.minidom as xml | 8 import xml.dom.minidom as xml |
7 from xml.parsers.expat import ExpatError | 9 from xml.parsers.expat import ExpatError |
8 | 10 |
9 from appengine_url_fetcher import AppEngineUrlFetcher | 11 from appengine_url_fetcher import AppEngineUrlFetcher |
10 from docs_server_utils import StringIdentity | 12 from docs_server_utils import StringIdentity |
11 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode | |
12 from future import Future | 13 from future import Future |
13 import svn_constants | 14 import svn_constants |
14 import url_constants | 15 import url_constants |
15 | 16 |
16 class _AsyncFetchFuture(object): | 17 class _AsyncFetchFuture(object): |
17 def __init__(self, paths, fetcher, binary, args=None): | 18 def __init__(self, paths, fetcher, binary, args=None): |
18 def apply_args(path): | 19 def apply_args(path): |
19 return path if args is None else '%s?%s' % (path, args) | 20 return path if args is None else '%s?%s' % (path, args) |
20 # A list of tuples of the form (path, Future). | 21 # A list of tuples of the form (path, Future). |
21 self._fetches = [(path, fetcher.FetchAsync(apply_args(path))) | 22 self._fetches = [(path, fetcher.FetchAsync(apply_args(path))) |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
159 if path.endswith('/'): | 160 if path.endswith('/'): |
160 return stat_info | 161 return stat_info |
161 if filename not in stat_info.child_versions: | 162 if filename not in stat_info.child_versions: |
162 raise FileNotFoundError('%s was not in child versions' % filename) | 163 raise FileNotFoundError('%s was not in child versions' % filename) |
163 return StatInfo(stat_info.child_versions[filename]) | 164 return StatInfo(stat_info.child_versions[filename]) |
164 | 165 |
165 def GetIdentity(self): | 166 def GetIdentity(self): |
166 # NOTE: no revision here, consider it just an implementation detail of the | 167 # NOTE: no revision here, consider it just an implementation detail of the |
167 # file version that is handled by Stat. | 168 # file version that is handled by Stat. |
168 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) | 169 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) |
OLD | NEW |