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

Side by Side Diff: chrome/common/extensions/docs/server2/subversion_file_system.py

Issue 474293007: Docserver: Automatically implement FileSystem.Stat if FileSystem.StatAsync has (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/common/extensions/docs/server2/gitiles_file_system.py ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2012 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 import posixpath 5 import posixpath
6 import traceback 6 import traceback
7 import xml.dom.minidom as xml 7 import xml.dom.minidom as xml
8 from xml.parsers.expat import ExpatError 8 from xml.parsers.expat import ExpatError
9 9
10 from appengine_url_fetcher import AppEngineUrlFetcher 10 from appengine_url_fetcher import AppEngineUrlFetcher
(...skipping 149 matching lines...) Expand 10 before | Expand all | Expand 10 after
160 if path.endswith('/'): 160 if path.endswith('/'):
161 value[path] = list_dir(result.content) 161 value[path] = list_dir(result.content)
162 else: 162 else:
163 value[path] = result.content 163 value[path] = result.content
164 return value 164 return value
165 return Future(callback=resolve) 165 return Future(callback=resolve)
166 166
167 def Refresh(self): 167 def Refresh(self):
168 return Future(value=()) 168 return Future(value=())
169 169
170 def Stat(self, path):
171 return self.StatAsync(path).Get()
172
173 def StatAsync(self, path): 170 def StatAsync(self, path):
174 directory, filename = posixpath.split(path) 171 directory, filename = posixpath.split(path)
175 if self._revision is not None: 172 if self._revision is not None:
176 # |stat_fetch| uses viewvc which uses pathrev= for version. 173 # |stat_fetch| uses viewvc which uses pathrev= for version.
177 directory += '?pathrev=%s' % self._revision 174 directory += '?pathrev=%s' % self._revision
178 175
179 result_future = self._stat_fetcher.FetchAsync(directory) 176 result_future = self._stat_fetcher.FetchAsync(directory)
180 def resolve(): 177 def resolve():
181 try: 178 try:
182 result = result_future.Get() 179 result = result_future.Get()
(...skipping 20 matching lines...) Expand all
203 return StatInfo(stat_info.child_versions[filename]) 200 return StatInfo(stat_info.child_versions[filename])
204 201
205 return Future(callback=resolve) 202 return Future(callback=resolve)
206 203
207 def GetIdentity(self): 204 def GetIdentity(self):
208 # NOTE: no revision here, since it would mess up the caching of reads. It 205 # NOTE: no revision here, since it would mess up the caching of reads. It
209 # probably doesn't matter since all the caching classes will use the result 206 # probably doesn't matter since all the caching classes will use the result
210 # of Stat to decide whether to re-read - and Stat has a ceiling of the 207 # of Stat to decide whether to re-read - and Stat has a ceiling of the
211 # revision - so when the revision changes, so might Stat. That is enough. 208 # revision - so when the revision changes, so might Stat. That is enough.
212 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path))) 209 return '@'.join((self.__class__.__name__, StringIdentity(self._svn_path)))
OLDNEW
« no previous file with comments | « chrome/common/extensions/docs/server2/gitiles_file_system.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698