Index: chrome/common/extensions/docs/server2/branch_utility.py |
diff --git a/chrome/common/extensions/docs/server2/branch_utility.py b/chrome/common/extensions/docs/server2/branch_utility.py |
index 1c683c682104d2cd6f9936e9da9647bde0ed3ffe..ce0917ed87f42d91bc2c828a4c1cf171db616e80 100644 |
--- a/chrome/common/extensions/docs/server2/branch_utility.py |
+++ b/chrome/common/extensions/docs/server2/branch_utility.py |
@@ -137,14 +137,23 @@ class BranchUtility(object): |
version_json = json.loads(self._history_result.Get().content) |
for entry in version_json['events']: |
- # Here, entry['title'] looks like: 'title - version#.#.branch#.#' |
+ # Here, entry['title'] looks like: '<title> - <version>.##.<branch>.##' |
version_title = entry['title'].split(' - ')[1].split('.') |
if version_title[0] == str(version): |
self._branch_object_store.Set(str(version), version_title[2]) |
return int(version_title[2]) |
- raise ValueError( |
- 'The branch for %s could not be found.' % version) |
+ raise ValueError('The branch for %s could not be found.' % version) |
+ |
+ def GetChannelForVersion(self, version): |
+ '''Returns the name of the development channel corresponding to a given |
+ version number. |
+ ''' |
+ for channel_info in self.GetAllChannelInfo(): |
+ if channel_info.channel == 'stable' and version <= channel_info.version: |
+ return channel_info.channel |
+ elif version == channel_info.version: |
+ return channel_info.channel |
epeterson
2013/06/21 00:48:26
Here's the new GetChannelForVersion method, create
not at google - send to devlin
2013/06/21 00:54:11
cool. no else after returns though. just if .. if.
epeterson
2013/06/22 01:42:40
Done.
|
def GetLatestVersionNumber(self): |
'''Returns the most recent version number found using data stored on |