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 xml.dom.minidom as xml | 6 import xml.dom.minidom as xml |
7 from xml.parsers.expat import ExpatError | 7 from xml.parsers.expat import ExpatError |
8 | 8 |
9 from appengine_url_fetcher import AppEngineUrlFetcher | 9 from appengine_url_fetcher import AppEngineUrlFetcher |
10 from docs_server_utils import StringIdentity | 10 from docs_server_utils import StringIdentity |
(...skipping 36 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
47 else: | 47 else: |
48 self._value[path] = result.content | 48 self._value[path] = result.content |
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 |
53 class SubversionFileSystem(FileSystem): | 53 class SubversionFileSystem(FileSystem): |
54 '''Class to fetch resources from src.chromium.org. | 54 '''Class to fetch resources from src.chromium.org. |
55 ''' | 55 ''' |
56 @staticmethod | 56 @staticmethod |
57 def Create(branch, revision=None): | 57 def Create(branch='trunk', revision=None): |
58 if branch == 'trunk': | 58 if branch == 'trunk': |
59 svn_path = 'trunk/src/%s' % svn_constants.EXTENSIONS_PATH | 59 svn_path = 'trunk/src/%s' % svn_constants.EXTENSIONS_PATH |
60 else: | 60 else: |
61 svn_path = 'branches/%s/src/%s' % (branch, | 61 svn_path = 'branches/%s/src/%s' % (branch, svn_constants.EXTENSIONS_PATH) |
62 svn_constants.EXTENSIONS_PATH) | |
63 return SubversionFileSystem( | 62 return SubversionFileSystem( |
64 AppEngineUrlFetcher('%s/%s' % (url_constants.SVN_URL, svn_path)), | 63 AppEngineUrlFetcher('%s/%s' % (url_constants.SVN_URL, svn_path)), |
65 AppEngineUrlFetcher('%s/%s' % (url_constants.VIEWVC_URL, svn_path)), | 64 AppEngineUrlFetcher('%s/%s' % (url_constants.VIEWVC_URL, svn_path)), |
66 svn_path, | 65 svn_path, |
67 revision=revision) | 66 revision=revision) |
68 | 67 |
69 def __init__(self, file_fetcher, stat_fetcher, svn_path, revision=None): | 68 def __init__(self, file_fetcher, stat_fetcher, svn_path, revision=None): |
70 self._file_fetcher = file_fetcher | 69 self._file_fetcher = file_fetcher |
71 self._stat_fetcher = stat_fetcher | 70 self._stat_fetcher = stat_fetcher |
72 self._svn_path = svn_path | 71 self._svn_path = svn_path |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
160 if path.endswith('/'): | 159 if path.endswith('/'): |
161 return stat_info | 160 return stat_info |
162 if filename not in stat_info.child_versions: | 161 if filename not in stat_info.child_versions: |
163 raise FileNotFoundError('%s was not in child versions' % filename) | 162 raise FileNotFoundError('%s was not in child versions' % filename) |
164 return StatInfo(stat_info.child_versions[filename]) | 163 return StatInfo(stat_info.child_versions[filename]) |
165 | 164 |
166 def GetIdentity(self): | 165 def GetIdentity(self): |
167 # NOTE: no revision here, consider it just an implementation detail of the | 166 # NOTE: no revision here, consider it just an implementation detail of the |
168 # file version that is handled by Stat. | 167 # file version that is handled by Stat. |
169 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) | 168 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) |
OLD | NEW |