OLD | NEW |
---|---|
1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 | 5 |
6 from base64 import b64decode | 6 from base64 import b64decode |
7 from itertools import izip | 7 from itertools import izip |
8 import json | 8 import json |
9 import logging | 9 import logging |
10 import posixpath | 10 import posixpath |
(...skipping 215 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
226 return stat_info | 226 return stat_info |
227 if filename not in stat_info.child_versions: | 227 if filename not in stat_info.child_versions: |
228 raise FileNotFoundError( | 228 raise FileNotFoundError( |
229 '%s from %s was not in child versions for Stat' % (filename, path)) | 229 '%s from %s was not in child versions for Stat' % (filename, path)) |
230 return StatInfo(stat_info.child_versions[filename]) | 230 return StatInfo(stat_info.child_versions[filename]) |
231 | 231 |
232 fetch_future = self._FetchAsync(ToDirectory(dir_) + _JSON_FORMAT) | 232 fetch_future = self._FetchAsync(ToDirectory(dir_) + _JSON_FORMAT) |
233 return self._ResolveFetchContent(path, fetch_future).Then(stat) | 233 return self._ResolveFetchContent(path, fetch_future).Then(stat) |
234 | 234 |
235 def GetIdentity(self): | 235 def GetIdentity(self): |
236 # NOTE: Do not use commit information to create the string identity. | 236 '''The identity is always the same for GitilesFileSystems designated to |
237 # Doing so will mess up caching. | 237 master, even if they are pinned to a specific commit.''' |
not at google - send to devlin
2014/10/24 00:04:51
This seems more like a code comment than a docstri
Ken Rockot(use gerrit already)
2014/10/24 21:26:53
Done.
| |
238 if self._commit is None and self._branch != 'master': | 238 if self._branch == 'master': |
239 str_id = '%s/%s/master' % (GITILES_BASE, GITILES_SRC_ROOT) | |
240 elif self._commit is not None: | |
241 str_id = '%s/%s/%s' % (GITILES_BASE, GITILES_SRC_ROOT, self._commit) | |
242 else: | |
239 str_id = '%s/%s/%s/%s' % ( | 243 str_id = '%s/%s/%s/%s' % ( |
240 GITILES_BASE, GITILES_SRC_ROOT, GITILES_BRANCHES_PATH, self._branch) | 244 GITILES_BASE, GITILES_SRC_ROOT, GITILES_BRANCHES_PATH, self._branch) |
not at google - send to devlin
2014/10/24 00:04:51
These all share GITILES_BASE and GITILES_SRC_ROOT
Ken Rockot(use gerrit already)
2014/10/24 21:26:53
Done.
| |
241 else: | |
242 str_id = '%s/%s' % (GITILES_BASE, GITILES_SRC_ROOT) | |
243 return '@'.join((self.__class__.__name__, StringIdentity(str_id))) | 245 return '@'.join((self.__class__.__name__, StringIdentity(str_id))) |
246 | |
247 def GetVersion(self): | |
248 if self._commit is not None: | |
249 return self._commit | |
250 return None | |
not at google - send to devlin
2014/10/24 00:04:51
return self._commit ?
Ken Rockot(use gerrit already)
2014/10/24 21:26:54
Lol. Right. Done.
| |
OLD | NEW |