summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJoão Abecasis <joao.abecasis@nokia.com>2011-02-02 13:08:23 +0100
committerJoão Abecasis <joao.abecasis@nokia.com>2011-02-02 14:30:36 +0100
commitd162694a7985546a79a9af04b246e0d1d95f1097 (patch)
treea545a418b2493be298ed4ccd6e5727e38e0cd426
parentf1258bdebe13df730931b59d2bcbc09e00ba6ae1 (diff)
Prefer sentinel value to code repetition
... as per Jo's suggestion. Reviewed-By: jasplin
-rw-r--r--scripts/listcontexts.py10
1 files changed, 2 insertions, 8 deletions
diff --git a/scripts/listcontexts.py b/scripts/listcontexts.py
index a72ae4a..9f5a2b6 100644
--- a/scripts/listcontexts.py
+++ b/scripts/listcontexts.py
@@ -11,7 +11,8 @@ class ListContexts:
contexts = execQuery(
"SELECT id, hostId, platformId, branchId, sha1Id, EXTRACT(EPOCH FROM timestamp)::INT"
" FROM context"
- " ORDER BY hostId, platformId, branchId, timestamp")
+ " ORDER BY hostId, platformId, branchId, timestamp") \
+ + [(-1, -1, -1, -1, -1, -1)] # Sentinel value
self.contexts = []
@@ -37,13 +38,6 @@ class ListContexts:
curSnapshots.append((idToText('sha1', sha1), timestamp, id))
- self.contexts.append({
- 'host' : idToText('host', curHost),
- 'platform' : idToText('platform', curPlatform),
- 'branch' : idToText('branch', curBranch),
- 'snapshots' : curSnapshots
- })
-
self.writeOutput()
def writeOutputAsJSON(self):