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 logging | |
6 import re | |
7 import posixpath | 5 import posixpath |
| 6 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode |
| 7 from future import Future |
8 import xml.dom.minidom as xml | 8 import xml.dom.minidom as xml |
9 from xml.parsers.expat import ExpatError | 9 from xml.parsers.expat import ExpatError |
10 | 10 |
11 from appengine_url_fetcher import AppEngineUrlFetcher | 11 from appengine_url_fetcher import AppEngineUrlFetcher |
12 from docs_server_utils import StringIdentity | 12 from docs_server_utils import StringIdentity |
13 from file_system import FileSystem, FileNotFoundError, StatInfo, ToUnicode | |
14 from future import Future | 13 from future import Future |
15 import svn_constants | 14 import svn_constants |
16 import url_constants | 15 import url_constants |
17 | 16 |
18 class _AsyncFetchFuture(object): | 17 class _AsyncFetchFuture(object): |
19 def __init__(self, paths, fetcher, binary): | 18 def __init__(self, paths, fetcher, binary): |
20 # A list of tuples of the form (path, Future). | 19 # A list of tuples of the form (path, Future). |
21 self._fetches = [(path, fetcher.FetchAsync(path)) | 20 self._fetches = [(path, fetcher.FetchAsync(path)) |
22 for path in paths] | 21 for path in paths] |
23 self._value = {} | 22 self._value = {} |
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
148 'Got 404 when fetching %s from %s for Stat' % (path, directory)) | 147 'Got 404 when fetching %s from %s for Stat' % (path, directory)) |
149 stat_info = self._CreateStatInfo(result.content) | 148 stat_info = self._CreateStatInfo(result.content) |
150 if path.endswith('/'): | 149 if path.endswith('/'): |
151 return stat_info | 150 return stat_info |
152 if filename not in stat_info.child_versions: | 151 if filename not in stat_info.child_versions: |
153 raise FileNotFoundError('%s was not in child versions' % filename) | 152 raise FileNotFoundError('%s was not in child versions' % filename) |
154 return StatInfo(stat_info.child_versions[filename]) | 153 return StatInfo(stat_info.child_versions[filename]) |
155 | 154 |
156 def GetIdentity(self): | 155 def GetIdentity(self): |
157 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) | 156 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) |
OLD | NEW |