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

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 197821)
+++ chrome/common/extensions/docs/server2/server_instance.py (working copy)
@@ -24,8 +24,10 @@
from local_file_system import LocalFileSystem
from object_store_creator import ObjectStoreCreator
from offline_file_system import OfflineFileSystem
+from patched_file_system import PatchedFileSystem
from path_canonicalizer import PathCanonicalizer
from reference_resolver import ReferenceResolver
+from rietveld_patcher import RietveldPatcher
from samples_data_source import SamplesDataSource
from sidenav_data_source import SidenavDataSource
from subversion_file_system import SubversionFileSystem
@@ -46,7 +48,7 @@
@staticmethod
@memoize
- def GetOrCreateOffline(channel):
+ def GetOrCreateOffline(channel, base_path=None, issue=None):
not at google - send to devlin 2013/05/03 19:12:22 After https://codereview.chromium.org/14856006 hop
'''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.
@@ -55,22 +57,26 @@
branch = branch_utility.GetBranchNumberForChannelName(channel)
object_store_creator_factory = ObjectStoreCreator.Factory(GetAppVersion(),
branch)
+ svn_file_system = CachingFileSystem(OfflineFileSystem(SubversionFileSystem),
+ object_store_creator_factory,
+ use_existing_values=True)
+
# No svn nor github file systems. Rely on the crons to fill the caches, and
# for the caches to exist.
- return ServerInstance(
+ return ServerInstance._CreateWithPatch(
channel,
+ base_path,
object_store_creator_factory,
- CachingFileSystem(OfflineFileSystem(SubversionFileSystem),
- object_store_creator_factory,
- use_existing_values=True),
+ svn_file_system,
# TODO(kalman): convert GithubFileSystem to be wrappable in a
# CachingFileSystem so that it can be replaced with an
# OfflineFileSystem. Currently GFS doesn't set the child versions of
# stat requests so it doesn't.
- ServerInstance._GetOrCreateGithubFileSystem())
+ ServerInstance._GetOrCreateGithubFileSystem(),
+ issue)
@staticmethod
- def CreateOnline(channel):
+ def CreateOnline(channel, base_path=None, issue=None):
'''Creates/creates an online server instance, meaning that both local and
subversion/github resources are queried.
'''
@@ -98,14 +104,42 @@
AppEngineUrlFetcher(viewvc_url)),
object_store_creator_factory)
+ return ServerInstance._CreateWithPatch(
+ channel,
+ base_path,
+ object_store_creator_factory,
+ svn_file_system,
+ ServerInstance._GetOrCreateGithubFileSystem(),
+ issue)
+
+ @staticmethod
+ def _CreateWithPatch(channel,
+ base_path,
+ object_store_creator_factory,
+ svn_file_system,
+ github_file_system,
+ issue=None):
+ if issue is not None:
+ object_store_creator_factory = ObjectStoreCreator.Factory(
+ GetAppVersion(),
+ 'trunk@%s' % issue)
+ rietveld_patcher = RietveldPatcher(
+ svn_constants.EXTENSIONS_PATH,
+ issue,
+ AppEngineUrlFetcher(url_constants.CODEREVIEW_SERVER),
+ object_store_creator_factory)
+ svn_file_system = PatchedFileSystem(svn_file_system,
+ rietveld_patcher)
return ServerInstance(channel,
+ base_path,
object_store_creator_factory,
svn_file_system,
- ServerInstance._GetOrCreateGithubFileSystem())
+ github_file_system)
@staticmethod
def CreateForTest(file_system):
return ServerInstance('test',
+ None,
ObjectStoreCreator.TestFactory(),
file_system,
None)
@@ -133,6 +167,7 @@
def __init__(self,
channel,
+ base_path,
object_store_creator_factory,
svn_file_system,
github_file_system):
@@ -198,7 +233,8 @@
self.compiled_fs_factory,
self.ref_resolver_factory,
svn_constants.PUBLIC_TEMPLATE_PATH,
- svn_constants.PRIVATE_TEMPLATE_PATH)
+ svn_constants.PRIVATE_TEMPLATE_PATH,
+ base_path)
self.example_zipper = ExampleZipper(
self.compiled_fs_factory,

Powered by Google App Engine
This is Rietveld 408576698