# Path: lava_dispatcher/action.py
# class InfrastructureError(LAVAError):
#     """
#     Exceptions based on an error raised by a component of the
#     test which is neither the LAVA dispatcher code nor the
#     code being executed on the device under test. This includes
#     errors arising from the device (like the arndale SD controller
#     issue) and errors arising from the hardware to which the device
#     is connected (serial console connection, ethernet switches or
#     internet connection beyond the control of the device under test).
# 
#     Use LAVABug for errors arising from bugs in LAVA code.
#     """
#     error_help = "InfrastructureError: The Infrastructure is not working " \
#                  "correctly. Please report this error to LAVA admins."
#     error_type = "Infrastructure"


import sys
import logging
import os
import shutil
import subprocess
import yaml
from lava_dispatcher.action import InfrastructureError
        self.url = url

    def clone(self, dest_path, revision=None, branch=None):
        raise NotImplementedError


class BzrHelper(VCSHelper):

    def __init__(self, url):
        super(BzrHelper, self).__init__(url)
        self.binary = '/usr/bin/bzr'

    def clone(self, dest_path, revision=None, branch=None):
        cwd = os.getcwd()
        logger = logging.getLogger('dispatcher')
        env = dict(os.environ)
        env.update({'BZR_HOME': '/dev/null', 'BZR_LOG': '/dev/null'})

        try:
            if revision is not None:
                logger.debug("Running '%s branch -r %s %s'", self.binary, str(revision), self.url)
                subprocess.check_output([self.binary, 'branch', '-r',
                                         str(revision), self.url,
                                         dest_path],
                                        stderr=subprocess.STDOUT, env=env)
                commit_id = revision
            else:
                logger.debug("Running '%s branch %s'", self.binary, self.url)
                subprocess.check_output([self.binary, 'branch', self.url,
                                         dest_path],

# Path: lava_dispatcher/action.py
# class InfrastructureError(LAVAError):
#     """
#     Exceptions based on an error raised by a component of the
#     test which is neither the LAVA dispatcher code nor the
#     code being executed on the device under test. This includes
#     errors arising from the device (like the arndale SD controller
#     issue) and errors arising from the hardware to which the device
#     is connected (serial console connection, ethernet switches or
#     internet connection beyond the control of the device under test).
# 
#     Use LAVABug for errors arising from bugs in LAVA code.
#     """
#     error_help = "InfrastructureError: The Infrastructure is not working " \
#                  "correctly. Please report this error to LAVA admins."
#     error_type = "Infrastructure"


# Path: lava_dispatcher/utils/vcs.py
import sys
import logging
import os
import shutil
import subprocess
import yaml
from lava_dispatcher.action import InfrastructureError

        self.url = url

    def clone(self, dest_path, revision=None, branch=None):
        raise NotImplementedError


class BzrHelper(VCSHelper):

    def __init__(self, url):
        super(BzrHelper, self).__init__(url)
        self.binary = '/usr/bin/bzr'

    def clone(self, dest_path, revision=None, branch=None):
        cwd = os.getcwd()
        logger = logging.getLogger('dispatcher')
        env = dict(os.environ)
        env.update({'BZR_HOME': '/dev/null', 'BZR_LOG': '/dev/null'})

        try:
            if revision is not None:
                logger.debug("Running '%s branch -r %s %s'", self.binary, str(revision), self.url)
                subprocess.check_output([self.binary, 'branch', '-r',
                                         str(revision), self.url,
                                         dest_path],
                                        stderr=subprocess.STDOUT, env=env)
                commit_id = revision
            else:
                logger.debug("Running '%s branch %s'", self.binary, self.url)
                subprocess.check_output([self.binary, 'branch', self.url,
                                         dest_path],

                                        stderr=subprocess.STDOUT, env=env)