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

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

Issue 68873003: Docserver: Serve docs out of src/ not src/chrome/common/extensions. This allows (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix samples Created 7 years, 1 month 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/rietveld_patcher.py
diff --git a/chrome/common/extensions/docs/server2/rietveld_patcher.py b/chrome/common/extensions/docs/server2/rietveld_patcher.py
index adc1b952a4c419d3068747d884cd6af6c8e80dc4..2ef8bc5015847c960a63669725b273b71d4f312f 100644
--- a/chrome/common/extensions/docs/server2/rietveld_patcher.py
+++ b/chrome/common/extensions/docs/server2/rietveld_patcher.py
@@ -9,7 +9,7 @@ from StringIO import StringIO
from file_system import FileNotFoundError, ToUnicode
from future import Future
from patcher import Patcher
-import svn_constants
+
_CHROMIUM_REPO_BASEURLS = [
'https://src.chromium.org/svn/trunk/src/',
@@ -19,11 +19,6 @@ _CHROMIUM_REPO_BASEURLS = [
'http://git.chromium.org/chromium/src.git@master',
]
-_DOCS_PATHS = [
- svn_constants.API_PATH,
- svn_constants.TEMPLATE_PATH,
- svn_constants.STATIC_PATH
-]
class RietveldPatcherError(Exception):
def __init__(self, message):
@@ -31,13 +26,11 @@ class RietveldPatcherError(Exception):
class _AsyncFetchFuture(object):
def __init__(self,
- base_path,
issue,
patchset,
files,
binary,
fetcher):
- self._base_path = base_path
self._issue = issue
self._patchset = patchset
self._files = files
@@ -60,10 +53,7 @@ class _AsyncFetchFuture(object):
self._value = {}
for path in self._files:
- if self._base_path:
- tar_path = 'b/%s/%s' % (self._base_path, path)
- else:
- tar_path = 'b/%s' % path
+ tar_path = 'b/%s' % path
patched_file = None
try:
@@ -94,10 +84,8 @@ class RietveldPatcher(Patcher):
''' Class to fetch resources from a patchset in Rietveld.
'''
def __init__(self,
- base_path,
issue,
fetcher):
- self._base_path = base_path
self._issue = issue
self._fetcher = fetcher
self._cache = None
@@ -145,31 +133,25 @@ class RietveldPatcher(Patcher):
added = []
deleted = []
modified = []
- for key in files:
- if not key.startswith(self._base_path + '/'):
- continue
-
- f = key.split(self._base_path + '/', 1)[1]
- if any(f.startswith(path) for path in _DOCS_PATHS):
- status = (files[key].get('status') or 'M')
- # status can be 'A ' or 'A + '
- if 'A' in status:
- added.append(f)
- elif 'D' in status:
- deleted.append(f)
- elif 'M' in status:
- modified.append(f)
- else:
- raise RietveldPatcherError('Unknown file status for file %s: "%s."' %
- (key, status))
+ for f in files:
+ status = (files[f].get('status') or 'M')
+ # status can be 'A ' or 'A + '
+ if 'A' in status:
+ added.append(f)
+ elif 'D' in status:
+ deleted.append(f)
+ elif 'M' in status:
+ modified.append(f)
+ else:
+ raise RietveldPatcherError('Unknown file status for file %s: "%s."' %
+ (key, status))
return (added, deleted, modified)
def Apply(self, paths, file_system, binary, version=None):
if version is None:
version = self.GetVersion()
- return Future(delegate=_AsyncFetchFuture(self._base_path,
- self._issue,
+ return Future(delegate=_AsyncFetchFuture(self._issue,
version,
paths,
binary,

Powered by Google App Engine
This is Rietveld 408576698