aboutsummaryrefslogtreecommitdiffstats
path: root/layerindex/context_processors.py
diff options
context:
space:
mode:
authorPaul Eggleton <paul.eggleton@linux.intel.com>2013-03-04 23:17:00 +0000
committerPaul Eggleton <paul.eggleton@linux.intel.com>2013-03-05 20:37:48 +0000
commit354e368aa28ee11a729afa8bd2c0d6c668b90f5b (patch)
treecea169a98c9d9e01561a5553888d43e1f937a53a /layerindex/context_processors.py
parent0d52678697d34d32e4ee767aff8e521e9d81754f (diff)
downloadopenembedded-core-contrib-354e368aa28ee11a729afa8bd2c0d6c668b90f5b.tar.gz
Add support for handling multiple branches
Change the data structure to support multiple branches. At the top level there is a set list of Branch objects, and then a LayerBranch object between each layer and the maintainers, dependencies, recipes and machines, so that the set of each can be different per branch. The branch is a session option, and can be selected via a drop-down that is shown for all pages. Additionally, with this change we avoid the need to run the update script within a build environment set up with oe-init-build-env - since we need a specific version of BitBake per branch we now use our own copy of BitBake which is fetched by the script itself. The update script will need to be called multiple times however - once per branch. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Diffstat (limited to 'layerindex/context_processors.py')
-rw-r--r--layerindex/context_processors.py16
1 files changed, 16 insertions, 0 deletions
diff --git a/layerindex/context_processors.py b/layerindex/context_processors.py
new file mode 100644
index 0000000000..8e2c4e7ad6
--- /dev/null
+++ b/layerindex/context_processors.py
@@ -0,0 +1,16 @@
+# layerindex-web - custom context processor
+#
+# Copyright (C) 2013 Intel Corporation
+#
+# Licensed under the MIT license, see COPYING.MIT for details
+
+from layerindex.models import Branch
+
+def layerindex_context(request):
+ current_branch = request.session.get('branch', None)
+ if not current_branch:
+ current_branch = 'master'
+ return {
+ 'all_branches': Branch.objects.all(),
+ 'current_branch': current_branch,
+ } \ No newline at end of file