Example #1
0
    def process_project_version(self, project: Project, version: ProjectVersion) -> List[str]:
        logger = logging.getLogger("checkout")

        try:
            checkout = version.get_checkout(self.checkouts_path)
        except ValueError as e:
            logger.error("Checkout data corrupted: %s", e)
            return self.skip(version)

        try:
            if self.force_checkout:
                checkout.delete()
            checkout_exists = checkout.exists()
            logger.debug("Checkout exists = %r", checkout_exists)
            if checkout_exists:
                logger.debug("Already checked out %s.", version)
            else:
                logger.info("Fetching %s from %s...", version, checkout)
                checkout.create()

            return self.ok()

        except CommandFailedError as e:
            logger.error("Checkout failed: %s", e)
            return self.skip(version)
        except IOError:
            logger.error("Checkout failed.", exc_info=True)
            return self.skip(version)