diff options
author | ahernandez.miralles <ahernandez.miralles@gmail.com> | 2014-09-15 11:14:37 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2014-09-15 18:25:30 +0000 |
commit | e380f604301c5cdde7d0fad496a5d46c80233afc (patch) | |
tree | f47cefe7894272224ebd8e97937c777241c7c226 | |
parent | 19ec9dafd5f465da381974c78a670b0e5fb15d22 (diff) | |
download | chromium_src-e380f604301c5cdde7d0fad496a5d46c80233afc.zip chromium_src-e380f604301c5cdde7d0fad496a5d46c80233afc.tar.gz chromium_src-e380f604301c5cdde7d0fad496a5d46c80233afc.tar.bz2 |
Docserver: Use GitilesFileSystem instead of SubversionFileSystem
BUG=404239
NOTRY=True
Review URL: https://codereview.chromium.org/491653002
Cr-Commit-Position: refs/heads/master@{#294851}
47 files changed, 348 insertions, 273 deletions
diff --git a/chrome/common/extensions/docs/server2/api_data_source.py b/chrome/common/extensions/docs/server2/api_data_source.py index 56fae41..1608da8 100644 --- a/chrome/common/extensions/docs/server2/api_data_source.py +++ b/chrome/common/extensions/docs/server2/api_data_source.py @@ -17,7 +17,7 @@ class APIDataSource(DataSource): |compiled_fs_factory|, so the APIs can be plugged into templates. ''' def __init__(self, server_instance, request): - file_system = server_instance.host_file_system_provider.GetTrunk() + file_system = server_instance.host_file_system_provider.GetMaster() self._json_cache = server_instance.compiled_fs_factory.ForJson(file_system) self._template_cache = server_instance.compiled_fs_factory.ForTemplates( file_system) diff --git a/chrome/common/extensions/docs/server2/api_data_source_test.py b/chrome/common/extensions/docs/server2/api_data_source_test.py index 8363186..43dda5a 100755 --- a/chrome/common/extensions/docs/server2/api_data_source_test.py +++ b/chrome/common/extensions/docs/server2/api_data_source_test.py @@ -9,14 +9,14 @@ from api_data_source import APIDataSource from extensions_paths import CHROME_EXTENSIONS from servlet import Request from server_instance import ServerInstance -from test_data.api_data_source.canned_trunk_fs import CANNED_TRUNK_FS_DATA +from test_data.api_data_source.canned_master_fs import CANNED_MASTER_FS_DATA from test_file_system import TestFileSystem class APIDataSourceTest(unittest.TestCase): def setUp(self): self.server_instance = ServerInstance.ForTest( - TestFileSystem(CANNED_TRUNK_FS_DATA, relative_to=CHROME_EXTENSIONS)) + TestFileSystem(CANNED_MASTER_FS_DATA, relative_to=CHROME_EXTENSIONS)) def testGet(self): api_ds = APIDataSource(self.server_instance, Request.ForTest('/')) diff --git a/chrome/common/extensions/docs/server2/api_list_data_source.py b/chrome/common/extensions/docs/server2/api_list_data_source.py index 3a9c4f5..af751c6 100644 --- a/chrome/common/extensions/docs/server2/api_list_data_source.py +++ b/chrome/common/extensions/docs/server2/api_list_data_source.py @@ -53,7 +53,7 @@ class APIListDataSource(DataSource): def make_dict_for_platform(platform): platform_dict = { - 'chrome': {'stable': [], 'beta': [], 'dev': [], 'trunk': []}, + 'chrome': {'stable': [], 'beta': [], 'dev': [], 'master': []}, } private_apis = [] experimental_apis = [] diff --git a/chrome/common/extensions/docs/server2/api_list_data_source_test.py b/chrome/common/extensions/docs/server2/api_list_data_source_test.py index 5ac1ae9..5ce8b39 100755 --- a/chrome/common/extensions/docs/server2/api_list_data_source_test.py +++ b/chrome/common/extensions/docs/server2/api_list_data_source_test.py @@ -174,7 +174,7 @@ class APIListDataSourceTest(unittest.TestCase): 'description': u'<code>sockets.udp</code>' }], 'beta': [], - 'trunk': [] + 'master': [] }, self._api_list.get('apps').get('chrome')) def testExperimentalApps(self): @@ -226,7 +226,7 @@ class APIListDataSourceTest(unittest.TestCase): 'description': u'<code>sockets.udp</code>' }], 'beta': [], - 'trunk': [] + 'master': [] }, self._api_list.get('extensions').get('chrome')) def testExperimentalExtensions(self): diff --git a/chrome/common/extensions/docs/server2/app.yaml b/chrome/common/extensions/docs/server2/app.yaml index 7408400..911a0b7 100644 --- a/chrome/common/extensions/docs/server2/app.yaml +++ b/chrome/common/extensions/docs/server2/app.yaml @@ -1,5 +1,5 @@ application: chrome-apps-doc -version: 3-42-2 +version: 3-43-0 runtime: python27 api_version: 1 threadsafe: false diff --git a/chrome/common/extensions/docs/server2/app_yaml_helper.py b/chrome/common/extensions/docs/server2/app_yaml_helper.py index d2bb706f..d965f96 100644 --- a/chrome/common/extensions/docs/server2/app_yaml_helper.py +++ b/chrome/common/extensions/docs/server2/app_yaml_helper.py @@ -25,7 +25,7 @@ class AppYamlHelper(object): host_file_system_provider): self._store = object_store_creator.Create( AppYamlHelper, - category=host_file_system_provider.GetTrunk().GetIdentity(), + category=host_file_system_provider.GetMaster().GetIdentity(), start_empty=False) self._host_file_system_provider = host_file_system_provider @@ -74,7 +74,7 @@ class AppYamlHelper(object): checked into the host file system. ''' checked_in_app_version = AppYamlHelper.ExtractVersion( - self._host_file_system_provider.GetTrunk().ReadSingle(APP_YAML).Get()) + self._host_file_system_provider.GetMaster().ReadSingle(APP_YAML).Get()) if app_version == checked_in_app_version: return True if AppYamlHelper.IsGreater(app_version, checked_in_app_version): @@ -100,6 +100,8 @@ class AppYamlHelper(object): return stored def _GetFirstRevisionGreaterThanImpl(self, app_version): + # XXX(ahernandez): Tricky. The 'version' of app.yaml coming from + # GitilesFileSystem is a blob ID. def get_app_yaml_revision(file_system): return int(file_system.Stat(APP_YAML).version) @@ -109,7 +111,7 @@ class AppYamlHelper(object): return AppYamlHelper.IsGreater(app_version_in_file_system, app_version) found = None - next_file_system = self._host_file_system_provider.GetTrunk() + next_file_system = self._host_file_system_provider.GetMaster() while has_greater_app_version(next_file_system): found = get_app_yaml_revision(next_file_system) @@ -117,8 +119,8 @@ class AppYamlHelper(object): if found == 0: logging.warning('All revisions are greater than %s' % app_version) return 0 - next_file_system = self._host_file_system_provider.GetTrunk( - revision=found - 1) + next_file_system = self._host_file_system_provider.GetMaster( + commit=next_file_system.GetPreviousCommitID().Get()) if found is None: raise ValueError('All revisions are less than %s' % app_version) diff --git a/chrome/common/extensions/docs/server2/app_yaml_helper_test.py b/chrome/common/extensions/docs/server2/app_yaml_helper_test.py index 8f38956..c6fad04 100755 --- a/chrome/common/extensions/docs/server2/app_yaml_helper_test.py +++ b/chrome/common/extensions/docs/server2/app_yaml_helper_test.py @@ -88,16 +88,16 @@ class AppYamlHelperTest(unittest.TestCase): file_system_at_head.Update(update) updates.append(update) - def host_file_system_constructor(branch, revision=None): - self.assertEqual('trunk', branch) - self.assertTrue(revision is not None) + def host_file_system_constructor(branch, commit=None): + self.assertEqual('master', branch) + self.assertTrue(commit is not None) return MockFileSystem.Create( - TestFileSystem(test_data, relative_to=SERVER2), updates[:revision]) + TestFileSystem(test_data, relative_to=SERVER2), updates[:commit]) object_store_creator = ObjectStoreCreator.ForTest() host_file_system_provider = HostFileSystemProvider( object_store_creator, - default_trunk_instance=file_system_at_head, + default_master_instance=file_system_at_head, constructor_for_test=host_file_system_constructor) helper = AppYamlHelper(object_store_creator, host_file_system_provider) diff --git a/chrome/common/extensions/docs/server2/appengine_url_fetcher.py b/chrome/common/extensions/docs/server2/appengine_url_fetcher.py index a4c359b..c9a94b0 100644 --- a/chrome/common/extensions/docs/server2/appengine_url_fetcher.py +++ b/chrome/common/extensions/docs/server2/appengine_url_fetcher.py @@ -10,7 +10,7 @@ from environment import GetAppVersion from future import Future -def _MakeHeaders(username, password): +def _MakeHeaders(username, password, access_token): headers = { 'User-Agent': 'Chromium docserver %s' % GetAppVersion(), 'Cache-Control': 'max-age=0', @@ -18,6 +18,8 @@ def _MakeHeaders(username, password): if username is not None and password is not None: headers['Authorization'] = 'Basic %s' % base64.b64encode( '%s:%s' % (username, password)) + if access_token is not None: + headers['Authorization'] = 'OAuth %s' % access_token return headers @@ -29,19 +31,24 @@ class AppEngineUrlFetcher(object): assert base_path is None or not base_path.endswith('/'), base_path self._base_path = base_path - def Fetch(self, url, username=None, password=None): + def Fetch(self, url, username=None, password=None, access_token=None): """Fetches a file synchronously. """ return urlfetch.fetch(self._FromBasePath(url), - headers=_MakeHeaders(username, password)) + deadline=20, + headers=_MakeHeaders(username, + password, + access_token)) - def FetchAsync(self, url, username=None, password=None): + def FetchAsync(self, url, username=None, password=None, access_token=None): """Fetches a file asynchronously, and returns a Future with the result. """ - rpc = urlfetch.create_rpc() + rpc = urlfetch.create_rpc(deadline=20) urlfetch.make_fetch_call(rpc, self._FromBasePath(url), - headers=_MakeHeaders(username, password)) + headers=_MakeHeaders(username, + password, + access_token)) return Future(callback=lambda: rpc.get_result()) def _FromBasePath(self, url): diff --git a/chrome/common/extensions/docs/server2/appengine_wrappers.py b/chrome/common/extensions/docs/server2/appengine_wrappers.py index ab91e5b..8af2ebc 100644 --- a/chrome/common/extensions/docs/server2/appengine_wrappers.py +++ b/chrome/common/extensions/docs/server2/appengine_wrappers.py @@ -18,6 +18,7 @@ def IsDownloadError(error): # This will attempt to import the actual App Engine modules, and if it fails, # they will be replaced with fake modules. This is useful during testing. try: + import google.appengine.api.app_identity as app_identity import google.appengine.api.files as files import google.appengine.api.logservice as logservice import google.appengine.api.memcache as memcache @@ -61,6 +62,12 @@ except ImportError: def wait(self): pass + class FakeAppIdentity(object): + """A fake app_identity module that returns no access tokens.""" + def get_access_token(self, scope): + return (None, None) + app_identity = FakeAppIdentity() + class FakeUrlFetch(object): """A fake urlfetch module that uses the current |FAKE_URL_FETCHER_CONFIGURATION| to map urls to fake fetchers. @@ -81,7 +88,7 @@ except ImportError: response.status_code = 404 return response - def create_rpc(self): + def create_rpc(self, **kwargs): return _RPC() def make_fetch_call(self, rpc, url, **kwargs): diff --git a/chrome/common/extensions/docs/server2/availability_finder.py b/chrome/common/extensions/docs/server2/availability_finder.py index ab4dba2c..69ecf35 100644 --- a/chrome/common/extensions/docs/server2/availability_finder.py +++ b/chrome/common/extensions/docs/server2/availability_finder.py @@ -59,7 +59,7 @@ def _GetAPISchemaFilename(api_name, file_system, version): single _EXTENSION_API file which all APIs share in older versions of Chrome, in which case it is unknown whether the API actually exists there. ''' - if version == 'trunk' or version > _ORIGINAL_FEATURES_MIN_VERSION: + if version == 'master' or version > _ORIGINAL_FEATURES_MIN_VERSION: # API schema filenames switch format to unix_hacker_style. api_name = UnixName(api_name) @@ -368,8 +368,8 @@ class AvailabilityFinder(object): self._branch_utility.GetChannelInfo('dev'), check_api_availability) if channel_info is None: - # The API wasn't available on 'dev', so it must be a 'trunk'-only API. - channel_info = self._branch_utility.GetChannelInfo('trunk') + # The API wasn't available on 'dev', so it must be a 'master'-only API. + channel_info = self._branch_utility.GetChannelInfo('master') # If the API is not stable, check when it will be scheduled to be stable. if channel_info.channel == 'stable': @@ -396,8 +396,8 @@ class AvailabilityFinder(object): availability_graph = APISchemaGraph() host_fs = self._host_file_system - trunk_stat = assert_not_none(host_fs.Stat(_GetAPISchemaFilename( - api_name, host_fs, 'trunk'))) + master_stat = assert_not_none(host_fs.Stat(_GetAPISchemaFilename( + api_name, host_fs, 'master'))) # Weird object thing here because nonlocal is Python 3. previous = type('previous', (object,), {'stat': None, 'graph': None}) @@ -446,8 +446,8 @@ class AvailabilityFinder(object): previous.graph = version_graph # Continue looping until there are no longer differences between this - # version and trunk. - return version_stat != trunk_stat + # version and master. + return version_stat != master_stat self._file_system_iterator.Ascending( self.GetAPIAvailability(api_name).channel_info, diff --git a/chrome/common/extensions/docs/server2/availability_finder_test.py b/chrome/common/extensions/docs/server2/availability_finder_test.py index 2f42416..62b5f53 100755 --- a/chrome/common/extensions/docs/server2/availability_finder_test.py +++ b/chrome/common/extensions/docs/server2/availability_finder_test.py @@ -35,7 +35,7 @@ class AvailabilityFinderTest(unittest.TestCase): self._branch_utility, CompiledFileSystem.Factory(test_object_store), host_fs_iterator, - host_fs_creator.GetTrunk(), + host_fs_creator.GetMaster(), test_object_store, platform, SchemaProcessorFactoryForTest()) @@ -64,7 +64,7 @@ class AvailabilityFinderTest(unittest.TestCase): # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem. # Increment the TestFileSystem stat count. file_system._file_system.IncrementStat(by=last_stat.val) - # Continue looping. The iterator will stop after 'trunk' automatically. + # Continue looping. The iterator will stop after 'master' automatically. return True # Use the HostFileSystemIterator created above to change global stat values @@ -116,7 +116,7 @@ class AvailabilityFinderTest(unittest.TestCase): get_availability(api)) # Testing APIs with predetermined availability. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'jsonTrunkAPI') + assertGet(ChannelInfo('master', 'master', 'master'), 'jsonMasterAPI') assertGet(ChannelInfo('dev', CANNED_BRANCHES[31], 31), 'jsonDevAPI') assertGet(ChannelInfo('beta', CANNED_BRANCHES[30], 30), 'jsonBetaAPI') assertGet(ChannelInfo('stable', CANNED_BRANCHES[20], 20), 'jsonStableAPI') @@ -139,22 +139,22 @@ class AvailabilityFinderTest(unittest.TestCase): scheduled=31) # Testing API channel existence for _manifest_features.json. - # Listed as 'trunk' on all channels. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'sync') - # No records of API until |trunk|. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'history') + # Listed as 'master' on all channels. + assertGet(ChannelInfo('master', 'master', 'master'), 'sync') + # No records of API until |master|. + assertGet(ChannelInfo('master', 'master', 'master'), 'history') # Listed as 'dev' on |dev|. assertGet(ChannelInfo('dev', CANNED_BRANCHES[31], 31), 'storage') # Stable in _manifest_features and into pre-18 versions. assertGet(ChannelInfo('stable', CANNED_BRANCHES[8], 8), 'pageAction') # Testing API channel existence for _permission_features.json. - # Listed as 'beta' on |trunk|. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'falseBetaAPI') - # Listed as 'trunk' on |trunk|. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'trunkAPI') - # Listed as 'trunk' on all development channels. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'declarativeContent') + # Listed as 'beta' on |master|. + assertGet(ChannelInfo('master', 'master', 'master'), 'falseBetaAPI') + # Listed as 'master' on |master|. + assertGet(ChannelInfo('master', 'master', 'master'), 'masterAPI') + # Listed as 'master' on all development channels. + assertGet(ChannelInfo('master', 'master', 'master'), 'declarativeContent') # Listed as 'dev' on all development channels. assertGet(ChannelInfo('dev', CANNED_BRANCHES[31], 31), 'bluetooth') # Listed as 'dev' on |dev|. @@ -168,8 +168,8 @@ class AvailabilityFinderTest(unittest.TestCase): assertGet(ChannelInfo('stable', CANNED_BRANCHES[5], 5), 'idle') # Switches between _features.json files across branches. - # Listed as 'trunk' on all channels, in _api, _permission, or _manifest. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'contextMenus') + # Listed as 'master' on all channels, in _api, _permission, or _manifest. + assertGet(ChannelInfo('master', 'master', 'master'), 'contextMenus') # Moves between _permission and _manifest as file system is traversed. assertGet(ChannelInfo('stable', CANNED_BRANCHES[23], 23), 'systemInfo.display') @@ -178,8 +178,8 @@ class AvailabilityFinderTest(unittest.TestCase): # Mid-upgrade cases: # Listed as 'dev' on |beta| and 'beta' on |dev|. assertGet(ChannelInfo('dev', CANNED_BRANCHES[31], 31), 'notifications') - # Listed as 'beta' on |stable|, 'dev' on |beta|...until |stable| on trunk. - assertGet(ChannelInfo('trunk', 'trunk', 'trunk'), 'events') + # Listed as 'beta' on |stable|, 'dev' on |beta|...until |stable| on master. + assertGet(ChannelInfo('master', 'master', 'master'), 'events') # Check for differing availability across apps|extensions assertGet(ChannelInfo('stable', CANNED_BRANCHES[26], 26), @@ -207,7 +207,7 @@ class AvailabilityFinderTest(unittest.TestCase): tabs_graph = avail_finder.GetAPINodeAvailability('tabs') fake_tabs_graph = avail_finder.GetAPINodeAvailability('fakeTabs') - assertEquals(True, self._branch_utility.GetChannelInfo('trunk'), + assertEquals(True, self._branch_utility.GetChannelInfo('master'), tabs_graph.Lookup('tabs', 'properties', 'fakeTabsProperty3')) assertEquals(True, self._branch_utility.GetChannelInfo('dev'), tabs_graph.Lookup('tabs', 'events', 'onActivated', 'parameters', @@ -230,7 +230,7 @@ class AvailabilityFinderTest(unittest.TestCase): tabs_graph.Lookup('tabs', 'types', 'InjectDetails')) # Test inlined type. - assertEquals(True, self._branch_utility.GetChannelInfo('trunk'), + assertEquals(True, self._branch_utility.GetChannelInfo('master'), tabs_graph.Lookup('tabs', 'types', 'InlinedType')) # Test implicitly inlined type. diff --git a/chrome/common/extensions/docs/server2/branch_utility.py b/chrome/common/extensions/docs/server2/branch_utility.py index 51b253f..3c0a1e3 100644 --- a/chrome/common/extensions/docs/server2/branch_utility.py +++ b/chrome/common/extensions/docs/server2/branch_utility.py @@ -12,7 +12,7 @@ import url_constants class ChannelInfo(object): '''Represents a Chrome channel with three pieces of information. |channel| is - one of 'stable', 'beta', 'dev', or 'trunk'. |branch| and |version| correspond + one of 'stable', 'beta', 'dev', or 'master'. |branch| and |version| correspond with each other, and represent different releases of Chrome. Note that |branch| and |version| can occasionally be the same for separate channels (i.e. 'beta' and 'dev'), so all three fields are required to uniquely @@ -24,7 +24,7 @@ class ChannelInfo(object): assert isinstance(branch, basestring), branch # TODO(kalman): Assert that this is a string. One day Chromium will probably # be served out of a git repository and the versions will no longer be ints. - assert isinstance(version, int) or version == 'trunk', version + assert isinstance(version, int) or version == 'master', version self.channel = channel self.branch = branch self.version = version @@ -65,7 +65,7 @@ class BranchUtility(object): @staticmethod def GetAllChannelNames(): - return ('stable', 'beta', 'dev', 'trunk') + return ('stable', 'beta', 'dev', 'master') @staticmethod def NewestChannel(channels): @@ -78,7 +78,7 @@ class BranchUtility(object): '''Given a ChannelInfo object, returns a new ChannelInfo object representing the next most recent Chrome version/branch combination. ''' - if channel_info.channel == 'trunk': + if channel_info.channel == 'master': return None if channel_info.channel == 'stable': stable_info = self.GetChannelInfo('stable') @@ -128,7 +128,7 @@ class BranchUtility(object): def GetChannelInfo(self, channel): version = self._ExtractFromVersionJson(channel, 'version') - if version != 'trunk': + if version != 'master': version = int(version) return ChannelInfo(channel, self._ExtractFromVersionJson(channel, 'branch'), @@ -143,8 +143,8 @@ class BranchUtility(object): def _ExtractFromVersionJson(self, channel_name, data_type): '''Returns the branch or version number for a channel name. ''' - if channel_name == 'trunk': - return 'trunk' + if channel_name == 'master': + return 'master' if data_type == 'branch': object_store = self._branch_object_store @@ -159,10 +159,10 @@ class BranchUtility(object): version_json = json.loads(self._fetch_result.Get().content) except Exception as e: # This can happen if omahaproxy is misbehaving, which we've seen before. - # Quick hack fix: just serve from trunk until it's fixed. + # Quick hack fix: just serve from master until it's fixed. logging.error('Failed to fetch or parse branch from omahaproxy: %s! ' - 'Falling back to "trunk".' % e) - return 'trunk' + 'Falling back to "master".' % e) + return 'master' numbers = {} for entry in version_json: @@ -190,8 +190,8 @@ class BranchUtility(object): '''Returns the most recent branch for a given chrome version number using data stored on omahaproxy (see url_constants). ''' - if version == 'trunk': - return 'trunk' + if version == 'master': + return 'master' branch = self._branch_object_store.Get(str(version)).Get() if branch is not None: diff --git a/chrome/common/extensions/docs/server2/branch_utility_test.py b/chrome/common/extensions/docs/server2/branch_utility_test.py index 41488a7..db9e87d 100755 --- a/chrome/common/extensions/docs/server2/branch_utility_test.py +++ b/chrome/common/extensions/docs/server2/branch_utility_test.py @@ -32,9 +32,9 @@ class BranchUtilityTest(unittest.TestCase): self.assertEquals(('beta', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'beta/extensions/stuff.html')) - self.assertEquals(('trunk', 'extensions/stuff.html'), + self.assertEquals(('master', 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( - 'trunk/extensions/stuff.html')) + 'master/extensions/stuff.html')) self.assertEquals((None, 'extensions/stuff.html'), self._branch_util.SplitChannelNameFromPath( 'extensions/stuff.html')) @@ -49,10 +49,10 @@ class BranchUtilityTest(unittest.TestCase): 'stuff.html')) def testNewestChannel(self): - self.assertEquals('trunk', - self._branch_util.NewestChannel(('trunk', 'dev', 'beta', 'stable'))) - self.assertEquals('trunk', - self._branch_util.NewestChannel(('stable', 'beta', 'dev', 'trunk'))) + self.assertEquals('master', + self._branch_util.NewestChannel(('master', 'dev', 'beta', 'stable'))) + self.assertEquals('master', + self._branch_util.NewestChannel(('stable', 'beta', 'dev', 'master'))) self.assertEquals('dev', self._branch_util.NewestChannel(('stable', 'beta', 'dev'))) self.assertEquals('dev', @@ -64,7 +64,7 @@ class BranchUtilityTest(unittest.TestCase): self.assertEquals('stable', self._branch_util.NewestChannel(('stable',))) self.assertEquals('beta', self._branch_util.NewestChannel(('beta',))) self.assertEquals('dev', self._branch_util.NewestChannel(('dev',))) - self.assertEquals('trunk', self._branch_util.NewestChannel(('trunk',))) + self.assertEquals('master', self._branch_util.NewestChannel(('master',))) def testNewer(self): oldest_stable_info = ChannelInfo('stable', '963', 17) @@ -74,7 +74,7 @@ class BranchUtilityTest(unittest.TestCase): stable_info = ChannelInfo('stable', '1547', 29) beta_info = ChannelInfo('beta', '1599', 30) dev_info = ChannelInfo('dev', '1612', 31) - trunk_info = ChannelInfo('trunk', 'trunk', 'trunk') + master_info = ChannelInfo('master', 'master', 'master') self.assertEquals(older_stable_info, self._branch_util.Newer(oldest_stable_info)) @@ -84,13 +84,13 @@ class BranchUtilityTest(unittest.TestCase): self._branch_util.Newer(sort_of_old_stable_info)) self.assertEquals(beta_info, self._branch_util.Newer(stable_info)) self.assertEquals(dev_info, self._branch_util.Newer(beta_info)) - self.assertEquals(trunk_info, self._branch_util.Newer(dev_info)) + self.assertEquals(master_info, self._branch_util.Newer(dev_info)) # Test the upper limit. - self.assertEquals(None, self._branch_util.Newer(trunk_info)) + self.assertEquals(None, self._branch_util.Newer(master_info)) def testOlder(self): - trunk_info = ChannelInfo('trunk', 'trunk', 'trunk') + master_info = ChannelInfo('master', 'master', 'master') dev_info = ChannelInfo('dev', '1612', 31) beta_info = ChannelInfo('beta', '1599', 30) stable_info = ChannelInfo('stable', '1547', 29) @@ -98,7 +98,7 @@ class BranchUtilityTest(unittest.TestCase): older_stable_info = ChannelInfo('stable', '1453', 27) oldest_stable_info = ChannelInfo('stable', '396', 5) - self.assertEquals(dev_info, self._branch_util.Older(trunk_info)) + self.assertEquals(dev_info, self._branch_util.Older(master_info)) self.assertEquals(beta_info, self._branch_util.Older(dev_info)) self.assertEquals(stable_info, self._branch_util.Older(beta_info)) self.assertEquals(old_stable_info, self._branch_util.Older(stable_info)) @@ -108,8 +108,8 @@ class BranchUtilityTest(unittest.TestCase): self.assertEquals(None, self._branch_util.Older(oldest_stable_info)) def testGetChannelInfo(self): - trunk_info = ChannelInfo('trunk', 'trunk', 'trunk') - self.assertEquals(trunk_info, self._branch_util.GetChannelInfo('trunk')) + master_info = ChannelInfo('master', 'master', 'master') + self.assertEquals(master_info, self._branch_util.GetChannelInfo('master')) dev_info = ChannelInfo('dev', '1612', 31) self.assertEquals(dev_info, self._branch_util.GetChannelInfo('dev')) @@ -154,8 +154,8 @@ class BranchUtilityTest(unittest.TestCase): self._branch_util.GetBranchForVersion(5)) def testGetChannelForVersion(self): - self.assertEquals('trunk', - self._branch_util.GetChannelForVersion('trunk')) + self.assertEquals('master', + self._branch_util.GetChannelForVersion('master')) self.assertEquals('dev', self._branch_util.GetChannelForVersion(31)) self.assertEquals('beta', diff --git a/chrome/common/extensions/docs/server2/caching_file_system.py b/chrome/common/extensions/docs/server2/caching_file_system.py index 201788a..941efac 100644 --- a/chrome/common/extensions/docs/server2/caching_file_system.py +++ b/chrome/common/extensions/docs/server2/caching_file_system.py @@ -141,6 +141,12 @@ class CachingFileSystem(FileSystem): return self._file_system.Read(set(paths) - set(up_to_date_data.iterkeys()), skip_not_found=skip_not_found).Then(next) + def GetCommitID(self): + return self._file_system.GetCommitID() + + def GetPreviousCommitID(self): + return self._file_system.GetPreviousCommitID() + def Walk(self, root, depth=-1): '''Overrides FileSystem.Walk() to provide caching functionality. ''' diff --git a/chrome/common/extensions/docs/server2/content_provider.py b/chrome/common/extensions/docs/server2/content_provider.py index e04dc7f..26ed754 100644 --- a/chrome/common/extensions/docs/server2/content_provider.py +++ b/chrome/common/extensions/docs/server2/content_provider.py @@ -2,7 +2,6 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. -import logging import mimetypes import posixpath import traceback diff --git a/chrome/common/extensions/docs/server2/content_providers.py b/chrome/common/extensions/docs/server2/content_providers.py index cc0b9e6..4940d62 100644 --- a/chrome/common/extensions/docs/server2/content_providers.py +++ b/chrome/common/extensions/docs/server2/content_providers.py @@ -123,14 +123,17 @@ class ContentProviders(object): logging.error('%s: "chromium" must have a "dir" property' % name) return None file_system = ChrootFileSystem(self._host_file_system, + chromium_config['dir']) + # TODO(rockot): Remove this in a future patch. It should not be needed once + # the new content_providers.json is committed. elif 'gitiles' in config: - gitiles_config = config['gitiles'] - if 'dir' not in gitiles_config: - logging.error('%s: "gitiles" must have a "dir" property' % name) + chromium_config = config['gitiles'] + if 'dir' not in chromium_config: + logging.error('%s: "chromium" must have a "dir" property' % name) return None - file_system = ChrootFileSystem(GitilesFileSystem.Create(), - gitiles_config['dir']) + file_system = ChrootFileSystem(self._host_file_system, + chromium_config['dir']) elif 'gcs' in config: gcs_config = config['gcs'] if 'bucket' not in gcs_config: diff --git a/chrome/common/extensions/docs/server2/cron.yaml b/chrome/common/extensions/docs/server2/cron.yaml index cf47854..3894257 100644 --- a/chrome/common/extensions/docs/server2/cron.yaml +++ b/chrome/common/extensions/docs/server2/cron.yaml @@ -2,4 +2,4 @@ cron: - description: Repopulates all cached data. url: /_cron schedule: every 5 minutes - target: 3-42-2 + target: 3-43-0 diff --git a/chrome/common/extensions/docs/server2/cron_servlet.py b/chrome/common/extensions/docs/server2/cron_servlet.py index b4676f5..dfd766f0 100644 --- a/chrome/common/extensions/docs/server2/cron_servlet.py +++ b/chrome/common/extensions/docs/server2/cron_servlet.py @@ -96,9 +96,9 @@ class CronServlet(Servlet): def CreateHostFileSystemProvider(self, object_store_creator, - max_trunk_revision=None): + pinned_commit=None): return HostFileSystemProvider(object_store_creator, - max_trunk_revision=max_trunk_revision) + pinned_commit=pinned_commit) def CreateGithubFileSystemProvider(self, object_store_creator): return GithubFileSystemProvider(object_store_creator) @@ -140,7 +140,7 @@ class CronServlet(Servlet): # TODO(kalman): IMPORTANT. This sometimes throws an exception, breaking # everything. Need retry logic at the fetcher level. server_instance = self._GetSafeServerInstance() - trunk_fs = server_instance.host_file_system_provider.GetTrunk() + master_fs = server_instance.host_file_system_provider.GetMaster() def render(path): request = Request(path, self._request.host, self._request.headers) @@ -158,7 +158,7 @@ class CronServlet(Servlet): base, ext = posixpath.splitext(name) return base if ext in strip_ext else name files = [maybe_strip_ext(name) - for name, _ in CreateURLsFromPaths(trunk_fs, path, prefix)] + for name, _ in CreateURLsFromPaths(master_fs, path, prefix)] return _RequestEachItem(path, files, render) results = [] @@ -233,19 +233,19 @@ class CronServlet(Servlet): Response.InternalError('Failure')) def _GetSafeServerInstance(self): - '''Returns a ServerInstance with a host file system at a safe revision, - meaning the last revision that the current running version of the server + '''Returns a ServerInstance with a host file system at a safe commit, + meaning the last commit that the current running version of the server existed. ''' delegate = self._delegate - # IMPORTANT: Get a ServerInstance pinned to the most recent revision, not + # IMPORTANT: Get a ServerInstance pinned to the most recent commit, not # HEAD. These cron jobs take a while and run very frequently such that # there is usually one running at any given time, and eventually a file # that we're dealing with will change underneath it, putting the server in # an undefined state. server_instance_near_head = self._CreateServerInstance( - self._GetMostRecentRevision()) + self._GetMostRecentCommit()) app_yaml_handler = AppYamlHelper( server_instance_near_head.object_store_creator, @@ -264,24 +264,24 @@ class CronServlet(Servlet): return self._CreateServerInstance(safe_revision) - def _GetMostRecentRevision(self): - '''Gets the revision of the most recent patch submitted to the host file - system. This is similar to HEAD but it's a concrete revision so won't + def _GetMostRecentCommit(self): + '''Gets the commit of the most recent patch submitted to the host file + system. This is similar to HEAD but it's a concrete commit so won't change as the cron runs. ''' head_fs = ( - self._CreateServerInstance(None).host_file_system_provider.GetTrunk()) - return head_fs.Stat('').version + self._CreateServerInstance(None).host_file_system_provider.GetMaster()) + return head_fs.GetCommitID().Get() - def _CreateServerInstance(self, revision): - '''Creates a ServerInstance pinned to |revision|, or HEAD if None. + def _CreateServerInstance(self, commit): + '''Creates a ServerInstance pinned to |commit|, or HEAD if None. NOTE: If passed None it's likely that during the cron run patches will be submitted at HEAD, which may change data underneath the cron run. ''' object_store_creator = ObjectStoreCreator(start_empty=True) branch_utility = self._delegate.CreateBranchUtility(object_store_creator) host_file_system_provider = self._delegate.CreateHostFileSystemProvider( - object_store_creator, max_trunk_revision=revision) + object_store_creator, pinned_commit=commit) github_file_system_provider = self._delegate.CreateGithubFileSystemProvider( object_store_creator) gcs_file_system_provider = self._delegate.CreateGCSFileSystemProvider( diff --git a/chrome/common/extensions/docs/server2/cron_servlet_test.py b/chrome/common/extensions/docs/server2/cron_servlet_test.py index 0994f2c..dda11cb 100755 --- a/chrome/common/extensions/docs/server2/cron_servlet_test.py +++ b/chrome/common/extensions/docs/server2/cron_servlet_test.py @@ -31,7 +31,7 @@ from test_util import EnableLogging, ReadFile class _TestDelegate(CronServlet.Delegate): def __init__(self, create_file_system): self.file_systems = [] - # A callback taking a revision and returning a file system. + # A callback taking a commit and returning a file system. self._create_file_system = create_file_system self._app_version = GetAppVersion() @@ -40,13 +40,13 @@ class _TestDelegate(CronServlet.Delegate): def CreateHostFileSystemProvider(self, object_store_creator, - max_trunk_revision=None): - def constructor(branch=None, revision=None): - file_system = self._create_file_system(revision) + pinned_commit=None): + def constructor(branch=None, commit=None): + file_system = self._create_file_system(commit) self.file_systems.append(file_system) return file_system return HostFileSystemProvider(object_store_creator, - max_trunk_revision=max_trunk_revision, + pinned_commit=pinned_commit, constructor_for_test=constructor) def CreateGithubFileSystemProvider(self, object_store_creator): @@ -174,14 +174,14 @@ class CronServletTest(unittest.TestCase): storage_html_path = PUBLIC_TEMPLATES + 'apps/storage.html' static_txt_path = STATIC_DOCS + 'static.txt' - def create_file_system(revision=None): - '''Creates a MockFileSystem at |revision| by applying that many |updates| + def create_file_system(commit=None): + '''Creates a MockFileSystem at |commit| by applying that many |updates| to it. ''' mock_file_system = MockFileSystem(TestFileSystem(test_data)) - updates_for_revision = ( - updates if revision is None else updates[:int(revision)]) - for update in updates_for_revision: + updates_for_commit = ( + updates if commit is None else updates[:int(commit)]) + for update in updates_for_commit: mock_file_system.Update(update) return mock_file_system diff --git a/chrome/common/extensions/docs/server2/fake_fetchers.py b/chrome/common/extensions/docs/server2/fake_fetchers.py index 78f719d..885df4c 100644 --- a/chrome/common/extensions/docs/server2/fake_fetchers.py +++ b/chrome/common/extensions/docs/server2/fake_fetchers.py @@ -82,8 +82,7 @@ _GITILES_BRANCH_BASE_RE = re.escape(url_constants.GITILES_BRANCH_BASE) # NOTE: _GITILES_BRANCH_BASE_RE must be first, because _GITILES_BASE_RE is # a more general pattern. _GITILES_URL_RE = r'(%s|%s)/' % (_GITILES_BRANCH_BASE_RE, _GITILES_BASE_RE) -_GITILES_URL_TO_COMMIT_PATTERN = re.compile( - r'%s[^/]+\?format=JSON' % _GITILES_URL_RE) +_GITILES_URL_TO_COMMIT_PATTERN = re.compile(r'%s[^/]+$' % _GITILES_URL_RE) _GITILES_URL_TO_PATH_PATTERN = re.compile(r'%s.+?/(.*)' % _GITILES_URL_RE) def _ExtractPathFromGitilesUrl(url): return _GITILES_URL_TO_PATH_PATTERN.match(url).group(2) diff --git a/chrome/common/extensions/docs/server2/fake_host_file_system_provider.py b/chrome/common/extensions/docs/server2/fake_host_file_system_provider.py index 06a4241..c8691c1 100644 --- a/chrome/common/extensions/docs/server2/fake_host_file_system_provider.py +++ b/chrome/common/extensions/docs/server2/fake_host_file_system_provider.py @@ -11,8 +11,8 @@ class FakeHostFileSystemProvider(object): def __init__(self, file_system_data): self._file_system_data = file_system_data - def GetTrunk(self): - return self.GetBranch('trunk') + def GetMaster(self): + return self.GetBranch('master') @memoize def GetBranch(self, branch): diff --git a/chrome/common/extensions/docs/server2/file_system.py b/chrome/common/extensions/docs/server2/file_system.py index 7a5ac4f..9eaabdf 100644 --- a/chrome/common/extensions/docs/server2/file_system.py +++ b/chrome/common/extensions/docs/server2/file_system.py @@ -29,6 +29,14 @@ class FileNotFoundError(_BaseFileSystemException): _BaseFileSystemException.__init__(self, filename) +class FileSystemThrottledError(_BaseFileSystemException): + '''Raised when access to a file system resource is temporarily unavailable + due to service throttling. + ''' + def __init__(self, filename): + _BaseFileSystemException.__init__(self, filename) + + class FileSystemError(_BaseFileSystemException): '''Raised on when there are errors reading or statting files, such as a network timeout. diff --git a/chrome/common/extensions/docs/server2/gitiles_file_system.py b/chrome/common/extensions/docs/server2/gitiles_file_system.py index df907e6..8470aff 100644 --- a/chrome/common/extensions/docs/server2/gitiles_file_system.py +++ b/chrome/common/extensions/docs/server2/gitiles_file_system.py @@ -2,14 +2,17 @@ # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. + from base64 import b64decode from itertools import izip +import logging import json import posixpath +import time import traceback from appengine_url_fetcher import AppEngineUrlFetcher -from appengine_wrappers import IsDownloadError +from appengine_wrappers import IsDownloadError, app_identity from docs_server_utils import StringIdentity from file_system import (FileNotFoundError, FileSystem, @@ -18,8 +21,9 @@ from file_system import (FileNotFoundError, from future import All, Future from path_util import AssertIsValid, IsDirectory, ToDirectory from third_party.json_schema_compiler.memoize import memoize -from url_constants import GITILES_BASE, GITILES_BRANCH_BASE - +from url_constants import (GITILES_BASE, + GITILES_BRANCH_BASE, + GITILES_OAUTH2_SCOPE) _JSON_FORMAT = '?format=JSON' _TEXT_FORMAT = '?format=TEXT' @@ -66,9 +70,12 @@ class GitilesFileSystem(FileSystem): need to use posixpath.join. ''' AssertIsValid(url) - return self._fetcher.FetchAsync('%s/%s' % (self._base_url, url)) + access_token, _ = app_identity.get_access_token(GITILES_OAUTH2_SCOPE) + return self._fetcher.FetchAsync('%s/%s' % (self._base_url, url), + access_token=access_token) - def _ResolveFetchContent(self, path, fetch_future, skip_not_found=False): + def _ResolveFetchContent(self, path, fetch_future, retry, + skip_not_found=False): '''Returns a future to cleanly resolve |fetch_future|. ''' def handle(e): @@ -84,11 +91,17 @@ class GitilesFileSystem(FileSystem): return None raise FileNotFoundError('Got 404 when fetching %s for Get from %s' % (path, self._base_url)) + if result.status_code == 429: + logging.warning('Access throttled when fetching %s for Get from %s' % + (path, self._base_url)) + time.sleep(30) + return retry().Then(get_content, handle) if result.status_code != 200: raise FileSystemError( 'Got %s when fetching %s for Get from %s, content %s' % (result.status_code, path, self._base_url, result.content)) return result.content + return fetch_future.Then(get_content, handle) def Read(self, paths, skip_not_found=False): @@ -118,8 +131,11 @@ class GitilesFileSystem(FileSystem): return path + (_JSON_FORMAT if IsDirectory(path) else _TEXT_FORMAT) # A list of tuples of the form (path, Future). - fetches = ((path, self._FetchAsync(fixup_url_format(path))) - for path in paths) + fetches = [] + for path in paths: + def make_fetch_future(): + return self._FetchAsync(fixup_url_format(path)) + fetches.append((path, make_fetch_future(), make_fetch_future)) def parse_contents(results): value = {} @@ -130,8 +146,9 @@ class GitilesFileSystem(FileSystem): # http://tools.ietf.org/html/rfc4648 for info about base64). value[path] = (list_dir if IsDirectory(path) else b64decode)(content) return value - return All(self._ResolveFetchContent(path, future, skip_not_found) - for path, future in fetches).Then(parse_contents) + + return All(self._ResolveFetchContent(path, future, factory, skip_not_found) + for path, future, factory in fetches).Then(parse_contents) def Refresh(self): return Future(value=()) @@ -166,8 +183,15 @@ class GitilesFileSystem(FileSystem): # different from '<gitiles_url>/<branch>/?format=JSON': the latter serves # the root directory JSON content, whereas the former serves the branch # commit info JSON content. - fetch_future = self._fetcher.FetchAsync(self._base_url + _JSON_FORMAT) - content_future = self._ResolveFetchContent(self._base_url, fetch_future) + + def make_fetch_future(): + access_token, _ = app_identity.get_access_token(GITILES_OAUTH2_SCOPE) + return self._fetcher.FetchAsync(self._base_url + _JSON_FORMAT, + access_token = access_token) + + fetch_future = make_fetch_future() + content_future = self._ResolveFetchContent(self._base_url, fetch_future, + make_fetch_future) return content_future.Then(lambda json: _ParseGitilesJson(json)[key]) def GetCommitID(self): @@ -175,6 +199,11 @@ class GitilesFileSystem(FileSystem): ''' return self._GetCommitInfo('commit') + def GetPreviousCommitID(self): + '''Returns a future that resolves to the previous commit ID for this branch. + ''' + return self._GetCommitInfo('parents').Then(lambda parents: parents[0]) + def StatAsync(self, path): dir_, filename = posixpath.split(path) def stat(content): @@ -187,8 +216,13 @@ class GitilesFileSystem(FileSystem): raise FileNotFoundError( '%s from %s was not in child versions for Stat' % (filename, path)) return StatInfo(stat_info.child_versions[filename]) - fetch_future = self._FetchAsync(ToDirectory(dir_) + _JSON_FORMAT) - return self._ResolveFetchContent(path, fetch_future).Then(stat) + + def make_fetch_future(): + return self._FetchAsync(ToDirectory(dir_) + _JSON_FORMAT) + + fetch_future = make_fetch_future() + return self._ResolveFetchContent(path, fetch_future, + make_fetch_future).Then(stat) def GetIdentity(self): # NOTE: Do not use commit information to create the string identity. diff --git a/chrome/common/extensions/docs/server2/gitiles_file_system_test.py b/chrome/common/extensions/docs/server2/gitiles_file_system_test.py index 4ec0403..3e2bdbc 100755 --- a/chrome/common/extensions/docs/server2/gitiles_file_system_test.py +++ b/chrome/common/extensions/docs/server2/gitiles_file_system_test.py @@ -47,7 +47,7 @@ class _FakeGitilesFetcher(object): def __init__(self, fs): self._fs = fs - def FetchAsync(self, url): + def FetchAsync(self, url, access_token=None): def resolve(): assert '?' in url if url == _BASE_URL + '?format=JSON': diff --git a/chrome/common/extensions/docs/server2/host_file_system_iterator.py b/chrome/common/extensions/docs/server2/host_file_system_iterator.py index ba4d319..867adec 100644 --- a/chrome/common/extensions/docs/server2/host_file_system_iterator.py +++ b/chrome/common/extensions/docs/server2/host_file_system_iterator.py @@ -20,8 +20,8 @@ class HostFileSystemIterator(object): ''' last_true = None while channel_info is not None: - if channel_info.branch == 'trunk': - file_system = self._file_system_provider.GetTrunk() + if channel_info.branch == 'master': + file_system = self._file_system_provider.GetMaster() else: file_system = self._file_system_provider.GetBranch(channel_info.branch) if not callback(file_system, channel_info): diff --git a/chrome/common/extensions/docs/server2/host_file_system_iterator_test.py b/chrome/common/extensions/docs/server2/host_file_system_iterator_test.py index aa59b43..5ef4ab2 100755 --- a/chrome/common/extensions/docs/server2/host_file_system_iterator_test.py +++ b/chrome/common/extensions/docs/server2/host_file_system_iterator_test.py @@ -47,15 +47,15 @@ class HostFileSystemIteratorTest(unittest.TestCase): return self._branch_utility.GetChannelInfo(channel_name) def testAscending(self): - # Start at |stable| version 5, and move up towards |trunk|. + # Start at |stable| version 5, and move up towards |master|. # Total: 28 file systems. iterations, callback = _GetIterationTracker(0) self.assertEqual( self._iterator.Ascending(self._GetStableChannelInfo(5), callback), - self._GetChannelInfo('trunk')) + self._GetChannelInfo('master')) self.assertEqual(len(iterations), 28) - # Start at |stable| version 5, and move up towards |trunk|. The callback + # Start at |stable| version 5, and move up towards |master|. The callback # fails at |beta|, so the last successful callback was the latest version # of |stable|. Total: 25 file systems. iterations, callback = _GetIterationTracker( @@ -82,8 +82,8 @@ class HostFileSystemIteratorTest(unittest.TestCase): self.assertEqual([self._GetStableChannelInfo(5)], iterations) # Start at the latest version of |stable|, and the callback fails at - # |trunk|. Total: 3 file systems. - iterations, callback = _GetIterationTracker('trunk') + # |master|. Total: 3 file systems. + iterations, callback = _GetIterationTracker('master') self.assertEqual( self._iterator.Ascending(self._GetChannelInfo('stable'), callback), self._GetChannelInfo('dev')) @@ -91,8 +91,8 @@ class HostFileSystemIteratorTest(unittest.TestCase): self._GetChannelInfo('beta'), self._GetChannelInfo('dev')], iterations) - # Start at |stable| version 10, and the callback fails at |trunk|. - iterations, callback = _GetIterationTracker('trunk') + # Start at |stable| version 10, and the callback fails at |master|. + iterations, callback = _GetIterationTracker('master') self.assertEqual( self._iterator.Ascending(self._GetStableChannelInfo(10), callback), self._GetChannelInfo('dev')) @@ -120,28 +120,28 @@ class HostFileSystemIteratorTest(unittest.TestCase): self._GetChannelInfo('dev')], iterations) def testDescending(self): - # Start at |trunk|, and the callback fails immediately. No file systems + # Start at |master|, and the callback fails immediately. No file systems # are successfully processed, so Descending() will return None. - iterations, callback = _GetIterationTracker('trunk') + iterations, callback = _GetIterationTracker('master') self.assertEqual( - self._iterator.Descending(self._GetChannelInfo('trunk'), callback), + self._iterator.Descending(self._GetChannelInfo('master'), callback), None) self.assertEqual([], iterations) - # Start at |trunk|, and the callback fails at |dev|. Last good iteration - # should be |trunk|. + # Start at |master|, and the callback fails at |dev|. Last good iteration + # should be |master|. iterations, callback = _GetIterationTracker( self._GetChannelInfo('dev').version) self.assertEqual( - self._iterator.Descending(self._GetChannelInfo('trunk'), callback), - self._GetChannelInfo('trunk')) - self.assertEqual([self._GetChannelInfo('trunk')], iterations) + self._iterator.Descending(self._GetChannelInfo('master'), callback), + self._GetChannelInfo('master')) + self.assertEqual([self._GetChannelInfo('master')], iterations) - # Start at |trunk|, and then move from |dev| down to |stable| at version 5. + # Start at |master|, and then move from |dev| down to |stable| at version 5. # Total: 28 file systems. iterations, callback = _GetIterationTracker(0) self.assertEqual( - self._iterator.Descending(self._GetChannelInfo('trunk'), callback), + self._iterator.Descending(self._GetChannelInfo('master'), callback), self._GetStableChannelInfo(5)) self.assertEqual(len(iterations), 28) diff --git a/chrome/common/extensions/docs/server2/host_file_system_provider.py b/chrome/common/extensions/docs/server2/host_file_system_provider.py index 407e0ec..ac50ccd 100644 --- a/chrome/common/extensions/docs/server2/host_file_system_provider.py +++ b/chrome/common/extensions/docs/server2/host_file_system_provider.py @@ -3,90 +3,93 @@ # found in the LICENSE file. from caching_file_system import CachingFileSystem +from gitiles_file_system import GitilesFileSystem from local_file_system import LocalFileSystem from offline_file_system import OfflineFileSystem -from subversion_file_system import SubversionFileSystem +from gitiles_file_system import GitilesFileSystem from third_party.json_schema_compiler.memoize import memoize class HostFileSystemProvider(object): '''Provides host file systems ("host" meaning the file system that hosts the - server's source code and templates) tracking trunk, or any branch. + server's source code and templates) tracking master, or any branch. File system instances are memoized to maintain the in-memory caches across multiple callers. ''' def __init__(self, object_store_creator, - max_trunk_revision=None, - default_trunk_instance=None, + pinned_commit=None, + default_master_instance=None, offline=False, constructor_for_test=None): ''' |object_store_creator| Provides caches for file systems that need one. - |max_trunk_revision| - If not None, the maximum revision that a 'trunk' file system will be - created at. If None, 'trunk' file systems will use HEAD. - |default_trunk_instance| - If not None, 'trunk' file systems provided by this class without a - specific revision will return |default_trunk_instance| instead. + |pinned_commit| + If not None, the commit at which a 'master' file system will be created. + If None, 'master' file systems will use HEAD. + |default_master_instance| + If not None, 'master' file systems provided by this class without a + specific commit will return |default_master_instance| instead. |offline| If True all provided file systems will be wrapped in an OfflineFileSystem. |constructor_for_test| - Provides a custom constructor rather than creating SubversionFileSystems. + Provides a custom constructor rather than creating GitilesFileSystems. ''' self._object_store_creator = object_store_creator - self._max_trunk_revision = max_trunk_revision - self._default_trunk_instance = default_trunk_instance + self._pinned_commit = pinned_commit + self._default_master_instance = default_master_instance self._offline = offline self._constructor_for_test = constructor_for_test @memoize - def GetTrunk(self, revision=None): - '''Gets a file system tracking 'trunk'. Use this method rather than - GetBranch('trunk') because the behaviour is subtly different; 'trunk' can - be pinned to a max revision (|max_trunk_revision| in constructor) and can - have its default instance overridden (|default_trunk_instance| in + def GetMaster(self, commit=None): + '''Gets a file system tracking 'master'. Use this method rather than + GetBranch('master') because the behaviour is subtly different; 'master' can + be pinned to a specific commit (|pinned_commit| in constructor) and can have + have its default instance overridden (|default_master_instance| in the constructor). - |revision| if non-None determines a specific revision to pin the host file - system at, though it will be ignored if it exceeds |max_trunk_revision|. - If None then |revision| will track |max_trunk_revision| if is has been + |commit| if non-None determines a specific commit to pin the host file + system at, though it will be ignored if it's newer than |pinned_commit|. + If None then |commit| will track |pinned_commit| if is has been set, or just HEAD (which might change during server runtime!). ''' - if revision is None: - if self._default_trunk_instance is not None: - return self._default_trunk_instance - return self._Create('trunk', revision=self._max_trunk_revision) - if self._max_trunk_revision is not None: - revision = min(revision, self._max_trunk_revision) - return self._Create('trunk', revision=revision) + if commit is None: + if self._default_master_instance is not None: + return self._default_master_instance + return self._Create('master', commit=self._pinned_commit) + if self._pinned_commit is not None: + # XXX(ahernandez): THIS IS WRONG. Should be + # commit = Oldest(commit, self._pinned_commit). + commit = min(commit, self._pinned_commit) + return self._Create('master', commit=commit) @memoize def GetBranch(self, branch): '''Gets a file system tracking |branch|, for example '1150' - anything other - than 'trunk', which must be constructed via the GetTrunk() method. + than 'master', which must be constructed via the GetMaster() method. - Note: Unlike GetTrunk this function doesn't take a |revision| argument - since we assume that branches hardly ever change, while trunk frequently + Note: Unlike GetMaster this function doesn't take a |commit| argument + since we assume that branches hardly ever change, while master frequently changes. ''' assert isinstance(branch, basestring), 'Branch %s must be a string' % branch - assert branch != 'trunk', 'Cannot specify branch=\'trunk\', use GetTrunk()' + assert branch != 'master', ( + 'Cannot specify branch=\'master\', use GetMaster()') return self._Create(branch) - def _Create(self, branch, revision=None): - '''Creates SVN file systems (or if in a test, potentially whatever + def _Create(self, branch, commit=None): + '''Creates Gitiles file systems (or if in a test, potentially whatever |self._constructor_for_test specifies). Wraps the resulting file system in an Offline file system if the offline flag is set, and finally wraps it in a Caching file system. ''' if self._constructor_for_test is not None: - file_system = self._constructor_for_test(branch=branch, revision=revision) + file_system = self._constructor_for_test(branch=branch, commit=commit) else: - file_system = SubversionFileSystem.Create(branch=branch, - revision=revision) + file_system = GitilesFileSystem.Create(branch=branch, commit=commit) if self._offline: file_system = OfflineFileSystem(file_system) return CachingFileSystem(file_system, self._object_store_creator) diff --git a/chrome/common/extensions/docs/server2/jsc_view_test.py b/chrome/common/extensions/docs/server2/jsc_view_test.py index 39510a0..23cbb72 100755 --- a/chrome/common/extensions/docs/server2/jsc_view_test.py +++ b/chrome/common/extensions/docs/server2/jsc_view_test.py @@ -22,7 +22,7 @@ from jsc_view import JSCView, _FormatValue from object_store_creator import ObjectStoreCreator from schema_processor import SchemaProcessorFactoryForTest from server_instance import ServerInstance -from test_data.api_data_source.canned_trunk_fs import CANNED_TRUNK_FS_DATA +from test_data.api_data_source.canned_master_fs import CANNED_MASTER_FS_DATA from test_data.canned_data import CANNED_API_FILE_SYSTEM_DATA from test_data.object_level_availability.tabs import TABS_SCHEMA_BRANCHES from test_file_system import TestFileSystem @@ -57,7 +57,7 @@ class _FakeAvailabilityFinder(object): def GetAPINodeAvailability(self, api_name): schema_graph = APISchemaGraph() api_graph = APISchemaGraph(json.loads( - CANNED_TRUNK_FS_DATA['api'][api_name + '.json'])) + CANNED_MASTER_FS_DATA['api'][api_name + '.json'])) # Give the graph fake ChannelInfo; it's not used in tests. channel_info = ChannelInfo('stable', '28', 28) schema_graph.Update(api_graph, lambda _: channel_info) @@ -69,8 +69,8 @@ class JSCViewTest(unittest.TestCase): self._base_path = Server2Path('test_data', 'test_json') server_instance = ServerInstance.ForTest( - TestFileSystem(CANNED_TRUNK_FS_DATA, relative_to=CHROME_EXTENSIONS)) - file_system = server_instance.host_file_system_provider.GetTrunk() + TestFileSystem(CANNED_MASTER_FS_DATA, relative_to=CHROME_EXTENSIONS)) + file_system = server_instance.host_file_system_provider.GetMaster() self._json_cache = server_instance.compiled_fs_factory.ForJson(file_system) self._features_bundle = FeaturesBundle(file_system, server_instance.compiled_fs_factory, @@ -266,7 +266,7 @@ class JSCViewWithoutNodeAvailabilityTest(unittest.TestCase): self._api_models = server_instance.platform_bundle.GetAPIModels( 'extensions') self._json_cache = server_instance.compiled_fs_factory.ForJson( - server_instance.host_file_system_provider.GetTrunk()) + server_instance.host_file_system_provider.GetMaster()) self._avail_finder = server_instance.platform_bundle.GetAvailabilityFinder( 'extensions') @@ -274,7 +274,7 @@ class JSCViewWithoutNodeAvailabilityTest(unittest.TestCase): def testGetAPIAvailability(self): api_availabilities = { 'bluetooth': 31, - 'contextMenus': 'trunk', + 'contextMenus': 'master', 'jsonStableAPI': 20, 'idle': 5, 'input.ime': 18, @@ -310,7 +310,7 @@ class JSCViewWithNodeAvailabilityTest(unittest.TestCase): self._branch_utility, CompiledFileSystem.Factory(test_object_store), self._node_fs_iterator, - self._node_fs_creator.GetTrunk(), + self._node_fs_creator.GetMaster(), test_object_store, 'extensions', SchemaProcessorFactoryForTest()) @@ -321,7 +321,7 @@ class JSCViewWithNodeAvailabilityTest(unittest.TestCase): self._api_models = server_instance.platform_bundle.GetAPIModels( 'extensions') self._json_cache = server_instance.compiled_fs_factory.ForJson( - server_instance.host_file_system_provider.GetTrunk()) + server_instance.host_file_system_provider.GetMaster()) # Imitate the actual SVN file system by incrementing the stats for paths # where an API schema has changed. @@ -333,7 +333,7 @@ class JSCViewWithNodeAvailabilityTest(unittest.TestCase): # HACK: |file_system| is a MockFileSystem backed by a TestFileSystem. # Increment the TestFileSystem stat count. file_system._file_system.IncrementStat(by=last_stat.val) - # Continue looping. The iterator will stop after 'trunk' automatically. + # Continue looping. The iterator will stop after 'master' automatically. return True # Use the HostFileSystemIterator created above to change global stat values diff --git a/chrome/common/extensions/docs/server2/mock_file_system.py b/chrome/common/extensions/docs/server2/mock_file_system.py index 52a84bd..76942f8 100644 --- a/chrome/common/extensions/docs/server2/mock_file_system.py +++ b/chrome/common/extensions/docs/server2/mock_file_system.py @@ -85,6 +85,12 @@ class MockFileSystem(FileSystem): return stat + def GetCommitID(self): + return Future(value=self._stat_tracker.GetVersion('')) + + def GetPreviousCommitID(self): + return Future(value=self._stat_tracker.GetVersion('') - 1) + def GetIdentity(self): return self._file_system.GetIdentity() diff --git a/chrome/common/extensions/docs/server2/owners_data_source.py b/chrome/common/extensions/docs/server2/owners_data_source.py index 540d910..282cc0e 100644 --- a/chrome/common/extensions/docs/server2/owners_data_source.py +++ b/chrome/common/extensions/docs/server2/owners_data_source.py @@ -45,7 +45,7 @@ def ParseOwnersFile(content, randomize): class OwnersDataSource(DataSource): def __init__(self, server_instance, _, randomize=True): - self._host_fs = server_instance.host_file_system_provider.GetTrunk() + self._host_fs = server_instance.host_file_system_provider.GetMaster() self._cache = server_instance.object_store_creator.Create(OwnersDataSource) self._owners_fs = server_instance.compiled_fs_factory.Create( self._host_fs, self._CreateAPIEntry, OwnersDataSource) diff --git a/chrome/common/extensions/docs/server2/patch_servlet.py b/chrome/common/extensions/docs/server2/patch_servlet.py index f003c45..93f0c3b 100644 --- a/chrome/common/extensions/docs/server2/patch_servlet.py +++ b/chrome/common/extensions/docs/server2/patch_servlet.py @@ -34,7 +34,7 @@ class _PatchServletDelegate(RenderServlet.Delegate): object_store_creator = ObjectStoreCreator(start_empty=False) unpatched_file_system = self._delegate.CreateHostFileSystemProvider( - object_store_creator).GetTrunk() + object_store_creator).GetMaster() rietveld_patcher = CachingRietveldPatcher( RietveldPatcher(self._issue, @@ -50,8 +50,8 @@ class _PatchServletDelegate(RenderServlet.Delegate): # The patched file system needs to be online otherwise it'd be # impossible to add files in the patches. offline=False, - # The trunk file system for this creator should be the patched one. - default_trunk_instance=patched_file_system)) + # The master file system for this creator should be the patched one. + default_master_instance=patched_file_system)) combined_compiled_fs_factory = ChainedCompiledFileSystem.Factory( [unpatched_file_system], object_store_creator) diff --git a/chrome/common/extensions/docs/server2/permissions_data_source.py b/chrome/common/extensions/docs/server2/permissions_data_source.py index 24db438..2e81451 100644 --- a/chrome/common/extensions/docs/server2/permissions_data_source.py +++ b/chrome/common/extensions/docs/server2/permissions_data_source.py @@ -49,7 +49,7 @@ class PermissionsDataSource(DataSource): self._object_store = server_instance.object_store_creator.Create( PermissionsDataSource) self._template_cache = server_instance.compiled_fs_factory.ForTemplates( - server_instance.host_file_system_provider.GetTrunk()) + server_instance.host_file_system_provider.GetMaster()) def _CreatePermissionsDataForPlatform(self, platform): features_bundle = self._platform_bundle.GetFeaturesBundle(platform) diff --git a/chrome/common/extensions/docs/server2/platform_bundle.py b/chrome/common/extensions/docs/server2/platform_bundle.py index 5df6c169..44eba68 100644 --- a/chrome/common/extensions/docs/server2/platform_bundle.py +++ b/chrome/common/extensions/docs/server2/platform_bundle.py @@ -32,13 +32,13 @@ class PlatformBundle(object): def __init__(self, branch_utility, compiled_fs_factory, - host_fs_at_trunk, + host_fs_at_master, host_file_system_iterator, object_store_creator, base_path): self._branch_utility = branch_utility self._compiled_fs_factory = compiled_fs_factory - self._host_fs_at_trunk = host_fs_at_trunk + self._host_fs_at_master = host_fs_at_master self._host_file_system_iterator = host_file_system_iterator self._object_store_creator = object_store_creator self._base_path = base_path @@ -52,7 +52,7 @@ class PlatformBundle(object): extension_samples_fs = EmptyDirFileSystem() app_samples_fs = EmptyDirFileSystem() else: - extension_samples_fs = self._host_fs_at_trunk + extension_samples_fs = self._host_fs_at_master # TODO(kalman): Re-enable the apps samples, see http://crbug.com/344097. app_samples_fs = EmptyDirFileSystem() #app_samples_fs = github_file_system_provider.Create( @@ -69,7 +69,7 @@ class PlatformBundle(object): def GetFeaturesBundle(self, platform): if self._platform_data[platform].features_bundle is None: self._platform_data[platform].features_bundle = FeaturesBundle( - self._host_fs_at_trunk, + self._host_fs_at_master, self._compiled_fs_factory, self._object_store_creator, platform) @@ -82,7 +82,7 @@ class PlatformBundle(object): self._platform_data[platform].api_models = APIModels( self.GetFeaturesBundle(platform), self._compiled_fs_factory, - self._host_fs_at_trunk, + self._host_fs_at_master, self._object_store_creator, platform, SchemaProcessorFactory( @@ -90,7 +90,7 @@ class PlatformBundle(object): Future(callback=lambda: self.GetAPIModels(platform)), Future(callback=lambda: self.GetFeaturesBundle(platform)), self._compiled_fs_factory, - self._host_fs_at_trunk)) + self._host_fs_at_master)) return self._platform_data[platform].api_models def GetReferenceResolver(self, platform): @@ -107,7 +107,7 @@ class PlatformBundle(object): self._branch_utility, self._compiled_fs_factory, self._host_file_system_iterator, - self._host_fs_at_trunk, + self._host_fs_at_master, self._object_store_creator, platform, SchemaProcessorFactory( @@ -115,13 +115,13 @@ class PlatformBundle(object): Future(callback=lambda: self.GetAPIModels(platform)), Future(callback=lambda: self.GetFeaturesBundle(platform)), self._compiled_fs_factory, - self._host_fs_at_trunk)) + self._host_fs_at_master)) return self._platform_data[platform].availability_finder def GetAPICategorizer(self, platform): if self._platform_data[platform].api_categorizer is None: self._platform_data[platform].api_categorizer = APICategorizer( - self._host_fs_at_trunk, + self._host_fs_at_master, self._compiled_fs_factory, platform) return self._platform_data[platform].api_categorizer @@ -131,4 +131,4 @@ class PlatformBundle(object): for platform in self._platform_data) def GetIdentity(self): - return self._host_fs_at_trunk.GetIdentity() + return self._host_fs_at_master.GetIdentity() diff --git a/chrome/common/extensions/docs/server2/render_servlet_test.py b/chrome/common/extensions/docs/server2/render_servlet_test.py index 330f500..2f3d257 100755 --- a/chrome/common/extensions/docs/server2/render_servlet_test.py +++ b/chrome/common/extensions/docs/server2/render_servlet_test.py @@ -29,7 +29,7 @@ class RenderServletTest(unittest.TestCase): self._Render('storage')) def testChannelRedirect(self): - for channel in ('stable', 'beta', 'dev', 'trunk'): + for channel in ('stable', 'beta', 'dev', 'master'): self.assertEqual( Response.Redirect('/extensions/storage', permanent=True), self._Render('%s/extensions/storage' % channel)) diff --git a/chrome/common/extensions/docs/server2/schema_processor_test.py b/chrome/common/extensions/docs/server2/schema_processor_test.py index 7530d45..9be4172 100755 --- a/chrome/common/extensions/docs/server2/schema_processor_test.py +++ b/chrome/common/extensions/docs/server2/schema_processor_test.py @@ -127,7 +127,7 @@ class SchemaUtilTest(unittest.TestCase): _FakeFeaturesBundle(), CompiledFileSystem.Factory( object_store_creator), - host_file_system_provider.GetTrunk(), + host_file_system_provider.GetMaster(), True) schema_processor._RemoveNoDocs(nodoc_data) self.assertEquals(expected_nodoc, nodoc_data) @@ -199,7 +199,7 @@ class SchemaUtilTest(unittest.TestCase): _FakeFeaturesBundle(), CompiledFileSystem.Factory( object_store_creator), - host_file_system_provider.GetTrunk(), + host_file_system_provider.GetMaster(), False) inlined_schema = deepcopy(schema) schema_processor._InlineDocs(inlined_schema) @@ -239,7 +239,7 @@ class SchemaUtilTest(unittest.TestCase): _FakeFeaturesBundle(), CompiledFileSystem.Factory( object_store_creator), - host_file_system_provider.GetTrunk(), + host_file_system_provider.GetMaster(), False) schema_processor._DetectInlineableTypes(schema) schema_processor._InlineDocs(schema) diff --git a/chrome/common/extensions/docs/server2/server_instance.py b/chrome/common/extensions/docs/server2/server_instance.py index a790821..c61d875 100644 --- a/chrome/common/extensions/docs/server2/server_instance.py +++ b/chrome/common/extensions/docs/server2/server_instance.py @@ -56,7 +56,7 @@ class ServerInstance(object): self.compiled_fs_factory = compiled_fs_factory self.host_file_system_provider = host_file_system_provider - host_fs_at_trunk = host_file_system_provider.GetTrunk() + host_fs_at_master = host_file_system_provider.GetMaster() self.github_file_system_provider = github_file_system_provider self.gcs_file_system_provider = gcs_file_system_provider @@ -71,7 +71,7 @@ class ServerInstance(object): self.platform_bundle = PlatformBundle( branch_utility, self.compiled_fs_factory, - host_fs_at_trunk, + host_fs_at_master, self.host_file_system_iterator, self.object_store_creator, self.base_path) @@ -79,7 +79,7 @@ class ServerInstance(object): self.content_providers = ContentProviders( object_store_creator, self.compiled_fs_factory, - host_fs_at_trunk, + host_fs_at_master, self.github_file_system_provider, self.gcs_file_system_provider) @@ -92,7 +92,7 @@ class ServerInstance(object): # TemplateDataSource itself rather than depending on template_renderer, but # for that the above todo should be addressed. self.document_renderer = DocumentRenderer( - TableOfContentsRenderer(host_fs_at_trunk, + TableOfContentsRenderer(host_fs_at_master, compiled_fs_factory, self.template_renderer), self.platform_bundle) diff --git a/chrome/common/extensions/docs/server2/sidenav_data_source.py b/chrome/common/extensions/docs/server2/sidenav_data_source.py index 8521a45..b6bb82d 100644 --- a/chrome/common/extensions/docs/server2/sidenav_data_source.py +++ b/chrome/common/extensions/docs/server2/sidenav_data_source.py @@ -59,7 +59,7 @@ class SidenavDataSource(DataSource): ''' def __init__(self, server_instance, request): self._cache = server_instance.compiled_fs_factory.Create( - server_instance.host_file_system_provider.GetTrunk(), + server_instance.host_file_system_provider.GetMaster(), self._CreateSidenavDict, SidenavDataSource) self._server_instance = server_instance diff --git a/chrome/common/extensions/docs/server2/strings_data_source.py b/chrome/common/extensions/docs/server2/strings_data_source.py index 4e62680..e4254d3 100644 --- a/chrome/common/extensions/docs/server2/strings_data_source.py +++ b/chrome/common/extensions/docs/server2/strings_data_source.py @@ -14,7 +14,7 @@ class StringsDataSource(DataSource): ''' def __init__(self, server_instance, _): self._cache = server_instance.compiled_fs_factory.ForJson( - server_instance.host_file_system_provider.GetTrunk()) + server_instance.host_file_system_provider.GetMaster()) def _GetStringsData(self): return self._cache.GetFromFile('%sstrings.json' % JSON_TEMPLATES) diff --git a/chrome/common/extensions/docs/server2/template_data_source.py b/chrome/common/extensions/docs/server2/template_data_source.py index c7ba806..bf6dfe9 100644 --- a/chrome/common/extensions/docs/server2/template_data_source.py +++ b/chrome/common/extensions/docs/server2/template_data_source.py @@ -23,8 +23,8 @@ class TemplateDataSource(DataSource): AssertIsDirectory(self._dir) self._request = request self._template_cache = server_instance.compiled_fs_factory.ForTemplates( - server_instance.host_file_system_provider.GetTrunk()) - self._file_system = server_instance.host_file_system_provider.GetTrunk() + server_instance.host_file_system_provider.GetMaster()) + self._file_system = server_instance.host_file_system_provider.GetMaster() def get(self, path): try: diff --git a/chrome/common/extensions/docs/server2/test_data/api_data_source/canned_trunk_fs.py b/chrome/common/extensions/docs/server2/test_data/api_data_source/canned_master_fs.py index d54deca..cd2e49b 100644 --- a/chrome/common/extensions/docs/server2/test_data/api_data_source/canned_trunk_fs.py +++ b/chrome/common/extensions/docs/server2/test_data/api_data_source/canned_master_fs.py @@ -5,7 +5,7 @@ import json -CANNED_TRUNK_FS_DATA = { +CANNED_MASTER_FS_DATA = { 'api': { '_api_features.json': json.dumps({ 'add_rules_tester': { 'dependencies': ['permission:add_rules_tester'] }, @@ -177,8 +177,8 @@ CANNED_TRUNK_FS_DATA = { }, 'json': { 'api_availabilities.json': json.dumps({ - 'trunk_api': { - 'channel': 'trunk' + 'master_api': { + 'channel': 'master' }, 'dev_api': { 'channel': 'dev' @@ -215,7 +215,7 @@ CANNED_TRUNK_FS_DATA = { }, 'private': { 'intro_tables': { - 'trunk_message.html': 'available on trunk', + 'master_message.html': 'available on master', 'stable_message.html': 'Since {{content.version}}.', 'content_scripts.html': 'Content Scripts' } diff --git a/chrome/common/extensions/docs/server2/test_data/canned_data.py b/chrome/common/extensions/docs/server2/test_data/canned_data.py index 3a10ff1..69d6d35 100644 --- a/chrome/common/extensions/docs/server2/test_data/canned_data.py +++ b/chrome/common/extensions/docs/server2/test_data/canned_data.py @@ -10,7 +10,7 @@ from test_file_system import MoveAllTo, MoveTo CANNED_CHANNELS = OrderedDict([ - ('trunk', 'trunk'), + ('master', 'master'), ('dev', 31), ('beta', 30), ('stable', 29) @@ -18,7 +18,7 @@ CANNED_CHANNELS = OrderedDict([ CANNED_BRANCHES = OrderedDict([ - ('trunk', 'trunk'), + ('master', 'master'), (31, '1612'), (30, '1599'), (29, '1547'), @@ -70,8 +70,8 @@ CANNED_TEST_FILE_SYSTEM_DATA = MoveTo(CHROME_EXTENSIONS, { }, 'json': { 'api_availabilities.json': json.dumps({ - 'trunk_api': { - 'channel': 'trunk' + 'master_api': { + 'channel': 'master' }, 'dev_api': { 'channel': 'dev' @@ -108,7 +108,7 @@ CANNED_TEST_FILE_SYSTEM_DATA = MoveTo(CHROME_EXTENSIONS, { }, 'private': { 'intro_tables': { - 'trunk_message.html': 'available on trunk' + 'master_message.html': 'available on master' }, 'table_of_contents.html': '<table-of-contents>', } @@ -137,7 +137,7 @@ _TEST_WHATS_NEW_JSON = { CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { - 'trunk': { + 'master': { 'api': { '_api_features.json': json.dumps({ 'alarm': { @@ -185,7 +185,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'beta' }, 'sync': { - 'channel': 'trunk' + 'channel': 'master' }, 'web_request': { 'channel': 'stable' @@ -205,7 +205,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta', @@ -222,8 +222,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'systemInfo.display': { 'channel': 'stable' }, - 'trunkAPI': { - 'channel': 'trunk' + 'masterAPI': { + 'channel': 'master' } }), 'alarm.json': json.dumps([{ @@ -275,8 +275,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -328,7 +328,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'events': { - 'channel': 'trunk' + 'channel': 'master' }, 'extension': { 'channel': 'stable' @@ -342,7 +342,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { }), '_manifest_features.json': json.dumps({ 'contextMenus': { - 'channel': 'trunk' + 'channel': 'master' }, 'notifications': { 'channel': 'beta' @@ -357,7 +357,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'sync': { - 'channel': 'trunk' + 'channel': 'master' }, 'system_info_display': { 'channel': 'stable' @@ -384,7 +384,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -416,8 +416,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -467,7 +467,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'events': { - 'channel': 'trunk' + 'channel': 'master' }, 'extension': { 'channel': 'stable' @@ -481,7 +481,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { }), '_manifest_features.json': json.dumps({ 'contextMenus': { - 'channel': 'trunk' + 'channel': 'master' }, 'notifications': { 'channel': 'dev' @@ -496,7 +496,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'sync': { - 'channel': 'trunk' + 'channel': 'master' }, 'system_info_display': { 'channel': 'stable' @@ -523,7 +523,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -555,8 +555,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -606,7 +606,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'events': { - 'channel': 'trunk' + 'channel': 'master' }, 'extension': { 'channel': 'stable' @@ -617,7 +617,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { }), '_manifest_features.json': json.dumps({ 'contextMenus': { - 'channel': 'trunk' + 'channel': 'master' }, 'notifications': { 'channel': 'dev' @@ -632,7 +632,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'sync': { - 'channel': 'trunk' + 'channel': 'master' }, 'system_info_display': { 'channel': 'stable' @@ -659,7 +659,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -691,8 +691,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -742,7 +742,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'events': { - 'channel': 'trunk' + 'channel': 'master' }, 'extension': { 'channel': 'stable' @@ -753,7 +753,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { }), '_manifest_features.json': json.dumps({ 'contextMenus': { - 'channel': 'trunk' + 'channel': 'master' }, 'notifications': { 'channel': 'dev' @@ -768,7 +768,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'sync': { - 'channel': 'trunk' + 'channel': 'master' }, 'system_info_display': { 'channel': 'stable' @@ -795,7 +795,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'dev' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -827,8 +827,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -922,10 +922,10 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'context_menus': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -957,8 +957,8 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'templates': { 'json': { 'api_availabilities.json': json.dumps({ - 'jsonTrunkAPI': { - 'channel': 'trunk' + 'jsonMasterAPI': { + 'channel': 'master' }, 'jsonDevAPI': { 'channel': 'dev' @@ -1039,10 +1039,10 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'channel': 'stable' }, 'context_menus': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeContent': { - 'channel': 'trunk' + 'channel': 'master' }, 'declarativeWebRequest': [ { 'channel': 'beta' }, @@ -1226,7 +1226,7 @@ CANNED_API_FILE_SYSTEM_DATA = MoveAllTo(CHROME_EXTENSIONS, { 'api': { '_manifest_features.json': json.dumps({ 'bookmarks': { - 'channel': 'trunk' + 'channel': 'master' }, 'page_action': { 'channel': 'stable' diff --git a/chrome/common/extensions/docs/server2/test_data/object_level_availability/tabs.py b/chrome/common/extensions/docs/server2/test_data/object_level_availability/tabs.py index c881fe5..568e6a9 100644 --- a/chrome/common/extensions/docs/server2/test_data/object_level_availability/tabs.py +++ b/chrome/common/extensions/docs/server2/test_data/object_level_availability/tabs.py @@ -32,7 +32,7 @@ FAKE_TABS_WITH_INLINING_IDL = '\n'.join([ '};']) TABS_SCHEMA_BRANCHES = MoveAllTo(CHROME_EXTENSIONS, { - 'trunk': { + 'master': { 'docs': { 'templates': { 'json': { diff --git a/chrome/common/extensions/docs/server2/test_servlet.py b/chrome/common/extensions/docs/server2/test_servlet.py index fde8781..6e568d7 100644 --- a/chrome/common/extensions/docs/server2/test_servlet.py +++ b/chrome/common/extensions/docs/server2/test_servlet.py @@ -14,7 +14,7 @@ class BrokenLinkTester(object): ''' def __init__(self, server_instance, renderer): self.link_error_detector = LinkErrorDetector( - server_instance.host_file_system_provider.GetTrunk(), + server_instance.host_file_system_provider.GetMaster(), renderer, PUBLIC_TEMPLATES, root_pages=('extensions/index.html', 'apps/about_apps.html')) diff --git a/chrome/common/extensions/docs/server2/url_constants.py b/chrome/common/extensions/docs/server2/url_constants.py index ef6273b..538689f 100644 --- a/chrome/common/extensions/docs/server2/url_constants.py +++ b/chrome/common/extensions/docs/server2/url_constants.py @@ -4,6 +4,7 @@ GITILES_BASE = 'https://chromium.googlesource.com/chromium/src/+' GITILES_BRANCH_BASE = '%s/refs/branch-heads' % GITILES_BASE +GITILES_OAUTH2_SCOPE = 'https://www.googleapis.com/auth/gerritcodereview' GITHUB_REPOS = 'https://api.github.com/repos' GITHUB_BASE = 'https://github.com/GoogleChrome/chrome-app-samples/tree/master/samples' diff --git a/chrome/common/extensions/docs/server2/whats_new_data_source.py b/chrome/common/extensions/docs/server2/whats_new_data_source.py index 04c4f43..7cfdefc 100644 --- a/chrome/common/extensions/docs/server2/whats_new_data_source.py +++ b/chrome/common/extensions/docs/server2/whats_new_data_source.py @@ -18,7 +18,7 @@ class WhatsNewDataSource(DataSource): def __init__(self, server_instance, _): self._parse_cache = server_instance.compiled_fs_factory.ForJson( - server_instance.host_file_system_provider.GetTrunk()) + server_instance.host_file_system_provider.GetMaster()) self._object_store = server_instance.object_store_creator.Create( WhatsNewDataSource) self._platform_bundle = server_instance.platform_bundle diff --git a/chrome/common/extensions/docs/templates/private/api.html b/chrome/common/extensions/docs/templates/private/api.html index 5ea5e6a..cadfb71 100644 --- a/chrome/common/extensions/docs/templates/private/api.html +++ b/chrome/common/extensions/docs/templates/private/api.html @@ -10,7 +10,7 @@ platform:platform platformTitle:platformTitle sidenav:sidenav}} -{{?api.channelWarning.trunk +partials.warning_trunk/}} +{{?api.channelWarning.master +partials.warning_master/}} {{?api.channelWarning.dev +partials.warning_dev/}} {{?api.channelWarning.beta +partials.warning_beta/}} <article> diff --git a/chrome/common/extensions/docs/templates/private/warning_trunk.html b/chrome/common/extensions/docs/templates/private/warning_master.html index bd30f42..9f03220 100644 --- a/chrome/common/extensions/docs/templates/private/warning_trunk.html +++ b/chrome/common/extensions/docs/templates/private/warning_master.html @@ -1,4 +1,4 @@ <p class="warning"> This API is still being developed. It is only available to developers building from - <a href="http://www.chromium.org/developers/">trunk</a>. + <a href="http://www.chromium.org/developers/">from source</a>. </p> |