1
1
# This file is part of Online Services Jenkaas.
3
# Copyright 2016 Canonical Ltd.
3
# Copyright 2016, 2017 Canonical Ltd.
5
5
# This program is free software: you can redistribute it and/or modify it under
6
6
# the terms of the GNU General Public License version 3, as published by the
38
38
def _run(self, args):
39
39
return subprocesses.run(['bzr'] + args)
41
def tip_commit_id(self):
42
with olsjenkaas.working_directory(self.location):
43
return self._run(['revision-info'])[1].split()[1].strip()
42
46
return self._run(['init', self.location])
44
def create_from(self, url):
45
# FIXME: Handle lp transient failures ? -- vila 2016-12-07
46
import pdb; pdb.set_trace()
47
return self._run(['branch', url, self.location])
48
def create_from(self, existing):
49
return self._run(['branch', existing, self.location])
49
51
def update(self, description, tree_update):
50
with fixtures.ThatDir(self.location):
52
from olsjenkaas.tests import fixtures
53
with olsjenkaas.working_directory(self.location):
51
54
fixtures.build_tree(tree_update)
53
56
return self._run(['commit', '-m', description])
59
with olsjenkaas.working_directory(self.location):
60
return self._run(['push', url])
56
with fixtures.ThatDir(self.location):
57
return subprocesses.run(['rm', '-r', self.location])
63
with olsjenkaas.working_directory(self.location):
64
return subprocesses.run(['rm', '-fr', self.location])
60
with fixtures.ThatDir(self.location):
67
with olsjenkaas.working_directory(self.location):
61
68
ret, out, err = self._run(['status'])