summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJonathan Maw <jonathan.maw@codethink.co.uk>2018-01-15 17:49:23 +0000
committerJürg Billeter <j@bitron.ch>2018-02-12 16:48:23 +0000
commit73b6e1e5df904d2e4079b7ae89a00d3ee9ef1b5b (patch)
tree1a56e394925f2fc66d0ba55be8e51ea1c01f474d
parent0f430622e4539b5cc9209384e32980dc086c29df (diff)
downloadbuildstream-73b6e1e5df904d2e4079b7ae89a00d3ee9ef1b5b.tar.gz
bzr: Implement init_workspace
This will checkout a branch from the cache, and switch its parent branch to the url and ref that the source came from
-rw-r--r--buildstream/plugins/sources/bzr.py15
1 files changed, 15 insertions, 0 deletions
diff --git a/buildstream/plugins/sources/bzr.py b/buildstream/plugins/sources/bzr.py
index cb7cbb040..b3427f835 100644
--- a/buildstream/plugins/sources/bzr.py
+++ b/buildstream/plugins/sources/bzr.py
@@ -113,6 +113,21 @@ class BzrSource(Source):
fail="Failed to checkout revision {} from branch {} to {}"
.format(self.ref, self._get_branch_dir(), directory))
+ def init_workspace(self, directory):
+ url = os.path.join(self.url, self.tracking)
+ with self.timed_activity('Setting up workspace "{}"'.format(directory), silent_nested=True):
+ # Checkout from the cache
+ self.call([self.host_bzr, "branch",
+ "--use-existing-dir",
+ "--revision=revno:{}".format(self.ref),
+ self._get_branch_dir(), directory],
+ fail="Failed to branch revision {} from branch {} to {}"
+ .format(self.ref, self._get_branch_dir(), directory))
+ # Switch the parent branch to the source's origin
+ self.call([self.host_bzr, "switch",
+ "--directory={}".format(directory), url],
+ fail="Failed to switch workspace's parent branch to {}".format(url))
+
def _check_ref(self):
# If the mirror doesnt exist yet, then we dont have the ref
if not os.path.exists(self._get_branch_dir()):