Beispiel #1
0
    def publish(self, block_name, tag, msg, versiontag, publish_all, origin):
        self._process()
        parents = [b.parent for b in self.hive_holder.block_holders if b.parent.time != -1]
        self.bii.biiapi.check_valid(parents)

        HiveManager.publish(self, block_name, tag, msg, versiontag, publish_all=publish_all, origin=origin)
        self._checkout()
        # Check again, in case some parent outdated DEV => STABLE
        parents = [b.parent for b in self.hive_holder.block_holders if b.parent.time != -1]
        self.bii.biiapi.check_valid(parents, publish=False)
 def close(self, block_name, force):
     self._process()
     HiveManager.close(self, block_name, self.hive_disk_image.settings, force)
     self._checkout(allow_delete_block=block_name)
     self._checkout_deps()  # When closing a block we might have less dependencies
     if os.path.exists(os.path.join(self.hive_disk_image.paths.blocks, block_name)):
         raise BiiException("Unable to remove %s from '%s' folder. Maybe there exist "
                            "temporary or ignored files, or some file is locked by an open "
                            "application. Check it and delete manually 'blocks/%s' folder."
                            % (block_name, SRC_DIR, block_name))
     self.bii.user_io.out.write('%s closed\n' % block_name)
Beispiel #3
0
 def close(self, block_name, force):
     self._process()
     HiveManager.close(self, block_name, self.hive_disk_image.settings,
                       force)
     self._checkout(allow_delete_block=block_name)
     self._checkout_deps(
     )  # When closing a block we might have less dependencies
     if os.path.exists(
             os.path.join(self.hive_disk_image.paths.blocks, block_name)):
         raise BiiException(
             "Unable to remove %s from '%s' folder. Maybe there exist "
             "temporary or ignored files, or some file is locked by an open "
             "application. Check it and delete manually 'blocks/%s' folder."
             % (block_name, SRC_DIR, block_name))
     self.bii.user_io.out.write('%s closed\n' % block_name)
Beispiel #4
0
    def publish(self, block_name, tag, msg, versiontag, publish_all, origin):
        self._process()
        parents = [
            b.parent for b in self.hive_holder.block_holders
            if b.parent.time != -1
        ]
        self.bii.biiapi.check_valid(parents)

        HiveManager.publish(self,
                            block_name,
                            tag,
                            msg,
                            versiontag,
                            publish_all=publish_all,
                            origin=origin)
        self._checkout()
        # Check again, in case some parent outdated DEV => STABLE
        parents = [
            b.parent for b in self.hive_holder.block_holders
            if b.parent.time != -1
        ]
        self.bii.biiapi.check_valid(parents, publish=False)
 def open(self, block_name, track, time, version_tag):
     '''
     Params:
         block_version. It time is None last version will be retrieved
     '''
     self._process()
     opened_version = HiveManager.open(self, block_name, track, time, version_tag)
     self._checkout()
     self._checkout_deps()
     if os.path.exists(os.path.join(self.hive_disk_image.paths.deps, block_name)):
         raise BiiException("Unable to remove %s from 'deps' folder. Maybe there exist "
                            "temporary files, or some file is locked by other "
                            "application. Check it and delete manually 'deps/%s' folder."
                            % (block_name, block_name))
     self.bii.user_io.out.write('Opened %s\n' % str(opened_version))
Beispiel #6
0
class FindRequestTest(BiiTestCase):
    def setUp(self):
        self.testuser = BRLUser('user')
        self.edition_api = TestEditionAPI()
        self.hive_manager = HiveManager(self.edition_api, None, OutputStream())
        self.block_name = BlockName('dummy/myblock')

    def test_compute_request(self):
        files = {
            self.block_name + 'main.cpp': '#include "user2/block/sphere.h"'
        }
        self.hive_manager.process(None, files)

        find_request, unresolved = self.hive_manager.hive_holder.find_request(
            Policy.default())
        self.assertIn(CPPDeclaration('user2/block/sphere.h'),
                      find_request.unresolved)
        self.assertEqual(unresolved, set())

    def test_no_unresolved_to_local(self):
        files = {
            self.block_name + 'main.cpp': '#include "dummy/myblock/sphere.h"'
        }
        self.hive_manager.process(None, files)

        find_request, unresolved = self.hive_manager.hive_holder.find_request(
            Policy.default())
        self.assertEqual(set(), find_request.unresolved)
        self.assertEqual(unresolved,
                         {CPPDeclaration("dummy/myblock/sphere.h")})

    def test_apply_result(self):
        # TODO: this is actually a test of find result, move away
        files = {
            self.block_name + 'main.cpp': '#include "user2/block/sphere.h"'
        }
        self.hive_manager.process(None, files)

        find_result = FinderResult()
        version = BRLBlock('user2/user2/block/branch') + 3
        d = ReferencedDependencies()
        decl = CPPDeclaration('user2/block/sphere.h')
        d[version][decl].add(BlockCellName('user2/block/sphere.h'))
        find_result.resolved = d

        processor_changes = ProcessorChanges()
        hive_holder = self.hive_manager.hive_holder
        update_hive_with_find_result(hive_holder, find_result,
                                     processor_changes)

        self.assertEqual(2, len(hive_holder.resources))
        self.assertEqual(BlockVersionTable([version]),
                         hive_holder[self.block_name].requirements)
Beispiel #7
0
 def open(self, block_name, track, time, version_tag):
     '''
     Params:
         block_version. It time is None last version will be retrieved
     '''
     self._process()
     opened_version = HiveManager.open(self, block_name, track, time,
                                       version_tag)
     self._checkout()
     self._checkout_deps()
     if os.path.exists(
             os.path.join(self.hive_disk_image.paths.deps, block_name)):
         raise BiiException(
             "Unable to remove %s from 'deps' folder. Maybe there exist "
             "temporary files, or some file is locked by other "
             "application. Check it and delete manually 'deps/%s' folder." %
             (block_name, block_name))
     self.bii.user_io.out.write('Opened %s\n' % str(opened_version))
Beispiel #8
0
class FindRequestTest(BiiTestCase):

    def setUp(self):
        self.testuser = BRLUser('user')
        self.edition_api = TestEditionAPI()
        self.hive_manager = HiveManager(self.edition_api, None, OutputStream())
        self.block_name = BlockName('dummy/myblock')

    def test_compute_request(self):
        files = {self.block_name + 'main.cpp': '#include "user2/block/sphere.h"'}
        self.hive_manager.process(None, files)

        find_request, unresolved = self.hive_manager.hive_holder.find_request(Policy.default())
        self.assertIn(CPPDeclaration('user2/block/sphere.h'), find_request.unresolved)
        self.assertEqual(unresolved, set())

    def test_no_unresolved_to_local(self):
        files = {self.block_name + 'main.cpp': '#include "dummy/myblock/sphere.h"'}
        self.hive_manager.process(None, files)

        find_request, unresolved = self.hive_manager.hive_holder.find_request(Policy.default())
        self.assertEqual(set(), find_request.unresolved)
        self.assertEqual(unresolved, {CPPDeclaration("dummy/myblock/sphere.h")})

    def test_apply_result(self):
        # TODO: this is actually a test of find result, move away
        files = {self.block_name + 'main.cpp': '#include "user2/block/sphere.h"'}
        self.hive_manager.process(None, files)

        find_result = FinderResult()
        version = BRLBlock('user2/user2/block/branch') + 3
        d = ReferencedDependencies()
        decl = CPPDeclaration('user2/block/sphere.h')
        d[version][decl].add(BlockCellName('user2/block/sphere.h'))
        find_result.resolved = d

        processor_changes = ProcessorChanges()
        hive_holder = self.hive_manager.hive_holder
        update_hive_with_find_result(hive_holder, find_result, processor_changes)

        self.assertEqual(2, len(hive_holder.resources))
        self.assertEqual(BlockVersionTable([version]), hive_holder[self.block_name].requirements)
Beispiel #9
0
 def setUp(self):
     self.testuser = BRLUser('user')
     self.edition_api = TestEditionAPI()
     self.hive_manager = HiveManager(self.edition_api, None, OutputStream())
     self.block_name = BlockName('dummy/myblock')
Beispiel #10
0
 def setUp(self):
     self.testuser = BRLUser('user')
     self.edition_api = TestEditionAPI()
     self.hive_manager = HiveManager(self.edition_api, None, OutputStream())
     self.block_name = BlockName('dummy/myblock')