Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(4677)

Unified Diff: chrome/common/extensions/docs/server2/fake_fetchers.py

Issue 491653002: Docserver: Use GitilesFileSystem instead of SubversionFileSystem (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: chrome/common/extensions/docs/server2/fake_fetchers.py
diff --git a/chrome/common/extensions/docs/server2/fake_fetchers.py b/chrome/common/extensions/docs/server2/fake_fetchers.py
index 4c132717b2230fb4e43b2932e2512c5a0dd17817..fa41456a39691a2c59143bf675a122a86401eb59 100644
--- a/chrome/common/extensions/docs/server2/fake_fetchers.py
+++ b/chrome/common/extensions/docs/server2/fake_fetchers.py
@@ -80,13 +80,18 @@ class _FakeSubversionServer(_FakeFetcher):
_GITILES_BASE_RE = re.escape(url_constants.GITILES_BASE)
_GITILES_BRANCH_BASE_RE = re.escape(url_constants.GITILES_BRANCH_BASE)
_GITILES_URL_TO_PATH_PATTERN = re.compile(
- r'(' + _GITILES_BASE_RE + r'|' + _GITILES_BRANCH_BASE_RE + r').+?/(.*)')
+ r'(' + _GITILES_BRANCH_BASE_RE + r'|' + _GITILES_BASE_RE + r').+?/(.*)')
def _ExtractPathFromGitilesUrl(url):
return _GITILES_URL_TO_PATH_PATTERN.match(url).group(2)
class _FakeGitilesServer(_FakeFetcher):
def fetch(self, url):
+ if _GITILES_URL_TO_PATH_PATTERN.match(url) is None:
+ return json.dumps({
+ 'commit': '1' * 40,
+ 'parents': ['0' * 40]
+ })
path = _ExtractPathFromGitilesUrl(url)
chromium_path = ChromiumPath(path)
if self._IsDir(chromium_path):
@@ -97,9 +102,11 @@ class _FakeGitilesServer(_FakeFetcher):
for f in self._ListDir(chromium_path):
if f.startswith('.'):
continue
+ f_path = os.path.join(chromium_path, f)
jsn['entries'].append({
- 'id': self._Stat(os.path.join(chromium_path, f)),
- 'name': f
+ 'id': self._Stat(f_path),
+ 'name': f,
+ 'type': 'tree' if self._IsDir(f_path) else 'blob'
})
return json.dumps(jsn)
try:

Powered by Google App Engine
This is Rietveld 408576698