| Index: chrome/common/extensions/docs/server2/subversion_fetcher.py
|
| diff --git a/chrome/common/extensions/docs/server2/subversion_fetcher.py b/chrome/common/extensions/docs/server2/subversion_fetcher.py
|
| index b9d881a810fee4c12c21f7e6118777871c9b7f5c..803381bf052223edd14cdf254fff144f2cfa07ad 100644
|
| --- a/chrome/common/extensions/docs/server2/subversion_fetcher.py
|
| +++ b/chrome/common/extensions/docs/server2/subversion_fetcher.py
|
| @@ -2,6 +2,8 @@
|
| # Use of this source code is governed by a BSD-style license that can be
|
| # found in the LICENSE file.
|
|
|
| +import xml.dom.minidom as xml
|
| +
|
| SUBVERSION_URL = 'http://src.chromium.org/chrome'
|
| TRUNK_URL = SUBVERSION_URL + '/trunk'
|
| BRANCH_URL = SUBVERSION_URL + '/branches'
|
| @@ -18,5 +20,30 @@ class SubversionFetcher(object):
|
| return TRUNK_URL + '/src'
|
| return BRANCH_URL + '/' + branch + '/src'
|
|
|
| + def _ListDir(self, directory):
|
| + dom = xml.parseString(directory)
|
| + files = [elem.childNodes[0].data for elem in dom.getElementsByTagName('a')]
|
| + if '..' in files:
|
| + files.remove('..')
|
| + return files
|
| +
|
| + def _RecursiveList(self, files, base):
|
| + all_files = []
|
| + for filename in files:
|
| + if filename.endswith('/'):
|
| + dir_name = base + '/' + filename.split('/')[-2]
|
| + all_files.extend(self.ListDirectory(dir_name, True).content)
|
| + else:
|
| + all_files.append(base + '/' + filename)
|
| + return all_files
|
| +
|
| + def ListDirectory(self, path, recursive=False):
|
| + result = self._url_fetcher.fetch(self._base_path + '/' + path)
|
| + result.content = self._ListDir(result.content)
|
| + if recursive:
|
| + result.content = self._RecursiveList(result.content, path)
|
| + return result
|
| +
|
| def FetchResource(self, path):
|
| return self._url_fetcher.fetch(self._base_path + '/' + path)
|
| +
|
|
|