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

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

Issue 14125010: Docserver: Add support for viewing docs with a codereview patch applied (Closed) Base URL: https://src.chromium.org/svn/trunk/src/
Patch Set: Created 7 years, 8 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/server_instance.py
===================================================================
--- chrome/common/extensions/docs/server2/server_instance.py (revision 196927)
+++ chrome/common/extensions/docs/server2/server_instance.py (working copy)
@@ -24,8 +24,11 @@
from local_file_system import LocalFileSystem
from object_store_creator import ObjectStoreCreator
from offline_file_system import OfflineFileSystem
+from patch_servlet import PatchData
+from patched_file_system import PatchedFileSystem
from path_canonicalizer import PathCanonicalizer
from reference_resolver import ReferenceResolver
+from rietveld_file_system import RietveldFileSystem
from samples_data_source import SamplesDataSource
from sidenav_data_source import SidenavDataSource
from subversion_file_system import SubversionFileSystem
@@ -50,7 +53,7 @@
@staticmethod
@memoize
- def GetOrCreateOffline(channel):
+ def GetOrCreateOffline(channel, branch_path=None):
'''Gets/creates a local ServerInstance, meaning that only resources local to
the server - memcache, object store, etc, are queried. This amounts to not
setting up the subversion nor github file systems.
@@ -63,6 +66,7 @@
# for the caches to exist.
return ServerInstance(
channel,
+ branch_path,
object_store_creator_factory,
CachingFileSystem(OfflineFileSystem(SubversionFileSystem),
object_store_creator_factory),
@@ -73,7 +77,7 @@
ServerInstance._GetOrCreateGithubFileSystem())
@staticmethod
- def CreateOnline(channel):
+ def CreateOnline(channel, branch_path=None, patch_data=None):
'''Creates/creates an online server instance, meaning that both local and
subversion/github resources are queried.
'''
@@ -102,7 +106,24 @@
AppEngineUrlFetcher(viewvc_url)),
object_store_creator_factory)
+ if patch_data is not None:
+ object_store_creator_factory = ObjectStoreCreator.Factory(
+ GetAppVersion(),
+ branch,
+ start_empty=True,
+ persistent=False,
+ more={'issue': patch_data.issue, 'patchset': patch_data.patchset})
+ rietveld_file_system = RietveldFileSystem(
+ svn_constants.EXTENSIONS_PATH,
+ patch_data,
+ AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER),
+ object_store_creator_factory)
+ svn_file_system = PatchedFileSystem(patch_data.files,
+ svn_file_system,
+ rietveld_file_system)
+
return ServerInstance(channel,
+ branch_path,
object_store_creator_factory,
svn_file_system,
ServerInstance._GetOrCreateGithubFileSystem())
@@ -110,6 +131,7 @@
@staticmethod
def CreateForTest(file_system):
return ServerInstance('test',
+ None,
ObjectStoreCreator.TestFactory(),
file_system,
None)
@@ -137,6 +159,7 @@
def __init__(self,
channel,
+ branch_path,
object_store_creator_factory,
svn_file_system,
github_file_system):
@@ -202,7 +225,8 @@
self.compiled_fs_factory,
self.ref_resolver_factory,
svn_constants.PUBLIC_TEMPLATE_PATH,
- svn_constants.PRIVATE_TEMPLATE_PATH)
+ svn_constants.PRIVATE_TEMPLATE_PATH,
+ branch_path)
self.example_zipper = ExampleZipper(
self.compiled_fs_factory,

Powered by Google App Engine
This is Rietveld 408576698