aboutsummaryrefslogtreecommitdiffstats
path: root/lib/bb/fetch/__init__.py
diff options
context:
space:
mode:
authorChris Larson <chris_larson@mentor.com>2011-04-04 09:36:10 -0700
committerChris Larson <chris_larson@mentor.com>2011-04-05 17:17:29 -0700
commita4f62433845c29f98c6a9746d5d2847bf9506ea5 (patch)
tree5ded4b15bf36f92fc329cc2a4cf644fa8da94bf7 /lib/bb/fetch/__init__.py
parentf50a22ee1bbe53094b2db3f85e224bb80070f4c8 (diff)
downloadbitbake-a4f62433845c29f98c6a9746d5d2847bf9506ea5.tar.gz
persist_data: raise KeyError on missing elements
Signed-off-by: Chris Larson <chris_larson@mentor.com>
Diffstat (limited to 'lib/bb/fetch/__init__.py')
-rw-r--r--lib/bb/fetch/__init__.py15
1 files changed, 7 insertions, 8 deletions
diff --git a/lib/bb/fetch/__init__.py b/lib/bb/fetch/__init__.py
index 4cf78779e..5be4c9cae 100644
--- a/lib/bb/fetch/__init__.py
+++ b/lib/bb/fetch/__init__.py
@@ -757,12 +757,11 @@ class Fetch(object):
revs = persist_data.persist('BB_URI_HEADREVS', d)
key = self.generate_revision_key(url, ud, d)
- rev = revs[key]
- if rev != None:
- return str(rev)
-
- revs[key] = rev = self._latest_revision(url, ud, d)
- return rev
+ try:
+ return revs[key]
+ except KeyError:
+ revs[key] = rev = self._latest_revision(url, ud, d)
+ return rev
def sortable_revision(self, url, ud, d):
"""
@@ -775,13 +774,13 @@ class Fetch(object):
key = self.generate_revision_key(url, ud, d)
latest_rev = self._build_revision(url, ud, d)
- last_rev = localcounts[key + '_rev']
+ last_rev = localcounts.get(key + '_rev')
uselocalcount = bb.data.getVar("BB_LOCALCOUNT_OVERRIDE", d, True) or False
count = None
if uselocalcount:
count = Fetch.localcount_internal_helper(ud, d)
if count is None:
- count = localcounts[key + '_count']
+ count = localcounts.get(key + '_count')
if last_rev == latest_rev:
return str(count + "+" + latest_rev)