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

Unified Diff: chrome/common/extensions/docs/server2/branch_utility.py

Issue 10831269: Extensions Docs Server: BranchUtility not fetching branch numbers correctly (fixed) (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: better testing and fixes Created 8 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 side-by-side diff with in-line comments
Download patch
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 b1470c2e38c43593282adf2962ec20a2ead361af..187382cb82ade3df7a3c57354b41e279a6842a90 100644
--- a/chrome/common/extensions/docs/server2/branch_utility.py
+++ b/chrome/common/extensions/docs/server2/branch_utility.py
@@ -14,6 +14,10 @@ class BranchUtility(object):
self._fetcher = fetcher
self._memcache = memcache
+ def GetAllBranchNumbers(self):
+ return [self.GetBranchNumberForChannelName(branch)
+ for branch in ['dev', 'beta', 'stable', 'trunk', 'local']]
+
def SplitChannelNameFromPath(self, path):
try:
first, second = path.split('/', 1)
@@ -26,8 +30,11 @@ class BranchUtility(object):
return (self._default_branch, path)
def GetBranchNumberForChannelName(self, channel_name):
- """Returns an empty string if the branch number cannot be found.
- Throws exception on network errors.
+ """Returns the branch number for a channel name. If the |channel_name| is
+ 'trunk' or 'local', then |channel_name| will be returned unchanged. These
+ are returned unchanged because 'trunk' has a separate URL from the other
+ branches and should be handled differently. 'local' is also a special branch
+ for development that should be handled differently.
"""
if channel_name in ['trunk', 'local']:
return channel_name
@@ -59,6 +66,6 @@ class BranchUtility(object):
self._memcache.Set(channel_name + '.' + self._base_path,
sorted_branches[0][0],
memcache.MEMCACHE_BRANCH_UTILITY,
- 86400)
+ time=86400)
return sorted_branches[0][0]

Powered by Google App Engine
This is Rietveld 408576698