| 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 re | 5 import re |
| 6 import xml.dom.minidom as xml | 6 import xml.dom.minidom as xml |
| 7 | 7 |
| 8 from file_system import FileSystem | 8 import file_system |
| 9 from future import Future | 9 from future import Future |
| 10 | 10 |
| 11 class SubversionFileSystem(FileSystem): | 11 class SubversionFileSystem(file_system.FileSystem): |
| 12 """Class to fetch resources from src.chromium.org. | 12 """Class to fetch resources from src.chromium.org. |
| 13 """ | 13 """ |
| 14 def __init__(self, fetcher): | 14 def __init__(self, fetcher): |
| 15 self._fetcher = fetcher | 15 self._fetcher = fetcher |
| 16 | 16 |
| 17 def Read(self, paths): | 17 def Read(self, paths): |
| 18 return Future(delegate=_AsyncFetchFuture(paths, self._fetcher)) | 18 return Future(delegate=_AsyncFetchFuture(paths, self._fetcher)) |
| 19 | 19 |
| 20 def Stat(self, path): | 20 def Stat(self, path): |
| 21 directory = path.rsplit('/', 1)[0] | 21 directory = path.rsplit('/', 1)[0] |
| (...skipping 16 matching lines...) Expand all Loading... |
| 38 return files | 38 return files |
| 39 | 39 |
| 40 def Get(self): | 40 def Get(self): |
| 41 for path, future in self._fetches: | 41 for path, future in self._fetches: |
| 42 result = future.Get() | 42 result = future.Get() |
| 43 if result.status_code == 404: | 43 if result.status_code == 404: |
| 44 self._value[path] = None | 44 self._value[path] = None |
| 45 elif path.endswith('/'): | 45 elif path.endswith('/'): |
| 46 self._value[path] = self._ListDir(result.content) | 46 self._value[path] = self._ListDir(result.content) |
| 47 else: | 47 else: |
| 48 self._value[path] = result.content | 48 self._value[path] = file_system._ProcessFileData(result.content, path) |
| 49 if self._error is not None: | 49 if self._error is not None: |
| 50 raise self._error | 50 raise self._error |
| 51 return self._value | 51 return self._value |
| 52 | 52 |
| OLD | NEW |