def __init__(self, **kwargs): self.__entries = [] self.__with_partition = kwargs.pop('with_partition', True) self.__with_detail = kwargs.pop('with_detail', False) self.__write_category_heading = self.__with_partition and self.__with_detail check_kwargs_empty(kwargs) self.__sort_partitions = True
def make_repository_spec(self, name, **kwargs): """Create GitRepositorySpec based on the name and configuration. Args: git_dir: if supplied then use it, otherwise default under the root path. origin: if supplied then use it, even if None. Otherwise default upstream: if supplied then use it, even if None. Otherwise default. """ git_dir = kwargs.pop('git_dir', os.path.join(self.__root_source_dir, name)) origin = kwargs.pop('origin', self.AUTO) upstream = kwargs.pop('upstream', self.AUTO) check_kwargs_empty(kwargs) if origin == self.AUTO: origin = self.determine_origin(name) if os.path.exists(git_dir): logging.info('Confirming existing %s matches expectations', git_dir) existing = self.__git.determine_git_repository_spec(git_dir) if existing.origin != origin: raise_and_log_error( UnexpectedError( 'Repository "{dir}" origin="{have}" expected="{want}"'.format( dir=git_dir, have=existing.origin, want=origin))) if upstream == self.AUTO: upstream = self.determine_upstream_url(name) return GitRepositorySpec( name, origin=origin, upstream=upstream, git_dir=git_dir)
def __init__(self, options, root_source_dir, **kwargs): self.__max_threads = kwargs.pop('max_threads', 100) self.__add_upstream = kwargs.pop('attach_upstream', False) check_kwargs_empty(kwargs) self.__options = options self.__git = GitRunner(options) self.__root_source_dir = root_source_dir
def __init__(self, name, **kwargs): """Create a new instance.""" self.__name = name self.__git_dir = kwargs.pop("git_dir", None) self.__origin = kwargs.pop("origin", None) self.__upstream = kwargs.pop("upstream", None) self.__commit = kwargs.pop("commit_id", None) self.__branch = kwargs.pop("branch", None) check_kwargs_empty(kwargs)
def __init__(self, name, **kwargs): """Create a new instance.""" self.__name = name self.__git_dir = kwargs.pop('git_dir', None) self.__origin = kwargs.pop('origin', None) self.__upstream = kwargs.pop('upstream', None) self.__commit = kwargs.pop('commit_id', None) self.__branch = kwargs.pop('branch', None) check_kwargs_empty(kwargs)
def ensure_git_path(self, repository, **kwargs): """Make sure repository path is consistent with BOM.""" check_kwargs_empty(kwargs) service_name = self.repository_name_to_service_name(repository.name) if not service_name in self.__bom['services'].keys(): raise_and_log_error( UnexpectedError('"%s" is not a BOM repo' % service_name)) git_dir = repository.git_dir have_git_dir = os.path.exists(git_dir) service = check_bom_service(self.__bom, service_name) commit_id = service['commit'] if not have_git_dir: self.git.clone_repository_to_path(repository, commit=commit_id)
def ensure_git_path(self, repository, **kwargs): branch = kwargs.pop('branch', None) check_kwargs_empty(kwargs) options = self.options git_dir = repository.git_dir have_git_dir = os.path.exists(git_dir) if not branch: if hasattr(options, 'git_branch'): branch = options.git_branch else: branch = 'master' logging.debug('No git_branch option available.' ' Assuming "%s" branch is "master"', repository.name) fallback_branch = (options.git_fallback_branch if hasattr(options, 'git_fallback_branch') else None) if not have_git_dir: self.git.clone_repository_to_path( repository, branch=branch, default_branch=fallback_branch)
def ensure_git_path(self, repository, **kwargs): branch = kwargs.pop('branch', None) check_kwargs_empty(kwargs) options = self.options git_dir = repository.git_dir have_git_dir = os.path.exists(git_dir) if not branch: if hasattr(options, 'git_branch'): branch = options.git_branch else: branch = 'master' logging.debug( 'No git_branch option available.' ' Assuming "%s" branch is "master"', repository.name) fallback_branch = (options.git_fallback_branch if hasattr( options, 'git_fallback_branch') else None) if not have_git_dir: self.git.clone_repository_to_path(repository, branch=branch, default_branch=fallback_branch)
def __init__(self, **kwargs): self.__entries = [] self.__with_partition = kwargs.pop('with_partition', True) self.__with_detail = kwargs.pop('with_detail', False) check_kwargs_empty(kwargs) self.__sort_partitions = True